all repos — mgba @ 927f8b0d8859fbfb8fe3f75e8ff8460ff74adf26

mGBA Game Boy Advance Emulator

include/mgba-util/gui/menu.h (view raw)

 1/* Copyright (c) 2013-2015 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef GUI_MENU_H
 7#define GUI_MENU_H
 8
 9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba-util/vector.h>
14
15struct GUIMenu;
16struct GUIMenuItem {
17	const char* title;
18	void* data;
19	unsigned state;
20	const char* const* validStates;
21	unsigned nStates;
22	struct GUIMenu* submenu;
23};
24
25DECLARE_VECTOR(GUIMenuItemList, struct GUIMenuItem);
26
27struct GUIBackground;
28struct GUIMenu {
29	const char* title;
30	const char* subtitle;
31	struct GUIMenuItemList items;
32	size_t index;
33	struct GUIBackground* background;
34};
35
36enum GUIMenuExitReason {
37	GUI_MENU_EXIT_ACCEPT,
38	GUI_MENU_EXIT_BACK,
39	GUI_MENU_EXIT_CANCEL,
40};
41
42enum GUIMessageBoxButtons {
43	GUI_MESSAGE_BOX_OK = 1,
44	GUI_MESSAGE_BOX_CANCEL = 2
45};
46
47struct GUIParams;
48enum GUIMenuExitReason GUIShowMenu(struct GUIParams* params, struct GUIMenu* menu, struct GUIMenuItem** item);
49
50ATTRIBUTE_FORMAT(printf, 4, 5)
51enum GUIMenuExitReason GUIShowMessageBox(struct GUIParams* params, int buttons, int frames, const char* format, ...);
52
53void GUIDrawBattery(struct GUIParams* params);
54void GUIDrawClock(struct GUIParams* params);
55
56CXX_GUARD_END
57
58#endif