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 
31 namespace GUI {
32 class CommandSender;
33 class StaticTextWidget;
34 }
35 
36 
37 namespace Scumm {
38 
39 struct ResString {
40  int num;
41  char string[80];
42 };
43 
44 class ScummEngine;
45 
46 class ScummDialog : public GUI::Dialog {
47 public:
48  ScummDialog(int x, int y, int w, int h);
50 
51 protected:
52  typedef Common::String String;
54 };
55 
56 #ifndef DISABLE_HELP
58 public:
60  ~ScummMenuDialog() override;
61  void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
62 
63 protected:
64  GUI::Dialog *_helpDialog;
65 };
66 #endif
67 
74 class InfoDialog : public ScummDialog {
75 protected:
76  ScummEngine *_vm;
77  U32String _message;
78  GUI::StaticTextWidget *_text;
80 
81 public:
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 
101 protected:
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 
112 class PauseDialog : public InfoDialog {
113 public:
114  PauseDialog(ScummEngine *scumm, int res);
115  void handleKeyDown(Common::KeyState state) override;
116 };
117 
122 class ConfirmDialog : public InfoDialog {
123 public:
124  ConfirmDialog(ScummEngine *scumm, int res);
125  void handleKeyDown(Common::KeyState state) override;
126 
127 protected:
128  char _yesKey, _noKey;
129 };
130 
136 public:
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) 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 
149 protected:
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 
166 public:
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;
175 protected:
176  int _value;
177  uint32 _timer;
178 
179  void cycleValue();
180 };
181 
182 //The Indy IQ dialog
184 public:
185  Indy3IQPointsDialog(ScummEngine *scumm, char* text);
186  void handleKeyDown(Common::KeyState state) override;
187 };
188 
189 class DebugInputDialog : public InfoDialog {
190 public:
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 
202 public:
204 
205  int getSelectedDifficulty() const { return _difficulty; }
206 protected:
207  void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
208 
209 private:
210  enum {
211  kStandardCmd = 'STDD',
212  kPracticeCmd = 'PRAD',
213  kExpertCmd = 'EXPD'
214  };
215 
216  int _difficulty;
217 };
218 
223 public:
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 
238 protected:
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 *createCopyProtectionCheckbox(GuiObject *boss, const Common::String &name);
243  void updateAdjustmentSlider(GUI::SliderWidget *slider, GUI::StaticTextWidget *value);
244 
245  Common::Array<GUI::CheckboxWidget *> _enhancementsCheckboxes;
246 
247 };
248 
253 public:
254  ScummGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain, const ExtraGuiOptions &options);
255  ~ScummGameOptionsWidget() override {};
256 
257  void load() override;
258  bool save() override;
259 
260 private:
261  enum {
262  kSmoothScrollCmd = 'SMSC'
263  };
264 
265  GUI::CheckboxWidget *_smoothScrollCheckbox;
266  GUI::CheckboxWidget *_semiSmoothScrollCheckbox;
267 
268  void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
269  void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
270 
271  ExtraGuiOptions _options;
273 };
274 
279 public:
280  LoomEgaGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain);
281  ~LoomEgaGameOptionsWidget() override {};
282 
283  void load() override;
284  bool save() override;
285 
286 private:
287  enum {
288  kOvertureTicksChanged = 'OTCH'
289  };
290 
291  void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
292  void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
293 
294  GUI::CheckboxWidget *_enableOriginalGUICheckbox;
295  GUI::CheckboxWidget *_enableCopyProtectionCheckbox;
296 
297  GUI::SliderWidget *_overtureTicksSlider;
298  GUI::StaticTextWidget *_overtureTicksValue;
299 
300  void updateOvertureTicksValue();
301 };
302 
307 public:
308  MacGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain, int gameId, const Common::String &extra);
309  ~MacGameOptionsWidget() override {};
310 
311  void load() override;
312  bool save() override;
313 private:
314  enum {
315  kQualitySliderUpdate = 'QUAL'
316  };
317  void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
318  void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
319  void updateQualitySlider();
320 
321  GUI::CheckboxWidget *_enableOriginalGUICheckbox;
322  GUI::CheckboxWidget *_enableCopyProtectionCheckbox;
323  GUI::SliderWidget *_sndQualitySlider;
324  GUI::StaticTextWidget *_sndQualityValue;
325  int _quality;
326 };
327 
332 public:
333  LoomVgaGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain);
334  ~LoomVgaGameOptionsWidget() override {};
335 
336  void load() override;
337  bool save() override;
338 
339 private:
340  enum {
341  kPlaybackAdjustmentChanged = 'PBAC'
342  };
343 
344  void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
345  void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
346 
347  GUI::CheckboxWidget *_enableOriginalGUICheckbox;
348 
349  GUI::SliderWidget *_playbackAdjustmentSlider;
350  GUI::StaticTextWidget *_playbackAdjustmentValue;
351 
352  void updatePlaybackAdjustmentValue();
353 };
354 
359 public:
360  MI1CdGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain);
361  ~MI1CdGameOptionsWidget() override {};
362 
363  void load() override;
364  bool save() override;
365 
366 private:
367  enum {
368  kIntroAdjustmentChanged = 'IACH',
369  kOutlookAdjustmentChanged = 'OACH'
370  };
371 
372  void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
373  void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
374 
375  GUI::CheckboxWidget *_enableOriginalGUICheckbox;
376 
377  GUI::SliderWidget *_introAdjustmentSlider;
378  GUI::StaticTextWidget *_introAdjustmentValue;
379  GUI::SliderWidget *_outlookAdjustmentSlider;
380  GUI::StaticTextWidget *_outlookAdjustmentValue;
381 
382  void updateIntroAdjustmentValue();
383  void updateOutlookAdjustmentValue();
384 };
385 
386 #ifdef USE_ENET
387 
392 class HENetworkGameOptionsWidget : public ScummOptionsContainerWidget {
393 public:
394  HENetworkGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain, const Common::String &&gameid);
395  ~HENetworkGameOptionsWidget() override {};
396 
397  void load() override;
398  bool save() override;
399 
400 private:
401  enum {
402  kEnableSessionCmd = 'ENBS',
403  kResetServersCmd = 'CLRS',
404  };
405 
406  Common::String _gameid;
407 
408  void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
409  void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
410 
411  GUI::CheckboxWidget *_audioOverride;
412 
413  GUI::CheckboxWidget *_enableSessionServer;
414 
415  GUI::EditTextWidget *_sessionServerAddr;
416  GUI::ButtonWidget *_serverResetButton;
417 
418  GUI::CheckboxWidget *_enableLANBroadcast;
419 
420  GUI::CheckboxWidget *_generateRandomMaps;
421 
422  GUI::EditTextWidget *_lobbyServerAddr;
423 
424 #ifdef USE_LIBCURL
425  GUI::CheckboxWidget *_enableCompetitiveMods;
426 #endif
427 
428  GUI::StaticTextWidget *_networkVersion;
429 };
430 #endif
431 
432 } // End of namespace Scumm
433 
434 #endif
Definition: str.h:59
Definition: dialogs.h:306
Definition: dialogs.h:278
Definition: dialogs.h:39
Definition: array.h:52
Definition: dialogs.h:57
Definition: edittext.h:32
Definition: dialogs.h:183
Definition: dialogs.h:252
Definition: widget.h:329
Definition: widget.h:205
Definition: widget.h:405
Definition: dialogs.h:201
Definition: ThemeEval.h:37
Definition: dialogs.h:46
Definition: system.h:46
Definition: dialogs.h:135
Definition: dialogs.h:165
Definition: widget.h:532
Definition: scumm.h:519
Definition: ustr.h:57
FontStyle
Font style selector.
Definition: ThemeEngine.h:274
Definition: dialog.h:49
Definition: dialogs.h:331
Definition: keyboard.h:294
uint16 ascii
Definition: keyboard.h:310
Definition: dialogs.h:38
Definition: widget.h:233
Definition: dialogs.h:222
Definition: dialogs.h:358
Definition: dialogs.h:112
Definition: dialogs.h:189
Definition: actor.h:30
Definition: object.h:40
Definition: dialogs.h:74
Language
Definition: language.h:45
Definition: dialogs.h:122