diff options
author | Joel Bodenmann <joel@unormal.org> | 2014-05-11 22:22:13 +0200 |
---|---|---|
committer | Joel Bodenmann <joel@unormal.org> | 2014-05-11 22:22:13 +0200 |
commit | f5765fab92c44048b8e987580e77fee48c72b814 (patch) | |
tree | 7b03811be5836d6fb7ccceda4dcb9a6547c1c7d2 /demos/modules/gwin/container/main.c | |
parent | e28e572ea81e5d81a33161b318c7849463c16e75 (diff) | |
download | uGFX-f5765fab92c44048b8e987580e77fee48c72b814.tar.gz uGFX-f5765fab92c44048b8e987580e77fee48c72b814.tar.bz2 uGFX-f5765fab92c44048b8e987580e77fee48c72b814.zip |
Adding GWIN container demo
Diffstat (limited to 'demos/modules/gwin/container/main.c')
-rw-r--r-- | demos/modules/gwin/container/main.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/demos/modules/gwin/container/main.c b/demos/modules/gwin/container/main.c new file mode 100644 index 00000000..4e73b0c4 --- /dev/null +++ b/demos/modules/gwin/container/main.c @@ -0,0 +1,56 @@ +#include "gfx.h" + +static GHandle ghContainer; +static GHandle ghButton; + +static void createWidgets(void) { + GWidgetInit wi; + + // Apply some default values for GWIN + gwinWidgetClearInit(&wi); + + // Apply the container parameters + wi.g.show = FALSE; + wi.g.width = 200; + wi.g.height = 150; + wi.g.y = 10; + wi.g.x = 10; + wi.text = "Container"; + ghContainer = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER); + wi.g.show = TRUE; + + // Apply the button parameters + wi.g.width = 120; + wi.g.height = 30; + wi.g.y = 10; + wi.g.x = 10; + wi.text = "Button"; + wi.g.parent = ghContainer; + ghButton = gwinButtonCreate(0, &wi); + + // Make the container become visible - therefore all its children + // become visible as well + gwinShow(ghContainer); +} + +int main(void) { + // Initialize the display + gfxInit(); + + // Attach the mouse input + gwinAttachMouse(0); + + // Set the widget defaults + gwinSetDefaultFont(gdispOpenFont("*")); + gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gdispClear(White); + + // Create the widget + createWidgets(); + + while(1) { + gfxSleepMilliseconds(1000); + } + + return 0; +} |