GUIslice
0.16.0
Embedded GUI in C
|
#include "GUIslice.h"
Go to the source code of this file.
Data Structures | |
struct | gslc_tsXKeyPadResult |
Return status for XKeyPad. More... | |
struct | gslc_tsKey |
Key information. Defines everything we need to know about a particular key. More... | |
struct | gslc_tsXKeyPadCfg |
Configuration for the KeyPad. More... | |
struct | gslc_tsXKeyPadData |
Input callback data structure. More... | |
struct | gslc_tsXKeyPad |
Extended data for KeyPad element. More... | |
Macros | |
#define | XKEYPAD_BUF_MAX |
#define | XKEYPAD_KEY_LEN |
#define | XKEYPAD_CURSOR_ENHANCED |
#define | XKEYPAD_CURSOR_CH |
#define | GSLC_TYPEX_KEYPAD |
#define | XKEYPAD_CB_STATE_DONE |
#define | XKEYPAD_CB_STATE_CANCEL |
#define | XKEYPAD_CB_STATE_UPDATE |
#define | XKEYPAD_REDRAW_NONE |
#define | XKEYPAD_REDRAW_TXT |
#define | XKEYPAD_REDRAW_KEY |
#define | XKEYPAD_REDRAW_ALL |
#define | XKEYPAD_REDRAW_FULL |
#define | DEBUG_XKEYPAD |
Debug message for XKeyPad (1=enabled, 0=disabled) More... | |
Typedefs | |
typedef struct gslc_tsKey | gslc_tsKey |
Key information. Defines everything we need to know about a particular key. More... | |
typedef void(* | GSLC_CB_XKEYPAD_RESET) (void *pvKeyPadConfig) |
typedef void(* | GSLC_CB_XKEYPAD_TXT_INIT) (void *pvKeyPad) |
typedef void(* | GSLC_CB_XKEYPAD_LABEL_GET) (void *pvKeyPad, uint8_t nId, uint8_t nStrMax, char *pStr) |
typedef void(* | GSLC_CB_XKEYPAD_SYTLE_GET) (void *pvKeyPad, uint8_t nId, bool *bVisible, gslc_tsColor *pcolTxt, gslc_tsColor *pcolFrame, gslc_tsColor *pcolFill, gslc_tsColor *pcolGlow) |
typedef void(* | GSLC_CB_XKEYPAD_BTN_EVT) (void *pvKeyPad, uint8_t nId, gslc_tsXKeyPadResult *psResult) |
Functions | |
void | gslc_ElemXKeyPadCfgInit (gslc_tsXKeyPadCfg *pConfig) |
Provide default initialization for the base XKeyPad. More... | |
int16_t | gslc_XKeyPadLookupId (gslc_tsKey *pKeys, uint8_t nKeyId) |
Find a key ID within a KeyPad label array and return it's index into the array. More... | |
bool | gslc_XKeyPadTxtAddCh (gslc_tsXKeyPad *pKeyPad, char ch, uint8_t nPos) |
Add a character to the KeyPad text field at the specified offset (nPos). More... | |
bool | gslc_XKeyPadTxtAddStr (gslc_tsXKeyPad *pKeyPad, const char *pStr, uint8_t nPos) |
Add a string to the KeyPad text field at the specified offset (nPos). More... | |
bool | gslc_XKeyPadTxtDelCh (gslc_tsXKeyPad *pKeyPad, uint8_t nPos) |
Remove a character from the KeyPad text field at the specified offset (nPos). More... | |
bool | gslc_XKeyPadLayoutSet (gslc_tsXKeyPadCfg *pConfig, int8_t eLayoutSel) |
Select a new KeyPad layout. More... | |
void | gslc_XKeyPadSizeAllGet (gslc_tsKey **pLayouts, uint8_t nNumLayouts, uint8_t *pnRows, uint8_t *pnCols) |
Calculate the overall dimensions of the KeyPad control encompassing all available layouts for the KeyPad, leveraging the computation in gslc_XKeyPadSizeGet(). More... | |
void | gslc_XKeyPadSizeGet (gslc_tsKey *pLayout, uint8_t *pnRows, uint8_t *pnCols) |
Calculate the overall dimensions of the KeyPad control encompassing the text field and key buttons. More... | |
void | gslc_XKeyPadDrawKey (gslc_tsGui *pGui, gslc_tsXKeyPad *pXData, gslc_tsKey *pKey) |
Draw a key to the screen. More... | |
gslc_tsElemRef * | gslc_XKeyPadCreateBase (gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsXKeyPad *pXData, int16_t nX0, int16_t nY0, int8_t nFontId, gslc_tsXKeyPadCfg *pConfig) |
Create a KeyPad Element. More... | |
void | gslc_ElemXKeyPadValSet (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, const char *pStrBuf) |
Set the current value for the editable text field. More... | |
void | gslc_ElemXKeyPadTargetRefSet (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsElemRef *pTargetRef) |
Set target element reference for KeyPad return value. More... | |
bool | gslc_ElemXKeyPadValGet (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, char *pStrBuf, uint8_t nStrBufMax) |
Fetch the current value string associated with KeyPad element. More... | |
char * | gslc_ElemXKeyPadDataValGet (gslc_tsGui *pGui, void *pvData) |
Fetch the final value string of the KeyPad from a callback. More... | |
int16_t | gslc_ElemXKeyPadDataTargetIdGet (gslc_tsGui *pGui, void *pvData) |
Fetch the element target ID associated with this KeyPad. More... | |
bool | gslc_XKeyPadDraw (void *pvGui, void *pvElemRef, gslc_teRedrawType eRedraw) |
Draw a KeyPad element on the screen. More... | |
bool | gslc_XKeyPadTouch (void *pvGui, void *pvElemRef, gslc_teTouch eTouch, int16_t nRelX, int16_t nRelY) |
Handle touch (up,down,move) events to KeyPad element. More... | |
void | gslc_ElemXKeyPadValSetCb (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, GSLC_CB_INPUT pfuncCb) |
Set the callback function associated with the KeyPad. More... | |
void | gslc_ElemXKeyPadCfgSetRoundEn (gslc_tsXKeyPadCfg *pConfig, bool bEn) |
Update the KeyPad configuration to enable rounded button corners. More... | |
void | gslc_ElemXKeyPadCfgSetButtonSz (gslc_tsXKeyPadCfg *pConfig, int8_t nButtonSzW, int8_t nButtonSzH) |
Update the KeyPad configuration to define the KeyPad button sizing. More... | |
void | gslc_ElemXKeyPadCfgSetButtonSpace (gslc_tsXKeyPadCfg *pConfig, int8_t nSpaceX, int8_t nSpaceY) |
Update the KeyPad configuration to define the KeyPad button spacing. More... | |
void | gslc_XKeyPadDrawVirtualTxt (gslc_tsGui *pGui, gslc_tsRect rElem, gslc_tsXKeyPad *pKeyPad, gslc_tsColor cColFrame, gslc_tsColor cColFill, gslc_tsColor cColTxt) |
Draw a virtual Text Element. More... | |
void | gslc_XKeyPadDrawVirtualBtn (gslc_tsGui *pGui, gslc_tsRect rElem, char *pStrBuf, uint8_t nStrBufMax, int16_t nFontId, gslc_tsColor cColFrame, gslc_tsColor cColFill, gslc_tsColor cColTxt, bool bRoundedEn) |
Draw a virtual textual Button Element. More... | |
void | gslc_ElemXKeyPadInputAsk (gslc_tsGui *pGui, gslc_tsElemRef *pKeyPadRef, int16_t nPgPopup, gslc_tsElemRef *pTxtRef) |
Trigger a KeyPad popup and associate it with a text element. More... | |
char * | gslc_ElemXKeyPadInputGet (gslc_tsGui *pGui, gslc_tsElemRef *pTxtRef, void *pvCbData) |
Complete a KeyPad popup by retrieving the input data and storing it in the text element. More... | |
Variables | |
static const int | RBIT_TXT |
static const int | RBIT_KEYONE |
static const int | RBIT_KEYALL |
static const int | RBIT_CTRL |
#define DEBUG_XKEYPAD |
Debug message for XKeyPad (1=enabled, 0=disabled)
#define GSLC_TYPEX_KEYPAD |
#define XKEYPAD_BUF_MAX |
#define XKEYPAD_CB_STATE_CANCEL |
#define XKEYPAD_CB_STATE_DONE |
#define XKEYPAD_CB_STATE_UPDATE |
#define XKEYPAD_CURSOR_CH |
#define XKEYPAD_CURSOR_ENHANCED |
#define XKEYPAD_KEY_LEN |
#define XKEYPAD_REDRAW_ALL |
#define XKEYPAD_REDRAW_FULL |
#define XKEYPAD_REDRAW_KEY |
#define XKEYPAD_REDRAW_NONE |
#define XKEYPAD_REDRAW_TXT |
typedef void(* GSLC_CB_XKEYPAD_BTN_EVT) (void *pvKeyPad, uint8_t nId, gslc_tsXKeyPadResult *psResult) |
typedef void(* GSLC_CB_XKEYPAD_LABEL_GET) (void *pvKeyPad, uint8_t nId, uint8_t nStrMax, char *pStr) |
typedef void(* GSLC_CB_XKEYPAD_RESET) (void *pvKeyPadConfig) |
typedef void(* GSLC_CB_XKEYPAD_SYTLE_GET) (void *pvKeyPad, uint8_t nId, bool *bVisible, gslc_tsColor *pcolTxt, gslc_tsColor *pcolFrame, gslc_tsColor *pcolFill, gslc_tsColor *pcolGlow) |
typedef void(* GSLC_CB_XKEYPAD_TXT_INIT) (void *pvKeyPad) |
typedef struct gslc_tsKey gslc_tsKey |
Key information. Defines everything we need to know about a particular key.
anonymous enum |
anonymous enum |
void gslc_ElemXKeyPadCfgInit | ( | gslc_tsXKeyPadCfg * | pConfig | ) |
Provide default initialization for the base XKeyPad.
[in] | pConfig | Ptr to the KeyPad base config structure |
void gslc_ElemXKeyPadCfgSetButtonSpace | ( | gslc_tsXKeyPadCfg * | pConfig, |
int8_t | nSpaceX, | ||
int8_t | nSpaceY | ||
) |
Update the KeyPad configuration to define the KeyPad button spacing.
[in,out] | pConfig | Pointer to the XKeyPad base config structure |
[in] | nSpaceX | Amount to inset button in horizontal direction (pixels) |
[in] | nSpaceY | Amount to inset button in vertical direction (pixels) |
void gslc_ElemXKeyPadCfgSetButtonSz | ( | gslc_tsXKeyPadCfg * | pConfig, |
int8_t | nButtonSzW, | ||
int8_t | nButtonSzH | ||
) |
Update the KeyPad configuration to define the KeyPad button sizing.
[in,out] | pConfig | Pointer to the XKeyPad base config structure |
[in] | nButtonSzW | Width of buttons in pixels |
[in] | nButtonSzH | Height of buttons in pixels |
void gslc_ElemXKeyPadCfgSetRoundEn | ( | gslc_tsXKeyPadCfg * | pConfig, |
bool | bEn | ||
) |
Update the KeyPad configuration to enable rounded button corners.
[in,out] | pConfig | Pointer to the XKeyPad base config structure |
[in] | bEn | Enable rounded corners |
int16_t gslc_ElemXKeyPadDataTargetIdGet | ( | gslc_tsGui * | pGui, |
void * | pvData | ||
) |
Fetch the element target ID associated with this KeyPad.
[in] | pGui | Pointer to GUI |
[in] | pvData | : Void ptr to callback data structure |
char* gslc_ElemXKeyPadDataValGet | ( | gslc_tsGui * | pGui, |
void * | pvData | ||
) |
Fetch the final value string of the KeyPad from a callback.
[in] | pGui | Pointer to GUI |
[out] | pvData | : Void ptr to callback data structure |
void gslc_ElemXKeyPadInputAsk | ( | gslc_tsGui * | pGui, |
gslc_tsElemRef * | pKeyPadRef, | ||
int16_t | nPgPopup, | ||
gslc_tsElemRef * | pTxtRef | ||
) |
Trigger a KeyPad popup and associate it with a text element.
[in] | pGui | Pointer to GUI |
[in] | pKeyPadRef | Pointer to KeyPad element reference |
[in] | nPgPopup | Page enum that contains the popup to show |
[in] | pTxtRef | Pointer to associated text field element reference |
char* gslc_ElemXKeyPadInputGet | ( | gslc_tsGui * | pGui, |
gslc_tsElemRef * | pTxtRef, | ||
void * | pvCbData | ||
) |
Complete a KeyPad popup by retrieving the input data and storing it in the text element.
[in] | pGui | Pointer to GUI |
[in] | pTxtRef | Pointer to associated text field element reference |
[in] | pvCbData | Void pointer to callback function's pvData |
void gslc_ElemXKeyPadTargetRefSet | ( | gslc_tsGui * | pGui, |
gslc_tsElemRef * | pElemRef, | ||
gslc_tsElemRef * | pTargetRef | ||
) |
Set target element reference for KeyPad return value.
[in] | pGui | Pointer to GUI |
[in] | pElemRef | Ptr to KeyPad Element reference |
[in] | pTargetRef | Element reference for target of KeyPad value |
bool gslc_ElemXKeyPadValGet | ( | gslc_tsGui * | pGui, |
gslc_tsElemRef * | pElemRef, | ||
char * | pStrBuf, | ||
uint8_t | nStrBufMax | ||
) |
Fetch the current value string associated with KeyPad element.
[in] | pGui | Pointer to GUI |
[in] | pElemRef | Ptr to KeyPad Element reference |
[out] | pStrBuf | String buffer |
[in] | nStrBufMax | Maximum length of string buffer (pStrBuf) including terminator |
void gslc_ElemXKeyPadValSet | ( | gslc_tsGui * | pGui, |
gslc_tsElemRef * | pElemRef, | ||
const char * | pStrBuf | ||
) |
Set the current value for the editable text field.
[in] | pGui | Pointer to GUI |
[in] | pElemRef | Ptr to KeyPad Element reference |
[in] | pStrBuf | String to copy into keypad |
void gslc_ElemXKeyPadValSetCb | ( | gslc_tsGui * | pGui, |
gslc_tsElemRef * | pElemRef, | ||
GSLC_CB_INPUT | pfuncCb | ||
) |
Set the callback function associated with the KeyPad.
[in] | pGui | Pointer to GUI |
[in] | pElemRef | Pointer to Element Reference for KeyPad |
[in] | pfuncCb | Callback function pointer |
gslc_tsElemRef* gslc_XKeyPadCreateBase | ( | gslc_tsGui * | pGui, |
int16_t | nElemId, | ||
int16_t | nPage, | ||
gslc_tsXKeyPad * | pXData, | ||
int16_t | nX0, | ||
int16_t | nY0, | ||
int8_t | nFontId, | ||
gslc_tsXKeyPadCfg * | pConfig | ||
) |
Create a KeyPad Element.
[in] | pGui | Pointer to GUI |
[in] | nElemId | Element ID to assign (0..16383 or GSLC_ID_AUTO to autogen) |
[in] | nPage | Page ID to attach element to |
[in] | pXData | Ptr to extended element data structure |
[in] | nX0 | X KeyPad Starting Coordinate |
[in] | nY0 | Y KeyPad Starting Coordinate |
[in] | nFontId | Font ID to use for drawing the element |
[in] | pConfig | Pointer to base Config options |
bool gslc_XKeyPadDraw | ( | void * | pvGui, |
void * | pvElemRef, | ||
gslc_teRedrawType | eRedraw | ||
) |
Draw a KeyPad element on the screen.
[in] | pvGui | Void ptr to GUI (typecast to gslc_tsGui*) |
[in] | pvElemRef | Void ptr to Element reference (typecast to gslc_tsElemRef*) |
[in] | eRedraw | Redraw mode |
void gslc_XKeyPadDrawKey | ( | gslc_tsGui * | pGui, |
gslc_tsXKeyPad * | pXData, | ||
gslc_tsKey * | pKey | ||
) |
Draw a key to the screen.
[in] | pGui | Pointer to GUI |
[in] | pXData | Ptr to extended element data structure |
[in] | pKey | Ptr to key being drawn |
void gslc_XKeyPadDrawVirtualBtn | ( | gslc_tsGui * | pGui, |
gslc_tsRect | rElem, | ||
char * | pStrBuf, | ||
uint8_t | nStrBufMax, | ||
int16_t | nFontId, | ||
gslc_tsColor | cColFrame, | ||
gslc_tsColor | cColFill, | ||
gslc_tsColor | cColTxt, | ||
bool | bRoundedEn | ||
) |
Draw a virtual textual Button Element.
[in] | pGui | Pointer to GUI |
[in] | rElem | Rectangle coordinates defining element size |
[in] | pStrBuf | String to copy into element |
[in] | nStrBufMax | Maximum length of string buffer (pStrBuf). |
[in] | nFontId | Font ID to use for text display |
[in] | cColFrame | Frame color for element |
[in] | cColFill | Fill color for element |
[in] | cColTxt | Text color for element |
[in] | bRoundedEn | Use Rounded Corners? |
void gslc_XKeyPadDrawVirtualTxt | ( | gslc_tsGui * | pGui, |
gslc_tsRect | rElem, | ||
gslc_tsXKeyPad * | pKeyPad, | ||
gslc_tsColor | cColFrame, | ||
gslc_tsColor | cColFill, | ||
gslc_tsColor | cColTxt | ||
) |
Draw a virtual Text Element.
[in] | pGui | Pointer to GUI |
[in] | rElem | Rectangle coordinates defining element size |
[in] | pKeyPad | Pointer to KeyPad struct |
[in] | cColFrame | Frame color for element |
[in] | cColFill | Fill color for element |
[in] | cColTxt | Text color for element |
bool gslc_XKeyPadLayoutSet | ( | gslc_tsXKeyPadCfg * | pConfig, |
int8_t | eLayoutSel | ||
) |
Select a new KeyPad layout.
[in] | pConfig | Ptr to the KeyPad configuration |
[in] | eLayoutSel | Layout index to select |
int16_t gslc_XKeyPadLookupId | ( | gslc_tsKey * | pKeys, |
uint8_t | nKeyId | ||
) |
Find a key ID within a KeyPad label array and return it's index into the array.
[in] | pKeys | Ptr to the Keypad label array |
[in] | nKeyId | Key ID to look for |
void gslc_XKeyPadSizeAllGet | ( | gslc_tsKey ** | pLayouts, |
uint8_t | nNumLayouts, | ||
uint8_t * | pnRows, | ||
uint8_t * | pnCols | ||
) |
Calculate the overall dimensions of the KeyPad control encompassing all available layouts for the KeyPad, leveraging the computation in gslc_XKeyPadSizeGet().
[in] | pLayouts | Ptr to the array of KeyPad layouts |
[in] | nNumLayouts | Number of layouts in pLayouts |
[out] | pnRows | Ptr for the number of rows |
[out] | pnCols | Ptr for the number of columns |
void gslc_XKeyPadSizeGet | ( | gslc_tsKey * | pLayout, |
uint8_t * | pnRows, | ||
uint8_t * | pnCols | ||
) |
Calculate the overall dimensions of the KeyPad control encompassing the text field and key buttons.
The dimension is calculated in units of the configured key size (width and height), and accounts for any column spans.
[in] | pLayout | Ptr to the KeyPad layout |
[out] | pnRows | Ptr for the number of rows |
[out] | pnCols | Ptr for the number of columns |
bool gslc_XKeyPadTouch | ( | void * | pvGui, |
void * | pvElemRef, | ||
gslc_teTouch | eTouch, | ||
int16_t | nRelX, | ||
int16_t | nRelY | ||
) |
Handle touch (up,down,move) events to KeyPad element.
[in] | pvGui | Void ptr to GUI (typecast to gslc_tsGui*) |
[in] | pvElemRef | Void ptr to Element reference (typecast to gslc_tsElemRef*) |
[in] | eTouch | Touch event type |
[in] | nRelX | Touch X coord relative to element |
[in] | nRelY | Touch Y coord relative to element |
bool gslc_XKeyPadTxtAddCh | ( | gslc_tsXKeyPad * | pKeyPad, |
char | ch, | ||
uint8_t | nPos | ||
) |
Add a character to the KeyPad text field at the specified offset (nPos).
Providing an offset equal to the end of the existing buffer length will cause the addition to the end, whereas an offset within the buffer will cause an insert.
[in] | pKeyPad | Ptr to the KeyPad |
[in] | ch | Character to add |
[in] | nPos | Buffer position for the insertion |
bool gslc_XKeyPadTxtAddStr | ( | gslc_tsXKeyPad * | pKeyPad, |
const char * | pStr, | ||
uint8_t | nPos | ||
) |
Add a string to the KeyPad text field at the specified offset (nPos).
Providing an offset equal to the end of the existing buffer length will cause the addition to the end, whereas an offset within the buffer will cause an insert.
[in] | pKeyPad | Ptr to the KeyPad |
[in] | pStr | String to add |
[in] | nPos | Buffer position for the insertion |
bool gslc_XKeyPadTxtDelCh | ( | gslc_tsXKeyPad * | pKeyPad, |
uint8_t | nPos | ||
) |
Remove a character from the KeyPad text field at the specified offset (nPos).
[in] | pKeyPad | Ptr to the KeyPad |
[in] | nPos | Buffer position for the removal |
|
static |
|
static |
|
static |
|
static |