member state of checkbox is now called isChecked
This commit is contained in:
parent
446f41297d
commit
48b4c6f6ba
2 changed files with 9 additions and 9 deletions
|
@ -38,7 +38,7 @@
|
||||||
typedef struct GEventGWinCheckbox_t {
|
typedef struct GEventGWinCheckbox_t {
|
||||||
GEventType type; // The type of this event (GEVENT_GWIN_CHECKBOX)
|
GEventType type; // The type of this event (GEVENT_GWIN_CHECKBOX)
|
||||||
GHandle checkbox; // The checkbox that has been depressed (actually triggered on release)
|
GHandle checkbox; // The checkbox that has been depressed (actually triggered on release)
|
||||||
bool_t state // Is the checkbox currently checked or unchecked?
|
bool_t isChecked; // Is the checkbox currently checked or unchecked?
|
||||||
} GEventGWinCheckbox;
|
} GEventGWinCheckbox;
|
||||||
|
|
||||||
typedef enum GCheckboxShape_e {
|
typedef enum GCheckboxShape_e {
|
||||||
|
@ -65,7 +65,7 @@ typedef struct GCheckboxObject_t {
|
||||||
|
|
||||||
GCheckboxDrawFunction fn;
|
GCheckboxDrawFunction fn;
|
||||||
GCheckboxColor *colors;
|
GCheckboxColor *colors;
|
||||||
bool_t state;
|
bool_t isChecked;
|
||||||
void *param;
|
void *param;
|
||||||
} GCheckboxObject;
|
} GCheckboxObject;
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ void gwinCheckboxSetEnabled(GHandle gh, bool_t enabled);
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
#define gwinCheckboxGetState(gh) (((GCheckboxObject *)(gh))->state)
|
#define gwinCheckboxGetState(gh) (((GCheckboxObject *)(gh))->isChecked)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the source handle of a checkbox
|
* @brief Get the source handle of a checkbox
|
||||||
|
|
|
@ -26,7 +26,7 @@ static const GCheckboxColor defaultColors = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* default style drawing routine */
|
/* default style drawing routine */
|
||||||
static void gwinCheckboxDrawDefaultStyle(GHandle gh, bool_t enabled, bool_t state, void* param) {
|
static void gwinCheckboxDrawDefaultStyle(GHandle gh, bool_t enabled, bool_t isChecked, void* param) {
|
||||||
#define gcw ((GCheckboxObject *)gh)
|
#define gcw ((GCheckboxObject *)gh)
|
||||||
|
|
||||||
(void) enabled;
|
(void) enabled;
|
||||||
|
@ -34,7 +34,7 @@ static void gwinCheckboxDrawDefaultStyle(GHandle gh, bool_t enabled, bool_t stat
|
||||||
|
|
||||||
gdispDrawBox(gh->x, gh->y, gh->width, gh->height, gcw->colors->border);
|
gdispDrawBox(gh->x, gh->y, gh->width, gh->height, gcw->colors->border);
|
||||||
|
|
||||||
if (state)
|
if (isChecked)
|
||||||
gdispFillArea(gh->x+2, gh->y+2, gh->width-4, gh->height-4, gcw->colors->checked);
|
gdispFillArea(gh->x+2, gh->y+2, gh->width-4, gh->height-4, gcw->colors->checked);
|
||||||
else
|
else
|
||||||
gdispFillArea(gh->x+2, gh->y+2, gh->width-4, gh->height-4, gcw->colors->bg);
|
gdispFillArea(gh->x+2, gh->y+2, gh->width-4, gh->height-4, gcw->colors->bg);
|
||||||
|
@ -70,7 +70,7 @@ static void gwinCheckboxCallback(void *param, GEvent *pe) {
|
||||||
&& pme->x >= gbw->gwin.x && pme->x < gbw->gwin.x + gbw->gwin.width
|
&& pme->x >= gbw->gwin.x && pme->x < gbw->gwin.x + gbw->gwin.width
|
||||||
&& pme->y >= gbw->gwin.y && pme->y < gbw->gwin.y + gbw->gwin.height) {
|
&& pme->y >= gbw->gwin.y && pme->y < gbw->gwin.y + gbw->gwin.height) {
|
||||||
|
|
||||||
gbw->state = !gbw->state;
|
gbw->isChecked = !gbw->isChecked;
|
||||||
|
|
||||||
gwinCheckboxDraw((GHandle)param);
|
gwinCheckboxDraw((GHandle)param);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ static void gwinCheckboxCallback(void *param, GEvent *pe) {
|
||||||
continue;
|
continue;
|
||||||
pbe->type = GEVENT_GWIN_CHECKBOX;
|
pbe->type = GEVENT_GWIN_CHECKBOX;
|
||||||
pbe->checkbox = gh;
|
pbe->checkbox = gh;
|
||||||
pbe->state = gbw->state;
|
pbe->isChecked = gbw->isChecked;
|
||||||
geventSendEvent(psl);
|
geventSendEvent(psl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ GHandle gwinCheckboxCreate(GCheckboxObject *gb, coord_t x, coord_t y, coord_t wi
|
||||||
gb->fn = gwinCheckboxDrawDefaultStyle; // set the default style drawing routine
|
gb->fn = gwinCheckboxDrawDefaultStyle; // set the default style drawing routine
|
||||||
gb->colors = &defaultColors; // asign the default colors
|
gb->colors = &defaultColors; // asign the default colors
|
||||||
gb->param = 0; // some safe value here
|
gb->param = 0; // some safe value here
|
||||||
gb->state = GCHBX_UNCHECKED; // checkbox is currently unchecked
|
gb->isChecked = GCHBX_UNCHECKED; // checkbox is currently unchecked
|
||||||
gb->gwin.enabled = TRUE; // checkboxes are enabled by default
|
gb->gwin.enabled = TRUE; // checkboxes are enabled by default
|
||||||
|
|
||||||
geventListenerInit(&gb->listener);
|
geventListenerInit(&gb->listener);
|
||||||
|
@ -140,7 +140,7 @@ void gwinCheckboxDraw(GHandle gh) {
|
||||||
|
|
||||||
gcw->fn(gh,
|
gcw->fn(gh,
|
||||||
gcw->gwin.enabled,
|
gcw->gwin.enabled,
|
||||||
gcw->state,
|
gcw->isChecked,
|
||||||
gcw->param);
|
gcw->param);
|
||||||
|
|
||||||
#undef gcw
|
#undef gcw
|
||||||
|
|
Loading…
Add table
Reference in a new issue