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 
30 namespace MM {
31 namespace Xeen {
32 
33 #define GAME_WINDOW 28
34 
35 class XeenEngine;
36 class Window;
37 
38 struct 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 
53 class Windows : public FontData {
54 private:
55  Common::Array<Window> _windows;
56  Common::Array<Window *> _windowStack;
57 public:
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 
84 class Window : public FontSurface {
85 private:
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;
93 private:
97  bool isFullScreen() const;
98 public:
99  bool _enabled;
100 public:
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 
155  const char *writeString(const Common::String &s) {
156  return FontSurface::writeString(s, _innerBounds);
157  }
158 
163  void writeCharacter(char c) {
164  FontSurface::writeCharacter(c, _innerBounds);
165  }
166 };
167 
168 } // End of namespace Xeen
169 } // End of namespace MM
170 
171 #endif
Definition: str.h:59
void writeCharacter(char c)
Definition: window.h:163
const char * writeString(const Common::String &s)
Definition: window.h:155
Definition: xsurface.h:45
Definition: array.h:52
Definition: sprites.h:52
const char * writeString(const Common::String &s, const Common::Rect &clipRect)
Definition: window.h:144
Definition: rect.h:144
Definition: font.h:37
void writeCharacter(char c, const Common::Rect &clipRect)
Definition: font.h:46
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: window.h:38
Definition: detection.h:27
Window & operator[](int index)
Definition: window.h:64
const char * writeString(const Common::String &s, const Common::Rect &clipRect)
signed char * fill(signed char *first, signed char *last, Value val)
Definition: algorithm.h:111
Definition: window.h:84
Definition: window.h:53