ScummVM API documentation
window.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_WINDOW_H
23#define XEEN_WINDOW_H
24
25#include "common/rect.h"
26#include "common/str.h"
27#include "mm/xeen/font.h"
28#include "mm/xeen/sprites.h"
29
30namespace MM {
31namespace Xeen {
32
33#define GAME_WINDOW 28
34
35class XeenEngine;
36class Window;
37
38struct DrawStruct {
39 SpriteResource *_sprites;
40 int _frame;
41 int _x;
42 int _y;
43 int _scale;
44 int _flags;
45
46 DrawStruct(int frame, int x, int y, int scale = 0, int flags = 0) :
47 _sprites(nullptr), _frame(frame), _x(x), _y(y), _scale(scale), _flags(flags) {
48 }
49 DrawStruct() : _sprites(nullptr), _frame(0), _x(0), _y(0), _scale(0), _flags(0) {
50 }
51};
52
53class Windows : public FontData {
54private:
55 Common::Array<Window> _windows;
56 Common::Array<Window *> _windowStack;
57public:
58 Windows();
59 ~Windows();
60
64 Window &operator[](int index) {
65 return _windows[index];
66 }
67
71 void closeAll();
72
76 void windowOpened(Window *win);
77
81 void windowClosed(Window *win);
82};
83
84class Window : public FontSurface {
85private:
86 Common::Rect _bounds;
87 Common::Rect _innerBounds;
88 XSurface _savedArea;
89 int _a;
90 int _border;
91 int _xLo, _xHi;
92 int _ycL, _ycH;
93private:
97 bool isFullScreen() const;
98public:
99 bool _enabled;
100public:
101 Window();
102 Window(const Window &src);
103 Window(const Common::Rect &bounds, int a, int border,
104 int xLo, int ycL, int xHi, int ycH);
105 ~Window() override {
106 }
107
108 void addDirtyRect(const Common::Rect &r) override;
109
110 void setBounds(const Common::Rect &r);
111
112 const Common::Rect &getBounds() {
113 return _bounds;
114 }
115
116 void open();
117
118 void close();
119
123 void update();
124
125 void frame();
126
130 void fill();
131
132 void drawList(DrawStruct *items, int count);
133
134 int getString(Common::String &line, uint maxLen, int maxWidth);
135
144 const char *writeString(const Common::String &s, const Common::Rect &clipRect) {
145 return FontSurface::writeString(s, clipRect);
146 }
147
157 const char *writeString(const Common::String &s, bool ttsVoiceText = true, Common::String *ttsMessage = nullptr) {
158 return FontSurface::writeString(s, _innerBounds, ttsVoiceText, ttsMessage);
159 }
160
165 void writeCharacter(char c) {
166 FontSurface::writeCharacter(c, _innerBounds);
167 }
168};
169
170} // End of namespace Xeen
171} // End of namespace MM
172
173#endif
Definition: array.h:52
Definition: str.h:59
Definition: sprites.h:52
Definition: xsurface.h:45
Definition: font.h:48
const char * writeString(const Common::String &s, const Common::Rect &clipRect, bool ttsVoiceText=true, Common::String *ttsMessage=nullptr)
void writeCharacter(uint16_t c, const Common::Rect &clipRect)
Definition: window.h:84
void writeCharacter(char c)
Definition: window.h:165
void addDirtyRect(const Common::Rect &r) override
const char * writeString(const Common::String &s, bool ttsVoiceText=true, Common::String *ttsMessage=nullptr)
Definition: window.h:157
const char * writeString(const Common::String &s, const Common::Rect &clipRect)
Definition: window.h:144
Definition: window.h:53
void windowClosed(Window *win)
Window & operator[](int index)
Definition: window.h:64
void windowOpened(Window *win)
Definition: detection.h:27
Definition: rect.h:536
Definition: window.h:38
Definition: font.h:38