ScummVM API documentation
dialogs.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 XEEN_DIALOGS_H
23#define XEEN_DIALOGS_H
24
25#include "common/array.h"
26#include "common/stack.h"
27#include "common/rect.h"
28#include "mm/xeen/cutscenes.h"
29#include "mm/xeen/sprites.h"
30#include "mm/shared/xeen/xsurface.h"
31
32namespace MM {
33namespace Xeen {
34
35class XeenEngine;
36
37class UIButton {
38public:
39 Common::Rect _bounds;
40 SpriteResource *_sprites;
41 int _value;
42 uint _frameNum, _selectedFrame;
43 bool _draw;
44#ifdef USE_TTS
45 uint8 _ttsIndex;
46 bool _canVoice;
47#endif
48
52 UIButton(const Common::Rect &bounds, int value, uint frameNum, SpriteResource *sprites, bool draw, uint8 ttsIndex, bool ttsCanVoice) :
53 _bounds(bounds), _value(value), _frameNum(frameNum), _selectedFrame(frameNum | 1),
54 _sprites(sprites), _draw(draw) {
55#ifdef USE_TTS
56 _ttsIndex = ttsIndex;
57 _canVoice = ttsCanVoice;
58#endif
59 }
60
64 UIButton() : _value(0), _frameNum(0), _selectedFrame(0), _sprites(nullptr), _draw(false) {
65#ifdef USE_TTS
66 _ttsIndex = 0;
67 _canVoice = false;
68#endif
69 }
70
74 void setFrame(uint frameNum) {
75 _frameNum = frameNum;
76 _selectedFrame = frameNum | 1;
77 }
78
82 void setFrame(uint frameNum, uint selectedFrame) {
83 _frameNum = frameNum;
84 _selectedFrame = selectedFrame;
85 }
86};
87
88class ButtonContainer : public Cutscenes {
89private:
91protected:
93 Common::StringArray _textStrings;
94 Common::Rect _waitBounds;
95 int _buttonValue;
96#ifdef USE_TTS
97 Common::StringArray _buttonTexts;
98 int _previousButton;
99#endif
100
101 bool checkEvents(XeenEngine *vm);
102
109 bool doScroll(bool rollUp, bool fadeIn) override;
110
115 void loadStrings(const Common::Path &name);
116
122 void loadStrings(const Common::Path &name, int ccMode);
123
129
130#ifdef USE_TTS
139 Common::String getNextTextSection(const Common::String &text, uint &index, uint count, const char *separator) const;
140
148 Common::String getNextTextSection(const Common::String &text, uint &index, uint count) const;
149
156 Common::String getNextTextSection(const Common::String &text, uint &index) const;
157
165
173 Common::String addNextTextToButtons(const Common::String &text, uint &index, uint count);
174
180
186 void disableButtonVoicing(uint startIndex, uint endIndex);
187
193 void enableButtonVoicing(uint startIndex, uint endIndex);
194#endif
195public:
196 ButtonContainer(XeenEngine *vm) : Cutscenes(vm), _buttonValue(0) {
197#ifdef USE_TTS
198 _previousButton = -1;
199#endif
200 }
201
206
207 void clearButtons();
208
209 void restoreButtons();
210
211 void addButton(const Common::Rect &bounds, int val,
212 SpriteResource *sprites = nullptr, uint8 ttsIndex = UINT8_MAX);
213 void addButton(const Common::Rect &bounds, int val,
214 int frameNum, SpriteResource *sprites = nullptr, uint8 ttsIndex = UINT8_MAX);
215
216 void addPartyButtons(XeenEngine *vm);
217
221 void drawButtons(XSurface *surface);
222
226 void clearEvents() { _buttonValue = 0; }
227
228#ifdef USE_TTS
233#endif
234};
235
237protected:
238 virtual void showContents(SpriteResource &title1, bool mode);
239public:
241
242 ~SettingsBaseDialog() override {}
243};
244
245} // End of namespace Xeen
246} // End of namespace MM
247
248#endif
Definition: array.h:52
Definition: path.h:52
Definition: stack.h:102
Definition: str.h:59
Definition: sprites.h:52
Definition: xsurface.h:45
Definition: dialogs.h:88
void enableButtonVoicing(uint startIndex, uint endIndex)
Common::String getNextTextSection(const Common::String &text, uint &index, uint count) const
void loadStrings(const Common::Path &name, int ccMode)
void drawButtons(XSurface *surface)
Common::String getNextTextSection(const Common::String &text, uint &index, uint count, const char *separator) const
Common::String addNextTextToButtons(const Common::String &text, uint &index)
void loadStrings(const Common::Path &name)
void clearEvents()
Definition: dialogs.h:226
Common::String getNextTextSection(const Common::String &text, uint &index) const
void setButtonTexts(const Common::String &text)
void disableButtonVoicing(uint startIndex, uint endIndex)
bool doScroll(bool rollUp, bool fadeIn) override
Common::String addNextTextToButtons(const Common::String &text, uint &index, uint count)
Definition: cutscenes.h:34
Definition: dialogs.h:236
Definition: dialogs.h:37
void setFrame(uint frameNum)
Definition: dialogs.h:74
void setFrame(uint frameNum, uint selectedFrame)
Definition: dialogs.h:82
UIButton(const Common::Rect &bounds, int value, uint frameNum, SpriteResource *sprites, bool draw, uint8 ttsIndex, bool ttsCanVoice)
Definition: dialogs.h:52
UIButton()
Definition: dialogs.h:64
Definition: xeen.h:107
Definition: detection.h:27
Definition: rect.h:536