diff options
Diffstat (limited to 'demos')
-rw-r--r-- | demos/modules/gwin/widgets/gfxconf.h | 2 | ||||
-rw-r--r-- | demos/modules/gwin/widgets/image_yesno.gif | bin | 0 -> 202 bytes | |||
-rw-r--r-- | demos/modules/gwin/widgets/image_yesno.h | 21 | ||||
-rw-r--r-- | demos/modules/gwin/widgets/main.c | 17 |
4 files changed, 35 insertions, 5 deletions
diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h index 9ca5580b..2b9d8f8f 100644 --- a/demos/modules/gwin/widgets/gfxconf.h +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -83,7 +83,7 @@ #define GWIN_NEED_RADIO TRUE #define GWIN_NEED_LIST TRUE #define GWIN_NEED_IMAGE_ANIMATION TRUE - +#define GWIN_NEED_LIST_IMAGES TRUE /* Features for the GINPUT sub-system. */ #define GINPUT_NEED_MOUSE TRUE diff --git a/demos/modules/gwin/widgets/image_yesno.gif b/demos/modules/gwin/widgets/image_yesno.gif Binary files differnew file mode 100644 index 00000000..5a3d3998 --- /dev/null +++ b/demos/modules/gwin/widgets/image_yesno.gif diff --git a/demos/modules/gwin/widgets/image_yesno.h b/demos/modules/gwin/widgets/image_yesno.h new file mode 100644 index 00000000..c3150ea7 --- /dev/null +++ b/demos/modules/gwin/widgets/image_yesno.h @@ -0,0 +1,21 @@ +/** + * This file was generated from "yesno.gif" using... + * + * file2c -bcs image_yesno.gif image_yesno.h + * + */ +static const unsigned char image_yesno[] = { + 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x0B, 0x00, 0x2C, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xC6, 0x00, 0xC6, 0xFF, 0xC6, 0xCE, 0xFF, 0xCE, 0xFF, 0x08, 0x18, 0xFF, 0xCE, 0xDE, 0xFF, + 0xDE, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x21, 0xF9, 0x04, + 0x03, 0x00, 0x00, 0x0F, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x2C, 0x00, 0x00, 0x04, + 0x77, 0xF0, 0xC9, 0x49, 0x03, 0xBD, 0xC1, 0xDE, 0x97, 0x83, 0xD8, 0xD9, 0xB7, 0x71, 0x22, 0xA8, + 0x8D, 0x59, 0x55, 0x7A, 0x55, 0x2A, 0x9C, 0x6D, 0x8A, 0xC2, 0x23, 0x45, 0xDC, 0x84, 0x61, 0xE7, + 0x12, 0xDE, 0x13, 0x1B, 0x1C, 0x70, 0xE4, 0x0B, 0x02, 0x6F, 0x17, 0xE4, 0xC3, 0x30, 0xFC, 0xED, + 0x24, 0xCC, 0x0B, 0x53, 0xA7, 0x7C, 0x36, 0x93, 0xD7, 0xCD, 0xA0, 0xF6, 0x18, 0x6C, 0xB5, 0xDE, + 0x03, 0x58, 0x3C, 0x1A, 0x90, 0xC1, 0x5C, 0x2F, 0xC5, 0x3C, 0x61, 0xB7, 0xD5, 0x87, 0xEF, 0xC5, + 0xAB, 0x2E, 0xCB, 0xB9, 0x93, 0x82, 0xBE, 0x70, 0x7E, 0xE8, 0xC9, 0x7B, 0x12, 0x7A, 0x1B, 0x7B, + 0x05, 0x35, 0x81, 0x84, 0x86, 0x83, 0x14, 0x8B, 0x07, 0x86, 0x79, 0x8F, 0x82, 0x8F, 0x8E, 0x17, + 0x8E, 0x62, 0x8B, 0x8C, 0x8A, 0x87, 0x05, 0x11, 0x00, 0x3B, +}; diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index 59b0b917..5f780193 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -30,6 +30,7 @@ // include our chibios logo in a .gif format #include "image_chibios.h" +#include "image_yesno.h" /** * This demo demonstrates many of the GWIN widgets. @@ -76,8 +77,9 @@ static GHandle ghCheckbox1, ghCheckbox2, ghCheckDisableAll; static GHandle ghLabel1; static GHandle ghRadio1, ghRadio2; static GHandle ghRadioBlack, ghRadioWhite, ghRadioYellow; -static GHandle ghList1, ghList2; +static GHandle ghList1, ghList2, ghList3; static GHandle ghImage1; +static gdispImage imgYesNo; /* Some useful macros */ #define ScrWidth gdispGetWidth() @@ -179,6 +181,13 @@ static void createWidgets(void) { gwinListAddItem(ghList2, "Item 8", FALSE); gwinListAddItem(ghList2, "Item 9", FALSE); gwinListAddItem(ghList2, "Item 10", FALSE); gwinListAddItem(ghList2, "Item 11", FALSE); gwinListAddItem(ghList2, "Item 12", FALSE); gwinListAddItem(ghList2, "Item 13", FALSE); + wi.g.x = 0+2*(LIST_WIDTH+1); wi.text = "L3"; ghList3 = gwinListCreate(NULL, &wi, FALSE); + gwinListAddItem(ghList3, "Item 0", FALSE); gwinListAddItem(ghList3, "Item 1", FALSE); + gwinListAddItem(ghList3, "Item 2", FALSE); gwinListAddItem(ghList3, "Item 3", FALSE); + gdispImageSetMemoryReader(&imgYesNo, image_yesno); + gdispImageOpen(&imgYesNo); + gwinListItemSetImage(ghList3, 1, &imgYesNo); + gwinListItemSetImage(ghList3, 3, &imgYesNo); // Image wi.g.x = ScrWidth-210; wi.g.y = TAB_HEIGHT + 10; wi.g.width = 200; wi.g.height = 200; @@ -207,7 +216,7 @@ static void setTab(GHandle tab) { gwinSetVisible(ghLabel1, FALSE); gwinSetVisible(ghRadio1, FALSE); gwinSetVisible(ghRadio2, FALSE); gwinSetVisible(ghRadioWhite, FALSE);gwinSetVisible(ghRadioBlack, FALSE);gwinSetVisible(ghRadioYellow, FALSE); - gwinSetVisible(ghList1, FALSE); gwinSetVisible(ghList2, FALSE); + gwinSetVisible(ghList1, FALSE); gwinSetVisible(ghList2, FALSE); gwinSetVisible(ghList3, FALSE); gwinSetVisible(ghImage1, FALSE); /* Turn on widgets depending on the tab selected */ @@ -225,7 +234,7 @@ static void setTab(GHandle tab) { gwinSetVisible(ghRadio1, TRUE); gwinSetVisible(ghRadio2, TRUE); gwinSetVisible(ghRadioWhite, TRUE); gwinSetVisible(ghRadioBlack, TRUE); gwinSetVisible(ghRadioYellow, TRUE); } else if (tab == ghTabLists) { - gwinSetVisible(ghList1, TRUE); gwinSetVisible(ghList2, TRUE); + gwinSetVisible(ghList1, TRUE); gwinSetVisible(ghList2, TRUE); gwinSetVisible(ghList3, TRUE); } else if (tab == ghTabImages) { gwinSetVisible(ghImage1, TRUE); } @@ -242,7 +251,7 @@ static void setEnabled(bool_t ena) { gwinSetEnabled(ghCheckbox1, ena); gwinSetEnabled(ghCheckbox2, ena); //gwinSetEnabled(ghCheckDisableAll, TRUE); gwinSetEnabled(ghLabel1, ena); gwinSetEnabled(ghRadio1, ena); gwinSetEnabled(ghRadio2, ena); - gwinSetEnabled(ghList1, ena); gwinSetEnabled(ghList2, ena); + gwinSetEnabled(ghList1, ena); gwinSetEnabled(ghList2, ena); gwinSetEnabled(ghList3, ena); gwinSetEnabled(ghRadioWhite, ena); gwinSetEnabled(ghRadioBlack, ena); gwinSetEnabled(ghRadioYellow, ena); gwinSetEnabled(ghImage1, ena); } |