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 
32 namespace MM {
33 namespace Xeen {
34 
35 class XeenEngine;
36 
37 class UIButton {
38 public:
39  Common::Rect _bounds;
40  SpriteResource *_sprites;
41  int _value;
42  uint _frameNum, _selectedFrame;
43  bool _draw;
44 
48  UIButton(const Common::Rect &bounds, int value, uint frameNum, SpriteResource *sprites, bool draw) :
49  _bounds(bounds), _value(value), _frameNum(frameNum), _selectedFrame(frameNum | 1),
50  _sprites(sprites), _draw(draw) {}
51 
55  UIButton() : _value(0), _frameNum(0), _selectedFrame(0), _sprites(nullptr), _draw(false) {}
56 
60  void setFrame(uint frameNum) {
61  _frameNum = frameNum;
62  _selectedFrame = frameNum | 1;
63  }
64 
68  void setFrame(uint frameNum, uint selectedFrame) {
69  _frameNum = frameNum;
70  _selectedFrame = selectedFrame;
71  }
72 };
73 
74 class ButtonContainer : public Cutscenes {
75 private:
77 protected:
78  Common::Array<UIButton> _buttons;
79  Common::StringArray _textStrings;
80  Common::Rect _waitBounds;
81  int _buttonValue;
82 
83  bool checkEvents(XeenEngine *vm);
84 
91  bool doScroll(bool rollUp, bool fadeIn) override;
92 
97  void loadStrings(const Common::Path &name);
98 
104  void loadStrings(const Common::Path &name, int ccMode);
105 
110  void setWaitBounds();
111 public:
112  ButtonContainer(XeenEngine *vm) : Cutscenes(vm), _buttonValue(0) {}
113 
117  void saveButtons();
118 
119  void clearButtons();
120 
121  void restoreButtons();
122 
123  void addButton(const Common::Rect &bounds, int val,
124  SpriteResource *sprites = nullptr);
125  void addButton(const Common::Rect &bounds, int val,
126  int frameNum, SpriteResource *sprites = nullptr);
127 
128  void addPartyButtons(XeenEngine *vm);
129 
133  void drawButtons(XSurface *surface);
134 
138  void clearEvents() { _buttonValue = 0; }
139 };
140 
142 protected:
143  virtual void showContents(SpriteResource &title1, bool mode);
144 public:
146 
147  ~SettingsBaseDialog() override {}
148 };
149 
150 } // End of namespace Xeen
151 } // End of namespace MM
152 
153 #endif
void clearEvents()
Definition: dialogs.h:138
Definition: xsurface.h:45
Definition: array.h:52
Definition: dialogs.h:141
Definition: sprites.h:52
Definition: cutscenes.h:34
Definition: rect.h:144
Definition: path.h:52
UIButton()
Definition: dialogs.h:55
Definition: xeen.h:93
void setFrame(uint frameNum, uint selectedFrame)
Definition: dialogs.h:68
Definition: dialogs.h:37
void setFrame(uint frameNum)
Definition: dialogs.h:60
Definition: detection.h:27
Definition: dialogs.h:74
Definition: stack.h:102
UIButton(const Common::Rect &bounds, int value, uint frameNum, SpriteResource *sprites, bool draw)
Definition: dialogs.h:48