GUI: Submenus

This commit is contained in:
Jeffrey Pfau 2015-09-01 22:09:12 -07:00
parent d724d914c8
commit 44736f89be
2 changed files with 10 additions and 1 deletions

View File

@ -56,7 +56,14 @@ enum GUIMenuExitReason GUIShowMenu(struct GUIParams* params, struct GUIMenu* men
}
if (newInput & (1 << GUI_INPUT_SELECT)) {
*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)) {
return GUI_MENU_EXIT_BACK;

View File

@ -8,9 +8,11 @@
#include "util/vector.h"
struct GUIMenu;
struct GUIMenuItem {
const char* title;
void* data;
struct GUIMenu* submenu;
};
DECLARE_VECTOR(GUIMenuItemList, struct GUIMenuItem);