7afdd14a4c
* Gui: ported submenu and view_dispatcher_remove_view from iButton branch * App gui-test: use backported submenu api * App subghz: initial commit * App subghz: syntax fix * App gui-test: fix submenu callback * App subghz: add subfolders to build * Gui view: c++ verison of with_view_model * Subghz app: simple spectrum settings view * Subghz app: add spectrum settings view to view manager * Subghz app: spectrum settings scene Co-authored-by: coreglitch <mail@s3f.ru>
51 lines
1.3 KiB
C
51 lines
1.3 KiB
C
#pragma once
|
|
#include <gui/view.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Submenu anonymous structure */
|
|
typedef struct Submenu Submenu;
|
|
typedef struct SubmenuItem SubmenuItem;
|
|
typedef void (*SubmenuItemCallback)(void* context, uint32_t index);
|
|
|
|
/* Allocate and initialize submenu
|
|
* This submenu is used to select one option
|
|
*/
|
|
Submenu* submenu_alloc();
|
|
|
|
/* Deinitialize and free submenu
|
|
* @param submenu - Submenu instance
|
|
*/
|
|
void submenu_free(Submenu* submenu);
|
|
|
|
/* Get submenu view
|
|
* @param submenu - Submenu instance
|
|
* @return View instance that can be used for embedding
|
|
*/
|
|
View* submenu_get_view(Submenu* submenu);
|
|
|
|
/* Add item to submenu
|
|
* @param submenu - Submenu instance
|
|
* @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
|
|
* @return SubmenuItem instance that can be used to modify or delete that item
|
|
*/
|
|
SubmenuItem* submenu_add_item(
|
|
Submenu* submenu,
|
|
const char* label,
|
|
uint32_t index,
|
|
SubmenuItemCallback callback,
|
|
void* callback_context);
|
|
|
|
/* Remove all items from submenu
|
|
* @param submenu - Submenu instance
|
|
*/
|
|
void submenu_clean(Submenu* submenu);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif |