Browse Source

Move GWIN widget internal flags into the public header so that all the state flags are available for custom draw routines.

inmarket 4 years ago
parent
commit
addbf47bdb

+ 0 - 3
src/gwin/gwin_button.c

@@ -23,9 +23,6 @@
23 23
 #define BTN_TOP_FADE			50		// (BTN_TOP_FADE/255)% fade to white for top of button
24 24
 #define BTN_BOTTOM_FADE			25		// (BTN_BOTTOM_FADE/255)% fade to black for bottom of button
25 25
 
26
-// Our pressed state
27
-#define GBUTTON_FLG_PRESSED		(GWIN_FIRST_CONTROL_FLAG<<0)
28
-
29 26
 #if GINPUT_NEED_MOUSE
30 27
 	// A mouse down has occurred over the button
31 28
 	static void ButtonMouseDown(GWidgetObject *gw, coord_t x, coord_t y) {

+ 8 - 0
src/gwin/gwin_button.h

@@ -39,6 +39,14 @@
39 39
  */
40 40
 typedef GEventGWin		GEventGWinButton;
41 41
 
42
+/**
43
+ * @brief	The internal button flags
44
+ * @note	Used only for writing a custom draw routine.
45
+ * @{
46
+ */
47
+#define GBUTTON_FLG_PRESSED		(GWIN_FIRST_CONTROL_FLAG<<0)
48
+/** @} */
49
+
42 50
 /**
43 51
  * @brief	The button widget structure
44 52
  * @note	Do not use the members directly - treat it as a black-box.

+ 0 - 3
src/gwin/gwin_checkbox.c

@@ -20,9 +20,6 @@
20 20
 #define CHK_TOP_FADE			50		// (CHK_TOP_FADE/255)% fade to white for top of button
21 21
 #define CHK_BOTTOM_FADE			25		// (CHK_BOTTOM_FADE/255)% fade to black for bottom of button
22 22
 
23
-// Our checked state
24
-#define GCHECKBOX_FLG_CHECKED		(GWIN_FIRST_CONTROL_FLAG<<0)
25
-
26 23
 // Send the checkbox event
27 24
 static void SendCheckboxEvent(GWidgetObject *gw) {
28 25
 	GSourceListener	*	psl;

+ 8 - 0
src/gwin/gwin_checkbox.h

@@ -45,6 +45,14 @@ typedef struct GEventGWinCheckbox {
45 45
 	bool_t			isChecked;		// Is the checkbox currently checked or unchecked?
46 46
 } GEventGWinCheckbox;
47 47
 
48
+/**
49
+ * @brief	The internal checkbox flags
50
+ * @note	Used only for writing a custom draw routine.
51
+ * @{
52
+ */
53
+#define GCHECKBOX_FLG_CHECKED		(GWIN_FIRST_CONTROL_FLAG<<0)
54
+/** @} */
55
+
48 56
 /* A Checkbox window */
49 57
 typedef struct GCheckboxObject {
50 58
 	GWidgetObject			w;

+ 1 - 4
src/gwin/gwin_frame.c

@@ -29,10 +29,7 @@
29 29
 
30 30
 /* Internal state flags */
31 31
 #define GWIN_FRAME_USER_FLAGS		(GWIN_FRAME_CLOSE_BTN|GWIN_FRAME_MINMAX_BTN|GWIN_FRAME_KEEPONCLOSE)
32
-#define GWIN_FRAME_CLOSE_PRESSED	(GWIN_FRAME_KEEPONCLOSE << 1)
33
-#define GWIN_FRAME_MIN_PRESSED		(GWIN_FRAME_KEEPONCLOSE << 2)
34
-#define GWIN_FRAME_MAX_PRESSED		(GWIN_FRAME_KEEPONCLOSE << 3)
35
-#define GWIN_FRAME_REDRAW_FRAME		(GWIN_FRAME_KEEPONCLOSE << 4)		// Only redraw the frame
32
+
36 33
 #if GWIN_FRAME_CLOSE_BTN < GWIN_FIRST_CONTROL_FLAG
37 34
 	#error "GWIN Frame: - Flag definitions don't match"
38 35
 #endif

+ 11 - 0
src/gwin/gwin_frame.h

@@ -37,6 +37,17 @@
37 37
 #define GWIN_FRAME_KEEPONCLOSE		0x00000004		/**< Don't automatically destroy the frame on close */
38 38
 /** @} */
39 39
 
40
+/**
41
+ * @brief	The internal frame flags
42
+ * @note	Used only for writing a custom draw routine.
43
+ * @{
44
+ */
45
+#define GWIN_FRAME_CLOSE_PRESSED	0x00000008
46
+#define GWIN_FRAME_MIN_PRESSED		0x00000010
47
+#define GWIN_FRAME_MAX_PRESSED		0x00000020
48
+#define GWIN_FRAME_REDRAW_FRAME		0x00000040		// Only redraw the frame
49
+/** @} */
50
+
40 51
 typedef GContainerObject GFrameObject;
41 52
 
42 53
 #ifdef __cplusplus

+ 0 - 6
src/gwin/gwin_keyboard.c

@@ -17,12 +17,6 @@
17 17
 #include "gwin_class.h"
18 18
 #include "gwin_keyboard_layout.h"
19 19
 
20
-
21
-#define GKEYBOARD_FLG_REVERTSET		(GWIN_FIRST_CONTROL_FLAG<<0)
22
-#define GKEYBOARD_FLG_QUICKUPDATE	(GWIN_FIRST_CONTROL_FLAG<<1)
23
-
24
-#define GKEY_BAD_ROWCOL		255
25
-
26 20
 typedef uint8_t		utf8;
27 21
 typedef uint16_t	utf16;
28 22
 typedef uint32_t	utf32;

+ 10 - 0
src/gwin/gwin_keyboard.h

@@ -39,6 +39,16 @@
39 39
  */
40 40
 typedef GEventGWin		GEventGWinKeyboard;
41 41
 
42
+/**
43
+ * @brief	The internal keyboard flags and other defines
44
+ * @note	Used only for writing a custom draw routine.
45
+ * @{
46
+ */
47
+#define GKEYBOARD_FLG_REVERTSET		(GWIN_FIRST_CONTROL_FLAG<<0)
48
+#define GKEYBOARD_FLG_QUICKUPDATE	(GWIN_FIRST_CONTROL_FLAG<<1)
49
+#define GKEY_BAD_ROWCOL				255
50
+/** @} */
51
+
42 52
 /**
43 53
  * @brief	The keyboard widget structure
44 54
  * @note	Do not use the members directly - treat it as a black-box.

+ 0 - 5
src/gwin/gwin_label.c

@@ -20,11 +20,6 @@
20 20
 #define gh2obj					((GLabelObject *)gh)
21 21
 #define gw2obj					((GLabelObject *)gw)
22 22
 
23
-// flags for the GLabelObject
24
-#define GLABEL_FLG_WAUTO		(GWIN_FIRST_CONTROL_FLAG << 0)
25
-#define GLABEL_FLG_HAUTO		(GWIN_FIRST_CONTROL_FLAG << 1)
26
-#define GLABEL_FLG_BORDER		(GWIN_FIRST_CONTROL_FLAG << 2)
27
-
28 23
 // simple: single line with no wrapping
29 24
 static coord_t getwidth(const char *text, font_t font, coord_t maxwidth) {
30 25
 	(void) maxwidth;

+ 10 - 0
src/gwin/gwin_label.h

@@ -33,6 +33,16 @@
33 33
 
34 34
 // This file is included within "src/gwin/gwin_widget.h"
35 35
 
36
+/**
37
+ * @brief	The internal label flags
38
+ * @note	Used only for writing a custom draw routine.
39
+ * @{
40
+ */
41
+#define GLABEL_FLG_WAUTO		(GWIN_FIRST_CONTROL_FLAG << 0)
42
+#define GLABEL_FLG_HAUTO		(GWIN_FIRST_CONTROL_FLAG << 1)
43
+#define GLABEL_FLG_BORDER		(GWIN_FIRST_CONTROL_FLAG << 2)
44
+/** @} */
45
+
36 46
 // An label window
37 47
 typedef struct GLabelObject {
38 48
 	GWidgetObject	w;

+ 0 - 21
src/gwin/gwin_list.c

@@ -31,27 +31,6 @@
31 31
 #define qix2li		((ListItem *)qix)
32 32
 #define ple			((GEventGWinList *)pe)
33 33
 
34
-// Flags for the GListObject
35
-#define GLIST_FLG_MULTISELECT		(GWIN_FIRST_CONTROL_FLAG << 0)
36
-#define GLIST_FLG_HASIMAGES			(GWIN_FIRST_CONTROL_FLAG << 1)
37
-#define GLIST_FLG_SCROLLALWAYS		(GWIN_FIRST_CONTROL_FLAG << 2)
38
-#define GLIST_FLG_SCROLLSMOOTH      (GWIN_FIRST_CONTROL_FLAG << 3)
39
-#define GLIST_FLG_ENABLERENDER      (GWIN_FIRST_CONTROL_FLAG << 4)
40
-
41
-// Flags on a ListItem.
42
-#define GLIST_FLG_SELECTED			0x0001
43
-
44
-typedef struct ListItem {
45
-	gfxQueueASyncItem	q_item;		// This must be the first member in the struct
46
-
47
-	uint16_t			flags;
48
-	uint16_t			param;		// A parameter the user can specify himself
49
-	const char*			text;
50
-	#if GWIN_NEED_LIST_IMAGES
51
-		gdispImage*		pimg;
52
-	#endif
53
-} ListItem;
54
-
55 34
 static void sendListEvent(GWidgetObject *gw, int item) {
56 35
 	GSourceListener*	psl;
57 36
 	GEvent*				pe;

+ 29 - 0
src/gwin/gwin_list.h

@@ -76,6 +76,35 @@ typedef struct GListObject {
76 76
  */
77 77
 typedef enum scroll_t { scrollAlways, scrollAuto, scrollSmooth } scroll_t;
78 78
 
79
+/**
80
+ * @brief	The internal list object flags
81
+ * @note	Used only for writing a custom draw routine.
82
+ * @{
83
+ */
84
+#define GLIST_FLG_MULTISELECT		(GWIN_FIRST_CONTROL_FLAG << 0)
85
+#define GLIST_FLG_HASIMAGES			(GWIN_FIRST_CONTROL_FLAG << 1)
86
+#define GLIST_FLG_SCROLLALWAYS		(GWIN_FIRST_CONTROL_FLAG << 2)
87
+#define GLIST_FLG_SCROLLSMOOTH      (GWIN_FIRST_CONTROL_FLAG << 3)
88
+#define GLIST_FLG_ENABLERENDER      (GWIN_FIRST_CONTROL_FLAG << 4)
89
+/** @} */
90
+
91
+/**
92
+ * @brief	The internal list item structure
93
+ * @note	Used only for writing a custom draw routine.
94
+ */
95
+typedef struct ListItem {
96
+	gfxQueueASyncItem	q_item;		// This must be the first member in the struct
97
+
98
+	uint16_t			flags;
99
+		#define GLIST_FLG_SELECTED			0x0001
100
+	uint16_t			param;		// A parameter the user can specify himself
101
+	const char*			text;
102
+	#if GWIN_NEED_LIST_IMAGES
103
+		gdispImage*		pimg;
104
+	#endif
105
+} ListItem;
106
+
107
+
79 108
 #ifdef __cplusplus
80 109
 extern "C" {
81 110
 #endif

+ 0 - 3
src/gwin/gwin_radio.c

@@ -21,9 +21,6 @@
21 21
 #define GRADIO_BOTTOM_FADE		25		// (GRADIO_BOTTOM_FADE/255)% fade to black for bottom of tab/button
22 22
 #define GRADIO_OUTLINE_FADE		128		// (GRADIO_OUTLINE_FADE/255)% fade to background for active tab edge
23 23
 
24
-// Our pressed state
25
-#define GRADIO_FLG_PRESSED		(GWIN_FIRST_CONTROL_FLAG<<0)
26
-
27 24
 // Send the button event
28 25
 static void SendRadioEvent(GWidgetObject *gw) {
29 26
 	GSourceListener	*	psl;

+ 8 - 0
src/gwin/gwin_radio.h

@@ -45,6 +45,14 @@ typedef struct GEventGWinRadio {
45 45
 	uint16_t		group;				// The group for this radio button
46 46
 } GEventGWinRadio;
47 47
 
48
+/**
49
+ * @brief	The internal radio button object flags
50
+ * @note	Used only for writing a custom draw routine.
51
+ * @{
52
+ */
53
+#define GRADIO_FLG_PRESSED		(GWIN_FIRST_CONTROL_FLAG<<0)
54
+/** @} */
55
+
48 56
 /**
49 57
  * @brief	The radio button widget structure
50 58
  * @note	Do not use the members directly - treat it as a black-box.

+ 0 - 2
src/gwin/gwin_slider.c

@@ -16,8 +16,6 @@
16 16
 
17 17
 #include "gwin_class.h"
18 18
 
19
-#define GSLIDER_FLG_EXTENDED_EVENTS		(GWIN_FIRST_CONTROL_FLAG<<0)
20
-
21 19
 // Calculate the slider position from the display position
22 20
 static int SliderCalcPosFromDPos(GSliderObject *gsw) {
23 21
 	int		halfbit;

+ 8 - 0
src/gwin/gwin_slider.h

@@ -45,6 +45,14 @@ typedef struct GEventGWinSlider {
45 45
 
46 46
 // There are currently no GEventGWinSlider listening flags - use 0
47 47
 
48
+/**
49
+ * @brief	The internal slider object flags
50
+ * @note	Used only for writing a custom draw routine.
51
+ * @{
52
+ */
53
+#define GSLIDER_FLG_EXTENDED_EVENTS		(GWIN_FIRST_CONTROL_FLAG<<0)
54
+/** @} */
55
+
48 56
 // A slider window
49 57
 typedef struct GSliderObject {
50 58
 	GWidgetObject		w;