EasyGUI  Version v1.0
Listbox

LISTBOX widget. More...

Data Structures

struct  gui_listbox_item_t
 Listbox string item object. More...
 
struct  gui_listbox_t
 Listbox object structure. More...
 

Enumerations

enum  gui_listbox_color_t {
  GUI_LISTBOX_COLOR_BG = 0x00, GUI_LISTBOX_COLOR_TEXT, GUI_LISTBOX_COLOR_SEL_FOC, GUI_LISTBOX_COLOR_SEL_NOFOC,
  GUI_LISTBOX_COLOR_SEL_FOC_BG, GUI_LISTBOX_COLOR_SEL_NOFOC_BG
}
 List of listbox colors. More...
 

Functions

gui_handle_p gui_listbox_create (gui_id_t id, float x, float y, float width, float height, gui_handle_p parent, gui_widget_evt_fn evt_fn, uint16_t flags)
 Create new listbox widget. More...
 
uint8_t gui_listbox_setcolor (gui_handle_p h, gui_listbox_color_t index, gui_color_t color)
 Set color to listbox. More...
 
uint8_t gui_listbox_addstring (gui_handle_p h, const gui_char *text)
 Add a new string to list box. More...
 
uint8_t gui_listbox_deletefirststring (gui_handle_p h)
 Delete first string from list. More...
 
uint8_t gui_listbox_deletelaststring (gui_handle_p h)
 Delete last string from list. More...
 
uint8_t gui_listbox_deletestring (gui_handle_p h, int16_t index)
 Delete specific entry from list. More...
 
uint8_t gui_listbox_setstring (gui_handle_p h, int16_t index, const gui_char *text)
 Set string value to already added string index. More...
 
uint8_t gui_listbox_setselection (gui_handle_p h, int16_t selection)
 Set selected value. More...
 
int16_t gui_listbox_getselection (gui_handle_p h)
 Get selected value. More...
 
uint8_t gui_listbox_scroll (gui_handle_p h, int16_t step)
 Scroll list if possible. More...
 

Detailed Description

LISTBOX widget.

Listbox widget is simple widget to display single list of data. For detailed support of list displays, refer to List view widget

image_widget_listbox.png
Listbox in passive (left) and active (focused, right image) modes

Example code of image above

Enumeration Type Documentation

◆ gui_listbox_color_t

List of listbox colors.

Enumerator
GUI_LISTBOX_COLOR_BG 

Background color

GUI_LISTBOX_COLOR_TEXT 

Text color index

GUI_LISTBOX_COLOR_SEL_FOC 

Text color of selected item when widget is in focus

GUI_LISTBOX_COLOR_SEL_NOFOC 

Text color of selected item when widget is not in focus

GUI_LISTBOX_COLOR_SEL_FOC_BG 

Background color of selected item when widget is in focus

GUI_LISTBOX_COLOR_SEL_NOFOC_BG 

Background color of selected item when widget is not in focus

Function Documentation

◆ gui_listbox_addstring()

uint8_t gui_listbox_addstring ( gui_handle_p  h,
const gui_char text 
)

Add a new string to list box.

Parameters
[in]hWidget handle
[in]textPointer to text to add to list. Only pointer is saved to memory!
Returns
1 on success, 0 otherwise

◆ gui_listbox_create()

gui_handle_p gui_listbox_create ( gui_id_t  id,
float  x,
float  y,
float  width,
float  height,
gui_handle_p  parent,
gui_widget_evt_fn  evt_fn,
uint16_t  flags 
)

Create new listbox widget.

Parameters
[in]idWidget unique ID to use for identity for callback processing
[in]xWidget X position relative to parent widget
[in]yWidget Y position relative to parent widget
[in]widthWidget width in units of pixels
[in]heightWidget height in units of pixels
[in]parentParent widget handle. Set to NULL to use current active parent widget
[in]evt_fnCustom widget callback function. Set to NULL to use default callback
[in]flagsflags for widget creation
Returns
Widget handle on success, NULL otherwise

◆ gui_listbox_deletefirststring()

uint8_t gui_listbox_deletefirststring ( gui_handle_p  h)

Delete first string from list.

Parameters
[in]hWidget handle
Returns
1 on success, 0 otherwise

◆ gui_listbox_deletelaststring()

uint8_t gui_listbox_deletelaststring ( gui_handle_p  h)

Delete last string from list.

Parameters
[in]hWidget handle
Returns
1 on success, 0 otherwise

◆ gui_listbox_deletestring()

uint8_t gui_listbox_deletestring ( gui_handle_p  h,
int16_t  index 
)

Delete specific entry from list.

Parameters
[in]hWidget handle
[in]indexList index (position) to delete
Returns
1 on success, 0 otherwise

◆ gui_listbox_getselection()

int16_t gui_listbox_getselection ( gui_handle_p  h)

Get selected value.

Parameters
[in]hWidget handle
Returns
Selection on success, -1 otherwise

◆ gui_listbox_scroll()

uint8_t gui_listbox_scroll ( gui_handle_p  h,
int16_t  step 
)

Scroll list if possible.

Parameters
[in]hWidget handle
[in]stepStep to scroll. Positive step will scroll up, negative will scroll down
Returns
1 on success, 0 otherwise

◆ gui_listbox_setcolor()

uint8_t gui_listbox_setcolor ( gui_handle_p  h,
gui_listbox_color_t  index,
gui_color_t  color 
)

Set color to listbox.

Parameters
[in]hWidget handle
[in]indexColor index
[in]colorColor value
Returns
1 on success, 0 otherwise

◆ gui_listbox_setselection()

uint8_t gui_listbox_setselection ( gui_handle_p  h,
int16_t  selection 
)

Set selected value.

Parameters
[in]hWidget handle
[in]selectionSet to -1 to invalidate selection or 0 - count-1 for specific selection
Returns
1 on success, 0 otherwise

◆ gui_listbox_setstring()

uint8_t gui_listbox_setstring ( gui_handle_p  h,
int16_t  index,
const gui_char text 
)

Set string value to already added string index.

Parameters
[in]hWidget handle
[in]indexIndex (position) on list to set/change text
[in]textPointer to text to add to list. Only pointer is saved to memory!
Returns
1 on success, 0 otherwise