aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2015-01-25 17:40:34 +1000
committerinmarket <andrewh@inmarket.com.au>2015-01-25 17:40:34 +1000
commitb9f53aa7936686134f19c480346816a3d234f7f7 (patch)
tree84a51da605c4e3f54320a6ed793e8ffb6ba2aaac /demos
parentb316263833c95cf2b8cf14fe890321d5880aa81c (diff)
downloaduGFX-b9f53aa7936686134f19c480346816a3d234f7f7.tar.gz
uGFX-b9f53aa7936686134f19c480346816a3d234f7f7.tar.bz2
uGFX-b9f53aa7936686134f19c480346816a3d234f7f7.zip
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).
Diffstat (limited to 'demos')
-rw-r--r--demos/modules/gwin/widgets/gfxconf.h1
-rw-r--r--demos/modules/gwin/widgets/main.c14
2 files changed, 15 insertions, 0 deletions
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;