Browse Source

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

remotes/origin_old/ugfx_release_2.6
inmarket 7 years ago
parent
commit
addbf47bdb
  1. 3
      src/gwin/gwin_button.c
  2. 8
      src/gwin/gwin_button.h
  3. 3
      src/gwin/gwin_checkbox.c
  4. 8
      src/gwin/gwin_checkbox.h
  5. 5
      src/gwin/gwin_frame.c
  6. 11
      src/gwin/gwin_frame.h
  7. 6
      src/gwin/gwin_keyboard.c
  8. 10
      src/gwin/gwin_keyboard.h
  9. 5
      src/gwin/gwin_label.c
  10. 10
      src/gwin/gwin_label.h
  11. 21
      src/gwin/gwin_list.c
  12. 29
      src/gwin/gwin_list.h
  13. 3
      src/gwin/gwin_radio.c
  14. 8
      src/gwin/gwin_radio.h
  15. 2
      src/gwin/gwin_slider.c
  16. 8
      src/gwin/gwin_slider.h

3
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) {

8
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.

3
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;

8
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;

5
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

11
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

6
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;

10
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.

5
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;

10
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;

21
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;

29
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

3
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;

8
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.

2
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;

8
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;

Loading…
Cancel
Save