ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
select_option.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 #ifndef GOT_VIEWS_DIALOGS_SELECT_OPTION_H
23 #define GOT_VIEWS_DIALOGS_SELECT_OPTION_H
24 
25 #include "got/views/dialogs/dialog.h"
26 
27 namespace Got {
28 namespace Views {
29 namespace Dialogs {
30 
31 // Commonly used options across multiple dialogs
32 extern const char *ON_OFF[];
33 extern const char *YES_NO[];
34 
35 class SelectOption : public Dialog {
36 private:
37  Common::String _title;
38  Common::StringArray _options;
39  int _hammerFrame = 0;
40  int _smackCtr = 0;
41 
42 protected:
43  int _selectedItem = 0;
44 
45  void setContent(const Common::String &title,
46  const Common::StringArray &options);
47  virtual void closed() {}
48  virtual void selected() {}
49 
50 public:
51  SelectOption(const Common::String &name, const char *title, const char *options[]);
52  SelectOption(const Common::String &name);
53  virtual ~SelectOption() {}
54 
55  bool msgFocus(const FocusMessage &msg) override;
56  bool msgAction(const ActionMessage &msg) override;
57  void draw() override;
58  bool tick() override;
59 };
60 
61 } // namespace Dialogs
62 } // namespace Views
63 } // namespace Got
64 
65 #endif
Definition: str.h:59
Definition: dialog.h:31
Definition: messages.h:34
Definition: messages.h:90
Definition: select_option.h:35
Definition: console.h:28