aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin/button.c
diff options
context:
space:
mode:
authorAndrew Hannam <andrewh@inmarket.com.au>2013-04-07 16:02:10 +1000
committerAndrew Hannam <andrewh@inmarket.com.au>2013-04-07 16:02:10 +1000
commit9ee7c284e63fc419f70ffc3c53eb23590767ee08 (patch)
tree57a45c0ca6e5222292bebb8445dffaff5757275b /src/gwin/button.c
parent90f5e851467e5ea14b710ada937409e506820d58 (diff)
downloaduGFX-9ee7c284e63fc419f70ffc3c53eb23590767ee08.tar.gz
uGFX-9ee7c284e63fc419f70ffc3c53eb23590767ee08.tar.bz2
uGFX-9ee7c284e63fc419f70ffc3c53eb23590767ee08.zip
Add GINPUT Dial, simplify GWIN input assignment
Added GINPUT Dial support and a driver that uses GADC to read the dial. Added support for Dial inputs to the GWIN slider. Updated the slider demo for Dial Inputs. Simplified the assigning of inputs to GWIN "widgets" button and slider. Updated the demo's to match the new input to button assignment.
Diffstat (limited to 'src/gwin/button.c')
-rw-r--r--src/gwin/button.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gwin/button.c b/src/gwin/button.c
index bec738b4..74fe3080 100644
--- a/src/gwin/button.c
+++ b/src/gwin/button.c
@@ -68,7 +68,7 @@ static void gwinButtonCallback(void *param, GEvent *pe) {
#define pbe ((GEventGWinButton *)pe)
switch (pe->type) {
- #if defined(GINPUT_NEED_MOUSE) && GINPUT_NEED_MOUSE
+ #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
case GEVENT_MOUSE:
case GEVENT_TOUCH:
// Ignore anything other than the primary mouse button going up or down
@@ -108,7 +108,7 @@ static void gwinButtonCallback(void *param, GEvent *pe) {
#endif
#endif
- #if defined(GINPUT_NEED_TOGGLE) && GINPUT_NEED_TOGGLE
+ #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE
case GEVENT_TOGGLE:
// State has changed - update the button
gbw->state = pxe->on ? GBTN_DOWN : GBTN_UP;
@@ -375,18 +375,22 @@ void gwinButtonDraw_Square(GHandle gh, bool_t isdown, const char *txt, const GBu
}
#endif
-#if defined(GINPUT_NEED_MOUSE) && GINPUT_NEED_MOUSE
- bool_t gwinAttachButtonMouseSource(GHandle gh, GSourceHandle gsh) {
- if (gh->type != GW_BUTTON)
+#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
+ bool_t gwinAttachButtonMouse(GHandle gh, uint16_t instance) {
+ GSourceHandle gsh;
+
+ if (gh->type != GW_BUTTON || !(gsh = ginputGetMouse(instance)))
return FALSE;
return geventAttachSource(&((GButtonObject *)gh)->listener, gsh, GLISTEN_MOUSEMETA);
}
#endif
-#if defined(GINPUT_NEED_TOGGLE) && GINPUT_NEED_TOGGLE
- bool_t gwinAttachButtonToggleSource(GHandle gh, GSourceHandle gsh) {
- if (gh->type != GW_BUTTON)
+#if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE
+ bool_t gwinAttachButtonToggle(GHandle gh, uint16_t instance) {
+ GSourceHandle gsh;
+
+ if (gh->type != GW_BUTTON || !(gsh = ginputGetToggle(instance)))
return FALSE;
return geventAttachSource(&((GButtonObject *)gh)->listener, gsh, GLISTEN_TOGGLE_OFF|GLISTEN_TOGGLE_ON);