diff options
author | Joel Bodenmann <joel@unormal.org> | 2013-07-28 23:18:59 +0200 |
---|---|---|
committer | Joel Bodenmann <joel@unormal.org> | 2013-07-28 23:18:59 +0200 |
commit | 31f355460248b2d39969590feefc9482e53c451f (patch) | |
tree | 04ccb15766a62a3616a04a7de947bc5c73a821b6 | |
parent | 632566e243e1fa914dfee6ec87913d940856963c (diff) | |
download | uGFX-31f355460248b2d39969590feefc9482e53c451f.tar.gz uGFX-31f355460248b2d39969590feefc9482e53c451f.tar.bz2 uGFX-31f355460248b2d39969590feefc9482e53c451f.zip |
list update
-rw-r--r-- | include/gwin/list.h | 6 | ||||
-rw-r--r-- | src/gwin/list.c | 21 |
2 files changed, 22 insertions, 5 deletions
diff --git a/include/gwin/list.h b/include/gwin/list.h index ba83f24b..d28206d9 100644 --- a/include/gwin/list.h +++ b/include/gwin/list.h @@ -45,6 +45,12 @@ typedef struct GEventGWinList { // A list window typedef struct GListObject { GWidgetObject w; + + #if GINPUT_NEED_TOGGLE + uint16_t t_up; + uint16_t t_dn; + #endif + int cnt; // Number of items currently in the list (quicker than counting each time) gfxQueueASync list_head; // The list of items } GListObject; diff --git a/src/gwin/list.c b/src/gwin/list.c index 54bac334..2509260c 100644 --- a/src/gwin/list.c +++ b/src/gwin/list.c @@ -201,19 +201,30 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param) { #define gcw ((GListObject *)gw) switch (role) { - // select up + // select down case 0: - _selectUp(gw); + _selectDown(gw); break; - // select down + // select up case 1: - _selectDown(gw); + _selectUp(gw); break; } #undef gcw } + + static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + if (role) + ((GListObject *)gw)->t_up = instance; + else + ((GListObject *)gw)->t_dn = instance; + } + + static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { + return role ? ((GListObject *)gw)->t_up : ((GListObject *)gw)->t_dn; + } #endif static void _destroy(GHandle gh) { @@ -244,7 +255,7 @@ static const gwidgetVMT listVMT = { #if GINPUT_NEED_TOGGLE { 2, // two toggle roles - ToggleAssin, // Assign toggles + ToggleAssign, // Assign toggles ToggleGet, // get toggles 0, ToggleOn, // process toggle on event |