ScummVM API documentation
widget.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 GUI_WIDGET_H
23 #define GUI_WIDGET_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/str.h"
28 #include "common/keyboard.h"
29 #include "graphics/font.h"
30 #include "graphics/managed_surface.h"
31 #include "gui/object.h"
32 #include "gui/ThemeEngine.h"
33 #include "common/text-to-speech.h"
34 #include "common/system.h"
35 #include "common/config-manager.h"
36 #include "common/events.h"
37 
38 namespace GUI {
39 
40 class ScrollContainerWidget;
41 
42 enum {
43  WIDGET_ENABLED = 1 << 0,
44  WIDGET_INVISIBLE = 1 << 1,
45  WIDGET_HILITED = 1 << 2,
46  WIDGET_PRESSED = 1 << 3,
47  WIDGET_CLEARBG = 1 << 4,
48  WIDGET_WANT_TICKLE = 1 << 5,
49  WIDGET_TRACK_MOUSE = 1 << 6,
50  /* Used by containers which need to receive
51  * mouse events in place of their children */
52  WIDGET_HOOK_DRAG = 1 << 7,
53  WIDGET_DYN_TOOLTIP = 1 << 8, // Widgets updates tooltip by coordinates
54 };
55 
56 enum {
57  kStaticTextWidget = 'TEXT',
58  kEditTextWidget = 'EDIT',
59  kButtonWidget = 'BTTN',
60  kCheckboxWidget = 'CHKB',
61  kRadiobuttonWidget = 'RDBT',
62  kSliderWidget = 'SLDE',
63  kListWidget = 'LIST',
64  kScrollBarWidget = 'SCRB',
65  kPopUpWidget = 'POPU',
66  kTabWidget = 'TABW',
67  kGraphicsWidget = 'GFXW',
68  kContainerWidget = 'CTNR',
69  kScrollContainerWidget = 'SCTR',
70  kRichTextWidget = 'RTXT',
71  kEEWidget = 'EEGG',
72 };
73 
74 enum {
75  kCaretBlinkTime = 300
76 };
77 
78 enum {
79  kPressedButtonTime = 200
80 };
81 
82 enum {
83  kPicButtonStateEnabled = 0,
84  kPicButtonHighlight = 1,
85  kPicButtonStateDisabled = 2,
86  kPicButtonStatePressed = 3,
87 
88  kPicButtonStateMax = 3
89 };
90 
91 enum {
92  kDragHookStateCancel = -2,
93  kDragHookStateMouseUp = -1,
94  kDragHookStateMouseMoved = 0,
95  kDragHookStateMouseDown = 1,
96 };
97 
98 /* Widget */
99 class Widget : public GuiObject {
100  friend class Dialog;
101 protected:
102  uint32 _type;
103  GuiObject *_boss;
104  Widget *_next;
105  bool _hasFocus;
107  Common::U32String _tooltip;
108 
109 private:
110  uint16 _flags;
111  bool _needsRedraw;
112 
113 public:
114  static Widget *findWidgetInChain(Widget *start, int x, int y);
115  static Widget *findWidgetInChain(Widget *start, const char *name);
116  static Widget *findWidgetInChain(Widget *w, uint32 type);
117  static bool containsWidgetInChain(Widget *start, Widget *search);
118 
119 public:
120  Widget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip = Common::U32String());
121  Widget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip = Common::U32String());
122  Widget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip = Common::U32String());
123  ~Widget() override;
124 
125  void init();
126 
127  void setNext(Widget *w) { _next = w; }
128  void setBoss(GuiObject *newBoss) { _boss = newBoss; }
129  Widget *next() { return _next; }
130 
131  int16 getAbsX() const override { return _x + _boss->getChildX(); }
132  int16 getAbsY() const override { return _y + _boss->getChildY(); }
133 
134  virtual void setPos(int x, int y) { _x = x; _y = y; }
135  virtual void setSize(int w, int h) { _w = w; _h = h; }
136 
138  virtual void getMinSize(int &minWidth, int &minHeight) { minHeight = -1; minWidth = -1; }
139 
140  virtual void handleMouseDown(int x, int y, int button, int clickCount) {}
141  virtual void handleMouseUp(int x, int y, int button, int clickCount) {}
142  virtual void handleMouseEntered(int button) {}
143  virtual void handleMouseLeft(int button) {}
144  virtual void handleMouseMoved(int x, int y, int button) {}
145  void handleMouseWheel(int x, int y, int direction) override { assert(_boss); _boss->handleMouseWheel(x, y, direction); }
146  virtual bool handleKeyDown(Common::KeyState state) { return false; } // Return true if the event was handled
147  virtual bool handleKeyUp(Common::KeyState state) { return false; } // Return true if the event was handled
148  virtual void handleOtherEvent(const Common::Event &evt) {}
149  virtual void handleTooltipUpdate(int x, int y) {}
150  virtual void handleTickle() {}
151  virtual bool handleDragHook(Widget *origTarget, int state, int x, int y, int button) { return false; }
152 
153  virtual void cancelDrag() {}
154  virtual void cancelTickle() {}
155 
157  virtual void markAsDirty();
158 
160  virtual void draw();
161 
162  void receivedFocus() { _hasFocus = true; receivedFocusWidget(); }
163  void lostFocus() { _hasFocus = false; lostFocusWidget(); }
164  virtual bool wantsFocus() { return false; }
165 
166  uint32 getType() const { return _type; }
167 
168  void setFlags(int flags);
169  void clearFlags(int flags);
170  int getFlags() const { return _flags; }
171 
172  void setEnabled(bool e);
173  bool isEnabled() const;
174 
175  void setVisible(bool e);
176  bool isVisible() const override;
177 
178  bool useRTL() const;
179 
180  uint8 parseHotkey(const Common::U32String &label);
181  Common::U32String cleanupHotkey(const Common::U32String &label);
182 
183  bool hasTooltip() const { return !_tooltip.empty(); }
184  const Common::U32String &getTooltip() const { return _tooltip; }
185  void setTooltip(const Common::U32String &tooltip) { _tooltip = tooltip; }
186  void setTooltip(const Common::String &tooltip) { _tooltip = Common::U32String(tooltip); }
187 
188  virtual bool containsWidget(Widget *) const { return false; }
189 
190  void read(const Common::U32String &str);
191 
192 protected:
193  void updateState(int oldFlags, int newFlags);
194 
195  virtual void drawWidget() = 0;
196 
197  virtual void receivedFocusWidget() {}
198  virtual void lostFocusWidget() {}
199 
200  virtual Widget *findWidget(int x, int y) { return this; }
201 
202  void releaseFocus() override { assert(_boss); _boss->releaseFocus(); }
203 
204  // Tickles are handled in Dialog
205  void registerTickleWidget(Widget *widget) override { assert(_boss); _boss->registerTickleWidget(widget); }
206  void unregisterTickleWidget(Widget *widget) override { assert(_boss); _boss->unregisterTickleWidget(widget); }
207 
208  // By default, delegate unhandled commands to the boss
209  void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override { assert(_boss); _boss->handleCommand(sender, cmd, data); }
210 };
211 
212 /* StaticTextWidget */
213 class StaticTextWidget : public Widget {
214 protected:
215  Common::U32String _label;
216  Graphics::TextAlign _align;
218  ThemeEngine::FontColor _fontColor;
219  bool _useEllipsis;
220 
221 public:
222  StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip = Common::U32String(), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold, Common::Language lang = Common::UNK_LANG, bool useEllipsis = true);
223  StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip = Common::U32String(), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold, Common::Language lang = Common::UNK_LANG, bool useEllipsis = true);
224  StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::U32String &text, const Common::U32String &tooltip = Common::U32String(), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold, Common::Language lang = Common::UNK_LANG, bool useEllipsis = true);
225  void setValue(int value);
226  void setLabel(const Common::U32String &label);
227  void handleMouseEntered(int button) override { readLabel(); }
228  const Common::U32String &getLabel() const { return _label; }
229  void setAlign(Graphics::TextAlign align);
230  Graphics::TextAlign getAlign() const { return _align; }
231  void readLabel() { read(_label); }
232  void setFontColor(ThemeEngine::FontColor color);
233 
234 protected:
235  void reflowLayout() override;
236  void drawWidget() override;
237  void setFont(ThemeEngine::FontStyle font, Common::Language lang);
238 };
239 
240 /* ButtonWidget */
242  friend class Dialog; // Needed for the hotkey handling
243 protected:
244  uint32 _cmd;
245  uint8 _hotkey;
246  uint8 _highresHotkey;
247  uint8 _lowresHotkey;
248  Common::U32String _lowresLabel;
249 public:
250  ButtonWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0, const Common::U32String &lowresLabel = Common::U32String());
251  ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0, const Common::U32String &lowresLabel = Common::U32String());
252  ButtonWidget(GuiObject *boss, const Common::String &name, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0, const Common::U32String &lowresLabel = Common::U32String());
253 
254  void getMinSize(int &minWidth, int &minHeight) override;
255 
256  void setCmd(uint32 cmd) { _cmd = cmd; }
257  uint32 getCmd() const { return _cmd; }
258 
259  void setLabel(const Common::U32String &label);
260  void setLabel(const Common::String &label);
261  void setLowresLabel(const Common::U32String &label);
262  const Common::U32String &getLabel();
263 
264  void handleMouseUp(int x, int y, int button, int clickCount) override;
265  void handleMouseDown(int x, int y, int button, int clickCount) override;
266  void handleMouseEntered(int button) override { readLabel(); if (_duringPress) { setFlags(WIDGET_PRESSED); } else { setFlags(WIDGET_HILITED); } markAsDirty(); }
267  void handleMouseLeft(int button) override { clearFlags(WIDGET_HILITED | WIDGET_PRESSED); markAsDirty(); }
268 
269  void setHighLighted(bool enable);
270  void setPressedState();
271  void setUnpressedState();
272 protected:
273  void drawWidget() override;
274  bool _duringPress;
275 };
276 
277 /* DropdownButtonWidget */
279 public:
280  DropdownButtonWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0, const Common::U32String &lowresLabel = Common::U32String());
281  DropdownButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0, const Common::U32String &lowresLabel = Common::U32String());
282  DropdownButtonWidget(GuiObject *boss, const Common::String &name, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0, const Common::U32String &lowresLabel = Common::U32String());
283 
284  void handleMouseMoved(int x, int y, int button) override;
285  void handleMouseUp(int x, int y, int button, int clickCount) override;
286  void reflowLayout() override;
287  void getMinSize(int &minWidth, int &minHeight) override;
288 
289 
290  void appendEntry(const Common::U32String &label, uint32 cmd);
291  void clearEntries();
292 
293 protected:
294  struct Entry {
295  Common::U32String label;
296  uint32 cmd;
297  };
299 
300  // Widget API
301  void drawWidget() override;
302 
303  void reset();
304  bool isInDropDown(int x, int y) const;
305 
306  EntryList _entries;
307 
308  uint32 _dropdownWidth;
309  bool _inDropdown;
310  bool _inButton;
311 };
312 
313 /* PicButtonWidget */
315 public:
316  PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
317  PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
318  PicButtonWidget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
319  ~PicButtonWidget() override;
320 
321  void setGfx(Common::SharedPtr<Graphics::ManagedSurface> &gfx, int statenum = kPicButtonStateEnabled);
322  void setGfx(const Graphics::Surface *gfx, int statenum = kPicButtonStateEnabled, bool scale = true);
323  void setGfxFromTheme(const char *name, int statenum = kPicButtonStateEnabled);
324  void setGfx(int w, int h, int r, int g, int b, int statenum = kPicButtonStateEnabled);
325  void clearGfx(int statenum = kPicButtonStateEnabled) { _gfx[statenum].reset(); }
326 
327  void setButtonDisplay(bool enable) {_showButton = enable; }
328 
329 protected:
330  void drawWidget() override;
331 
332  Common::SharedPtr<Graphics::ManagedSurface> _gfx[kPicButtonStateMax + 1];
333  Graphics::AlphaType _alphaType[kPicButtonStateMax + 1];
334  bool _showButton;
335 };
336 
337 /* CheckboxWidget */
338 class CheckboxWidget : public ButtonWidget {
339 protected:
340  bool _state;
341  bool _overrideText;
342  int _spacing;
343 public:
344  CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
345  CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
346  CheckboxWidget(GuiObject *boss, const Common::String &name, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
347 
348  void handleMouseUp(int x, int y, int button, int clickCount) override;
349  void handleMouseEntered(int button) override { readLabel(); setFlags(WIDGET_HILITED); markAsDirty(); }
350  void handleMouseLeft(int button) override { clearFlags(WIDGET_HILITED); markAsDirty(); }
351 
352  void setState(bool state);
353  void toggleState() { setState(!_state); }
354  bool getState() const { return _state; }
355 
356  void setOverride(bool enable);
357 
358 protected:
359  void drawWidget() override;
360 };
361 
362 class RadiobuttonWidget;
363 
365 public:
366  RadiobuttonGroup(GuiObject *boss, uint32 cmd = 0);
367  ~RadiobuttonGroup() override {}
368 
369  void addButton(RadiobuttonWidget *button) { _buttons.push_back(button); }
370  Common::Array<RadiobuttonWidget *> getButtonList() const { return _buttons; }
371 
372  void setValue(int state);
373  int getValue() const { return _value; }
374 
375  void setEnabled(bool ena);
376 
377  void setCmd(uint32 cmd) { _cmd = cmd; }
378  uint32 getCmd() const { return _cmd; }
379 
380 protected:
382  int _value;
383  uint32 _cmd;
384 };
385 
386 /* RadiobuttonWidget */
388 protected:
389  bool _state;
390  int _spacing;
391  int _value;
392 
393 public:
394  RadiobuttonWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, RadiobuttonGroup *group, int value, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint8 hotkey = 0);
395  RadiobuttonWidget(GuiObject *boss, int x, int y, int w, int h, RadiobuttonGroup *group, int value, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint8 hotkey = 0);
396  RadiobuttonWidget(GuiObject *boss, const Common::String &name, RadiobuttonGroup *group, int value, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint8 hotkey = 0);
397 
398  void handleMouseUp(int x, int y, int button, int clickCount) override;
399  void handleMouseEntered(int button) override { readLabel(); setFlags(WIDGET_HILITED); markAsDirty(); }
400  void handleMouseLeft(int button) override { clearFlags(WIDGET_HILITED); markAsDirty(); }
401 
402  void setState(bool state, bool setGroup = true);
403  void toggleState() { setState(!_state); }
404  bool getState() const { return _state; }
405  int getValue() const { return _value; }
406 
407 protected:
408  void drawWidget() override;
409 
410  RadiobuttonGroup *_group;
411 };
412 
413 /* SliderWidget */
414 class SliderWidget : public Widget, public CommandSender {
415 protected:
416  uint32 _cmd;
417  int _value, _oldValue;
418  int _valueMin, _valueMax;
419  bool _isDragging;
420  uint _labelWidth;
421 public:
422  SliderWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0);
423  SliderWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0);
424  SliderWidget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0);
425 
426  void setCmd(uint32 cmd) { _cmd = cmd; }
427  uint32 getCmd() const { return _cmd; }
428 
429  void setValue(int value) { _value = value; }
430  int getValue() const { return _value; }
431 
432  void setMinValue(int value) { _valueMin = value; }
433  int getMinValue() const { return _valueMin; }
434  void setMaxValue(int value) { _valueMax = value; }
435  int getMaxValue() const { return _valueMax; }
436 
437  void handleMouseMoved(int x, int y, int button) override;
438  void handleMouseDown(int x, int y, int button, int clickCount) override;
439  void handleMouseUp(int x, int y, int button, int clickCount) override;
440  void handleMouseEntered(int button) override { setFlags(WIDGET_HILITED); markAsDirty(); }
441  void handleMouseLeft(int button) override { clearFlags(WIDGET_HILITED); markAsDirty(); }
442  void handleMouseWheel(int x, int y, int direction) override;
443 
444 protected:
445  void drawWidget() override;
446 
447  int valueToPos(int value);
448  int posToValue(int pos);
449  int valueToBarWidth(int value);
450 };
451 
452 /* GraphicsWidget */
453 class GraphicsWidget : public Widget {
454 public:
455  GraphicsWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip = Common::U32String());
456  GraphicsWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip = Common::U32String());
457  GraphicsWidget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip = Common::U32String());
458  ~GraphicsWidget() override;
459 
461  void setGfx(const Graphics::Surface *gfx, bool scale = false);
462  void setGfx(int w, int h, int r, int g, int b);
463  void setGfxFromTheme(const char *name);
464  void clearGfx() { _gfx.reset(); }
465 
466 protected:
467  void drawWidget() override;
468 
470  Graphics::AlphaType _alphaType;
471 };
472 
473 class PathWidget : public StaticTextWidget {
474 public:
475  PathWidget(GuiObject *boss, int x, int y, int w, int h, bool scale,
476  const Common::Path &path, Graphics::TextAlign align,
477  const Common::U32String &placeholder = Common::U32String(),
478  const Common::U32String &tooltip = Common::U32String(),
480  bool useEllipsis = true) :
481  StaticTextWidget(boss, x, y, w, h, scale,
482  path.empty() ? placeholder : Common::U32String(path.toString(Common::Path::kNativeSeparator)),
483  align, tooltip, font, Common::UNK_LANG, useEllipsis),
484  _path(path),
485  _placeholder(placeholder) { }
486  PathWidget(GuiObject *boss, int x, int y, int w, int h,
487  const Common::Path &path, Graphics::TextAlign align,
488  const Common::U32String &placeholder = Common::U32String(),
489  const Common::U32String &tooltip = Common::U32String(),
491  bool useEllipsis = true) :
492  StaticTextWidget(boss, x, y, w, h,
493  path.empty() ? placeholder : Common::U32String(path.toString(Common::Path::kNativeSeparator)),
494  align, tooltip, font, Common::UNK_LANG, useEllipsis),
495  _path(path),
496  _placeholder(placeholder) {}
497  PathWidget(GuiObject *boss, const Common::String &name,
498  const Common::Path &path,
499  const Common::U32String &placeholder = Common::U32String(),
500  const Common::U32String &tooltip = Common::U32String(),
502  bool useEllipsis = true) :
503  StaticTextWidget(boss, name,
504  path.empty() ? placeholder : Common::U32String(path.toString(Common::Path::kNativeSeparator)),
505  tooltip, font, Common::UNK_LANG, useEllipsis),
506  _path(path),
507  _placeholder(placeholder) {}
508  void setLabel(const Common::Path &path) {
509  _path = path;
510  if (path.empty()) {
511  StaticTextWidget::setLabel(_placeholder);
512  } else {
513  StaticTextWidget::setLabel(path.toString(Common::Path::kNativeSeparator));
514  }
515  }
516  const Common::Path &getLabel() const { return _path; }
517  void setEmptyPlaceHolder(const Common::U32String &placeholder) { _placeholder = placeholder; }
518 protected:
519  Common::Path _path;
520  Common::U32String _placeholder;
521 };
522 
523 /* ContainerWidget */
524 class ContainerWidget : public Widget {
525 public:
526  ContainerWidget(GuiObject *boss, int x, int y, int w, int h, bool scale = false);
527  ContainerWidget(GuiObject *boss, const Common::String &name);
528  ~ContainerWidget() override;
529 
530  bool containsWidget(Widget *) const override;
531  Widget *findWidget(int x, int y) override;
532  void removeWidget(Widget *widget) override;
533 
534  void setBackgroundType(ThemeEngine::WidgetBackground backgroundType);
535 protected:
536  void drawWidget() override;
537 
538  ThemeEngine::WidgetBackground _backgroundType;
539 };
540 
541 /* OptionsContainerWidget */
543 public:
551  OptionsContainerWidget(GuiObject *boss, const Common::String &name, const Common::String &dialogLayout,
552  const Common::String &domain);
553  ~OptionsContainerWidget() override;
554 
556  virtual void load() = 0;
557 
563  virtual bool save() = 0;
564 
569  virtual bool hasKeys() { return true; }
570 
572  virtual void setEnabled(bool e) {}
573 
574  void setParentDialog(Dialog *parentDialog) { _parentDialog = parentDialog; }
575  void setDomain(const Common::String &domain) { _domain = domain; }
576 
577 protected:
578  // Widget API
579  void reflowLayout() override;
580  Common::Rect getClipRect() const override;
581  void drawWidget() override {}
582  bool containsWidget(Widget *widget) const override;
583  Widget *findWidget(int x, int y) override;
584  void removeWidget(Widget *widget) override;
585 
587  GuiObject *widgetsBoss() { return this; }
588 
594  virtual void defineLayout(ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const {}
595 
596  Common::String _domain;
597  const Common::String _dialogLayout;
598 
599  Dialog *_parentDialog;
600 };
601 
602 ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd, int x=0, int y=0, int w=0, int h=0, bool scale = false);
603 
604 } // End of namespace GUI
605 
606 #endif
Definition: str.h:59
FontColor
Font color selector.
Definition: ThemeEngine.h:288
TextAlign
Definition: font.h:48
Definition: surface.h:67
Definition: widget.h:364
Definition: widget.h:453
WidgetBackground
Widget background type.
Definition: ThemeEngine.h:226
Definition: widget.h:314
Definition: rect.h:536
Definition: path.h:52
virtual void draw()
Definition: widget.h:338
Definition: widget.h:213
virtual void defineLayout(ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const
Definition: widget.h:594
Definition: widget.h:414
Definition: widget.h:387
Definition: ThemeEval.h:37
Definition: printman.h:30
static const char kNativeSeparator
Definition: path.h:195
Definition: object.h:60
Definition: widget.h:542
Definition: widget.h:473
bool empty() const
Definition: path.h:353
Definition: ustr.h:57
virtual bool hasKeys()
Definition: widget.h:569
virtual Common::Rect getClipRect() const
virtual void markAsDirty()
Definition: events.h:218
FontStyle
Font style selector.
Definition: ThemeEngine.h:274
virtual void getMinSize(int &minWidth, int &minHeight)
Definition: widget.h:138
String toString(char separator='/') const
GuiObject * widgetsBoss()
Definition: widget.h:587
Definition: dialog.h:49
A bold font. This is also the default font.
Definition: ThemeEngine.h:275
Definition: widget.h:278
State
State of the widget to be drawn.
Definition: ThemeEngine.h:249
Definition: widget.h:99
Definition: keyboard.h:294
virtual void setEnabled(bool e)
Definition: widget.h:572
Definition: widget.h:294
Definition: widget.h:524
Definition: widget.h:241
Definition: object.h:40
Language
Definition: language.h:45