ScummVM API documentation
OptionMenu.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * This code is based on the CRAB engine
24 *
25 * Copyright (c) Arvind Raja Yadav
26 *
27 * Licensed under MIT
28 *
29 */
30
31#ifndef CRAB_OPTIONMENU_H
32#define CRAB_OPTIONMENU_H
33
34#include "crab/timer.h"
35#include "crab/ui/GeneralSettingMenu.h"
36#include "crab/ui/GfxSettingMenu.h"
37#include "crab/ui/ImageData.h"
38#include "crab/ui/KeyBindMenu.h"
39#include "crab/ui/StateButton.h"
40#include "crab/ui/ToggleButton.h"
41#include "crab/ui/slider.h"
42
43namespace Crab {
44
45namespace pyrodactyl {
46namespace ui {
48 // What overall state the menu is in
49 enum {
50 STATE_GENERAL,
51 STATE_GRAPHICS,
52 STATE_KEYBOARD,
53 STATE_CONTROLLER,
54 STATE_ENTER_W,
55 STATE_ENTER_H,
56 STATE_CONFIRM
57 } _state;
58
59 // The overall menu for switching between states
60 // The second last button is save, the last button is cancel
62
63 // The background image
64 ImageData _bg;
65
66 // The graphical settings menu
67 GfxSettingMenu _gfx;
68
69 // The general settings menu
70 GeneralSettingMenu _general;
71
72 // Keyboard controls menu
73 KeyBindMenu _keybind;
74
75 // The controller controls are just drawn in a single image, no reassign options
76 ImageData _conbind;
77
78 // The UI for accepting/rejecting change in resolution
79 HoverInfo _noticeRes;
80 ImageData _questionbox;
81 Button _accept, _cancel;
82
83 // If the user wants to input a custom resolution, these are used along with the question box
84 TextArea _promptW, _promptH;
85
86 // The countdown until the timer resets
87 TextData _countdown;
88 Timer _timer;
89
90 // Function to draw the main menu (controls, settings, save, cancel)
91 bool handleTabs(Button &back, const Common::Event &event);
92
93public:
94 bool _loaded;
95
96 OptionMenu() {
97 _loaded = false;
98 _state = STATE_GENERAL;
99 _menu.useKeyboard(true);
100 }
101 ~OptionMenu() {}
102
103 void reset();
104 bool disableHotkeys() {
105 return _keybind.disableHotkeys();
106 }
107
108 void load(const Common::Path &filename);
109 void draw(Button &back);
110 bool handleEvents(Button &back, const Common::Event &event);
111 void internalEvents();
112
113 void setUI();
114 void saveState();
115};
116
117} // End of namespace ui
118} // End of namespace pyrodactyl
119
120} // End of namespace Crab
121
122#endif // CRAB_OPTIONMENU_H
Definition: path.h:52
Definition: timer.h:43
Definition: button.h:86
Definition: GeneralSettingMenu.h:42
Definition: GfxSettingMenu.h:44
Definition: HoverInfo.h:41
Definition: ImageData.h:40
Definition: KeyBindMenu.h:42
Definition: menu.h:47
Definition: OptionMenu.h:47
Definition: textarea.h:45
Definition: TextData.h:41
Definition: events.h:218