Rich menu widget with item icons and sub-labels.
More...
Go to the source code of this file.
|
|
typedef struct Menu | Menu |
| | Menu opaque structure.
|
| |
| typedef void(* | MenuItemCallback) (uint32_t index, void *context) |
| | Menu item callback function type.
|
| |
Rich menu widget with item icons and sub-labels.
◆ MenuItemCallback
| typedef void(* MenuItemCallback) (uint32_t index, void *context) |
Menu item callback function type.
- Parameters
-
| [in] | index | index value that the item was created with |
| [in,out] | context | pointer to a user-specific object |
◆ menu_add_item()
| void menu_add_item |
( |
Menu * | instance, |
|
|
const char * | label, |
|
|
const char * | sub_label, |
|
|
const char * | icon_source, |
|
|
uint32_t | index, |
|
|
MenuItemCallback | callback, |
|
|
void * | context ) |
Add an item to a Menu instance.
- Parameters
-
| [in,out] | instance | pointer to the Menu instance to be modified |
| [in] | label | zero-terminated string containing the item text |
| [in] | sub_label | zero-terminated string containing the auxiliary item text (may be NULL) |
| [in] | icon_source | zero-terminated string containing a full path to the icon file |
| [in] | index | item identifier, doesn't have to be unique |
| [in] | callback | pointer to the function to be called when the item is clicked |
| [in,out] | context | pointer to a user-specific object, will be passed to callback |
◆ menu_alloc()
Create a new Menu instance.
- Parameters
-
| [in,out] | parent | pointer to the parent Widget instance |
- Returns
- pointer to the newly created Menu instance
◆ menu_free()
| void menu_free |
( |
Menu * | instance | ) |
|
Delete a Menu instance.
- Parameters
-
| [in,out] | instance | pointer to the Menu instance to be deleted |
◆ menu_get_base()
Get a pointer to the base class instance.
The return value can be used in all Widget methods.
- Parameters
-
| [in,out] | instance | pointer to the Menu instance to be queried |
- Returns
- pointer to the base class instance
◆ menu_get_selected_item_index()
| uint32_t menu_get_selected_item_index |
( |
const Menu * | instance | ) |
|
Get the index of the selected item in a Menu instance.
- Parameters
-
| [in] | instance | pointer to the Menu instance to be queried |
- Returns
- index of the selected item that was provided when adding it
◆ menu_reset()
| void menu_reset |
( |
Menu * | instance | ) |
|
Remove all items from a Menu instance.
- Parameters
-
| [in,out] | instance | pointer to the Menu instance to be modified |
◆ menu_set_selected_item_index()
| void menu_set_selected_item_index |
( |
Menu * | instance, |
|
|
uint32_t | index ) |
Select the item in a Menu instance with a matching index.
- Note
- If two or more items share the same index, only the first of them will be selected.
- Parameters
-
| [in,out] | instance | pointer to the Menu instance to be modified |
| [in] | index | the index of the item to be selected |