unleashed-firmware/applications/gui/modules/menu.h
gornekich 61c8f3325a
[FL-1217] Menu refactoring (#726)
* menu: remove dead code
* loader: change views from modules instead of menu service
* dolphin: start main menu with loader API
* applications: don't start menu service
* loader: add debug tools menu
* gui modules: introduce menu model
* loader: remove calls to menu service API
* gui modules: implement menu module
* loader: add menu view
* gui menu: add animation
* applications: remove menu service
* gui modules: rename icon_menu -> menu
* loader: clean up code
* menu module: add documentation, format code
* menu: remove unused parameter
* desktop: use loader to launch primary menu
* Applications: cleaner makefile app declaration. Loader: application autostart
* Gui: cleanup menu and submenu API.

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-09-28 16:10:13 +03:00

52 lines
1 KiB
C
Executable file

#pragma once
#include <gui/view.h>
#ifdef __cplusplus
extern "C" {
#endif
/** Menu anonymous structure */
typedef struct Menu Menu;
typedef void (*MenuItemCallback)(void* context, uint32_t index);
/** Menu allocation and initialization
* @return Menu instance
*/
Menu* menu_alloc();
/** Free menu
* @param menu - Menu instance
*/
void menu_free(Menu* menu);
/** Get Menu view
* @param menu - Menu instance
* @return View instance
*/
View* menu_get_view(Menu* menu);
/** Add item to menu
* @param menu - Menu instance
* @param label - menu item string label
* @param icon - IconAnimation instance
* @param index - menu item index
* @param callback - MenuItemCallback instance
* @param context - pointer to context
*/
void menu_add_item(
Menu* menu,
const char* label,
IconAnimation* icon,
uint32_t index,
MenuItemCallback callback,
void* context);
/** Clean menu
* Note: this function does not free menu instance
* @param menu - Menu instance
*/
void menu_clean(Menu* menu);
#ifdef __cplusplus
}
#endif