Loading...
Searching...
No Matches
submenu.h File Reference

GUI: SubMenu view module API. More...

#include <gui/view.h>

Go to the source code of this file.

Typedefs

typedef struct Submenu Submenu
 Submenu anonymous structure.
 
typedef void(* SubmenuItemCallback) (void *context, uint32_t index)
 

Functions

Submenusubmenu_alloc (void)
 Allocate and initialize submenu.
 
void submenu_free (Submenu *submenu)
 Deinitialize and free submenu.
 
Viewsubmenu_get_view (Submenu *submenu)
 Get submenu view.
 
void submenu_add_item (Submenu *submenu, const char *label, uint32_t index, SubmenuItemCallback callback, void *callback_context)
 Add item to submenu.
 
void submenu_change_item_label (Submenu *submenu, uint32_t index, const char *label)
 Change label of an existing item.
 
void submenu_reset (Submenu *submenu)
 Remove all items from submenu.
 
uint32_t submenu_get_selected_item (Submenu *submenu)
 Get submenu selected item index.
 
void submenu_set_selected_item (Submenu *submenu, uint32_t index)
 Set submenu selected item by index.
 
void submenu_set_header (Submenu *submenu, const char *header)
 Set optional header for submenu.
 

Detailed Description

GUI: SubMenu view module API.

Function Documentation

◆ submenu_add_item()

void submenu_add_item ( Submenu * submenu,
const char * label,
uint32_t index,
SubmenuItemCallback callback,
void * callback_context )

Add item to submenu.

Parameters
submenuSubmenu instance
labelmenu item label
indexmenu item index, used for callback, may be the same with other items
callbackmenu item callback
callback_contextmenu item callback context

◆ submenu_alloc()

Submenu * submenu_alloc ( void )

Allocate and initialize submenu.

This submenu is used to select one option

Returns
Submenu instance

◆ submenu_change_item_label()

void submenu_change_item_label ( Submenu * submenu,
uint32_t index,
const char * label )

Change label of an existing item.

Parameters
submenuSubmenu instance
indexThe index of the item
labelThe new label

◆ submenu_free()

void submenu_free ( Submenu * submenu)

Deinitialize and free submenu.

Parameters
submenuSubmenu instance

◆ submenu_get_selected_item()

uint32_t submenu_get_selected_item ( Submenu * submenu)

Get submenu selected item index.

Parameters
submenuSubmenu instance
Returns
Index of the selected item

◆ submenu_get_view()

View * submenu_get_view ( Submenu * submenu)

Get submenu view.

Parameters
submenuSubmenu instance
Returns
View instance that can be used for embedding

◆ submenu_reset()

void submenu_reset ( Submenu * submenu)

Remove all items from submenu.

Parameters
submenuSubmenu instance

◆ submenu_set_header()

void submenu_set_header ( Submenu * submenu,
const char * header )

Set optional header for submenu.

Parameters
submenuSubmenu instance
headerheader to set

◆ submenu_set_selected_item()

void submenu_set_selected_item ( Submenu * submenu,
uint32_t index )

Set submenu selected item by index.

Parameters
submenuSubmenu instance
indexThe index of the selected item