GUIslice  0.16.0
Embedded GUI in C
XKeyPad_Num.h File Reference
#include "GUIslice.h"
#include "elem/XKeyPad.h"
Include dependency graph for XKeyPad_Num.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gslc_tsXKeyPadCfg_Num
 

Functions

gslc_tsElemRefgslc_ElemXKeyPadCreate_Num (gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsXKeyPad *pXData, int16_t nX0, int16_t nY0, int8_t nFontId, gslc_tsXKeyPadCfg_Num *pConfig)
 Create a KeyPad Element. More...
 
gslc_tsXKeyPadCfg_Num gslc_ElemXKeyPadCfgInit_Num ()
 Initialize the KeyPad config structure. More...
 
void gslc_ElemXKeyPadReset_Num (void *pvConfig)
 Callback function to reset internal state. More...
 
void gslc_ElemXKeyPadTxtInit_Num (void *pvKeyPad)
 Callback function to update internal state whenever the text field is manually set via gslc_ElemXKeyPadValSet(). More...
 
void gslc_ElemXKeyPadLabelGet_Num (void *pvKeyPad, uint8_t nId, uint8_t nStrMax, char *pStr)
 Callback function to retrieve the label associated with a KeyPad button. More...
 
void gslc_ElemXKeyPadStyleGet_Num (void *pvKeyPad, uint8_t nId, bool *pbVisible, gslc_tsColor *pcolTxt, gslc_tsColor *pcolFrame, gslc_tsColor *pcolFill, gslc_tsColor *pcolGlow)
 Callback function to retrieve the style associated with a KeyPad button. More...
 
void gslc_ElemXKeyPadBtnEvt_Num (void *pvKeyPad, uint8_t nId, gslc_tsXKeyPadResult *psResult)
 Callback function activated when a key has been pressed. More...
 
void gslc_ElemXKeyPadCfgSetFloatEn_Num (gslc_tsXKeyPadCfg_Num *pConfig, bool bEn)
 Update the KeyPad configuration to enable floating point numbers. More...
 
void gslc_ElemXKeyPadCfgSetSignEn_Num (gslc_tsXKeyPadCfg_Num *pConfig, bool bEn)
 Update the KeyPad configuration to enable negative numbers. More...
 

Function Documentation

void gslc_ElemXKeyPadBtnEvt_Num ( void *  pvKeyPad,
uint8_t  nId,
gslc_tsXKeyPadResult psResult 
)

Callback function activated when a key has been pressed.

This callback is used to enable the KeyPad variant to handle any events associated with the key press and update any internal state.

  • The callback is also used to determine whether any redraw actions need to be taken.
Parameters
[in]pvKeyPadVoid ptr to the KeyPad
[in]nIdKeyPad key ID
[out]psResultThe returned state vector (including redraw)
Returns
none
gslc_tsXKeyPadCfg_Num gslc_ElemXKeyPadCfgInit_Num ( )

Initialize the KeyPad config structure.

  • This routine should be called to initialize the configuration data structure before calling any of the KeyPad config APIs
Returns
Initialized KeyPad config structure
void gslc_ElemXKeyPadCfgSetFloatEn_Num ( gslc_tsXKeyPadCfg_Num pConfig,
bool  bEn 
)

Update the KeyPad configuration to enable floating point numbers.

  • Effectively disables/enables the decimal point button & handling
Parameters
[in]pConfigPointer to the XKeyPad variant config structure
[in]bEnEnable flag (true if floating point enabled)
Returns
none
void gslc_ElemXKeyPadCfgSetSignEn_Num ( gslc_tsXKeyPadCfg_Num pConfig,
bool  bEn 
)

Update the KeyPad configuration to enable negative numbers.

  • Effectively disables/enables the sign button & handling
Parameters
[in]pConfigPointer to the XKeyPad variant config structure
[in]bEnEnable flag (true if negative numbers enabled)
Returns
none
gslc_tsElemRef* gslc_ElemXKeyPadCreate_Num ( gslc_tsGui pGui,
int16_t  nElemId,
int16_t  nPage,
gslc_tsXKeyPad pXData,
int16_t  nX0,
int16_t  nY0,
int8_t  nFontId,
gslc_tsXKeyPadCfg_Num pConfig 
)

Create a KeyPad 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]nX0X KeyPad Starting Coordinate
[in]nY0Y KeyPad Starting Coordinate
[in]nFontIdFont ID to use for drawing the element
[in]pConfigPtr to config options
Returns
Pointer to Element or NULL if failure
void gslc_ElemXKeyPadLabelGet_Num ( void *  pvKeyPad,
uint8_t  nId,
uint8_t  nStrMax,
char *  pStr 
)

Callback function to retrieve the label associated with a KeyPad button.

This is called during the drawing of the KeyPad layout.

Parameters
[in]pvKeyPadVoid ptr to the KeyPad
[in]nIdKeyPad key ID
[in]nStrMaxMaximum length of return string (including NULL)
[out]pStrBuffer for the returned label
Returns
none
void gslc_ElemXKeyPadReset_Num ( void *  pvConfig)

Callback function to reset internal state.

Parameters
[in]pvConfigVoid ptr to the KeyPad config
Returns
none
void gslc_ElemXKeyPadStyleGet_Num ( void *  pvKeyPad,
uint8_t  nId,
bool *  pbVisible,
gslc_tsColor pcolTxt,
gslc_tsColor pcolFrame,
gslc_tsColor pcolFill,
gslc_tsColor pcolGlow 
)

Callback function to retrieve the style associated with a KeyPad button.

This is called during the drawing of the KeyPad layout.

  • This function is used to assign the color and visibility state of the keys at runtime.
  • This function can also be used to change the appearance dynamically, according to internal state (eg. dimmed buttons).
Parameters
[in]pvKeyPadVoid ptr to the KeyPad
[in]nIdKeyPad key ID
[out]pbVisibleThe returned visibility state
[out]pcolTxtThe returned text color
[out]pcolFrameThe returned key's frame color
[out]pcolFillThe returned key's fill color
[out]pcolGlowThe returned key's fill color when highlighted
Returns
none
void gslc_ElemXKeyPadTxtInit_Num ( void *  pvKeyPad)

Callback function to update internal state whenever the text field is manually set via gslc_ElemXKeyPadValSet().

  • This is used to ensure any KeyPad variant state can be kept in sync with the text string.
  • For example, if a numeric KeyPad is initiaized with a string that contains a minus sign, an internal negation flag might be set.
Parameters
[in]pvKeyPadVoid ptr to the KeyPad
Returns
none