EasyGUI  Version v1.0
Dropdown

Dropdown widget. More...

Data Structures

struct  gui_dropdown_item_t
 Dropdown string item object structure. More...
 
struct  gui_dropdown_t
 Dropdown object structure. More...
 

Enumerations

enum  gui_dropdown_color_t {
  GUI_DROPDOWN_COLOR_BG = 0x00, GUI_DROPDOWN_COLOR_TEXT, GUI_DROPDOWN_COLOR_SEL_FOC, GUI_DROPDOWN_COLOR_SEL_NOFOC,
  GUI_DROPDOWN_COLOR_SEL_FOC_BG, GUI_DROPDOWN_COLOR_SEL_NOFOC_BG
}
 List of dropdown colors. More...
 
enum  gui_dropdown_opendir_t { GUI_DROPDOWN_OPENDIR_DOWN = 0x00, GUI_DROPDOWN_OPENDIR_UP = 0x01 }
 Dropdown open direction. More...
 

Functions

gui_handle_p gui_dropdown_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 dropdown widget. More...
 
uint8_t gui_dropdown_setcolor (gui_handle_p h, gui_dropdown_color_t index, gui_color_t color)
 Set color to DROPDOWN. More...
 
uint8_t gui_dropdown_addstring (gui_handle_p h, const gui_char *text)
 Add a new string to list box. More...
 
uint8_t gui_dropdown_deletefirststring (gui_handle_p h)
 Delete first string from list. More...
 
uint8_t gui_dropdown_deletelaststring (gui_handle_p h)
 Delete last string from list. More...
 
uint8_t gui_dropdown_deletestring (gui_handle_p h, uint16_t index)
 Delete specific entry from list. More...
 
uint8_t gui_dropdown_setstring (gui_handle_p h, uint16_t index, const gui_char *text)
 Set string value to already added string index. More...
 
uint8_t gui_dropdown_setselection (gui_handle_p h, int16_t selection)
 Set selected value. More...
 
int16_t gui_dropdown_getselection (gui_handle_p h)
 Get selected value. More...
 
uint8_t gui_dropdown_setsliderauto (gui_handle_p h, uint8_t autoMode)
 
uint8_t gui_dropdown_setslidervisibility (gui_handle_p h, uint8_t visible)
 
uint8_t gui_dropdown_scroll (gui_handle_p h, int16_t step)
 Scroll list if possible. More...
 
uint8_t gui_dropdown_setopendirection (gui_handle_p h, gui_dropdown_opendir_t dir)
 Set opening direction for dropdown list. More...
 

Detailed Description

Dropdown widget.

Dropdown widget is another way to have single select mode of multiple choices.

image_widget_dropdown.png
Dropdown with actual opening down (left) or opening to top (right)

Example code of image above:

Enumeration Type Documentation

◆ gui_dropdown_color_t

List of dropdown colors.

Enumerator
GUI_DROPDOWN_COLOR_BG 

Background color index

GUI_DROPDOWN_COLOR_TEXT 

Text color index

GUI_DROPDOWN_COLOR_SEL_FOC 

Text color index of selected item when widget is in focus

GUI_DROPDOWN_COLOR_SEL_NOFOC 

Text color index of selected item when widget is not in focus

GUI_DROPDOWN_COLOR_SEL_FOC_BG 

Background color index of selected item when widget is in focus

GUI_DROPDOWN_COLOR_SEL_NOFOC_BG 

Background color index of selected item when widget is not in focus

◆ gui_dropdown_opendir_t

Dropdown open direction.

Enumerator
GUI_DROPDOWN_OPENDIR_DOWN 

Dropdown will open down according to current position

GUI_DROPDOWN_OPENDIR_UP 

Dropdown will open up according to current position

Function Documentation

◆ gui_dropdown_addstring()

uint8_t gui_dropdown_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_dropdown_create()

gui_handle_p gui_dropdown_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 dropdown 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_dropdown_deletefirststring()

uint8_t gui_dropdown_deletefirststring ( gui_handle_p  h)

Delete first string from list.

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

◆ gui_dropdown_deletelaststring()

uint8_t gui_dropdown_deletelaststring ( gui_handle_p  h)

Delete last string from list.

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

◆ gui_dropdown_deletestring()

uint8_t gui_dropdown_deletestring ( gui_handle_p  h,
uint16_t  index 
)

Delete specific entry from list.

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

◆ gui_dropdown_getselection()

int16_t gui_dropdown_getselection ( gui_handle_p  h)

Get selected value.

Parameters
[in]hWidget handle
Returns
Selection number or -1 if no selection

◆ gui_dropdown_scroll()

uint8_t gui_dropdown_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_dropdown_setcolor()

uint8_t gui_dropdown_setcolor ( gui_handle_p  h,
gui_dropdown_color_t  index,
gui_color_t  color 
)

Set color to DROPDOWN.

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

◆ gui_dropdown_setopendirection()

uint8_t gui_dropdown_setopendirection ( gui_handle_p  h,
gui_dropdown_opendir_t  dir 
)

Set opening direction for dropdown list.

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

◆ gui_dropdown_setselection()

uint8_t gui_dropdown_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_dropdown_setstring()

uint8_t gui_dropdown_setstring ( gui_handle_p  h,
uint16_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