diff options
author | あく <alleteam@gmail.com> | 2021-09-29 07:18:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-29 07:18:28 +0300 |
commit | 8b6c466058a63922e7846ebffcfc7b14884d455a (patch) | |
tree | 1a4526be372a646c1f4d9915b7c22ab472b5098f /applications/gui | |
parent | 0126b3aba474b84fc5dfe57bcd42c5b9fc05e634 (diff) |
Loader: forget menu position on main menu reentry, proper NULL arg passing. Gui: set current item for menu gui module. (#729)
Diffstat (limited to 'applications/gui')
-rwxr-xr-x | applications/gui/modules/menu.c | 12 | ||||
-rwxr-xr-x | applications/gui/modules/menu.h | 6 |
2 files changed, 18 insertions, 0 deletions
diff --git a/applications/gui/modules/menu.c b/applications/gui/modules/menu.c index e09437d9..3fe709c7 100755 --- a/applications/gui/modules/menu.c +++ b/applications/gui/modules/menu.c @@ -160,6 +160,18 @@ void menu_clean(Menu* menu) { }); } +void menu_set_selected_item(Menu* menu, uint32_t index) { + with_view_model( + menu->view, (MenuModel * model) { + if(index >= MenuItemArray_size(model->items)) { + return false; + } + + model->position = index; + return true; + }); +} + static void menu_process_up(Menu* menu) { with_view_model( menu->view, (MenuModel * model) { diff --git a/applications/gui/modules/menu.h b/applications/gui/modules/menu.h index 2abc2fc8..26c83c0c 100755 --- a/applications/gui/modules/menu.h +++ b/applications/gui/modules/menu.h @@ -47,6 +47,12 @@ void menu_add_item( */ void menu_clean(Menu* menu); +/** Set current menu item + * @param submenu + * @param index + */ +void menu_set_selected_item(Menu* menu, uint32_t index); + #ifdef __cplusplus } #endif |