GUIslice  0.16.0
Embedded GUI in C
XTogglebtn.c File Reference
#include "GUIslice.h"
#include "GUIslice_drv.h"
#include "XTogglebtn.h"
#include <stdio.h>
Include dependency graph for XTogglebtn.c:

Functions

gslc_tsElemRefgslc_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. More...
 
bool gslc_ElemXTogglebtnGetState (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
 Get a Togglebtn element's current state. More...
 
void gslc_ElemXTogglebtnSetStateHelp (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bOn)
 
void gslc_ElemXTogglebtnSetState (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bOn)
 Set a Togglebtn element's current state. More...
 
void gslc_ElemXTogglebtnToggleState (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
 Toggle a Togglebtn element's current state. More...
 
void gslc_ElemXTogglebtnDrawCircularHelp (gslc_tsGui *pGui, gslc_tsElem *pElem, gslc_tsXTogglebtn *pTogglebtn)
 
void gslc_ElemXTogglebtnDrawRectangularHelp (gslc_tsGui *pGui, gslc_tsElem *pElem, gslc_tsXTogglebtn *pTogglebtn)
 
bool gslc_ElemXTogglebtnDraw (void *pvGui, void *pvElemRef, gslc_teRedrawType eRedraw)
 Draw a Togglebtn element on the screen. More...
 
bool gslc_ElemXTogglebtnTouch (void *pvGui, void *pvElemRef, gslc_teTouch eTouch, int16_t nRelX, int16_t nRelY)
 Handle touch events to Togglebtn element. More...
 
gslc_tsElemRefgslc_ElemXTogglebtnFindSelected (gslc_tsGui *pGui, int16_t nGroupId)
 Find the togglebtn within a group that has been selected. More...
 

Variables

const char GSLC_PMEM ERRSTR_NULL []
 
const char GSLC_PMEM ERRSTR_PXD_NULL []
 

Function Documentation

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.

Parameters
[in]pGuiPointer to GUI
[in]nElemIdElement ID to assign (0..16383 or GSLC_ID_AUTO to autogen)
[in]nPagePage ID to attach element to
[in]pXDataPtr to extended element data structure
[in]rElemRectangle coordinates defining togglebtn size
[in]colThumbColor of thumb
[in]colOnStateColor to indicate on position
[in]colOffStateColor to indicate off position
[in]bCircularStyle of the toggle button circular or rectangular
[in]bCheckedDefault state
[in]cbTouchCallback for touch events
Returns
Pointer to Element reference or NULL if failure
bool gslc_ElemXTogglebtnDraw ( void *  pvGui,
void *  pvElemRef,
gslc_teRedrawType  eRedraw 
)

Draw a Togglebtn element on the screen.

Parameters
[in]pvGuiVoid ptr to GUI (typecast to gslc_tsGui*)
[in]pvElemRefVoid ptr to Element reference (typecast to gslc_tsElemRef*)
[in]eRedrawRedraw mode
Returns
true if success, false otherwise
void gslc_ElemXTogglebtnDrawCircularHelp ( gslc_tsGui pGui,
gslc_tsElem pElem,
gslc_tsXTogglebtn pTogglebtn 
)
void gslc_ElemXTogglebtnDrawRectangularHelp ( gslc_tsGui pGui,
gslc_tsElem pElem,
gslc_tsXTogglebtn pTogglebtn 
)
gslc_tsElemRef* gslc_ElemXTogglebtnFindSelected ( gslc_tsGui pGui,
int16_t  nGroupId 
)

Find the togglebtn within a group that has been selected.

Parameters
[in]pGuiPointer to GUI
[in]nGroupIdGroup ID to search
Returns
Element Ptr or NULL if none selected
bool gslc_ElemXTogglebtnGetState ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef 
)

Get a Togglebtn element's current state.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
Returns
Current state
void gslc_ElemXTogglebtnSetState ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
bool  bOn 
)

Set a Togglebtn element's current state.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]bOnNew state
Returns
none
void gslc_ElemXTogglebtnSetStateHelp ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
bool  bOn 
)
void gslc_ElemXTogglebtnToggleState ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef 
)

Toggle a Togglebtn element's current state.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
Returns
none
bool gslc_ElemXTogglebtnTouch ( void *  pvGui,
void *  pvElemRef,
gslc_teTouch  eTouch,
int16_t  nRelX,
int16_t  nRelY 
)

Handle touch events to Togglebtn element.

Parameters
[in]pvGuiVoid ptr to GUI (typecast to gslc_tsGui*)
[in]pvElemRefVoid ptr to Element reference (typecast to gslc_tsElemRef*)
[in]eTouchTouch event type
[in]nRelXTouch X coord relative to element
[in]nRelYTouch Y coord relative to element
Returns
true if success, false otherwise

Variable Documentation

const char GSLC_PMEM ERRSTR_NULL[]
const char GSLC_PMEM ERRSTR_PXD_NULL[]