From b9f53aa7936686134f19c480346816a3d234f7f7 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 25 Jan 2015 17:40:34 +1000 Subject: Add the ability to flash a gwin window/widget. Only the button draws for checkbox's and radio's currently do anything about it. Widget demo updated to show this on Checkbox 3 (the toggle button). --- demos/modules/gwin/widgets/gfxconf.h | 1 + demos/modules/gwin/widgets/main.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) (limited to 'demos') diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h index e7e2714e..4ba2c21d 100644 --- a/demos/modules/gwin/widgets/gfxconf.h +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -51,6 +51,7 @@ #define GFX_USE_GWIN TRUE #define GWIN_NEED_WINDOWMANAGER TRUE + #define GWIN_NEED_FLASHING TRUE #define GWIN_NEED_CONSOLE TRUE #define GWIN_CONSOLE_USE_HISTORY TRUE diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index 80cd6c02..d5bfb6d2 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -79,6 +79,8 @@ static const GWidgetStyle YellowWidgetStyle = { static font_t font; static GListener gl; static GHandle ghConsole; +static GTimer FlashTimer; + #if GWIN_NEED_TABSET static GHandle ghTabset; #else @@ -485,6 +487,12 @@ static void setEnabled(bool_t ena) { //gwinSetEnabled(ghCheckDisableAll, TRUE); } +static void FlashOffFn(void *param) { + (void) param; + + gwinNoFlash(ghCheckbox3); +} + int main(void) { GEvent * pe; @@ -517,6 +525,7 @@ int main(void) { // We want to listen for widget events geventListenerInit(&gl); gwinAttachListener(&gl); + gtimerInit(&FlashTimer); #if !GWIN_NEED_TABSET // Press the Tab we want visible @@ -543,6 +552,11 @@ int main(void) { if (((GEventGWinCheckbox *)pe)->gwin == ghCheckDisableAll) { gwinPrintf(ghConsole, "%s All\n", ((GEventGWinCheckbox *)pe)->isChecked ? "Disable" : "Enable"); setEnabled(!((GEventGWinCheckbox *)pe)->isChecked); + + // If it is the toggle button checkbox start the flash. + } else if (((GEventGWinCheckbox *)pe)->gwin == ghCheckbox3) { + gwinFlash(ghCheckbox3); + gtimerStart(&FlashTimer, FlashOffFn, 0, FALSE, 3000); } break; -- cgit v1.2.3