1 #ifndef _GUISLICE_EX_XTOGGLEBTN_H_ 2 #define _GUISLICE_EX_XTOGGLEBTN_H_ 54 #define GSLC_TYPEX_TOGGLEBTN GSLC_TYPE_BASE_EXTEND + 40 193 #if (GSLC_USE_PROGMEM) 195 #define gslc_ElemXTogglebtnCreate_P(pGui,nElemId,nPage,nX,nY,nW,nH,colThumb_,colOnState_,colOffState_,bCircular_,bChecked_,cbTouch) \ 196 static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \ 197 GSLC_ELEM_FEA_GLOW_EN | GSLC_ELEM_FEA_CLICK_EN | GSLC_ELEM_FEA_FILL_EN; \ 198 static gslc_tsXTogglebtn sTogglebtn##nElemId; \ 199 sTogglebtn##nElemId.bOn = bChecked_; \ 200 sTogglebtn##nElemId.nMyPageId = nPage; \ 201 sTogglebtn##nElemId.colThumb = colThumb_; \ 202 sTogglebtn##nElemId.colOnState = colOnState_; \ 203 sTogglebtn##nElemId.colOffState = colOffState_; \ 204 sTogglebtn##nElemId.bCircular = bCircular_; \ 205 sTogglebtn##nElemId.pfunctUser = cbTouch; \ 206 static const gslc_tsElem sElem##nElemId PROGMEM = { \ 208 nFeatures##nElemId, \ 209 GSLC_TYPEX_TOGGLEBTN, \ 210 (gslc_tsRect){nX,nY,nW,nH}, \ 212 GSLC_COL_GRAY,GSLC_COL_BLACK,GSLC_COL_WHITE,GSLC_COL_BLACK, \ 213 (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \ 214 (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \ 218 (gslc_teTxtFlags)(GSLC_TXT_DEFAULT), \ 221 GSLC_ALIGN_MID_MID, \ 225 (void*)(&sTogglebtn##nElemId), \ 227 &gslc_ElemXTogglebtnDraw, \ 228 &gslc_ElemXTogglebtnTouch, \ 231 gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \ 232 (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_PROG | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL)); 237 #define gslc_ElemXTogglebtnCreate_P(pGui,nElemId,nPage,nX,nY,nW,nH,colThumb_,colOnState_,colOffState_,bCircular_,bChecked_,cbTouch) \ 238 static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \ 239 GSLC_ELEM_FEA_GLOW_EN | GSLC_ELEM_FEA_CLICK_EN | GSLC_ELEM_FEA_FILL_EN; \ 240 static gslc_tsXTogglebtn sTogglebtn##nElemId; \ 241 sTogglebtn##nElemId.bOn = bChecked_; \ 242 sTogglebtn##nElemId.nMyPageId = nPage; \ 243 sTogglebtn##nElemId.colThumb = colThumb_; \ 244 sTogglebtn##nElemId.colOnState = colOnState_; \ 245 sTogglebtn##nElemId.colOffState = colOffState_; \ 246 sTogglebtn##nElemId.bCircular = bCircular_; \ 247 sTogglebtn##nElemId.pfunctUser = cbTouch; \ 248 static const gslc_tsElem sElem##nElemId = { \ 250 nFeatures##nElemId, \ 251 GSLC_TYPEX_TOGGLEBTN, \ 252 (gslc_tsRect){nX,nY,nW,nH}, \ 254 GSLC_COL_GRAY,GSLC_COL_BLACK,GSLC_COL_WHITE,GSLC_COL_BLACK, \ 255 (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \ 256 (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \ 260 (gslc_teTxtFlags)(GSLC_TXT_DEFAULT), \ 263 GSLC_ALIGN_MID_MID, \ 267 (void*)(&sTogglebtn##nElemId), \ 269 &gslc_ElemXTogglebtnDraw, \ 270 &gslc_ElemXTogglebtnTouch, \ 273 gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \ 274 (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_PROG | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL)); 281 #endif // __cplusplus 282 #endif // _GUISLICE_EX_XTOGGLEBTN_H_ bool gslc_ElemXTogglebtnDraw(void *pvGui, void *pvElemRef, gslc_teRedrawType eRedraw)
Draw a Togglebtn element on the screen.
Definition: XTogglebtn.c:332
bool bOn
Indicates if button is ON or OFF.
Definition: XTogglebtn.h:62
gslc_tsElemRef * gslc_ElemXTogglebtnFindSelected(gslc_tsGui *pGui, int16_t nGroupId)
Find the togglebtn within a group that has been selected.
Definition: XTogglebtn.c:411
gslc_tsElemRef * gslc_ElemXTogglebtnCreate(gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsXTogglebtn *pXData, gslc_tsRect rElem, gslc_tsColor colThumb, gslc_tsColor colOnState, gslc_tsColor colOffState, bool bCircular, bool bChecked, GSLC_CB_TOUCH cbTouch)
Create a Togglebtn button Element.
Definition: XTogglebtn.c:79
gslc_tsColor colOffState
Color of button in OFF state.
Definition: XTogglebtn.h:67
gslc_teRedrawType
Redraw types.
Definition: GUIslice.h:370
GSLC_CB_TOUCH pfunctUser
User's Callback event to say element has changed.
Definition: XTogglebtn.h:69
Extended data for Togglebtn element.
Definition: XTogglebtn.h:61
Rectangular region. Defines X,Y corner coordinates plus dimensions.
Definition: GUIslice.h:519
bool gslc_ElemXTogglebtnTouch(void *pvGui, void *pvElemRef, gslc_teTouch eTouch, int16_t nRelX, int16_t nRelY)
Handle touch events to Togglebtn element.
Definition: XTogglebtn.c:371
bool(* GSLC_CB_TOUCH)(void *pvGui, void *pvElemRef, gslc_teTouch eTouch, int16_t nX, int16_t nY)
Callback function for element touch tracking.
Definition: GUIslice.h:502
int16_t nMyPageId
We need to track our page in case of grouping elements on a non current layer, like base layer...
Definition: XTogglebtn.h:63
Element reference structure.
Definition: GUIslice.h:578
bool bCircular
Style of the toggle button circular or rectangular.
Definition: XTogglebtn.h:68
void gslc_ElemXTogglebtnSetState(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bOn)
Set a Togglebtn element's current state.
Definition: XTogglebtn.c:162
gslc_teTouch
Processed event from input raw events and actions.
Definition: GUIslice.h:305
bool gslc_ElemXTogglebtnGetState(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Get a Togglebtn element's current state.
Definition: XTogglebtn.c:132
void gslc_ElemXTogglebtnToggleState(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Toggle a Togglebtn element's current state.
Definition: XTogglebtn.c:241
gslc_tsColor colOnState
Color of button in ON state.
Definition: XTogglebtn.h:66
GUI structure.
Definition: GUIslice.h:716
Color structure. Defines RGB triplet.
Definition: GUIslice.h:534