1 #ifndef _GUISLICE_EX_XLISTBOX_H_ 2 #define _GUISLICE_EX_XLISTBOX_H_ 52 #define GSLC_TYPEX_LISTBOX GSLC_TYPE_BASE_EXTEND + 10 55 #define XLISTBOX_SEL_NONE -9 // Indicator for "no selection" 56 #define XLISTBOX_SIZE_AUTO -1 // Indicator for "auto-size" 57 #define XLISTBOX_BUF_OH_R 2 // Listbox buffer overhead per row 118 uint16_t nBufItemsMax, int16_t nSelDefault);
205 const char* pStrItem);
230 char* pStrItem, uint8_t nStrItemLen);
328 #endif // __cplusplus 329 #endif // _GUISLICE_EX_XLISTBOX_H_ int8_t nRows
Number of columns (or XLSITBOX_SIZE_AUTO to calculate)
Definition: XListbox.h:77
bool gslc_ElemXListboxTouch(void *pvGui, void *pvElemRef, gslc_teTouch eTouch, int16_t nRelX, int16_t nRelY)
Handle touch events to Listbox element.
Definition: XListbox.c:718
int16_t nItemSavedSel
Persistent selected item (ie. saved selection)
Definition: XListbox.h:91
void gslc_ElemXListboxReset(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Empty the listbox of all items.
Definition: XListbox.c:236
bool gslc_ElemXListboxAddItem(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, const char *pStrItem)
Add an item to the listbox.
Definition: XListbox.c:250
int16_t nItemTop
Item to show at top of list after scrolling (0 is default)
Definition: XListbox.h:92
uint16_t nBufItemsMax
Max size of buffer containing items.
Definition: XListbox.h:71
gslc_teRedrawType
Redraw types.
Definition: GUIslice.h:370
int16_t gslc_ElemXListboxGetItemCnt(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Get the number of items in the listbox.
Definition: XListbox.c:464
int16_t nItemW
Width of listbox item.
Definition: XListbox.h:81
int16_t nItemH
Height of listbox item.
Definition: XListbox.h:82
void gslc_ElemXListboxSetSelFunc(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, GSLC_CB_XLISTBOX_SEL funcCb)
Assign the selection callback function for a Listbox.
Definition: XListbox.c:1015
bool gslc_ElemXListboxSetScrollPos(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, uint16_t nScrollPos)
Set the Listbox scroll position.
Definition: XListbox.c:983
bool gslc_ElemXListboxDraw(void *pvGui, void *pvElemRef, gslc_teRedrawType eRedraw)
Draw a Listbox element on the screen.
Definition: XListbox.c:551
bool(* GSLC_CB_XLISTBOX_SEL)(void *pvGui, void *pvElem, int16_t nSel)
Callback function for Listbox feedback.
Definition: XListbox.h:60
uint8_t * pBufItems
Buffer containing items.
Definition: XListbox.h:70
GSLC_CB_XLISTBOX_SEL pfuncXSel
Callback func ptr for selection update.
Definition: XListbox.h:96
int8_t nMarginH
Margin inside main listbox area (Y offset)
Definition: XListbox.h:80
gslc_tsColor colGap
Gap color.
Definition: XListbox.h:84
bool gslc_ElemXListboxGetItem(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int16_t nItemCurSel, char *pStrItem, uint8_t nStrItemLen)
Get the indexed listbox item.
Definition: XListbox.c:424
void gslc_ElemXListboxItemsSetSize(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int16_t nItemW, int16_t nItemH)
Configure the size of the listbox items.
Definition: XListbox.c:207
bool bItemAutoSizeH
Enable auto-sizing of items (in height)
Definition: XListbox.h:86
bool gslc_ElemXListboxDeleteItemAt(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, uint16_t nDeletePos)
Insert an item in the listbox at a specific position.
Definition: XListbox.c:371
Rectangular region. Defines X,Y corner coordinates plus dimensions.
Definition: GUIslice.h:519
void gslc_ElemXListboxSetMargin(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int8_t nMarginW, int8_t nMarginH)
Configure the margin inside the listbox.
Definition: XListbox.c:194
int16_t nItemCurSel
Currently selected item (XLISTBOX_SEL_NONE for none)
Definition: XListbox.h:89
int8_t nMarginW
Margin inside main listbox area (X offset)
Definition: XListbox.h:79
int8_t nItemGap
Gap between listbox items.
Definition: XListbox.h:83
int8_t nCols
Number of columns.
Definition: XListbox.h:76
void gslc_ElemXListboxSetSize(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int8_t nRows, int8_t nCols)
Configure the number of rows & columns to display in the listbox.
Definition: XListbox.c:180
Element reference structure.
Definition: GUIslice.h:578
gslc_tsElemRef * gslc_ElemXListboxCreate(gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsXListbox *pXData, gslc_tsRect rElem, int16_t nFontId, uint8_t *pBufItems, uint16_t nBufItemsMax, int16_t nSelDefault)
Create a Listbox Element.
Definition: XListbox.c:476
int16_t nItemCurSelLast
Old selected item to redraw (XLISTBOX_SEL_NONE for none)
Definition: XListbox.h:90
bool gslc_ElemXListboxInsertItemAt(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, uint16_t nInsertPos, const char *pStrItem)
Insert an item in the listbox at a specific position.
Definition: XListbox.c:297
bool bGlowLast
Last glow state.
Definition: XListbox.h:93
void gslc_ElemXListboxItemsSetGap(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int8_t nGap, gslc_tsColor colGap)
Configure the gap between listbox items.
Definition: XListbox.c:223
uint16_t nBufItemsPos
Current buffer position.
Definition: XListbox.h:72
int16_t nItemCnt
Number of items in the list.
Definition: XListbox.h:73
gslc_teTouch
Processed event from input raw events and actions.
Definition: GUIslice.h:305
int16_t gslc_ElemXListboxGetSel(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Get a Listbox element's current selection.
Definition: XListbox.c:941
GUI structure.
Definition: GUIslice.h:716
Color structure. Defines RGB triplet.
Definition: GUIslice.h:534
bool gslc_ElemXListboxSetSel(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int16_t nItemCurSel)
Set a Listbox element's current selection.
Definition: XListbox.c:949
Extended data for Listbox element.
Definition: XListbox.h:67
bool bNeedRecalc
Determine if sizing may need recalc.
Definition: XListbox.h:78
bool bItemAutoSizeW
Enable auto-sizing of items (in width)
Definition: XListbox.h:85