2013-06-06 04:33:32 +00:00
|
|
|
/*
|
2013-06-06 06:48:30 +00:00
|
|
|
* Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu <joel@unormal.org>
|
2013-06-15 11:09:02 +00:00
|
|
|
* Copyright (c) 2012, 2013, Andrew Hannam aka inmarket
|
2013-06-06 06:48:30 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* * Neither the name of the <organization> nor the
|
|
|
|
* names of its contributors may be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
|
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
2013-06-06 04:33:32 +00:00
|
|
|
#include "gfx.h"
|
|
|
|
|
2013-07-07 09:43:34 +00:00
|
|
|
/**
|
|
|
|
* This demo demonstrates many of the GWIN widgets.
|
|
|
|
* On the "Radio" tab try playing with the color radio buttons.
|
|
|
|
* On the "Checkbox" tab try playing with the "Disable All" checkbox.
|
|
|
|
*/
|
|
|
|
|
2014-02-07 08:44:32 +00:00
|
|
|
/**
|
|
|
|
* The image files must be stored on a GFILE file-system.
|
|
|
|
* Use either GFILE_NEED_NATIVEFS or GFILE_NEED_ROMFS (or both).
|
|
|
|
*
|
|
|
|
* The ROMFS uses the file "romfs_files.h" to describe the set of files in the ROMFS.
|
|
|
|
*/
|
|
|
|
|
2015-01-03 08:46:46 +00:00
|
|
|
/**
|
|
|
|
* The code can either use the Tabset control or use Radio buttons set to the Tab style.
|
|
|
|
* Change this in your gfxconf.h file by defining GWIN_NEED_TABSET (or not). It is
|
|
|
|
* defined by default in this demo.
|
|
|
|
*/
|
|
|
|
|
2013-07-07 09:43:34 +00:00
|
|
|
/* Our custom yellow style */
|
|
|
|
static const GWidgetStyle YellowWidgetStyle = {
|
|
|
|
Yellow, // window background
|
2015-08-16 11:53:47 +00:00
|
|
|
HTML2COLOR(0x800000), // focus
|
2013-07-07 09:43:34 +00:00
|
|
|
|
|
|
|
// enabled color set
|
|
|
|
{
|
|
|
|
HTML2COLOR(0x0000FF), // text
|
|
|
|
HTML2COLOR(0x404040), // edge
|
|
|
|
HTML2COLOR(0xE0E0E0), // fill
|
2015-08-16 11:53:47 +00:00
|
|
|
HTML2COLOR(0xE0E0E0) // progress - inactive area
|
2013-07-07 09:43:34 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// disabled color set
|
|
|
|
{
|
|
|
|
HTML2COLOR(0xC0C0C0), // text
|
|
|
|
HTML2COLOR(0x808080), // edge
|
|
|
|
HTML2COLOR(0xE0E0E0), // fill
|
2015-08-16 11:53:47 +00:00
|
|
|
HTML2COLOR(0xC0E0C0) // progress - active area
|
2013-07-07 09:43:34 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// pressed color set
|
|
|
|
{
|
|
|
|
HTML2COLOR(0xFF00FF), // text
|
|
|
|
HTML2COLOR(0x404040), // edge
|
|
|
|
HTML2COLOR(0x808080), // fill
|
|
|
|
HTML2COLOR(0x00E000), // progress - active area
|
2015-08-16 11:53:47 +00:00
|
|
|
}
|
2013-07-07 09:43:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* The variables we need */
|
2014-05-11 10:12:16 +00:00
|
|
|
static font_t font;
|
2013-06-06 04:33:32 +00:00
|
|
|
static GListener gl;
|
|
|
|
static GHandle ghConsole;
|
2015-01-25 07:40:34 +00:00
|
|
|
static GTimer FlashTimer;
|
|
|
|
|
2015-01-03 08:46:46 +00:00
|
|
|
#if GWIN_NEED_TABSET
|
|
|
|
static GHandle ghTabset;
|
|
|
|
#else
|
|
|
|
static GHandle ghTabButtons, ghTabSliders, ghTabCheckboxes, ghTabLabels, ghTabRadios, ghTabLists, ghTabImages, ghTabProgressbar;
|
|
|
|
#endif
|
2014-05-11 10:12:16 +00:00
|
|
|
static GHandle ghPgButtons, ghPgSliders, ghPgCheckboxes, ghPgLabels, ghPgRadios, ghPgLists, ghPgImages, ghPgProgressbars;
|
2013-06-06 04:33:32 +00:00
|
|
|
static GHandle ghButton1, ghButton2, ghButton3, ghButton4;
|
|
|
|
static GHandle ghSlider1, ghSlider2, ghSlider3, ghSlider4;
|
2015-01-23 07:57:13 +00:00
|
|
|
static GHandle ghCheckbox1, ghCheckbox2, ghCheckbox3, ghCheckDisableAll;
|
2014-05-11 13:11:10 +00:00
|
|
|
static GHandle ghLabelSlider1, ghLabelSlider2, ghLabelSlider3, ghLabelSlider4, ghLabelRadio1;
|
2013-07-05 15:46:34 +00:00
|
|
|
static GHandle ghRadio1, ghRadio2;
|
2013-07-07 09:43:34 +00:00
|
|
|
static GHandle ghRadioBlack, ghRadioWhite, ghRadioYellow;
|
2014-04-23 01:03:36 +00:00
|
|
|
static GHandle ghList1, ghList2, ghList3, ghList4;
|
2013-07-07 10:10:00 +00:00
|
|
|
static GHandle ghImage1;
|
2014-04-23 21:06:28 +00:00
|
|
|
static GHandle ghProgressbar1;
|
2013-08-01 08:05:48 +00:00
|
|
|
static gdispImage imgYesNo;
|
2013-06-06 04:33:32 +00:00
|
|
|
|
2013-07-07 09:43:34 +00:00
|
|
|
/* Some useful macros */
|
2013-07-07 10:10:00 +00:00
|
|
|
#define ScrWidth gdispGetWidth()
|
|
|
|
#define ScrHeight gdispGetHeight()
|
2013-06-06 04:33:32 +00:00
|
|
|
|
2014-05-11 10:12:16 +00:00
|
|
|
#define BUTTON_PADDING 20
|
2013-07-07 09:43:34 +00:00
|
|
|
#define TAB_HEIGHT 30
|
2014-05-11 13:11:10 +00:00
|
|
|
#define LABEL_HEIGHT 15
|
2013-07-07 09:43:34 +00:00
|
|
|
#define BUTTON_WIDTH 50
|
|
|
|
#define BUTTON_HEIGHT 30
|
2014-05-11 10:26:17 +00:00
|
|
|
#define LIST_WIDTH 75
|
2013-08-01 04:50:40 +00:00
|
|
|
#define LIST_HEIGHT 80
|
2013-07-07 09:43:34 +00:00
|
|
|
#define SLIDER_WIDTH 20
|
|
|
|
#define CHECKBOX_WIDTH 80
|
|
|
|
#define CHECKBOX_HEIGHT 20
|
|
|
|
#define RADIO_WIDTH 50
|
|
|
|
#define RADIO_HEIGHT 20
|
|
|
|
#define COLOR_WIDTH 80
|
|
|
|
#define DISABLEALL_WIDTH 100
|
|
|
|
#define GROUP_TABS 0
|
|
|
|
#define GROUP_YESNO 1
|
|
|
|
#define GROUP_COLORS 2
|
|
|
|
|
2015-01-03 08:46:46 +00:00
|
|
|
#if !GWIN_NEED_TABSET
|
|
|
|
// Wrap tabs onto the next line if they don't fit.
|
|
|
|
static void settabtext(GWidgetInit *pwi, char *txt) {
|
|
|
|
if (pwi->g.x >= ScrWidth) {
|
|
|
|
pwi->g.x = 0;
|
|
|
|
pwi->g.y += pwi->g.height;
|
|
|
|
}
|
|
|
|
pwi->text = txt;
|
|
|
|
pwi->g.width = gdispGetStringWidth(pwi->text, font) + BUTTON_PADDING;
|
|
|
|
if (pwi->g.x + pwi->g.width > ScrWidth) {
|
|
|
|
pwi->g.x = 0;
|
|
|
|
pwi->g.y += pwi->g.height;
|
|
|
|
}
|
2014-05-11 10:12:16 +00:00
|
|
|
}
|
2015-01-03 08:46:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the visibility of widgets based on which tab is selected.
|
|
|
|
*/
|
|
|
|
static void setTab(GHandle tab) {
|
|
|
|
/* Make sure everything is invisible first */
|
|
|
|
gwinHide(ghPgButtons);
|
|
|
|
gwinHide(ghPgSliders);
|
|
|
|
gwinHide(ghPgCheckboxes);
|
|
|
|
gwinHide(ghPgLabels);
|
|
|
|
gwinHide(ghPgRadios);
|
|
|
|
gwinHide(ghPgLists);
|
|
|
|
gwinHide(ghPgImages);
|
|
|
|
gwinHide(ghPgProgressbars);
|
|
|
|
|
|
|
|
/* Turn on widgets depending on the tab selected */
|
|
|
|
if (tab == ghTabButtons)
|
|
|
|
gwinShow(ghPgButtons);
|
|
|
|
else if (tab == ghTabSliders)
|
|
|
|
gwinShow(ghPgSliders);
|
|
|
|
else if (tab == ghTabCheckboxes)
|
|
|
|
gwinShow(ghPgCheckboxes);
|
|
|
|
else if (tab == ghTabLabels)
|
|
|
|
gwinShow(ghPgLabels);
|
|
|
|
else if (tab == ghTabRadios)
|
|
|
|
gwinShow(ghPgRadios);
|
|
|
|
else if (tab == ghTabLists)
|
|
|
|
gwinShow(ghPgLists);
|
|
|
|
else if (tab == ghTabImages)
|
|
|
|
gwinShow(ghPgImages);
|
|
|
|
else if (tab == ghTabProgressbar)
|
|
|
|
gwinShow(ghPgProgressbars);
|
2014-05-11 10:12:16 +00:00
|
|
|
}
|
2015-01-03 08:46:46 +00:00
|
|
|
#endif
|
2014-05-11 10:12:16 +00:00
|
|
|
|
2015-01-03 08:46:46 +00:00
|
|
|
// Wrap buttons onto the next line if they don't fit.
|
2014-05-11 23:25:37 +00:00
|
|
|
static void setbtntext(GWidgetInit *pwi, coord_t maxwidth, char *txt) {
|
|
|
|
if (pwi->g.x >= maxwidth) {
|
|
|
|
pwi->g.x = 5;
|
|
|
|
pwi->g.y += pwi->g.height+1;
|
|
|
|
}
|
|
|
|
pwi->text = txt;
|
|
|
|
pwi->g.width = gdispGetStringWidth(pwi->text, font) + BUTTON_PADDING;
|
|
|
|
if (pwi->g.x + pwi->g.width > maxwidth) {
|
|
|
|
pwi->g.x = 5;
|
|
|
|
pwi->g.y += pwi->g.height+1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-07 09:43:34 +00:00
|
|
|
/**
|
|
|
|
* Create all the widgets.
|
2014-05-11 23:25:37 +00:00
|
|
|
* With the exception of the Pages they are all initially visible.
|
|
|
|
*
|
|
|
|
* This routine is complicated by the fact that we want a dynamic
|
|
|
|
* layout so it looks good on small and large displays.
|
|
|
|
* It is tested to work on 320x272 as a minimum LCD size.
|
2013-07-07 09:43:34 +00:00
|
|
|
*/
|
|
|
|
static void createWidgets(void) {
|
|
|
|
GWidgetInit wi;
|
2015-01-03 08:46:46 +00:00
|
|
|
coord_t border, pagewidth;
|
2013-07-07 09:43:34 +00:00
|
|
|
|
2014-05-09 11:25:31 +00:00
|
|
|
gwinWidgetClearInit(&wi);
|
2013-07-07 09:43:34 +00:00
|
|
|
|
2014-05-11 23:25:37 +00:00
|
|
|
// Calculate page borders based on screen size
|
|
|
|
border = ScrWidth < 450 ? 1 : 5;
|
|
|
|
|
2015-01-03 08:46:46 +00:00
|
|
|
// Create the Tabs
|
|
|
|
#if GWIN_NEED_TABSET
|
|
|
|
wi.g.show = TRUE;
|
|
|
|
wi.g.x = border; wi.g.y = 0;
|
|
|
|
wi.g.width = ScrWidth - 2*border; wi.g.height = ScrHeight-wi.g.y-border;
|
|
|
|
ghTabset = gwinTabsetCreate(0, &wi, GWIN_TABSET_BORDER);
|
|
|
|
ghPgButtons = gwinTabsetAddTab(ghTabset, "Buttons", FALSE);
|
|
|
|
ghPgSliders = gwinTabsetAddTab(ghTabset, "Sliders", FALSE);
|
|
|
|
ghPgCheckboxes = gwinTabsetAddTab(ghTabset, "Checkbox", FALSE);
|
|
|
|
ghPgRadios = gwinTabsetAddTab(ghTabset, "Radios", FALSE);
|
|
|
|
ghPgLists = gwinTabsetAddTab(ghTabset, "Lists", FALSE);
|
|
|
|
ghPgLabels = gwinTabsetAddTab(ghTabset, "Labels", FALSE);
|
|
|
|
ghPgImages = gwinTabsetAddTab(ghTabset, "Images", FALSE);
|
|
|
|
ghPgProgressbars = gwinTabsetAddTab(ghTabset, "Progressbar", FALSE);
|
|
|
|
|
|
|
|
pagewidth = gwinGetInnerWidth(ghTabset)/2;
|
|
|
|
|
|
|
|
// Console - we apply some special colors before making it visible
|
|
|
|
// We put the console on the tabset itself rather than a tab-page.
|
|
|
|
// This makes it appear on every page :)
|
|
|
|
wi.g.parent = ghTabset;
|
|
|
|
wi.g.x = pagewidth;
|
|
|
|
wi.g.width = pagewidth;
|
|
|
|
ghConsole = gwinConsoleCreate(0, &wi.g);
|
|
|
|
gwinSetColor(ghConsole, Black);
|
|
|
|
gwinSetBgColor(ghConsole, HTML2COLOR(0xF0F0F0));
|
|
|
|
|
|
|
|
#else
|
|
|
|
wi.g.show = TRUE; wi.customDraw = gwinRadioDraw_Tab;
|
|
|
|
wi.g.height = TAB_HEIGHT; wi.g.y = 0;
|
|
|
|
wi.g.x = 0; setbtntext(&wi, ScrWidth, "Buttons");
|
|
|
|
ghTabButtons = gwinRadioCreate(0, &wi, GROUP_TABS);
|
|
|
|
wi.g.x += wi.g.width; settabtext(&wi, "Sliders");
|
|
|
|
ghTabSliders = gwinRadioCreate(0, &wi, GROUP_TABS);
|
|
|
|
wi.g.x += wi.g.width; settabtext(&wi, "Checkbox");
|
|
|
|
ghTabCheckboxes = gwinRadioCreate(0, &wi, GROUP_TABS);
|
|
|
|
wi.g.x += wi.g.width; settabtext(&wi, "Radios");
|
|
|
|
ghTabRadios = gwinRadioCreate(0, &wi, GROUP_TABS);
|
|
|
|
wi.g.x += wi.g.width; settabtext(&wi, "Lists");
|
|
|
|
ghTabLists = gwinRadioCreate(0, &wi, GROUP_TABS);
|
|
|
|
wi.g.x += wi.g.width; settabtext(&wi, "Labels");
|
|
|
|
ghTabLabels = gwinRadioCreate(0, &wi, GROUP_TABS);
|
|
|
|
wi.g.x += wi.g.width; settabtext(&wi, "Images");
|
|
|
|
ghTabImages = gwinRadioCreate(0, &wi, GROUP_TABS);
|
|
|
|
wi.g.x += wi.g.width; settabtext(&wi, "Progressbar");
|
|
|
|
ghTabProgressbar = gwinRadioCreate(0, &wi, GROUP_TABS);
|
|
|
|
wi.g.y += wi.g.height;
|
|
|
|
wi.customDraw = 0;
|
|
|
|
|
|
|
|
// Create the Pages
|
|
|
|
wi.g.show = FALSE;
|
|
|
|
wi.g.x = border; wi.g.y += border;
|
|
|
|
wi.g.width = ScrWidth/2 - border; wi.g.height = ScrHeight-wi.g.y-border;
|
|
|
|
ghPgButtons = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER);
|
|
|
|
ghPgSliders = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER);
|
|
|
|
ghPgCheckboxes = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER);
|
|
|
|
ghPgRadios = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER);
|
|
|
|
ghPgLists = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER);
|
|
|
|
ghPgLabels = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER);
|
|
|
|
ghPgImages = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER);
|
|
|
|
ghPgProgressbars = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER);
|
|
|
|
wi.g.show = TRUE;
|
|
|
|
|
|
|
|
// Console - we apply some special colors before making it visible
|
|
|
|
wi.g.x = ScrWidth/2+border;
|
|
|
|
wi.g.width = ScrWidth/2 - 2*border;
|
|
|
|
ghConsole = gwinConsoleCreate(0, &wi.g);
|
|
|
|
gwinSetColor(ghConsole, Black);
|
|
|
|
gwinSetBgColor(ghConsole, HTML2COLOR(0xF0F0F0));
|
|
|
|
|
|
|
|
pagewidth = gwinGetInnerWidth(ghPgButtons);
|
|
|
|
#endif
|
2014-05-11 10:12:16 +00:00
|
|
|
|
|
|
|
// Buttons
|
|
|
|
wi.g.parent = ghPgButtons;
|
2014-05-11 13:11:10 +00:00
|
|
|
wi.g.width = BUTTON_WIDTH; wi.g.height = BUTTON_HEIGHT; wi.g.y = 5;
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.g.x = 5; setbtntext(&wi, pagewidth, "Button 1");
|
2014-04-23 00:58:49 +00:00
|
|
|
ghButton1 = gwinButtonCreate(0, &wi);
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.g.x += wi.g.width+3; setbtntext(&wi, pagewidth, "Button 2");
|
2014-04-23 00:58:49 +00:00
|
|
|
ghButton2 = gwinButtonCreate(0, &wi);
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.g.x += wi.g.width+3; setbtntext(&wi, pagewidth, "Button 3");
|
2014-04-23 00:58:49 +00:00
|
|
|
ghButton3 = gwinButtonCreate(0, &wi);
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.g.x += wi.g.width+3; setbtntext(&wi, pagewidth, "Button 4");
|
2014-04-23 00:58:49 +00:00
|
|
|
ghButton4 = gwinButtonCreate(0, &wi);
|
2013-07-07 09:43:34 +00:00
|
|
|
|
|
|
|
// Horizontal Sliders
|
2014-05-11 10:12:16 +00:00
|
|
|
wi.g.parent = ghPgSliders;
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.g.width = pagewidth - 10; wi.g.height = SLIDER_WIDTH;
|
2014-05-11 13:11:10 +00:00
|
|
|
wi.g.x = 5; wi.g.y = 5; wi.text = "S1";
|
2014-04-23 00:58:49 +00:00
|
|
|
ghSlider1 = gwinSliderCreate(0, &wi);
|
2014-05-11 14:01:50 +00:00
|
|
|
gwinSliderSetPosition(ghSlider1, 33);
|
2014-05-11 10:12:16 +00:00
|
|
|
wi.g.y += wi.g.height + 1; wi.text = "S2";
|
2014-04-23 00:58:49 +00:00
|
|
|
ghSlider2 = gwinSliderCreate(0, &wi);
|
2014-05-11 14:01:50 +00:00
|
|
|
gwinSliderSetPosition(ghSlider2, 86);
|
2013-07-07 09:43:34 +00:00
|
|
|
|
|
|
|
// Vertical Sliders
|
2014-05-11 13:11:10 +00:00
|
|
|
wi.g.y += wi.g.height + 5;
|
|
|
|
wi.g.width = SLIDER_WIDTH; wi.g.height = gwinGetInnerHeight(ghPgSliders) - 5 - wi.g.y;
|
|
|
|
wi.g.x = 5; wi.text = "S3";
|
2014-04-23 00:58:49 +00:00
|
|
|
ghSlider3 = gwinSliderCreate(0, &wi);
|
2014-05-11 14:01:50 +00:00
|
|
|
gwinSliderSetPosition(ghSlider3, 13);
|
2014-05-11 10:12:16 +00:00
|
|
|
wi.g.x += wi.g.width+1; wi.text = "S4";
|
2014-04-23 00:58:49 +00:00
|
|
|
ghSlider4 = gwinSliderCreate(0, &wi);
|
2014-05-11 14:01:50 +00:00
|
|
|
gwinSliderSetPosition(ghSlider4, 76);
|
2013-07-07 09:43:34 +00:00
|
|
|
|
2015-01-23 07:57:13 +00:00
|
|
|
// Checkboxes - for the 2nd and 3rd checkbox we apply special drawing before making it visible
|
2014-05-11 10:12:16 +00:00
|
|
|
wi.g.parent = ghPgCheckboxes;
|
2014-05-11 13:11:10 +00:00
|
|
|
wi.g.width = CHECKBOX_WIDTH; wi.g.height = CHECKBOX_HEIGHT; wi.g.x = 5;
|
|
|
|
wi.g.y = 5; wi.text = "C1";
|
2014-04-23 00:58:49 +00:00
|
|
|
ghCheckbox1 = gwinCheckboxCreate(0, &wi);
|
2013-07-07 09:43:34 +00:00
|
|
|
wi.customDraw = gwinCheckboxDraw_CheckOnRight;
|
2014-05-11 10:12:16 +00:00
|
|
|
wi.g.y += wi.g.height+1; wi.text = "C2";
|
2014-04-23 00:58:49 +00:00
|
|
|
ghCheckbox2 = gwinCheckboxCreate(0, &wi);
|
2015-01-23 07:57:13 +00:00
|
|
|
wi.customDraw = gwinCheckboxDraw_Button;
|
|
|
|
wi.g.y += wi.g.height+1; wi.text = "C3"; wi.g.width = BUTTON_WIDTH; wi.g.height = BUTTON_HEIGHT;
|
|
|
|
ghCheckbox3 = gwinCheckboxCreate(0, &wi);
|
2014-05-11 10:12:16 +00:00
|
|
|
wi.g.y += wi.g.height+1; wi.text = "Disable All";
|
2015-01-23 07:57:13 +00:00
|
|
|
wi.customDraw = 0; wi.g.width = DISABLEALL_WIDTH; wi.g.height = CHECKBOX_HEIGHT;
|
2014-04-23 00:58:49 +00:00
|
|
|
ghCheckDisableAll = gwinCheckboxCreate(0, &wi);
|
2013-07-07 09:43:34 +00:00
|
|
|
|
|
|
|
// Labels
|
2014-05-11 10:12:16 +00:00
|
|
|
wi.g.parent = ghPgLabels;
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.g.width = pagewidth-10; wi.g.height = LABEL_HEIGHT;
|
2014-05-11 23:25:37 +00:00
|
|
|
wi.g.x = wi.g.y = 5; wi.text = "N/A";
|
2015-11-06 23:39:08 +00:00
|
|
|
ghLabelSlider1 = gwinLabelCreate(0, &wi);
|
2014-05-11 13:11:10 +00:00
|
|
|
gwinLabelSetAttribute(ghLabelSlider1, 100, "Slider 1:");
|
|
|
|
wi.g.y += LABEL_HEIGHT + 2;
|
2015-11-06 23:39:08 +00:00
|
|
|
ghLabelSlider2 = gwinLabelCreate(0, &wi);
|
2014-05-11 13:11:10 +00:00
|
|
|
gwinLabelSetAttribute(ghLabelSlider2, 100, "Slider 2:");
|
|
|
|
wi.g.y += LABEL_HEIGHT + 2;
|
2015-11-06 23:39:08 +00:00
|
|
|
ghLabelSlider3 = gwinLabelCreate(0, &wi);
|
2014-05-11 13:11:10 +00:00
|
|
|
gwinLabelSetAttribute(ghLabelSlider3, 100, "Slider 3:");
|
|
|
|
wi.g.y += LABEL_HEIGHT + 2;
|
2015-11-06 23:39:08 +00:00
|
|
|
ghLabelSlider4 = gwinLabelCreate(0, &wi);
|
2014-05-11 13:11:10 +00:00
|
|
|
gwinLabelSetAttribute(ghLabelSlider4, 100, "Slider 4:");
|
|
|
|
wi.g.y += LABEL_HEIGHT + 2;
|
2015-11-06 23:39:08 +00:00
|
|
|
ghLabelRadio1 = gwinLabelCreate(0, &wi);
|
2014-05-11 13:11:10 +00:00
|
|
|
gwinLabelSetAttribute(ghLabelRadio1, 100, "RadioButton 1:");
|
|
|
|
|
2013-07-07 09:43:34 +00:00
|
|
|
|
|
|
|
// Radio Buttons
|
2014-05-11 10:12:16 +00:00
|
|
|
wi.g.parent = ghPgRadios;
|
2014-05-11 13:11:10 +00:00
|
|
|
wi.g.width = RADIO_WIDTH; wi.g.height = RADIO_HEIGHT; wi.g.y = 5;
|
|
|
|
wi.g.x = 5; wi.text = "Yes";
|
2014-04-23 00:58:49 +00:00
|
|
|
ghRadio1 = gwinRadioCreate(0, &wi, GROUP_YESNO);
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.g.x += wi.g.width; wi.text = "No"; if (wi.g.x + wi.g.width > pagewidth) { wi.g.x = 5; wi.g.y += RADIO_HEIGHT; }
|
2014-04-23 00:58:49 +00:00
|
|
|
ghRadio2 = gwinRadioCreate(0, &wi, GROUP_YESNO);
|
2014-05-11 13:11:10 +00:00
|
|
|
gwinRadioPress(ghRadio1);
|
2013-07-07 09:43:34 +00:00
|
|
|
wi.g.width = COLOR_WIDTH; wi.g.y += RADIO_HEIGHT+5;
|
2014-05-11 13:11:10 +00:00
|
|
|
wi.g.x = 5; wi.text = "Black";
|
2014-04-23 00:58:49 +00:00
|
|
|
ghRadioBlack = gwinRadioCreate(0, &wi, GROUP_COLORS);
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.g.x += wi.g.width; wi.text = "White"; if (wi.g.x + wi.g.width > pagewidth) { wi.g.x = 5; wi.g.y += RADIO_HEIGHT; }
|
2014-04-23 00:58:49 +00:00
|
|
|
ghRadioWhite = gwinRadioCreate(0, &wi, GROUP_COLORS);
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.g.x += wi.g.width; wi.text = "Yellow"; if (wi.g.x + wi.g.width > pagewidth) { wi.g.x = 5; wi.g.y += RADIO_HEIGHT; }
|
2014-04-23 00:58:49 +00:00
|
|
|
ghRadioYellow = gwinRadioCreate(0, &wi, GROUP_COLORS);
|
2013-07-07 09:43:34 +00:00
|
|
|
gwinRadioPress(ghRadioWhite);
|
|
|
|
|
2013-08-01 04:50:40 +00:00
|
|
|
// Lists
|
2015-01-03 08:46:46 +00:00
|
|
|
border = pagewidth < 10+2*LIST_WIDTH ? 2 : 5;
|
2014-05-11 10:12:16 +00:00
|
|
|
wi.g.parent = ghPgLists;
|
2014-05-11 23:25:37 +00:00
|
|
|
wi.g.width = LIST_WIDTH; wi.g.height = LIST_HEIGHT; wi.g.y = border;
|
|
|
|
wi.g.x = border; wi.text = "L1";
|
2014-04-23 00:58:49 +00:00
|
|
|
ghList1 = gwinListCreate(0, &wi, FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 0", FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 1", FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 2", FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 3", FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 4", FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 5", FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 6", FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 7", FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 8", FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 9", FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 10", FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 11", FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 12", FALSE);
|
|
|
|
gwinListAddItem(ghList1, "Item 13", FALSE);
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.text = "L2"; wi.g.x += LIST_WIDTH+border; if (wi.g.x + LIST_WIDTH > pagewidth) { wi.g.x = border; wi.g.y += LIST_HEIGHT+border; }
|
2014-04-23 00:58:49 +00:00
|
|
|
ghList2 = gwinListCreate(0, &wi, TRUE);
|
|
|
|
gwinListAddItem(ghList2, "Item 0", FALSE);
|
|
|
|
gwinListAddItem(ghList2, "Item 1", FALSE);
|
|
|
|
gwinListAddItem(ghList2, "Item 2", FALSE);
|
|
|
|
gwinListAddItem(ghList2, "Item 3", FALSE);
|
|
|
|
gwinListAddItem(ghList2, "Item 4", FALSE);
|
|
|
|
gwinListAddItem(ghList2, "Item 5", FALSE);
|
|
|
|
gwinListAddItem(ghList2, "Item 6", FALSE);
|
|
|
|
gwinListAddItem(ghList2, "Item 7", FALSE);
|
|
|
|
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);
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.text = "L3"; wi.g.x += LIST_WIDTH+border; if (wi.g.x + LIST_WIDTH > pagewidth) { wi.g.x = border; wi.g.y += LIST_HEIGHT+border; }
|
2014-04-23 00:58:49 +00:00
|
|
|
ghList3 = gwinListCreate(0, &wi, TRUE);
|
|
|
|
gwinListAddItem(ghList3, "Item 0", FALSE);
|
|
|
|
gwinListAddItem(ghList3, "Item 1", FALSE);
|
|
|
|
gwinListAddItem(ghList3, "Item 2", FALSE);
|
|
|
|
gwinListAddItem(ghList3, "Item 3", FALSE);
|
2014-02-07 08:44:32 +00:00
|
|
|
gdispImageOpenFile(&imgYesNo, "image_yesno.gif");
|
2013-08-01 08:05:48 +00:00
|
|
|
gwinListItemSetImage(ghList3, 1, &imgYesNo);
|
|
|
|
gwinListItemSetImage(ghList3, 3, &imgYesNo);
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.text = "L4"; wi.g.x += LIST_WIDTH+border; if (wi.g.x + LIST_WIDTH > pagewidth) { wi.g.x = border; wi.g.y += LIST_HEIGHT+border; }
|
2014-04-23 01:03:36 +00:00
|
|
|
ghList4 = gwinListCreate(0, &wi, TRUE);
|
|
|
|
gwinListAddItem(ghList4, "Item 0", FALSE);
|
|
|
|
gwinListAddItem(ghList4, "Item 1", FALSE);
|
|
|
|
gwinListAddItem(ghList4, "Item 2", FALSE);
|
|
|
|
gwinListAddItem(ghList4, "Item 3", FALSE);
|
|
|
|
gwinListAddItem(ghList4, "Item 4", FALSE);
|
|
|
|
gwinListAddItem(ghList4, "Item 5", FALSE);
|
|
|
|
gwinListAddItem(ghList4, "Item 6", FALSE);
|
|
|
|
gwinListAddItem(ghList4, "Item 7", FALSE);
|
|
|
|
gwinListAddItem(ghList4, "Item 8", FALSE);
|
|
|
|
gwinListAddItem(ghList4, "Item 9", FALSE);
|
|
|
|
gwinListAddItem(ghList4, "Item 10", FALSE);
|
|
|
|
gwinListAddItem(ghList4, "Item 11", FALSE);
|
|
|
|
gwinListAddItem(ghList4, "Item 12", FALSE);
|
|
|
|
gwinListAddItem(ghList4, "Item 13", FALSE);
|
|
|
|
gwinListSetScroll(ghList4, scrollSmooth);
|
2013-08-01 04:50:40 +00:00
|
|
|
|
2013-07-07 10:10:00 +00:00
|
|
|
// Image
|
2014-05-11 10:12:16 +00:00
|
|
|
wi.g.parent = ghPgImages;
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.g.x = wi.g.y = 0; wi.g.width = pagewidth; wi.g.height = gwinGetInnerHeight(ghPgImages);
|
2013-12-21 03:21:59 +00:00
|
|
|
ghImage1 = gwinImageCreate(0, &wi.g);
|
2014-05-01 06:42:35 +00:00
|
|
|
gwinImageOpenFile(ghImage1, "romfs_img_ugfx.gif");
|
2013-07-07 10:10:00 +00:00
|
|
|
|
2014-04-23 21:06:28 +00:00
|
|
|
// Progressbar
|
2014-05-11 10:12:16 +00:00
|
|
|
wi.g.parent = ghPgProgressbars;
|
2015-01-03 08:46:46 +00:00
|
|
|
wi.g.width = pagewidth-10; wi.g.height = SLIDER_WIDTH; wi.g.y = 5;
|
2014-05-11 13:11:10 +00:00
|
|
|
wi.g.x = 5; wi.text = "Progressbar 1";
|
2014-04-23 21:06:28 +00:00
|
|
|
ghProgressbar1 = gwinProgressbarCreate(0, &wi);
|
|
|
|
gwinProgressbarSetResolution(ghProgressbar1, 10);
|
2013-07-07 09:43:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-01-03 08:46:46 +00:00
|
|
|
* Set the value of the labels
|
2013-07-07 09:43:34 +00:00
|
|
|
*/
|
2015-01-03 08:46:46 +00:00
|
|
|
static void setLabels(void) {
|
|
|
|
char tmp[20];
|
|
|
|
|
|
|
|
// The sliders
|
|
|
|
snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider1));
|
|
|
|
gwinSetText(ghLabelSlider1, tmp, TRUE);
|
|
|
|
snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider2));
|
|
|
|
gwinSetText(ghLabelSlider2, tmp, TRUE);
|
|
|
|
snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider3));
|
|
|
|
gwinSetText(ghLabelSlider3, tmp, TRUE);
|
|
|
|
snprintg(tmp, sizeof(tmp), "%d%%", gwinSliderGetPosition(ghSlider4));
|
|
|
|
gwinSetText(ghLabelSlider4, tmp, TRUE);
|
|
|
|
|
|
|
|
// The radio buttons
|
|
|
|
if (gwinRadioIsPressed(ghRadio1))
|
|
|
|
gwinSetText(ghLabelRadio1, "Yes", TRUE);
|
|
|
|
else if (gwinRadioIsPressed(ghRadio2))
|
|
|
|
gwinSetText(ghLabelRadio1, "No", TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Control the progress bar auto-increment
|
|
|
|
*/
|
|
|
|
static void setProgressbar(bool_t onoff) {
|
|
|
|
if (onoff)
|
2014-04-23 21:41:50 +00:00
|
|
|
gwinProgressbarStart(ghProgressbar1, 500);
|
2015-01-03 08:46:46 +00:00
|
|
|
else {
|
|
|
|
gwinProgressbarStop(ghProgressbar1); // Stop the progress bar
|
|
|
|
gwinProgressbarReset(ghProgressbar1);
|
2013-07-07 09:43:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the enabled state of every widget (except the tabs etc)
|
|
|
|
*/
|
|
|
|
static void setEnabled(bool_t ena) {
|
2014-05-11 10:12:16 +00:00
|
|
|
gwinSetEnabled(ghPgButtons, ena);
|
|
|
|
gwinSetEnabled(ghPgSliders, ena);
|
|
|
|
gwinSetEnabled(ghPgLabels, ena);
|
|
|
|
gwinSetEnabled(ghPgRadios, ena);
|
|
|
|
gwinSetEnabled(ghPgLists, ena);
|
|
|
|
gwinSetEnabled(ghPgImages, ena);
|
|
|
|
gwinSetEnabled(ghPgProgressbars, ena);
|
|
|
|
// Checkboxes we need to do individually so we don't disable the checkbox to re-enable everything
|
2014-04-23 00:58:49 +00:00
|
|
|
gwinSetEnabled(ghCheckbox1, ena);
|
|
|
|
gwinSetEnabled(ghCheckbox2, ena);
|
2015-01-23 07:57:13 +00:00
|
|
|
gwinSetEnabled(ghCheckbox3, ena);
|
2014-04-23 00:58:49 +00:00
|
|
|
//gwinSetEnabled(ghCheckDisableAll, TRUE);
|
2013-07-05 15:46:34 +00:00
|
|
|
}
|
2013-06-06 04:33:32 +00:00
|
|
|
|
2015-01-25 07:40:34 +00:00
|
|
|
static void FlashOffFn(void *param) {
|
|
|
|
(void) param;
|
|
|
|
|
|
|
|
gwinNoFlash(ghCheckbox3);
|
|
|
|
}
|
|
|
|
|
2013-06-06 04:33:32 +00:00
|
|
|
int main(void) {
|
|
|
|
GEvent * pe;
|
|
|
|
|
|
|
|
// Initialize the display
|
|
|
|
gfxInit();
|
|
|
|
|
2014-05-01 06:42:35 +00:00
|
|
|
// Set the widget defaults
|
2014-05-11 10:12:16 +00:00
|
|
|
font = gdispOpenFont("*"); // Get the first defined font.
|
|
|
|
gwinSetDefaultFont(font);
|
2014-05-01 06:42:35 +00:00
|
|
|
gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE);
|
|
|
|
gdispClear(White);
|
|
|
|
|
2013-06-24 12:58:37 +00:00
|
|
|
// Create the gwin windows/widgets
|
2013-07-07 09:43:34 +00:00
|
|
|
createWidgets();
|
2013-06-06 04:33:32 +00:00
|
|
|
|
2013-07-07 09:43:34 +00:00
|
|
|
// Assign toggles and dials to specific buttons & sliders etc.
|
2013-06-10 07:18:01 +00:00
|
|
|
#if GINPUT_NEED_TOGGLE
|
|
|
|
gwinAttachToggle(ghButton1, 0, 0);
|
|
|
|
gwinAttachToggle(ghButton2, 0, 1);
|
|
|
|
#endif
|
|
|
|
#if GINPUT_NEED_DIAL
|
|
|
|
gwinAttachDial(ghSlider1, 0, 0);
|
|
|
|
gwinAttachDial(ghSlider3, 0, 1);
|
|
|
|
#endif
|
2013-06-06 04:33:32 +00:00
|
|
|
|
2013-07-05 15:46:34 +00:00
|
|
|
// Make the console visible
|
2014-05-11 11:59:48 +00:00
|
|
|
gwinShow(ghConsole);
|
2013-07-05 15:46:34 +00:00
|
|
|
gwinClear(ghConsole);
|
2013-07-03 14:22:15 +00:00
|
|
|
|
2013-07-07 09:43:34 +00:00
|
|
|
// We want to listen for widget events
|
|
|
|
geventListenerInit(&gl);
|
|
|
|
gwinAttachListener(&gl);
|
2015-01-25 07:40:34 +00:00
|
|
|
gtimerInit(&FlashTimer);
|
2013-07-07 09:43:34 +00:00
|
|
|
|
2015-01-03 08:46:46 +00:00
|
|
|
#if !GWIN_NEED_TABSET
|
|
|
|
// Press the Tab we want visible
|
|
|
|
gwinRadioPress(ghTabButtons);
|
|
|
|
#endif
|
2013-07-03 14:22:15 +00:00
|
|
|
|
2013-06-06 04:33:32 +00:00
|
|
|
while(1) {
|
|
|
|
// Get an Event
|
|
|
|
pe = geventEventWait(&gl, TIME_INFINITE);
|
|
|
|
|
|
|
|
switch(pe->type) {
|
|
|
|
case GEVENT_GWIN_BUTTON:
|
2014-08-20 02:18:27 +00:00
|
|
|
gwinPrintf(ghConsole, "Button %s\n", gwinGetText(((GEventGWinButton *)pe)->gwin));
|
2013-06-06 04:33:32 +00:00
|
|
|
break;
|
2013-07-07 09:43:34 +00:00
|
|
|
|
2013-06-06 04:33:32 +00:00
|
|
|
case GEVENT_GWIN_SLIDER:
|
2014-08-20 02:18:27 +00:00
|
|
|
gwinPrintf(ghConsole, "Slider %s=%d\n", gwinGetText(((GEventGWinSlider *)pe)->gwin), ((GEventGWinSlider *)pe)->position);
|
2013-06-06 04:33:32 +00:00
|
|
|
break;
|
2013-07-07 09:43:34 +00:00
|
|
|
|
2013-06-06 04:33:32 +00:00
|
|
|
case GEVENT_GWIN_CHECKBOX:
|
2014-08-20 02:18:27 +00:00
|
|
|
gwinPrintf(ghConsole, "Checkbox %s=%s\n", gwinGetText(((GEventGWinCheckbox *)pe)->gwin), ((GEventGWinCheckbox *)pe)->isChecked ? "Checked" : "UnChecked");
|
2013-07-07 09:43:34 +00:00
|
|
|
|
|
|
|
// If it is the Disable All checkbox then do that.
|
2014-08-20 02:18:27 +00:00
|
|
|
if (((GEventGWinCheckbox *)pe)->gwin == ghCheckDisableAll) {
|
2013-07-07 09:43:34 +00:00
|
|
|
gwinPrintf(ghConsole, "%s All\n", ((GEventGWinCheckbox *)pe)->isChecked ? "Disable" : "Enable");
|
|
|
|
setEnabled(!((GEventGWinCheckbox *)pe)->isChecked);
|
2015-01-25 07:40:34 +00:00
|
|
|
|
|
|
|
// If it is the toggle button checkbox start the flash.
|
|
|
|
} else if (((GEventGWinCheckbox *)pe)->gwin == ghCheckbox3) {
|
|
|
|
gwinFlash(ghCheckbox3);
|
|
|
|
gtimerStart(&FlashTimer, FlashOffFn, 0, FALSE, 3000);
|
2013-07-07 09:43:34 +00:00
|
|
|
}
|
2013-06-06 04:33:32 +00:00
|
|
|
break;
|
2013-07-07 09:43:34 +00:00
|
|
|
|
2013-08-01 04:50:40 +00:00
|
|
|
case GEVENT_GWIN_LIST:
|
2014-08-20 02:18:27 +00:00
|
|
|
gwinPrintf(ghConsole, "List %s Item %d %s\n", gwinGetText(((GEventGWinList *)pe)->gwin), ((GEventGWinList *)pe)->item,
|
|
|
|
gwinListItemIsSelected(((GEventGWinList *)pe)->gwin, ((GEventGWinList *)pe)->item) ? "Selected" : "Unselected");
|
2013-08-01 04:50:40 +00:00
|
|
|
break;
|
|
|
|
|
2013-07-05 15:46:34 +00:00
|
|
|
case GEVENT_GWIN_RADIO:
|
2014-08-20 02:18:27 +00:00
|
|
|
gwinPrintf(ghConsole, "Radio Group %u=%s\n", ((GEventGWinRadio *)pe)->group, gwinGetText(((GEventGWinRadio *)pe)->gwin));
|
2013-07-05 15:46:34 +00:00
|
|
|
|
2013-07-07 09:43:34 +00:00
|
|
|
switch(((GEventGWinRadio *)pe)->group) {
|
2015-01-03 08:46:46 +00:00
|
|
|
#if !GWIN_NEED_TABSET
|
|
|
|
case GROUP_TABS:
|
2013-07-05 15:46:34 +00:00
|
|
|
|
2015-01-03 08:46:46 +00:00
|
|
|
// Set control visibility depending on the tab selected
|
|
|
|
setTab(((GEventGWinRadio *)pe)->gwin);
|
2013-07-07 09:43:34 +00:00
|
|
|
|
2015-01-03 08:46:46 +00:00
|
|
|
// We show the state of some of the GUI elements here
|
|
|
|
setProgressbar(((GEventGWinRadio *)pe)->gwin == ghTabProgressbar);
|
|
|
|
if (((GEventGWinRadio *)pe)->gwin == ghTabLabels)
|
|
|
|
setLabels();
|
|
|
|
break;
|
|
|
|
#endif
|
2013-07-07 09:43:34 +00:00
|
|
|
|
|
|
|
case GROUP_COLORS:
|
|
|
|
{
|
|
|
|
const GWidgetStyle *pstyle;
|
|
|
|
|
|
|
|
gwinPrintf(ghConsole, "Change Color Scheme\n");
|
|
|
|
|
2014-08-20 02:18:27 +00:00
|
|
|
if (((GEventGWinRadio *)pe)->gwin == ghRadioYellow)
|
2013-07-07 09:43:34 +00:00
|
|
|
pstyle = &YellowWidgetStyle;
|
2014-08-20 02:18:27 +00:00
|
|
|
else if (((GEventGWinRadio *)pe)->gwin == ghRadioBlack)
|
2013-07-07 09:43:34 +00:00
|
|
|
pstyle = &BlackWidgetStyle;
|
|
|
|
else
|
|
|
|
pstyle = &WhiteWidgetStyle;
|
|
|
|
|
2014-05-11 23:25:37 +00:00
|
|
|
// Clear the screen to the new color
|
2014-05-11 10:12:16 +00:00
|
|
|
gdispClear(pstyle->background);
|
2013-07-07 09:43:34 +00:00
|
|
|
|
|
|
|
// Update the style on all controls
|
|
|
|
gwinSetDefaultStyle(pstyle, TRUE);
|
|
|
|
}
|
|
|
|
break;
|
2013-07-05 15:46:34 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-07-07 09:43:34 +00:00
|
|
|
|
2015-01-03 08:46:46 +00:00
|
|
|
#if GWIN_NEED_TABSET
|
|
|
|
case GEVENT_GWIN_TABSET:
|
|
|
|
gwinPrintf(ghConsole, "TabPage %u (%s)\n", ((GEventGWinTabset *)pe)->nPage, gwinTabsetGetTitle(((GEventGWinTabset *)pe)->ghPage));
|
|
|
|
|
|
|
|
// We show the state of some of the GUI elements here
|
|
|
|
setProgressbar(((GEventGWinTabset *)pe)->ghPage == ghPgProgressbars);
|
|
|
|
if (((GEventGWinTabset *)pe)->ghPage == ghPgLabels)
|
|
|
|
setLabels();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2013-06-06 04:33:32 +00:00
|
|
|
default:
|
|
|
|
gwinPrintf(ghConsole, "Unknown %d\n", pe->type);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2013-10-27 23:42:38 +00:00
|
|
|
|