mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-24 05:23:06 +00:00
6c74ea65c2
* Add saving to SD-Card (not ready yet) * Add saving to SD-card (done) * Select previous menu item * Fix central button * Fix current_button * Refactoring * Add notifications * [FL-1417] Add IRDA CLI CLI commands: 1) ir_rx Receives all IR-trafic, decodes and prints result to stdout 2) ir_tx <protocol> <address> <command> Transmits IR-signal. Address and command are hex-formatted * Fix BUG with random memory corruption at random time in random place in random universe in random unknown space and time forever amen * Fix submenu set_selected_item * Bring protocol order back * Add TODO sdcard check
80 lines
2.2 KiB
C
80 lines
2.2 KiB
C
#pragma once
|
|
#include <stdint.h>
|
|
#include <gui/view.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* ButtonMenu anonymous structure */
|
|
typedef struct ButtonMenu ButtonMenu;
|
|
typedef struct ButtonMenuItem ButtonMenuItem;
|
|
|
|
/* Callback for any button menu actions */
|
|
typedef void (*ButtonMenuItemCallback)(void* context, int32_t index);
|
|
|
|
/* Type of button. Difference in drawing buttons. */
|
|
typedef enum {
|
|
ButtonMenuItemTypeCommon,
|
|
ButtonMenuItemTypeControl,
|
|
} ButtonMenuItemType;
|
|
|
|
/**
|
|
* @brief Get button menu view
|
|
* @param button_menu - ButtonMenu instance
|
|
* @return View instance that can be used for embedding
|
|
*/
|
|
View* button_menu_get_view(ButtonMenu* button_menu);
|
|
|
|
/**
|
|
* @brief Clean button menu
|
|
* @param button_menu - ButtonMenu instance
|
|
*/
|
|
void button_menu_clean(ButtonMenu* button_menu);
|
|
|
|
/**
|
|
* @brief Add item to button menu instance
|
|
* @param button_menu - ButtonMenu instance
|
|
* @param label - text inside new button
|
|
* @param index - value to distinct between buttons inside ButtonMenuItemCallback
|
|
* @param type - type of button to create. Differ by button drawing.
|
|
* Control buttons have no frames, and have more squared borders.
|
|
* @return pointer to just-created item
|
|
*/
|
|
ButtonMenuItem* button_menu_add_item(
|
|
ButtonMenu* button_menu,
|
|
const char* label,
|
|
int32_t index,
|
|
ButtonMenuItemCallback callback,
|
|
ButtonMenuItemType type,
|
|
void* callback_context);
|
|
|
|
/**
|
|
* @brief Allocate and initialize new instance of ButtonMenu model
|
|
* @return just-created ButtonMenu model
|
|
*/
|
|
ButtonMenu* button_menu_alloc(void);
|
|
|
|
/**
|
|
* @brief Free ButtonMenu element
|
|
* @param button_menu - ButtonMenu instance
|
|
*/
|
|
void button_menu_free(ButtonMenu* button_menu);
|
|
|
|
/**
|
|
* @brief Set ButtonMenu header on top of canvas
|
|
* @param button_menu - ButtonMenu instance
|
|
* @param header - header on the top of button menu
|
|
*/
|
|
void button_menu_set_header(ButtonMenu* button_menu, const char* header);
|
|
|
|
/**
|
|
* @brief Set selected item
|
|
* @param button_menu - ButtonMenu instance
|
|
* @param index - index of ButtonMenu to be selected
|
|
*/
|
|
void button_menu_set_selected_item(ButtonMenu* button_menu, uint32_t index);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|