flipperzero-firmware/lib/app-scened-template/view-modules/submenu-vm.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

42 lines
1002 B
C++

#pragma once
#include "generic-view-module.h"
#include <gui/modules/submenu.h>
class SubmenuVM : public GenericViewModule {
public:
SubmenuVM();
~SubmenuVM() final;
View* get_view() final;
void clean() final;
/**
* @brief Add item to submenu
*
* @param label - menu item label
* @param index - menu item index, used for callback, may be the same with other items
* @param callback - menu item callback
* @param callback_context - menu item callback context
*/
void add_item(
const char* label,
uint32_t index,
SubmenuItemCallback callback,
void* callback_context);
/**
* @brief Set submenu item selector
*
* @param index index of the item to be selected
*/
void set_selected_item(uint32_t index);
/**
* @brief Set optional header for submenu
*
* @param header header to set
*/
void set_header(const char* header);
private:
Submenu* submenu;
};