diff --git a/src/gwin/gwin_button.c b/src/gwin/gwin_button.c index 6e25ab6c..c96d3cdd 100644 --- a/src/gwin/gwin_button.c +++ b/src/gwin/gwin_button.c @@ -23,9 +23,6 @@ #define BTN_TOP_FADE 50 // (BTN_TOP_FADE/255)% fade to white for top of button #define BTN_BOTTOM_FADE 25 // (BTN_BOTTOM_FADE/255)% fade to black for bottom of button -// Our pressed state -#define GBUTTON_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0) - #if GINPUT_NEED_MOUSE // A mouse down has occurred over the button static void ButtonMouseDown(GWidgetObject *gw, coord_t x, coord_t y) { diff --git a/src/gwin/gwin_button.h b/src/gwin/gwin_button.h index dcbab682..0e46330b 100644 --- a/src/gwin/gwin_button.h +++ b/src/gwin/gwin_button.h @@ -39,6 +39,14 @@ */ typedef GEventGWin GEventGWinButton; +/** + * @brief The internal button flags + * @note Used only for writing a custom draw routine. + * @{ + */ +#define GBUTTON_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0) +/** @} */ + /** * @brief The button widget structure * @note Do not use the members directly - treat it as a black-box. diff --git a/src/gwin/gwin_checkbox.c b/src/gwin/gwin_checkbox.c index 43d74f23..436a0806 100644 --- a/src/gwin/gwin_checkbox.c +++ b/src/gwin/gwin_checkbox.c @@ -20,9 +20,6 @@ #define CHK_TOP_FADE 50 // (CHK_TOP_FADE/255)% fade to white for top of button #define CHK_BOTTOM_FADE 25 // (CHK_BOTTOM_FADE/255)% fade to black for bottom of button -// Our checked state -#define GCHECKBOX_FLG_CHECKED (GWIN_FIRST_CONTROL_FLAG<<0) - // Send the checkbox event static void SendCheckboxEvent(GWidgetObject *gw) { GSourceListener * psl; diff --git a/src/gwin/gwin_checkbox.h b/src/gwin/gwin_checkbox.h index 10401624..48807239 100644 --- a/src/gwin/gwin_checkbox.h +++ b/src/gwin/gwin_checkbox.h @@ -45,6 +45,14 @@ typedef struct GEventGWinCheckbox { bool_t isChecked; // Is the checkbox currently checked or unchecked? } GEventGWinCheckbox; +/** + * @brief The internal checkbox flags + * @note Used only for writing a custom draw routine. + * @{ + */ +#define GCHECKBOX_FLG_CHECKED (GWIN_FIRST_CONTROL_FLAG<<0) +/** @} */ + /* A Checkbox window */ typedef struct GCheckboxObject { GWidgetObject w; diff --git a/src/gwin/gwin_frame.c b/src/gwin/gwin_frame.c index a9abbb9b..9aed4c06 100644 --- a/src/gwin/gwin_frame.c +++ b/src/gwin/gwin_frame.c @@ -29,10 +29,7 @@ /* Internal state flags */ #define GWIN_FRAME_USER_FLAGS (GWIN_FRAME_CLOSE_BTN|GWIN_FRAME_MINMAX_BTN|GWIN_FRAME_KEEPONCLOSE) -#define GWIN_FRAME_CLOSE_PRESSED (GWIN_FRAME_KEEPONCLOSE << 1) -#define GWIN_FRAME_MIN_PRESSED (GWIN_FRAME_KEEPONCLOSE << 2) -#define GWIN_FRAME_MAX_PRESSED (GWIN_FRAME_KEEPONCLOSE << 3) -#define GWIN_FRAME_REDRAW_FRAME (GWIN_FRAME_KEEPONCLOSE << 4) // Only redraw the frame + #if GWIN_FRAME_CLOSE_BTN < GWIN_FIRST_CONTROL_FLAG #error "GWIN Frame: - Flag definitions don't match" #endif diff --git a/src/gwin/gwin_frame.h b/src/gwin/gwin_frame.h index 45c97b53..f39d3df6 100644 --- a/src/gwin/gwin_frame.h +++ b/src/gwin/gwin_frame.h @@ -37,6 +37,17 @@ #define GWIN_FRAME_KEEPONCLOSE 0x00000004 /**< Don't automatically destroy the frame on close */ /** @} */ +/** + * @brief The internal frame flags + * @note Used only for writing a custom draw routine. + * @{ + */ +#define GWIN_FRAME_CLOSE_PRESSED 0x00000008 +#define GWIN_FRAME_MIN_PRESSED 0x00000010 +#define GWIN_FRAME_MAX_PRESSED 0x00000020 +#define GWIN_FRAME_REDRAW_FRAME 0x00000040 // Only redraw the frame +/** @} */ + typedef GContainerObject GFrameObject; #ifdef __cplusplus diff --git a/src/gwin/gwin_keyboard.c b/src/gwin/gwin_keyboard.c index 075ef4c8..f3dd6fb0 100644 --- a/src/gwin/gwin_keyboard.c +++ b/src/gwin/gwin_keyboard.c @@ -17,12 +17,6 @@ #include "gwin_class.h" #include "gwin_keyboard_layout.h" - -#define GKEYBOARD_FLG_REVERTSET (GWIN_FIRST_CONTROL_FLAG<<0) -#define GKEYBOARD_FLG_QUICKUPDATE (GWIN_FIRST_CONTROL_FLAG<<1) - -#define GKEY_BAD_ROWCOL 255 - typedef uint8_t utf8; typedef uint16_t utf16; typedef uint32_t utf32; diff --git a/src/gwin/gwin_keyboard.h b/src/gwin/gwin_keyboard.h index 1d792d7a..43f6cf76 100644 --- a/src/gwin/gwin_keyboard.h +++ b/src/gwin/gwin_keyboard.h @@ -39,6 +39,16 @@ */ typedef GEventGWin GEventGWinKeyboard; +/** + * @brief The internal keyboard flags and other defines + * @note Used only for writing a custom draw routine. + * @{ + */ +#define GKEYBOARD_FLG_REVERTSET (GWIN_FIRST_CONTROL_FLAG<<0) +#define GKEYBOARD_FLG_QUICKUPDATE (GWIN_FIRST_CONTROL_FLAG<<1) +#define GKEY_BAD_ROWCOL 255 +/** @} */ + /** * @brief The keyboard widget structure * @note Do not use the members directly - treat it as a black-box. diff --git a/src/gwin/gwin_label.c b/src/gwin/gwin_label.c index e6b4e986..e6e31eec 100644 --- a/src/gwin/gwin_label.c +++ b/src/gwin/gwin_label.c @@ -20,11 +20,6 @@ #define gh2obj ((GLabelObject *)gh) #define gw2obj ((GLabelObject *)gw) -// flags for the GLabelObject -#define GLABEL_FLG_WAUTO (GWIN_FIRST_CONTROL_FLAG << 0) -#define GLABEL_FLG_HAUTO (GWIN_FIRST_CONTROL_FLAG << 1) -#define GLABEL_FLG_BORDER (GWIN_FIRST_CONTROL_FLAG << 2) - // simple: single line with no wrapping static coord_t getwidth(const char *text, font_t font, coord_t maxwidth) { (void) maxwidth; diff --git a/src/gwin/gwin_label.h b/src/gwin/gwin_label.h index c08eb85d..b0e30af5 100644 --- a/src/gwin/gwin_label.h +++ b/src/gwin/gwin_label.h @@ -33,6 +33,16 @@ // This file is included within "src/gwin/gwin_widget.h" +/** + * @brief The internal label flags + * @note Used only for writing a custom draw routine. + * @{ + */ +#define GLABEL_FLG_WAUTO (GWIN_FIRST_CONTROL_FLAG << 0) +#define GLABEL_FLG_HAUTO (GWIN_FIRST_CONTROL_FLAG << 1) +#define GLABEL_FLG_BORDER (GWIN_FIRST_CONTROL_FLAG << 2) +/** @} */ + // An label window typedef struct GLabelObject { GWidgetObject w; diff --git a/src/gwin/gwin_list.c b/src/gwin/gwin_list.c index 4bb9c283..f0bd7362 100644 --- a/src/gwin/gwin_list.c +++ b/src/gwin/gwin_list.c @@ -31,27 +31,6 @@ #define qix2li ((ListItem *)qix) #define ple ((GEventGWinList *)pe) -// Flags for the GListObject -#define GLIST_FLG_MULTISELECT (GWIN_FIRST_CONTROL_FLAG << 0) -#define GLIST_FLG_HASIMAGES (GWIN_FIRST_CONTROL_FLAG << 1) -#define GLIST_FLG_SCROLLALWAYS (GWIN_FIRST_CONTROL_FLAG << 2) -#define GLIST_FLG_SCROLLSMOOTH (GWIN_FIRST_CONTROL_FLAG << 3) -#define GLIST_FLG_ENABLERENDER (GWIN_FIRST_CONTROL_FLAG << 4) - -// Flags on a ListItem. -#define GLIST_FLG_SELECTED 0x0001 - -typedef struct ListItem { - gfxQueueASyncItem q_item; // This must be the first member in the struct - - uint16_t flags; - uint16_t param; // A parameter the user can specify himself - const char* text; - #if GWIN_NEED_LIST_IMAGES - gdispImage* pimg; - #endif -} ListItem; - static void sendListEvent(GWidgetObject *gw, int item) { GSourceListener* psl; GEvent* pe; diff --git a/src/gwin/gwin_list.h b/src/gwin/gwin_list.h index 2ab06960..a60ded9d 100644 --- a/src/gwin/gwin_list.h +++ b/src/gwin/gwin_list.h @@ -76,6 +76,35 @@ typedef struct GListObject { */ typedef enum scroll_t { scrollAlways, scrollAuto, scrollSmooth } scroll_t; +/** + * @brief The internal list object flags + * @note Used only for writing a custom draw routine. + * @{ + */ +#define GLIST_FLG_MULTISELECT (GWIN_FIRST_CONTROL_FLAG << 0) +#define GLIST_FLG_HASIMAGES (GWIN_FIRST_CONTROL_FLAG << 1) +#define GLIST_FLG_SCROLLALWAYS (GWIN_FIRST_CONTROL_FLAG << 2) +#define GLIST_FLG_SCROLLSMOOTH (GWIN_FIRST_CONTROL_FLAG << 3) +#define GLIST_FLG_ENABLERENDER (GWIN_FIRST_CONTROL_FLAG << 4) +/** @} */ + +/** + * @brief The internal list item structure + * @note Used only for writing a custom draw routine. + */ +typedef struct ListItem { + gfxQueueASyncItem q_item; // This must be the first member in the struct + + uint16_t flags; + #define GLIST_FLG_SELECTED 0x0001 + uint16_t param; // A parameter the user can specify himself + const char* text; + #if GWIN_NEED_LIST_IMAGES + gdispImage* pimg; + #endif +} ListItem; + + #ifdef __cplusplus extern "C" { #endif diff --git a/src/gwin/gwin_radio.c b/src/gwin/gwin_radio.c index 9b9f589b..6d9bd60e 100644 --- a/src/gwin/gwin_radio.c +++ b/src/gwin/gwin_radio.c @@ -21,9 +21,6 @@ #define GRADIO_BOTTOM_FADE 25 // (GRADIO_BOTTOM_FADE/255)% fade to black for bottom of tab/button #define GRADIO_OUTLINE_FADE 128 // (GRADIO_OUTLINE_FADE/255)% fade to background for active tab edge -// Our pressed state -#define GRADIO_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0) - // Send the button event static void SendRadioEvent(GWidgetObject *gw) { GSourceListener * psl; diff --git a/src/gwin/gwin_radio.h b/src/gwin/gwin_radio.h index 17d64d8b..e0897725 100644 --- a/src/gwin/gwin_radio.h +++ b/src/gwin/gwin_radio.h @@ -45,6 +45,14 @@ typedef struct GEventGWinRadio { uint16_t group; // The group for this radio button } GEventGWinRadio; +/** + * @brief The internal radio button object flags + * @note Used only for writing a custom draw routine. + * @{ + */ +#define GRADIO_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0) +/** @} */ + /** * @brief The radio button widget structure * @note Do not use the members directly - treat it as a black-box. diff --git a/src/gwin/gwin_slider.c b/src/gwin/gwin_slider.c index 86d3cdd9..d2e671b1 100644 --- a/src/gwin/gwin_slider.c +++ b/src/gwin/gwin_slider.c @@ -16,8 +16,6 @@ #include "gwin_class.h" -#define GSLIDER_FLG_EXTENDED_EVENTS (GWIN_FIRST_CONTROL_FLAG<<0) - // Calculate the slider position from the display position static int SliderCalcPosFromDPos(GSliderObject *gsw) { int halfbit; diff --git a/src/gwin/gwin_slider.h b/src/gwin/gwin_slider.h index d42aa67b..358027de 100644 --- a/src/gwin/gwin_slider.h +++ b/src/gwin/gwin_slider.h @@ -45,6 +45,14 @@ typedef struct GEventGWinSlider { // There are currently no GEventGWinSlider listening flags - use 0 +/** + * @brief The internal slider object flags + * @note Used only for writing a custom draw routine. + * @{ + */ +#define GSLIDER_FLG_EXTENDED_EVENTS (GWIN_FIRST_CONTROL_FLAG<<0) +/** @} */ + // A slider window typedef struct GSliderObject { GWidgetObject w;