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 SCUMM_DIALOGS_H
23#define SCUMM_DIALOGS_H
24
25#include "common/str.h"
26#include "common/ustr.h"
27#include "common/keyboard.h"
28#include "gui/dialog.h"
29#include "engines/dialogs.h"
30
31namespace GUI {
32class CommandSender;
33class StaticTextWidget;
34}
35
36
37namespace Scumm {
38
39struct ResString {
40 int num;
41 char string[80];
42};
43
44class ScummEngine;
45
46class ScummDialog : public GUI::Dialog {
47public:
48 ScummDialog(int x, int y, int w, int h);
50
51protected:
52 typedef Common::String String;
54};
55
56#ifndef DISABLE_HELP
58public:
60 ~ScummMenuDialog() override;
61 void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
62
63protected:
64 GUI::Dialog *_helpDialog;
65};
66#endif
67
74class InfoDialog : public ScummDialog {
75protected:
76 ScummEngine *_vm;
77 U32String _message;
80
81public:
82 // arbitrary message
83 InfoDialog(ScummEngine *scumm, const U32String &message);
84 // from resources
85 InfoDialog(ScummEngine *scumm, int res);
86
87 void setInfoText(const U32String &message);
88
89 void handleMouseDown(int x, int y, int button, int clickCount) override {
90 setResult(0);
91 close();
92 }
93 void handleKeyDown(Common::KeyState state) override {
94 setResult(state.ascii);
95 close();
96 }
97
98 void reflowLayout() override;
99 const char *getPlainEngineString(int stringno, bool forceHardcodedString = false);
100
101protected:
102 // Query a string from the resources
103 const U32String queryResString(int stringno);
104 // Query hard coded string (copied over from the executable)
105 const ResString &getStaticResString(Common::Language lang, int stringno);
106};
107
112class PauseDialog : public InfoDialog {
113public:
114 PauseDialog(ScummEngine *scumm, int res);
115 void handleKeyDown(Common::KeyState state) override;
116};
117
122class ConfirmDialog : public InfoDialog {
123public:
124 ConfirmDialog(ScummEngine *scumm, int res);
125 void handleKeyDown(Common::KeyState state) override;
126
127protected:
128 char _yesKey, _noKey;
129};
130
136public:
137 ValueDisplayDialog(const Common::U32String &label, int minVal, int maxVal, int val, uint16 incKey, uint16 decKey);
138
139 void open() override;
140 void drawDialog(GUI::DrawLayer layerToDraw, bool resetClipping = true) override;
141 void handleTickle() override;
142 void handleMouseDown(int x, int y, int button, int clickCount) override {
143 close();
144 }
145 void handleKeyDown(Common::KeyState state) override;
146
147 void reflowLayout() override;
148
149protected:
150 enum {
151 kDisplayDelay = 1500
152 };
153 Common::U32String _label;
154 const int _min = 0, _max = 0;
155 const uint16 _incKey = 0, _decKey = 0;
156 int _percentBarWidth = 0;
157 int _value = 0;
158 uint32 _timer = 0;
159};
160
166public:
167 SubtitleSettingsDialog(ScummEngine *scumm, int value);
168
169 void open() override;
170 void handleTickle() override;
171 void handleMouseDown(int x, int y, int button, int clickCount) override {
172 close();
173 }
174 void handleKeyDown(Common::KeyState state) override;
175protected:
176 int _value;
177 uint32 _timer;
178
179 void cycleValue();
180};
181
182//The Indy IQ dialog
184public:
185 Indy3IQPointsDialog(ScummEngine *scumm, char* text);
186 void handleKeyDown(Common::KeyState state) override;
187};
188
190public:
191 DebugInputDialog(ScummEngine *scumm, char* text);
192 void handleKeyDown(Common::KeyState state) override;
193 bool done;
194 Common::String buffer;
195 Common::String mainText;
196};
197
202public:
204
205 int getSelectedDifficulty() const { return _difficulty; }
206protected:
207 void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
208
209private:
210 enum {
211 kStandardCmd = 'STDD',
212 kPracticeCmd = 'PRAD',
213 kExpertCmd = 'EXPD'
214 };
215
216 int _difficulty;
217};
218
223public:
224 ScummOptionsContainerWidget(GuiObject *boss, const Common::String &name, const Common::String &dialogLayout, const Common::String &domain) :
225 OptionsContainerWidget(boss, name, dialogLayout, domain) {
226 }
227
228 enum {
229 kEnhancementGroup1Cmd = 'ENH1',
230 kEnhancementGroup2Cmd = 'ENH2',
231 kEnhancementGroup3Cmd = 'ENH3',
232 kEnhancementGroup4Cmd = 'ENH4'
233 };
234
235 void load() override;
236 bool save() override;
237
238protected:
239 void createEnhancementsWidget(GuiObject *boss, const Common::String &name);
240 GUI::ThemeEval &addEnhancementsLayout(GUI::ThemeEval &layouts) const;
241 GUI::CheckboxWidget *createOriginalGUICheckbox(GuiObject *boss, const Common::String &name);
242 GUI::CheckboxWidget *createGammaCorrectionCheckbox(GuiObject *boss, const Common::String &name);
243 GUI::CheckboxWidget *createSegaShadowModeCheckbox(GuiObject *boss, const Common::String &name);
244 GUI::CheckboxWidget *createSegaCdWaitCursorWhenPausedCheckbox(GuiObject *boss, const Common::String &name);
245 GUI::CheckboxWidget *createCopyProtectionCheckbox(GuiObject *boss, const Common::String &name);
246#ifdef USE_TTS
247 GUI::CheckboxWidget *createEnableTTSCheckbox(GuiObject *boss, const Common::String &name);
248#endif
249 void updateAdjustmentSlider(GUI::SliderWidget *slider, GUI::StaticTextWidget *value);
250
251 Common::Array<GUI::CheckboxWidget *> _enhancementsCheckboxes;
252};
253
258public:
259 ScummGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain, const ExtraGuiOptions &options);
260 ~ScummGameOptionsWidget() override {};
261
262 void load() override;
263 bool save() override;
264
265private:
266 enum {
267 kSmoothScrollCmd = 'SMSC'
268 };
269
270#ifdef USE_SID_AUDIO
271 GUI::CheckboxWidget *_c64SidTypeCheckbox = nullptr;
272#endif
273 GUI::CheckboxWidget *_smoothScrollCheckbox = nullptr;
274 GUI::CheckboxWidget *_semiSmoothScrollCheckbox = nullptr;
275
276 void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
277 void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
278
279 ExtraGuiOptions _options;
281};
282
287public:
288 LoomEgaGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain);
289 ~LoomEgaGameOptionsWidget() override {};
290
291 void load() override;
292 bool save() override;
293
294private:
295 enum {
296 kOvertureTicksChanged = 'OTCH'
297 };
298
299 void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
300 void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
301
302 GUI::CheckboxWidget *_enableOriginalGUICheckbox = nullptr;
303 GUI::CheckboxWidget *_enableCopyProtectionCheckbox = nullptr;
304#ifdef USE_TTS
305 GUI::CheckboxWidget *_enableTTSCheckbox = nullptr;
306#endif
307
308 GUI::SliderWidget *_overtureTicksSlider = nullptr;
309 GUI::StaticTextWidget *_overtureTicksValue = nullptr;
310
311 void updateOvertureTicksValue();
312};
313
318public:
319 MacGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain, int gameId, const Common::String &extra);
320 ~MacGameOptionsWidget() override {};
321
322 void load() override;
323 bool save() override;
324private:
325 enum {
326 kQualitySliderUpdate = 'QUAL'
327 };
328 void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
329 void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
330 void updateQualitySlider();
331
332 GUI::CheckboxWidget *_enableOriginalGUICheckbox = nullptr;
333 GUI::CheckboxWidget *_enableGammaCorrectionCheckbox = nullptr;
334 GUI::CheckboxWidget *_enableCopyProtectionCheckbox = nullptr;
335#ifdef USE_TTS
336 GUI::CheckboxWidget *_enableTTSCheckbox = nullptr;
337#endif
338 GUI::SliderWidget *_sndQualitySlider = nullptr;
339 GUI::StaticTextWidget *_sndQualityValue = nullptr;
340 int _quality = 0;
341};
342
347public:
348 LoomVgaGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain);
349 ~LoomVgaGameOptionsWidget() override {};
350
351 void load() override;
352 bool save() override;
353
354private:
355 enum {
356 kPlaybackAdjustmentChanged = 'PBAC'
357 };
358
359 void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
360 void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
361
362 GUI::CheckboxWidget *_enableOriginalGUICheckbox = nullptr;
363#ifdef USE_TTS
364 GUI::CheckboxWidget *_enableTTSCheckbox = nullptr;
365#endif
366
367 GUI::SliderWidget *_playbackAdjustmentSlider = nullptr;
368 GUI::StaticTextWidget *_playbackAdjustmentValue = nullptr;
369
370 void updatePlaybackAdjustmentValue();
371};
372
377public:
378 MI1CdGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain);
379 ~MI1CdGameOptionsWidget() override {};
380
381 void load() override;
382 bool save() override;
383
384private:
385 enum {
386 kIntroAdjustmentChanged = 'IACH',
387 kOutlookAdjustmentChanged = 'OACH'
388 };
389
390 void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
391 void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
392
393 GUI::CheckboxWidget *_enableOriginalGUICheckbox = nullptr;
394 GUI::CheckboxWidget *_enableSegaShadowModeCheckbox = nullptr;
395 GUI::CheckboxWidget *_enableSegaCdWaitCursorWhenPausedCheckbox = nullptr;
396#ifdef USE_TTS
397 GUI::CheckboxWidget *_enableTTSCheckbox = nullptr;
398#endif
399
400 GUI::SliderWidget *_introAdjustmentSlider = nullptr;
401 GUI::StaticTextWidget *_introAdjustmentValue = nullptr;
402 GUI::SliderWidget *_outlookAdjustmentSlider = nullptr;
403 GUI::StaticTextWidget *_outlookAdjustmentValue = nullptr;
404
405 void updateIntroAdjustmentValue();
406 void updateOutlookAdjustmentValue();
407};
408
409#ifdef USE_ENET
415class HENetworkGameOptionsWidget : public ScummOptionsContainerWidget {
416public:
417 HENetworkGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain, const Common::String &&gameid);
418 ~HENetworkGameOptionsWidget() override {};
419
420 void load() override;
421 bool save() override;
422
423private:
424 enum {
425 kEnableSessionCmd = 'ENBS',
426 kResetServersCmd = 'CLRS',
427 };
428
429 Common::String _gameid;
430
431 void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
432 void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
433
434 GUI::CheckboxWidget *_audioOverride = nullptr;
435
436 GUI::CheckboxWidget *_enableSessionServer = nullptr;
437
438 GUI::EditTextWidget *_sessionServerAddr = nullptr;
439 GUI::ButtonWidget *_serverResetButton = nullptr;
440
441 GUI::CheckboxWidget *_enableLANBroadcast = nullptr;
442
443 GUI::CheckboxWidget *_generateRandomMaps = nullptr;
444
445 GUI::EditTextWidget *_lobbyServerAddr = nullptr;
446
447#ifdef USE_BASIC_NET
448 GUI::CheckboxWidget *_enableCompetitiveMods = nullptr;
449#endif
450
451 GUI::StaticTextWidget *_networkVersion = nullptr;
452};
453#endif
454
455} // End of namespace Scumm
456
457#endif
Definition: str.h:59
Definition: ustr.h:57
Definition: widget.h:241
Definition: widget.h:338
Definition: object.h:40
Definition: dialog.h:49
Definition: edittext.h:32
Definition: widget.h:542
OptionsContainerWidget(GuiObject *boss, const Common::String &name, const Common::String &dialogLayout, const Common::String &domain)
Definition: widget.h:414
Definition: widget.h:213
FontStyle
Font style selector.
Definition: ThemeEngine.h:274
Definition: ThemeEval.h:37
Definition: dialogs.h:38
Definition: dialogs.h:122
Definition: dialogs.h:189
Definition: dialogs.h:183
Definition: dialogs.h:74
Definition: dialogs.h:286
Definition: dialogs.h:201
Definition: dialogs.h:346
Definition: dialogs.h:376
Definition: dialogs.h:317
Definition: dialogs.h:112
Definition: dialogs.h:46
Definition: scumm.h:536
Definition: dialogs.h:257
Definition: dialogs.h:57
Definition: dialogs.h:222
Definition: dialogs.h:165
Definition: dialogs.h:135
void drawDialog(GUI::DrawLayer layerToDraw, bool resetClipping=true) override
Language
Definition: language.h:45
Definition: actor.h:30
Definition: keyboard.h:294
uint16 ascii
Definition: keyboard.h:310
Definition: dialogs.h:39