ScummVM API documentation
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 #ifdef USE_TTS
43  bool _titleVoiced = false;
44 #endif
45 
46 protected:
47  int _selectedItem = 0;
48 
49  void setContent(const Common::String &title,
50  const Common::StringArray &options);
51  virtual void closed() {}
52  virtual void selected() {}
53 
54 public:
55  SelectOption(const Common::String &name, const char *title, const char *options[]);
56  SelectOption(const Common::String &name);
57  virtual ~SelectOption() {}
58 
59  bool msgFocus(const FocusMessage &msg) override;
60  bool msgAction(const ActionMessage &msg) override;
61  void draw() override;
62  bool tick() override;
63 };
64 
65 } // namespace Dialogs
66 } // namespace Views
67 } // namespace Got
68 
69 #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