Create a generic GWIN event.

The frame now sends a GEVENT_GWIN_CLOSE event on closing.
Unfortunately some gwin events have had a field renamed in order to generalise the structure.
Demo's updated to match.
ugfx_release_2.6
inmarket 2014-08-20 12:18:27 +10:00
parent 3b21507274
commit ecaf8b83f8
22 changed files with 140 additions and 106 deletions

View File

@ -83,7 +83,7 @@ int main(void) {
switch(pe->type) { switch(pe->type) {
case GEVENT_GWIN_BUTTON: case GEVENT_GWIN_BUTTON:
if (((GEventGWinButton*)pe)->button == ghButton1) { if (((GEventGWinButton*)pe)->gwin == ghButton1) {
// Our button has been pressed // Our button has been pressed
if (++which >= sizeof(orients)/sizeof(orients[0])) if (++which >= sizeof(orients)/sizeof(orients[0]))
which = 0; which = 0;

View File

@ -77,7 +77,7 @@ int main(void) {
switch(pe->type) { switch(pe->type) {
case GEVENT_GWIN_CHECKBOX: case GEVENT_GWIN_CHECKBOX:
if (((GEventGWinCheckbox*)pe)->checkbox == ghCheckbox1) { if (((GEventGWinCheckbox*)pe)->gwin == ghCheckbox1) {
// The state of our checkbox has changed // The state of our checkbox has changed
//printf("Checkbox state: %d\r\n", ((GEventGWinCheckbox*)pe)->isChecked); //printf("Checkbox state: %d\r\n", ((GEventGWinCheckbox*)pe)->isChecked);
} }

View File

@ -141,13 +141,13 @@ int main(void) {
switch(pe->type) { switch(pe->type) {
case GEVENT_GWIN_CHECKBOX: case GEVENT_GWIN_CHECKBOX:
if (((GEventGWinCheckbox*)pe)->checkbox == ghCheckbox1) { if (((GEventGWinCheckbox*)pe)->gwin == ghCheckbox1) {
gwinSetVisible(ghContainer2, gwinCheckboxIsChecked(ghCheckbox1)); gwinSetVisible(ghContainer2, gwinCheckboxIsChecked(ghCheckbox1));
} }
else if (((GEventGWinCheckbox*)pe)->checkbox == ghCheckbox2) { else if (((GEventGWinCheckbox*)pe)->gwin == ghCheckbox2) {
gwinSetVisible(ghContainer3, gwinCheckboxIsChecked(ghCheckbox2)); gwinSetVisible(ghContainer3, gwinCheckboxIsChecked(ghCheckbox2));
} }
else if (((GEventGWinCheckbox*)pe)->checkbox == ghCheckbox3) { else if (((GEventGWinCheckbox*)pe)->gwin == ghCheckbox3) {
gwinSetVisible(ghContainer1, gwinCheckboxIsChecked(ghCheckbox3)); gwinSetVisible(ghContainer1, gwinCheckboxIsChecked(ghCheckbox3));
} }
break; break;

View File

@ -138,19 +138,19 @@ int main(void) {
switch(pe->type) { switch(pe->type) {
case GEVENT_GWIN_SLIDER: case GEVENT_GWIN_SLIDER:
if (((GEventGWinSlider *)pe)->slider == ghSliderR || \ if (((GEventGWinSlider *)pe)->gwin == ghSliderR || \
ghSliderG || \ ghSliderG || \
ghSliderB ) { ghSliderB ) {
_updateColor(); _updateColor();
} }
break; break;
case GEVENT_GWIN_BUTTON: case GEVENT_GWIN_BUTTON:
if (((GEventGWinButton *)pe)->button == ghButton1) { if (((GEventGWinButton *)pe)->gwin == ghButton1) {
gwinSliderSetPosition(ghSliderR, rand() % 256); gwinSliderSetPosition(ghSliderR, rand() % 256);
} else if (((GEventGWinButton *)pe)->button == ghButton2) { } else if (((GEventGWinButton *)pe)->gwin == ghButton2) {
gwinSliderSetPosition(ghSliderG, rand() % 256); gwinSliderSetPosition(ghSliderG, rand() % 256);
} else if (((GEventGWinButton *)pe)->button == ghButton3) { } else if (((GEventGWinButton *)pe)->gwin == ghButton3) {
gwinSliderSetPosition(ghSliderB, rand() % 256); gwinSliderSetPosition(ghSliderB, rand() % 256);
} }

View File

@ -99,7 +99,7 @@ int main(void) {
switch(pe->type) { switch(pe->type) {
case GEVENT_GWIN_RADIO: case GEVENT_GWIN_RADIO:
//printf("group: %u radio: %s\n", ((GEventGWinRadio *)pe)->group, gwinGetText(((GEventGWinRadio *)pe)->radio)); //printf("group: %u radio: %s\n", ((GEventGWinRadio *)pe)->group, gwinGetText(((GEventGWinRadio *)pe)->gwin));
break; break;
default: default:

View File

@ -75,7 +75,7 @@ int main(void) {
switch(pe->type) { switch(pe->type) {
case GEVENT_GWIN_SLIDER: case GEVENT_GWIN_SLIDER:
//printf("Slider %s = %d\n", gwinGetText(((GEventGWinSlider *)pe)->slider), ((GEventGWinSlider *)pe)->position); //printf("Slider %s = %d\n", gwinGetText(((GEventGWinSlider *)pe)->gwin), ((GEventGWinSlider *)pe)->position);
break; break;
default: default:

View File

@ -459,39 +459,39 @@ int main(void) {
switch(pe->type) { switch(pe->type) {
case GEVENT_GWIN_BUTTON: case GEVENT_GWIN_BUTTON:
gwinPrintf(ghConsole, "Button %s\n", gwinGetText(((GEventGWinButton *)pe)->button)); gwinPrintf(ghConsole, "Button %s\n", gwinGetText(((GEventGWinButton *)pe)->gwin));
break; break;
case GEVENT_GWIN_SLIDER: case GEVENT_GWIN_SLIDER:
gwinPrintf(ghConsole, "Slider %s=%d\n", gwinGetText(((GEventGWinSlider *)pe)->slider), ((GEventGWinSlider *)pe)->position); gwinPrintf(ghConsole, "Slider %s=%d\n", gwinGetText(((GEventGWinSlider *)pe)->gwin), ((GEventGWinSlider *)pe)->position);
break; break;
case GEVENT_GWIN_CHECKBOX: case GEVENT_GWIN_CHECKBOX:
gwinPrintf(ghConsole, "Checkbox %s=%s\n", gwinGetText(((GEventGWinCheckbox *)pe)->checkbox), ((GEventGWinCheckbox *)pe)->isChecked ? "Checked" : "UnChecked"); gwinPrintf(ghConsole, "Checkbox %s=%s\n", gwinGetText(((GEventGWinCheckbox *)pe)->gwin), ((GEventGWinCheckbox *)pe)->isChecked ? "Checked" : "UnChecked");
// If it is the Disable All checkbox then do that. // If it is the Disable All checkbox then do that.
if (((GEventGWinCheckbox *)pe)->checkbox == ghCheckDisableAll) { if (((GEventGWinCheckbox *)pe)->gwin == ghCheckDisableAll) {
gwinPrintf(ghConsole, "%s All\n", ((GEventGWinCheckbox *)pe)->isChecked ? "Disable" : "Enable"); gwinPrintf(ghConsole, "%s All\n", ((GEventGWinCheckbox *)pe)->isChecked ? "Disable" : "Enable");
setEnabled(!((GEventGWinCheckbox *)pe)->isChecked); setEnabled(!((GEventGWinCheckbox *)pe)->isChecked);
} }
break; break;
case GEVENT_GWIN_LIST: case GEVENT_GWIN_LIST:
gwinPrintf(ghConsole, "List %s Item %d %s\n", gwinGetText(((GEventGWinList *)pe)->list), ((GEventGWinList *)pe)->item, gwinPrintf(ghConsole, "List %s Item %d %s\n", gwinGetText(((GEventGWinList *)pe)->gwin), ((GEventGWinList *)pe)->item,
gwinListItemIsSelected(((GEventGWinList *)pe)->list, ((GEventGWinList *)pe)->item) ? "Selected" : "Unselected"); gwinListItemIsSelected(((GEventGWinList *)pe)->gwin, ((GEventGWinList *)pe)->item) ? "Selected" : "Unselected");
break; break;
case GEVENT_GWIN_RADIO: case GEVENT_GWIN_RADIO:
gwinPrintf(ghConsole, "Radio Group %u=%s\n", ((GEventGWinRadio *)pe)->group, gwinGetText(((GEventGWinRadio *)pe)->radio)); gwinPrintf(ghConsole, "Radio Group %u=%s\n", ((GEventGWinRadio *)pe)->group, gwinGetText(((GEventGWinRadio *)pe)->gwin));
switch(((GEventGWinRadio *)pe)->group) { switch(((GEventGWinRadio *)pe)->group) {
case GROUP_TABS: case GROUP_TABS:
// Set control visibility depending on the tab selected // Set control visibility depending on the tab selected
setTab(((GEventGWinRadio *)pe)->radio); setTab(((GEventGWinRadio *)pe)->gwin);
// We show the state of some of the GUI elements here // We show the state of some of the GUI elements here
if (((GEventGWinRadio *)pe)->radio == ghTabLabels) { if (((GEventGWinRadio *)pe)->gwin == ghTabLabels) {
char tmp[20]; char tmp[20];
// The sliders // The sliders
@ -519,9 +519,9 @@ int main(void) {
gwinPrintf(ghConsole, "Change Color Scheme\n"); gwinPrintf(ghConsole, "Change Color Scheme\n");
if (((GEventGWinRadio *)pe)->radio == ghRadioYellow) if (((GEventGWinRadio *)pe)->gwin == ghRadioYellow)
pstyle = &YellowWidgetStyle; pstyle = &YellowWidgetStyle;
else if (((GEventGWinRadio *)pe)->radio == ghRadioBlack) else if (((GEventGWinRadio *)pe)->gwin == ghRadioBlack)
pstyle = &BlackWidgetStyle; pstyle = &BlackWidgetStyle;
else else
pstyle = &WhiteWidgetStyle; pstyle = &WhiteWidgetStyle;

View File

@ -26,28 +26,6 @@
// Our pressed state // Our pressed state
#define GBUTTON_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0) #define GBUTTON_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0)
// Send the button event
static void SendButtonEvent(GWidgetObject *gw) {
GSourceListener * psl;
GEvent * pe;
#define pbe ((GEventGWinButton *)pe)
// Trigger a GWIN Button Event
psl = 0;
while ((psl = geventGetSourceListener(GWIDGET_SOURCE, psl))) {
if (!(pe = geventGetEventBuffer(psl)))
continue;
pbe->type = GEVENT_GWIN_BUTTON;
pbe->button = (GHandle)gw;
#if GWIN_WIDGET_TAGS
pbe->tag = gw->tag;
#endif
geventSendEvent(psl);
}
#undef pbe
}
#if GINPUT_NEED_MOUSE #if GINPUT_NEED_MOUSE
// A mouse down has occurred over the button // A mouse down has occurred over the button
static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) { static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) {
@ -68,7 +46,7 @@ static void SendButtonEvent(GWidgetObject *gw) {
return; return;
#endif #endif
SendButtonEvent(gw); _gwinSendEvent(&gw->g, GEVENT_GWIN_BUTTON);
} }
#endif #endif
@ -86,7 +64,7 @@ static void SendButtonEvent(GWidgetObject *gw) {
gw->g.flags |= GBUTTON_FLG_PRESSED; gw->g.flags |= GBUTTON_FLG_PRESSED;
_gwinUpdate((GHandle)gw); _gwinUpdate((GHandle)gw);
// Trigger the event on button down (different than for mouse/touch) // Trigger the event on button down (different than for mouse/touch)
SendButtonEvent(gw); _gwinSendEvent(&gw->g, GEVENT_GWIN_BUTTON);
} }
static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) {

View File

@ -29,19 +29,13 @@
/** /**
* @brief The Event Type for a Button Event * @brief The Event Type for a Button Event
*/ */
#define GEVENT_GWIN_BUTTON (GEVENT_GWIN_FIRST+0) #define GEVENT_GWIN_BUTTON (GEVENT_GWIN_CTRL_FIRST+0)
/** /**
* @brief A Button Event * @brief A Button Event
* @note There are currently no GEventGWinButton listening flags - use 0 as the flags to @p gwinAttachListener() * @note There are currently no GEventGWinButton listening flags - use 0 as the flags to @p gwinAttachListener()
*/ */
typedef struct GEventGWinButton { typedef GEventGWin GEventGWinButton;
GEventType type; // The type of this event (GEVENT_GWIN_BUTTON)
GHandle button; // The button that has been depressed (actually triggered on release)
#if GWIN_WIDGET_TAGS
WidgetTag tag; // The button tag
#endif
} GEventGWinButton;
/** /**
* @brief The button widget structure * @brief The button widget structure

View File

@ -31,7 +31,7 @@ static void SendCheckboxEvent(GWidgetObject *gw) {
if (!(pe = geventGetEventBuffer(psl))) if (!(pe = geventGetEventBuffer(psl)))
continue; continue;
pce->type = GEVENT_GWIN_CHECKBOX; pce->type = GEVENT_GWIN_CHECKBOX;
pce->checkbox = &gw->g; pce->gwin = &gw->g;
pce->isChecked = (gw->g.flags & GCHECKBOX_FLG_CHECKED) ? TRUE : FALSE; pce->isChecked = (gw->g.flags & GCHECKBOX_FLG_CHECKED) ? TRUE : FALSE;
#if GWIN_WIDGET_TAGS #if GWIN_WIDGET_TAGS
pce->tag = gw->tag; pce->tag = gw->tag;

View File

@ -28,7 +28,7 @@
/* Driver constants. */ /* Driver constants. */
/*===========================================================================*/ /*===========================================================================*/
#define GEVENT_GWIN_CHECKBOX (GEVENT_GWIN_FIRST+2) #define GEVENT_GWIN_CHECKBOX (GEVENT_GWIN_CTRL_FIRST+2)
/*===========================================================================*/ /*===========================================================================*/
/* Type definitions */ /* Type definitions */
@ -36,11 +36,11 @@
typedef struct GEventGWinCheckbox { typedef struct GEventGWinCheckbox {
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 gwin; // The checkbox that has been depressed (actually triggered on release)
bool_t isChecked; // Is the checkbox currently checked or unchecked?
#if GWIN_WIDGET_TAGS #if GWIN_WIDGET_TAGS
WidgetTag tag; // The checkbox tag WidgetTag tag; // The checkbox tag
#endif #endif
bool_t isChecked; // Is the checkbox currently checked or unchecked?
} GEventGWinCheckbox; } GEventGWinCheckbox;
/* A Checkbox window */ /* A Checkbox window */

View File

@ -243,7 +243,7 @@ bool_t _gwinDrawStart(GHandle gh);
void _gwinDrawEnd(GHandle gh); void _gwinDrawEnd(GHandle gh);
/** /**
* @brief Flush any pending redraws in the system. * @brief Destroy a window.
* *
* @param[in] gh The window * @param[in] gh The window
* @param[in] how Do we wait for the lock? * @param[in] how Do we wait for the lock?
@ -301,6 +301,18 @@ bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit);
* @notapi * @notapi
*/ */
void _gwidgetRedraw(GHandle gh); void _gwidgetRedraw(GHandle gh);
/**
* @brief Send a standard GWIN event.
*
* @param[in] gh The window
* @param[in] type The event type
*
* @note No consideration is given to recording EVENT LOST statuses.
*
* @notapi
*/
void _gwinSendEvent(GHandle gh, GEventType type);
#endif #endif
#if GWIN_NEED_CONTAINERS || defined(__DOXYGEN__) #if GWIN_NEED_CONTAINERS || defined(__DOXYGEN__)

View File

@ -95,6 +95,7 @@ static void forceFrameRedraw(GWidgetObject *gw) {
// Close is released - destroy the window // Close is released - destroy the window
gw->g.flags &= ~(GWIN_FRAME_CLOSE_PRESSED|GWIN_FRAME_MAX_PRESSED|GWIN_FRAME_MIN_PRESSED); gw->g.flags &= ~(GWIN_FRAME_CLOSE_PRESSED|GWIN_FRAME_MAX_PRESSED|GWIN_FRAME_MIN_PRESSED);
forceFrameRedraw(gw); forceFrameRedraw(gw);
_gwinSendEvent(&gw->g, GEVENT_GWIN_CLOSE);
gwinDestroy(&gw->g); gwinDestroy(&gw->g);
return; return;
} }

View File

@ -302,6 +302,24 @@ void _gwidgetRedraw(GHandle gh) {
gw->fnDraw(gw, gw->fnParam); gw->fnDraw(gw, gw->fnParam);
} }
void _gwinSendEvent(GHandle gh, GEventType type) {
GSourceListener * psl;
GEventGWin * pge;
// Trigger a GWIN Event
psl = 0;
while ((psl = geventGetSourceListener(GWIDGET_SOURCE, psl))) {
if (!(pge = (GEventGWin *)geventGetEventBuffer(psl)))
continue;
pge->type = type;
pge->gwin = gh;
#if GWIN_WIDGET_TAGS
pge->tag = (gh->flags & GWIN_FLG_WIDGET) ? ((GWidgetObject *)gh)->tag : 0;
#endif
geventSendEvent(psl);
}
}
void gwinWidgetClearInit(GWidgetInit *pwi) { void gwinWidgetClearInit(GWidgetInit *pwi) {
char *p; char *p;
unsigned len; unsigned len;

View File

@ -135,6 +135,36 @@ typedef struct GWidgetObject {
* won't support it even with special flags. * won't support it even with special flags.
*/ */
/**
* @brief A Generic GWIN Event
* @note All gwin windows when sending events will either use this structure or a
* structure that is 100% compatible except that it may also have extra fields.
* @note There are currently no GEventGWin listening flags - use 0 as the flags to @p gwinAttachListener()
*
* @{
*/
typedef struct GEventGWin {
GEventType type; // The type of this event
GHandle gwin; // The gwin window handle
#if GWIN_NEED_WIDGET && GWIN_WIDGET_TAGS
WidgetTag tag; // The tag (if applicable)
#endif
} GEventGWin;
/** @} */
/**
* @brief The list of predefined GWIN events.
* @note The definition of an event type does not mean it is always sent. For example,
* close events are sent by Frame windows but by little else. They are normally
* only sent if there is a specific reason that the event should be sent.
* @{
*/
#define GEVENT_GWIN_OPEN (GEVENT_GWIN_FIRST+0x00)
#define GEVENT_GWIN_CLOSE (GEVENT_GWIN_FIRST+0x01)
#define GEVENT_GWIN_RESIZE (GEVENT_GWIN_FIRST+0x02)
#define GEVENT_GWIN_CTRL_FIRST (GEVENT_GWIN_FIRST+0x40)
/** @} */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -101,6 +101,40 @@ GHandle _gwindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit
return (GHandle)pgw; return (GHandle)pgw;
} }
// Internal routine for use by GWIN components only
void _gwinDestroy(GHandle gh, GRedrawMethod how) {
if (!gh)
return;
// Make the window invisible
gwinSetVisible(gh, FALSE);
// Make sure it is flushed first - must be REDRAW_WAIT or REDRAW_INSESSION
_gwinFlushRedraws(how);
#if GWIN_NEED_CONTAINERS
// Notify the parent it is about to be deleted
if (gh->parent && ((gcontainerVMT *)gh->parent->vmt)->NotifyDelete)
((gcontainerVMT *)gh->parent->vmt)->NotifyDelete(gh->parent, gh);
#endif
// Remove from the window manager
#if GWIN_NEED_WINDOWMANAGER
_GWINwm->vmt->Delete(gh);
#endif
// Class destroy routine
if (gh->vmt->Destroy)
gh->vmt->Destroy(gh);
// Clean up the structure
if (gh->flags & GWIN_FLG_DYNAMIC) {
gh->flags = 0; // To be sure, to be sure
gfxFree((void *)gh);
} else
gh->flags = 0; // To be sure, to be sure
}
/*----------------------------------------------- /*-----------------------------------------------
* Routines that affect all windows * Routines that affect all windows
*-----------------------------------------------*/ *-----------------------------------------------*/
@ -152,39 +186,6 @@ GHandle gwinGWindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pI
return pgw; return pgw;
} }
void _gwinDestroy(GHandle gh, GRedrawMethod how) {
if (!gh)
return;
// Make the window invisible
gwinSetVisible(gh, FALSE);
// Make sure it is flushed first - must be REDRAW_WAIT or REDRAW_INSESSION
_gwinFlushRedraws(how);
#if GWIN_NEED_CONTAINERS
// Notify the parent it is about to be deleted
if (gh->parent && ((gcontainerVMT *)gh->parent->vmt)->NotifyDelete)
((gcontainerVMT *)gh->parent->vmt)->NotifyDelete(gh->parent, gh);
#endif
// Remove from the window manager
#if GWIN_NEED_WINDOWMANAGER
_GWINwm->vmt->Delete(gh);
#endif
// Class destroy routine
if (gh->vmt->Destroy)
gh->vmt->Destroy(gh);
// Clean up the structure
if (gh->flags & GWIN_FLG_DYNAMIC) {
gh->flags = 0; // To be sure, to be sure
gfxFree((void *)gh);
} else
gh->flags = 0; // To be sure, to be sure
}
void gwinDestroy(GHandle gh) { void gwinDestroy(GHandle gh) {
_gwinDestroy(gh, REDRAW_WAIT); _gwinDestroy(gh, REDRAW_WAIT);
} }

View File

@ -64,7 +64,7 @@ static void sendListEvent(GWidgetObject *gw, int item) {
continue; continue;
ple->type = GEVENT_GWIN_LIST; ple->type = GEVENT_GWIN_LIST;
ple->list = (GHandle)gw; ple->gwin = (GHandle)gw;
ple->item = item; ple->item = item;
#if GWIN_WIDGET_TAGS #if GWIN_WIDGET_TAGS
ple->tag = gw->tag; ple->tag = gw->tag;

View File

@ -31,18 +31,18 @@
/** /**
* @brief The event type for a list event * @brief The event type for a list event
*/ */
#define GEVENT_GWIN_LIST (GEVENT_GWIN_FIRST+4) #define GEVENT_GWIN_LIST (GEVENT_GWIN_CTRL_FIRST+4)
/** /**
* @brief A list event * @brief A list event
*/ */
typedef struct GEventGWinList { typedef struct GEventGWinList {
GEventType type; // The type of this event (GEVENT_GWIN_LIST) GEventType type; // The type of this event (GEVENT_GWIN_LIST)
GHandle list; // The list GHandle gwin; // The list
int item; // The item that has been selected (or unselected in a multi-select listbox)
#if GWIN_WIDGET_TAGS #if GWIN_WIDGET_TAGS
WidgetTag tag; // The list tag WidgetTag tag; // The list tag
#endif #endif
int item; // The item that has been selected (or unselected in a multi-select listbox)
} GEventGWinList; } GEventGWinList;
// A list window // A list window

View File

@ -36,7 +36,7 @@ static void SendRadioEvent(GWidgetObject *gw) {
if (!(pe = geventGetEventBuffer(psl))) if (!(pe = geventGetEventBuffer(psl)))
continue; continue;
pbe->type = GEVENT_GWIN_RADIO; pbe->type = GEVENT_GWIN_RADIO;
pbe->radio = (GHandle)gw; pbe->gwin = (GHandle)gw;
pbe->group = ((GRadioObject *)gw)->group; pbe->group = ((GRadioObject *)gw)->group;
#if GWIN_WIDGET_TAGS #if GWIN_WIDGET_TAGS
pbe->tag = gw->tag; pbe->tag = gw->tag;

View File

@ -27,7 +27,7 @@
/** /**
* @brief The Event Type for a Radio Event * @brief The Event Type for a Radio Event
*/ */
#define GEVENT_GWIN_RADIO (GEVENT_GWIN_FIRST+3) #define GEVENT_GWIN_RADIO (GEVENT_GWIN_CTRL_FIRST+3)
/** /**
* @brief A Button Event * @brief A Button Event
@ -35,11 +35,11 @@
*/ */
typedef struct GEventGWinRadio { typedef struct GEventGWinRadio {
GEventType type; // The type of this event (GEVENT_GWIN_RADIO) GEventType type; // The type of this event (GEVENT_GWIN_RADIO)
GHandle radio; // The radio button that has been depressed GHandle gwin; // The radio button that has been depressed
uint16_t group; // The group for this radio button
#if GWIN_WIDGET_TAGS #if GWIN_WIDGET_TAGS
WidgetTag tag; // The radio tag WidgetTag tag; // The radio tag
#endif #endif
uint16_t group; // The group for this radio button
} GEventGWinRadio; } GEventGWinRadio;
/** /**

View File

@ -36,7 +36,7 @@ static void SendSliderEvent(GWidgetObject *gw) {
if (!(pe = geventGetEventBuffer(psl))) if (!(pe = geventGetEventBuffer(psl)))
continue; continue;
pse->type = GEVENT_GWIN_SLIDER; pse->type = GEVENT_GWIN_SLIDER;
pse->slider = (GHandle)gw; pse->gwin = (GHandle)gw;
pse->position = ((GSliderObject *)gw)->pos; pse->position = ((GSliderObject *)gw)->pos;
#if GWIN_WIDGET_TAGS #if GWIN_WIDGET_TAGS
pse->tag = gw->tag; pse->tag = gw->tag;

View File

@ -24,15 +24,15 @@
/* This file is included within "gwin/gwidget.h" */ /* This file is included within "gwin/gwidget.h" */
#define GEVENT_GWIN_SLIDER (GEVENT_GWIN_FIRST+1) #define GEVENT_GWIN_SLIDER (GEVENT_GWIN_CTRL_FIRST+1)
typedef struct GEventGWinSlider { typedef struct GEventGWinSlider {
GEventType type; // The type of this event (GEVENT_GWIN_BUTTON) GEventType type; // The type of this event (GEVENT_GWIN_BUTTON)
GHandle slider; // The slider that is returning results GHandle gwin; // The slider that is returning results
int position;
#if GWIN_WIDGET_TAGS #if GWIN_WIDGET_TAGS
WidgetTag tag; // The slider tag WidgetTag tag; // The slider tag
#endif #endif
int position;
} GEventGWinSlider; } GEventGWinSlider;
// There are currently no GEventGWinSlider listening flags - use 0 // There are currently no GEventGWinSlider listening flags - use 0