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 "xeen/cutscenes.h"
29 #include "xeen/sprites.h"
30 #include "xeen/xsurface.h"
31 
32 namespace Xeen {
33 
34 class XeenEngine;
35 
36 class UIButton {
37 public:
38  Common::Rect _bounds;
39  SpriteResource *_sprites;
40  int _value;
41  uint _frameNum, _selectedFrame;
42  bool _draw;
43 
47  UIButton(const Common::Rect &bounds, int value, uint frameNum, SpriteResource *sprites, bool draw) :
48  _bounds(bounds), _value(value), _frameNum(frameNum), _selectedFrame(frameNum | 1),
49  _sprites(sprites), _draw(draw) {}
50 
54  UIButton() : _value(0), _frameNum(0), _selectedFrame(0), _sprites(nullptr), _draw(false) {}
55 
59  void setFrame(uint frameNum) {
60  _frameNum = frameNum;
61  _selectedFrame = frameNum | 1;
62  }
63 
67  void setFrame(uint frameNum, uint selectedFrame) {
68  _frameNum = frameNum;
69  _selectedFrame = selectedFrame;
70  }
71 };
72 
73 class ButtonContainer : public Cutscenes {
74 private:
76 protected:
77  Common::Array<UIButton> _buttons;
78  Common::StringArray _textStrings;
79  Common::Rect _waitBounds;
80  int _buttonValue;
81 
82  bool checkEvents(XeenEngine *vm);
83 
90  bool doScroll(bool rollUp, bool fadeIn) override;
91 
96  void loadStrings(const Common::String &name);
97 
103  void loadStrings(const Common::String &name, int ccMode);
104 
109  void setWaitBounds();
110 public:
111  ButtonContainer(XeenEngine *vm) : Cutscenes(vm), _buttonValue(0) {}
112 
116  void saveButtons();
117 
118  void clearButtons();
119 
120  void restoreButtons();
121 
122  void addButton(const Common::Rect &bounds, int val,
123  SpriteResource *sprites = nullptr);
124  void addButton(const Common::Rect &bounds, int val,
125  int frameNum, SpriteResource *sprites = nullptr);
126 
127  void addPartyButtons(XeenEngine *vm);
128 
132  void drawButtons(XSurface *surface);
133 
137  void clearEvents() { _buttonValue = 0; }
138 };
139 
141 protected:
142  virtual void showContents(SpriteResource &title1, bool mode);
143 public:
145 
146  ~SettingsBaseDialog() override {}
147 };
148 
149 } // End of namespace Xeen
150 
151 #endif /* XEEN_DIALOGS_H */
void setFrame(uint frameNum)
Definition: dialogs.h:59
Definition: str.h:59
Definition: xsurface.h:43
Definition: array.h:52
Definition: sprites.h:48
UIButton(const Common::Rect &bounds, int value, uint frameNum, SpriteResource *sprites, bool draw)
Definition: dialogs.h:47
Definition: rect.h:144
Definition: dialogs.h:140
UIButton()
Definition: dialogs.h:54
Definition: cutscenes.h:33
void setFrame(uint frameNum, uint selectedFrame)
Definition: dialogs.h:67
Definition: dialogs.h:36
Definition: xeen.h:100
Definition: stack.h:102
Definition: character.h:33
Definition: dialogs.h:73
void clearEvents()
Definition: dialogs.h:137