1 #ifndef _GUISLICE_EX_XKEYPAD_H_ 2 #define _GUISLICE_EX_XKEYPAD_H_ 55 #define XKEYPAD_BUF_MAX 20 // Maximum buffer length for input string 56 #define XKEYPAD_KEY_LEN 6 // Maximum buffer length for a single key 62 #define XKEYPAD_CURSOR_ENHANCED 1 // Cursor appearance 63 #define XKEYPAD_CURSOR_CH '^' // Character to use for embedded cursor 70 #define GSLC_TYPEX_KEYPAD GSLC_TYPE_BASE_EXTEND + 20 73 #define XKEYPAD_CB_STATE_DONE 1 74 #define XKEYPAD_CB_STATE_CANCEL 2 75 #define XKEYPAD_CB_STATE_UPDATE 3 84 #define XKEYPAD_REDRAW_NONE 0 // No need for a redraw 85 #define XKEYPAD_REDRAW_TXT RBIT_TXT // Redraw the text field 86 #define XKEYPAD_REDRAW_KEY RBIT_KEYONE // Redraw a single key (defined by nXKeyPadRedrawId) 87 #define XKEYPAD_REDRAW_ALL RBIT_KEYALL+RBIT_TXT // Redraw all keys and text field 88 #define XKEYPAD_REDRAW_FULL RBIT_KEYALL+RBIT_TXT+RBIT_CTRL // Redraw entire control (frame, all keys and text) 90 #define DEBUG_XKEYPAD 0 544 char* pStrBuf,uint8_t nStrBufMax,int16_t nFontId,
gslc_tsColor cColFrame,
584 #endif // __cplusplus 585 #endif // _GUISLICE_EX_XKEYPAD_H_ GSLC_CB_XKEYPAD_RESET pfuncReset
Callback function whenever keypad needs to be reset.
Definition: XKeyPad.h:177
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.
Definition: XKeyPad.c:655
bool(* GSLC_CB_INPUT)(void *pvGui, void *pvElemRef, int16_t nStatus, void *pvData)
Callback function for element input ready.
Definition: GUIslice.h:511
static const int RBIT_CTRL
Definition: XKeyPad.h:81
int8_t nButtonSpaceX
Button X spacing (in pixels)
Definition: XKeyPad.h:161
void(* GSLC_CB_XKEYPAD_BTN_EVT)(void *pvKeyPad, uint8_t nId, gslc_tsXKeyPadResult *psResult)
Definition: XKeyPad.h:152
Key information. Defines everything we need to know about a particular key.
Definition: XKeyPad.h:137
Definition: XKeyPad.h:104
GSLC_CB_XKEYPAD_LABEL_GET pfuncLabelGet
Callback function to get a key label.
Definition: XKeyPad.h:179
void gslc_ElemXKeyPadTargetRefSet(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsElemRef *pTargetRef)
Set target element reference for KeyPad return value.
Definition: XKeyPad.c:419
void gslc_ElemXKeyPadCfgSetButtonSz(gslc_tsXKeyPadCfg *pConfig, int8_t nButtonSzW, int8_t nButtonSzH)
Update the KeyPad configuration to define the KeyPad button sizing.
Definition: XKeyPad.c:913
static const int RBIT_KEYONE
Definition: XKeyPad.h:79
void(* GSLC_CB_XKEYPAD_TXT_INIT)(void *pvKeyPad)
Definition: XKeyPad.h:149
uint8_t nCursorPos
Cursor position within the buffer.
Definition: XKeyPad.h:201
gslc_tsElemRef * pTargetRef
Target element reference to receive the value.
Definition: XKeyPad.h:191
Configuration for the KeyPad.
Definition: XKeyPad.h:155
gslc_teRedrawType
Redraw types.
Definition: GUIslice.h:370
uint8_t nColSpan
Number of columns that key takes up (in units of nButtonSzW pixels)
Definition: XKeyPad.h:142
bool gslc_ElemXKeyPadValGet(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, char *pStrBuf, uint8_t nStrBufMax)
Fetch the current value string associated with KeyPad element.
Definition: XKeyPad.c:463
bool gslc_XKeyPadTxtAddCh(gslc_tsXKeyPad *pKeyPad, char ch, uint8_t nPos)
Add a character to the KeyPad text field at the specified offset (nPos).
Definition: XKeyPad.c:838
struct gslc_tsKey gslc_tsKey
Key information. Defines everything we need to know about a particular key.
int8_t eLayoutSel
Current KeyPad layout (type gslc_teXKeyPadSel)
Definition: XKeyPad.h:166
uint8_t nCol
Column to place the key (0 is left-most)
Definition: XKeyPad.h:140
Input callback data structure.
Definition: XKeyPad.h:189
GSLC_CB_INPUT pfuncCb
Callback function for KeyPad actions.
Definition: XKeyPad.h:209
Definition: XKeyPad.h:126
void(* GSLC_CB_XKEYPAD_LABEL_GET)(void *pvKeyPad, uint8_t nId, uint8_t nStrMax, char *pStr)
Definition: XKeyPad.h:150
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.
Definition: XKeyPad.c:1233
Definition: XKeyPad.h:129
int8_t eLayoutDef
Default KeyPad layout (type gslc_teXKeyPadSel)
Definition: XKeyPad.h:165
void gslc_XKeyPadDrawKey(gslc_tsGui *pGui, gslc_tsXKeyPad *pXData, gslc_tsKey *pKey)
Draw a key to the screen.
Definition: XKeyPad.c:208
GSLC_CB_XKEYPAD_BTN_EVT pfuncBtnEvt
Callback function to handle a key.
Definition: XKeyPad.h:181
int16_t eRedrawState
XKeyPad pending redraw state.
Definition: XKeyPad.h:95
GSLC_CB_XKEYPAD_TXT_INIT pfuncTxtInit
Callback function whenever text string initialized.
Definition: XKeyPad.h:178
Definition: XKeyPad.h:107
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...
Definition: XKeyPad.c:538
bool gslc_XKeyPadLayoutSet(gslc_tsXKeyPadCfg *pConfig, int8_t eLayoutSel)
Select a new KeyPad layout.
Definition: XKeyPad.c:375
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.
Definition: XKeyPad.c:1153
bool gslc_XKeyPadTxtDelCh(gslc_tsXKeyPad *pKeyPad, uint8_t nPos)
Remove a character from the KeyPad text field at the specified offset (nPos).
Definition: XKeyPad.c:802
Definition: XKeyPad.h:119
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.
Definition: XKeyPad.c:283
int8_t nButtonSzH
Button height (in pixels)
Definition: XKeyPad.h:160
Definition: XKeyPad.h:110
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.
Definition: XKeyPad.c:931
bool bRoundEn
Enable rounded corners.
Definition: XKeyPad.h:158
uint8_t nRowSpan
Number of rows that key takes up (in units of nButtonSzH pixels)
Definition: XKeyPad.h:141
Extended data for KeyPad element.
Definition: XKeyPad.h:195
Definition: XKeyPad.h:128
Definition: XKeyPad.h:105
Rectangular region. Defines X,Y corner coordinates plus dimensions.
Definition: GUIslice.h:519
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)
Definition: XKeyPad.h:151
int8_t nButtonSpaceY
Button Y spacing (in pixels)
Definition: XKeyPad.h:162
uint8_t nBufferMax
Maximum number of characters stored in edit value string.
Definition: XKeyPad.h:198
int16_t nOffsetX
Configured offset (X direction) for buttons from parent container.
Definition: XKeyPad.h:170
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).
Definition: XKeyPad.c:900
uint8_t nBufferLen
Current number of characters stored in edit value string.
Definition: XKeyPad.h:199
void gslc_ElemXKeyPadCfgInit(gslc_tsXKeyPadCfg *pConfig)
Provide default initialization for the base XKeyPad.
Definition: XKeyPad.c:96
uint8_t nScrollPos
Display offset within the buffer.
Definition: XKeyPad.h:202
static const int RBIT_TXT
Definition: XKeyPad.h:78
char * gslc_ElemXKeyPadDataValGet(gslc_tsGui *pGui, void *pvData)
Fetch the final value string of the KeyPad from a callback.
Definition: XKeyPad.c:444
char * pStr
Final value of edited value field.
Definition: XKeyPad.h:190
int16_t nRedrawKeyId
XKeyPad specific key to redraw (-1 for none)
Definition: XKeyPad.h:96
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.
Definition: XKeyPad.c:1205
gslc_tsXKeyPadCfg * pConfig
Ptr to config struct (may be derived variant)
Definition: XKeyPad.h:207
gslc_tsKey ** pLayouts
Key Positions for each KeyPad layout.
Definition: XKeyPad.h:164
Definition: XKeyPad.h:117
Element reference structure.
Definition: GUIslice.h:578
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.
Definition: XKeyPad.c:125
void gslc_ElemXKeyPadCfgSetRoundEn(gslc_tsXKeyPadCfg *pConfig, bool bEn)
Update the KeyPad configuration to enable rounded button corners.
Definition: XKeyPad.c:925
gslc_tsXKeyPadResult sRedraw
Pending redraw state.
Definition: XKeyPad.h:204
int16_t gslc_ElemXKeyPadDataTargetIdGet(gslc_tsGui *pGui, void *pvData)
Fetch the element target ID associated with this KeyPad.
Definition: XKeyPad.c:427
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 Key...
Definition: XKeyPad.c:525
gslc_tsKey * pLayout
Current selected layout.
Definition: XKeyPad.h:163
int8_t nButtonSzW
Button width (in pixels)
Definition: XKeyPad.h:159
Definition: XKeyPad.h:106
void gslc_ElemXKeyPadValSetCb(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, GSLC_CB_INPUT pfuncCb)
Set the callback function associated with the KeyPad.
Definition: XKeyPad.c:517
void gslc_ElemXKeyPadCfgSetButtonSpace(gslc_tsXKeyPadCfg *pConfig, int8_t nSpaceX, int8_t nSpaceY)
Update the KeyPad configuration to define the KeyPad button spacing.
Definition: XKeyPad.c:919
void(* GSLC_CB_XKEYPAD_RESET)(void *pvKeyPadConfig)
Definition: XKeyPad.h:148
uint8_t nId
Unique identifier.
Definition: XKeyPad.h:138
Return status for XKeyPad.
Definition: XKeyPad.h:94
gslc_teTouch
Processed event from input raw events and actions.
Definition: GUIslice.h:305
Definition: XKeyPad.h:121
gslc_tsElemRef * pTargetRef
Target element ref associated with keypad (GSLC_CB_INPUT)
Definition: XKeyPad.h:210
int16_t nFontId
Configured font for KeyPad labels.
Definition: XKeyPad.h:169
uint8_t nType
Key type.
Definition: XKeyPad.h:143
Definition: XKeyPad.h:125
GUI structure.
Definition: GUIslice.h:716
#define XKEYPAD_BUF_MAX
Definition: XKeyPad.h:55
uint8_t nRow
Row to place the key (0 is top-most)
Definition: XKeyPad.h:139
Color structure. Defines RGB triplet.
Definition: GUIslice.h:534
Definition: XKeyPad.h:108
uint8_t nMaxRows
Maximum number of rows to occupy.
Definition: XKeyPad.h:175
static const int RBIT_KEYALL
Definition: XKeyPad.h:80
Definition: XKeyPad.h:109
uint8_t nDispMax
Maximum length to display.
Definition: XKeyPad.h:156
Definition: XKeyPad.h:127
int8_t nFrameMargin
Margin around text value field.
Definition: XKeyPad.h:173
GSLC_CB_XKEYPAD_SYTLE_GET pfuncStyleGet
Callback function to get a key's style.
Definition: XKeyPad.h:180
void gslc_ElemXKeyPadValSet(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, const char *pStrBuf)
Set the current value for the editable text field.
Definition: XKeyPad.c:388
uint8_t nMaxCols
Maximum number of columns to occupy.
Definition: XKeyPad.h:174
int16_t nOffsetY
Configured offset (Y direction) for buttons from parent container.
Definition: XKeyPad.h:171
bool gslc_XKeyPadDraw(void *pvGui, void *pvElemRef, gslc_teRedrawType eRedraw)
Draw a KeyPad element on the screen.
Definition: XKeyPad.c:477