1 #ifndef _GUISLICE_EX_XCHECKBOX_H_ 2 #define _GUISLICE_EX_XCHECKBOX_H_ 49 #define GSLC_TYPEX_CHECKBOX GSLC_TYPE_BASE_EXTEND + 1 61 typedef bool (*
GSLC_CB_XCHECKBOX)(
void* pvGui,
void* pvElemRef,int16_t nSelId,
bool bChecked);
94 gslc_teXCheckboxStyle nStyle,
gslc_tsColor colCheck,
bool bChecked);
206 #if (GSLC_USE_PROGMEM) 208 #define gslc_ElemXCheckboxCreate_P(pGui,nElemId,nPage,nX,nY,nW,nH,colFill,bFillEn,nGroup,bRadio_,nStyle_,colCheck_,bChecked_) \ 209 static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \ 210 GSLC_ELEM_FEA_GLOW_EN | GSLC_ELEM_FEA_CLICK_EN | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0); \ 211 static gslc_tsXCheckbox sCheckbox##nElemId; \ 212 sCheckbox##nElemId.bRadio = bRadio_; \ 213 sCheckbox##nElemId.bChecked = bChecked_; \ 214 sCheckbox##nElemId.colCheck = colCheck_; \ 215 sCheckbox##nElemId.nStyle = nStyle_; \ 216 static const gslc_tsElem sElem##nElemId PROGMEM = { \ 218 nFeatures##nElemId, \ 219 GSLC_TYPEX_CHECKBOX, \ 220 (gslc_tsRect){nX,nY,nW,nH}, \ 222 GSLC_COL_GRAY,colFill,GSLC_COL_WHITE,GSLC_COL_BLACK, \ 223 (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \ 224 (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \ 228 (gslc_teTxtFlags)(GSLC_TXT_DEFAULT), \ 231 GSLC_ALIGN_MID_MID, \ 235 (void*)(&sCheckbox##nElemId), \ 237 &gslc_ElemXCheckboxDraw, \ 238 &gslc_ElemXCheckboxTouch, \ 241 gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \ 242 (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_PROG | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL)); 247 #define gslc_ElemXCheckboxCreate_P(pGui,nElemId,nPage,nX,nY,nW,nH,colFill,bFillEn,nGroup,bRadio_,nStyle_,colCheck_,bChecked_) \ 248 static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \ 249 GSLC_ELEM_FEA_GLOW_EN | GSLC_ELEM_FEA_CLICK_EN | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0); \ 250 static gslc_tsXCheckbox sCheckbox##nElemId; \ 251 sCheckbox##nElemId.bRadio = bRadio_; \ 252 sCheckbox##nElemId.bChecked = bChecked_; \ 253 sCheckbox##nElemId.colCheck = colCheck_; \ 254 sCheckbox##nElemId.nStyle = nStyle_; \ 255 static const gslc_tsElem sElem##nElemId = { \ 257 nFeatures##nElemId, \ 258 GSLC_TYPEX_CHECKBOX, \ 259 (gslc_tsRect){nX,nY,nW,nH}, \ 261 GSLC_COL_GRAY,colFill,GSLC_COL_WHITE,GSLC_COL_BLACK, \ 262 (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \ 263 (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \ 267 (gslc_teTxtFlags)(GSLC_TXT_DEFAULT), \ 270 GSLC_ALIGN_MID_MID, \ 274 (void*)(&sCheckbox##nElemId), \ 276 &gslc_ElemXCheckboxDraw, \ 277 &gslc_ElemXCheckboxTouch, \ 280 gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \ 281 (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_CONST | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL)); 288 #endif // __cplusplus 289 #endif // _GUISLICE_EX_XCHECKBOX_H_ void gslc_ElemXCheckboxToggleState(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Toggle a Checkbox element's current state.
Definition: XCheckbox.c:358
bool gslc_ElemXCheckboxDraw(void *pvGui, void *pvElemRef, gslc_teRedrawType eRedraw)
Draw a Checkbox element on the screen.
Definition: XCheckbox.c:378
gslc_teRedrawType
Redraw types.
Definition: GUIslice.h:370
GSLC_CB_XCHECKBOX pfuncXToggle
Callback event to say element has changed.
Definition: XCheckbox.h:73
Extended data for Checkbox element.
Definition: XCheckbox.h:68
Crossed.
Definition: XCheckbox.h:54
gslc_teXCheckboxStyle nStyle
Drawing style for element.
Definition: XCheckbox.h:70
gslc_tsColor colCheck
Color of checked inner fill.
Definition: XCheckbox.h:72
bool bChecked
Indicates if it is selected (checked)
Definition: XCheckbox.h:71
bool gslc_ElemXCheckboxGetState(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Get a Checkbox element's current state.
Definition: XCheckbox.c:130
Rectangular region. Defines X,Y corner coordinates plus dimensions.
Definition: GUIslice.h:519
gslc_tsElemRef * gslc_ElemXCheckboxFindChecked(gslc_tsGui *pGui, int16_t nGroupId)
Find the checkbox within a group that has been checked.
Definition: XCheckbox.c:140
bool(* GSLC_CB_XCHECKBOX)(void *pvGui, void *pvElemRef, int16_t nSelId, bool bChecked)
Callback function for checkbox/radio element state change.
Definition: XCheckbox.h:61
Inner box.
Definition: XCheckbox.h:53
Element reference structure.
Definition: GUIslice.h:578
bool gslc_ElemXCheckboxTouch(void *pvGui, void *pvElemRef, gslc_teTouch eTouch, int16_t nRelX, int16_t nRelY)
Handle touch events to Checkbox element.
Definition: XCheckbox.c:455
gslc_teXCheckboxStyle
Checkbox drawing style.
Definition: XCheckbox.h:52
bool bRadio
Radio-button operation if true.
Definition: XCheckbox.h:69
void gslc_ElemXCheckboxSetStateFunc(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, GSLC_CB_XCHECKBOX pfuncCb)
Assign the state callback function for a checkbox/radio button.
Definition: XCheckbox.c:192
gslc_teTouch
Processed event from input raw events and actions.
Definition: GUIslice.h:305
GUI structure.
Definition: GUIslice.h:716
void gslc_ElemXCheckboxSetState(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bChecked)
Set a Checkbox element's current state.
Definition: XCheckbox.c:270
Color structure. Defines RGB triplet.
Definition: GUIslice.h:534
Circular.
Definition: XCheckbox.h:55
gslc_tsElemRef * gslc_ElemXCheckboxCreate(gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsXCheckbox *pXData, gslc_tsRect rElem, bool bRadio, gslc_teXCheckboxStyle nStyle, gslc_tsColor colCheck, bool bChecked)
Create a Checkbox or Radio button Element.
Definition: XCheckbox.c:78