mirror of https://github.com/mgba-emu/mgba.git
GUI: Submenus
This commit is contained in:
parent
d724d914c8
commit
44736f89be
|
@ -56,7 +56,14 @@ enum GUIMenuExitReason GUIShowMenu(struct GUIParams* params, struct GUIMenu* men
|
||||||
}
|
}
|
||||||
if (newInput & (1 << GUI_INPUT_SELECT)) {
|
if (newInput & (1 << GUI_INPUT_SELECT)) {
|
||||||
*item = *GUIMenuItemListGetPointer(&menu->items, menu->index);
|
*item = *GUIMenuItemListGetPointer(&menu->items, menu->index);
|
||||||
return GUI_MENU_EXIT_ACCEPT;
|
if (item->submenu) {
|
||||||
|
enum GUIMenuExitReason reason = GUIShowMenu(params, item->submenu, item);
|
||||||
|
if (reason != GUI_MENU_EXIT_BACK) {
|
||||||
|
return reason;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return GUI_MENU_EXIT_ACCEPT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (newInput & (1 << GUI_INPUT_BACK)) {
|
if (newInput & (1 << GUI_INPUT_BACK)) {
|
||||||
return GUI_MENU_EXIT_BACK;
|
return GUI_MENU_EXIT_BACK;
|
||||||
|
|
|
@ -8,9 +8,11 @@
|
||||||
|
|
||||||
#include "util/vector.h"
|
#include "util/vector.h"
|
||||||
|
|
||||||
|
struct GUIMenu;
|
||||||
struct GUIMenuItem {
|
struct GUIMenuItem {
|
||||||
const char* title;
|
const char* title;
|
||||||
void* data;
|
void* data;
|
||||||
|
struct GUIMenu* submenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
DECLARE_VECTOR(GUIMenuItemList, struct GUIMenuItem);
|
DECLARE_VECTOR(GUIMenuItemList, struct GUIMenuItem);
|
||||||
|
|
Loading…
Reference in New Issue