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

GUI: ButtonPanel view module API. More...

#include <gui/view.h>

Go to the source code of this file.

Typedefs

typedef struct ButtonPanel ButtonPanel
 Button panel module descriptor.
 
typedef void(* ButtonItemCallback) (void *context, uint32_t index)
 Callback type to call for handling selecting button_panel items.
 

Functions

ButtonPanelbutton_panel_alloc (void)
 Allocate new button_panel module.
 
void button_panel_free (ButtonPanel *button_panel)
 Free button_panel module.
 
void button_panel_reset (ButtonPanel *button_panel)
 Free items from button_panel module.
 
void button_panel_reserve (ButtonPanel *button_panel, size_t reserve_x, size_t reserve_y)
 Reserve space for adding items.
 
void button_panel_add_item (ButtonPanel *button_panel, uint32_t index, uint16_t matrix_place_x, uint16_t matrix_place_y, uint16_t x, uint16_t y, const Icon *icon_name, const Icon *icon_name_selected, ButtonItemCallback callback, void *callback_context)
 Add item to button_panel module.
 
Viewbutton_panel_get_view (ButtonPanel *button_panel)
 Get button_panel view.
 
void button_panel_add_label (ButtonPanel *button_panel, uint16_t x, uint16_t y, Font font, const char *label_str)
 Add label to button_panel module.
 
void button_panel_add_icon (ButtonPanel *button_panel, uint16_t x, uint16_t y, const Icon *icon_name)
 Add a non-button icon to button_panel module.
 

Detailed Description

GUI: ButtonPanel view module API.

Function Documentation

◆ button_panel_add_icon()

void button_panel_add_icon ( ButtonPanel * button_panel,
uint16_t x,
uint16_t y,
const Icon * icon_name )

Add a non-button icon to button_panel module.

Parameters
button_panelButtonPanel instance
xx-coordinate to place icon
yy-coordinate to place icon
icon_namename of the icon to draw

◆ button_panel_add_item()

void button_panel_add_item ( ButtonPanel * button_panel,
uint32_t index,
uint16_t matrix_place_x,
uint16_t matrix_place_y,
uint16_t x,
uint16_t y,
const Icon * icon_name,
const Icon * icon_name_selected,
ButtonItemCallback callback,
void * callback_context )

Add item to button_panel module.

Have to set element in bounds of allocated size by X and by Y.

Parameters
button_panelButtonPanel instance
indexvalue to pass to callback
matrix_place_xcoordinates by x-axis on virtual grid, it is only used for navigation
matrix_place_ycoordinates by y-axis on virtual grid, it is only used for naviagation
xx-coordinate to draw icon on
yy-coordinate to draw icon on
icon_namename of the icon to draw
icon_name_selectedname of the icon to draw when current element is selected
callbackfunction to call when specific element is selected (pressed Ok on selected item)
callback_contextcontext to pass to callback

◆ button_panel_add_label()

void button_panel_add_label ( ButtonPanel * button_panel,
uint16_t x,
uint16_t y,
Font font,
const char * label_str )

Add label to button_panel module.

Parameters
button_panelButtonPanel instance
xx-coordinate to place label
yy-coordinate to place label
fontfont to write label with
label_strstring label to write

◆ button_panel_alloc()

ButtonPanel * button_panel_alloc ( void )

Allocate new button_panel module.

Returns
ButtonPanel instance

◆ button_panel_free()

void button_panel_free ( ButtonPanel * button_panel)

Free button_panel module.

Parameters
button_panelButtonPanel instance

◆ button_panel_get_view()

View * button_panel_get_view ( ButtonPanel * button_panel)

Get button_panel view.

Parameters
button_panelButtonPanel instance
Returns
acquired view

◆ button_panel_reserve()

void button_panel_reserve ( ButtonPanel * button_panel,
size_t reserve_x,
size_t reserve_y )

Reserve space for adding items.

One does not simply use button_panel_add_item() without this function. It should be allocated space for it first.

Parameters
button_panelButtonPanel instance
reserve_xnumber of columns in button_panel
reserve_ynumber of rows in button_panel

◆ button_panel_reset()

void button_panel_reset ( ButtonPanel * button_panel)

Free items from button_panel module.

Preallocated matrix stays unchanged.

Parameters
button_panelButtonPanel instance