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, InputType type) |
| Callback type to call for handling selecting button_panel items. | |
Functions | |
| ButtonPanel * | button_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. | |
| View * | button_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. | |
GUI: ButtonPanel view module API.
| 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.
| button_panel | ButtonPanel instance |
| x | x-coordinate to place icon |
| y | y-coordinate to place icon |
| icon_name | name of the icon to draw |
| 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.
| button_panel | ButtonPanel instance |
| index | value to pass to callback |
| matrix_place_x | coordinates by x-axis on virtual grid, it is only used for navigation |
| matrix_place_y | coordinates by y-axis on virtual grid, it is only used for naviagation |
| x | x-coordinate to draw icon on |
| y | y-coordinate to draw icon on |
| icon_name | name of the icon to draw |
| icon_name_selected | name of the icon to draw when current element is selected |
| callback | function to call when specific element is selected (pressed Ok on selected item) |
| callback_context | context to pass to callback |
| 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.
| button_panel | ButtonPanel instance |
| x | x-coordinate to place label |
| y | y-coordinate to place label |
| font | font to write label with |
| label_str | string label to write |
| ButtonPanel * button_panel_alloc | ( | void | ) |
Allocate new button_panel module.
| void button_panel_free | ( | ButtonPanel * | button_panel | ) |
Free button_panel module.
| button_panel | ButtonPanel instance |
| View * button_panel_get_view | ( | ButtonPanel * | button_panel | ) |
Get button_panel view.
| button_panel | ButtonPanel instance |
| 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.
| button_panel | ButtonPanel instance |
| reserve_x | number of columns in button_panel |
| reserve_y | number of rows in button_panel |
| void button_panel_reset | ( | ButtonPanel * | button_panel | ) |
Free items from button_panel module.
Preallocated matrix stays unchanged.
| button_panel | ButtonPanel instance |