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

GUI: ButtonMenu view module API. More...

#include <stdint.h>
#include <gui/view.h>

Go to the source code of this file.

Typedefs

typedef struct ButtonMenu ButtonMenu
 ButtonMenu anonymous structure.
 
typedef struct ButtonMenuItem ButtonMenuItem
 ButtonMenuItem anonymous structure.
 
typedef void(* ButtonMenuItemCallback) (void *context, int32_t index, InputType type)
 Callback for any button menu actions.
 

Enumerations

enum  ButtonMenuItemType { ButtonMenuItemTypeCommon , ButtonMenuItemTypeControl }
 Type of button. More...
 

Functions

Viewbutton_menu_get_view (ButtonMenu *button_menu)
 Get button menu view.
 
void button_menu_reset (ButtonMenu *button_menu)
 Clean button menu.
 
ButtonMenuItembutton_menu_add_item (ButtonMenu *button_menu, const char *label, int32_t index, ButtonMenuItemCallback callback, ButtonMenuItemType type, void *callback_context)
 Add item to button menu instance.
 
ButtonMenubutton_menu_alloc (void)
 Allocate and initialize new instance of ButtonMenu model.
 
void button_menu_free (ButtonMenu *button_menu)
 Free ButtonMenu element.
 
void button_menu_set_header (ButtonMenu *button_menu, const char *header)
 Set ButtonMenu header on top of canvas.
 
void button_menu_set_selected_item (ButtonMenu *button_menu, uint32_t index)
 Set selected item.
 

Detailed Description

GUI: ButtonMenu view module API.

Enumeration Type Documentation

◆ ButtonMenuItemType

Type of button.

Difference in drawing buttons.

Function Documentation

◆ button_menu_add_item()

ButtonMenuItem * button_menu_add_item ( ButtonMenu * button_menu,
const char * label,
int32_t index,
ButtonMenuItemCallback callback,
ButtonMenuItemType type,
void * callback_context )

Add item to button menu instance.

Parameters
button_menuButtonMenu instance
labeltext inside new button
indexvalue to distinct between buttons inside ButtonMenuItemCallback
callbackThe callback
typetype of button to create. Differ by button drawing. Control buttons have no frames, and have more squared borders.
callback_contextThe callback context
Returns
pointer to just-created item

◆ button_menu_alloc()

ButtonMenu * button_menu_alloc ( void )

Allocate and initialize new instance of ButtonMenu model.

Returns
just-created ButtonMenu model

◆ button_menu_free()

void button_menu_free ( ButtonMenu * button_menu)

Free ButtonMenu element.

Parameters
button_menuButtonMenu instance

◆ button_menu_get_view()

View * button_menu_get_view ( ButtonMenu * button_menu)

Get button menu view.

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

◆ button_menu_reset()

void button_menu_reset ( ButtonMenu * button_menu)

Clean button menu.

Parameters
button_menuButtonMenu instance

◆ button_menu_set_header()

void button_menu_set_header ( ButtonMenu * button_menu,
const char * header )

Set ButtonMenu header on top of canvas.

Parameters
button_menuButtonMenu instance
headerheader on the top of button menu

◆ button_menu_set_selected_item()

void button_menu_set_selected_item ( ButtonMenu * button_menu,
uint32_t index )

Set selected item.

Parameters
button_menuButtonMenu instance
indexindex of ButtonMenu to be selected