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 "xeen/font.h"
28 #include "xeen/sprites.h"
29 
30 namespace Xeen {
31 
32 #define GAME_WINDOW 28
33 
34 class XeenEngine;
35 class Window;
36 
37 struct DrawStruct {
38  SpriteResource *_sprites;
39  int _frame;
40  int _x;
41  int _y;
42  int _scale;
43  int _flags;
44 
45  DrawStruct(int frame, int x, int y, int scale = 0, int flags = 0) :
46  _sprites(nullptr), _frame(frame), _x(x), _y(y), _scale(scale), _flags(flags) {}
47  DrawStruct(): _sprites(nullptr), _frame(0), _x(0), _y(0), _scale(0), _flags(0) {}
48 };
49 
50 class Windows : public FontData {
51 private:
52  Common::Array<Window> _windows;
53  Common::Array<Window *> _windowStack;
54 public:
55  Windows();
56  ~Windows();
57 
61  Window &operator[](int index) { return _windows[index]; }
62 
66  void closeAll();
67 
71  void windowOpened(Window *win);
72 
76  void windowClosed(Window *win);
77 };
78 
79 class Window: public FontSurface {
80 private:
81  Common::Rect _bounds;
82  Common::Rect _innerBounds;
83  XSurface _savedArea;
84  int _a;
85  int _border;
86  int _xLo, _xHi;
87  int _ycL, _ycH;
88 private:
92  bool isFullScreen() const;
93 public:
94  bool _enabled;
95 public:
96  Window();
97  Window(const Window &src);
98  Window(const Common::Rect &bounds, int a, int border,
99  int xLo, int ycL, int xHi, int ycH);
100  ~Window() override {}
101 
102  void addDirtyRect(const Common::Rect &r) override;
103 
104  void setBounds(const Common::Rect &r);
105 
106  const Common::Rect &getBounds() { return _bounds; }
107 
108  void open();
109 
110  void close();
111 
115  void update();
116 
117  void frame();
118 
122  void fill();
123 
124  void drawList(DrawStruct *items, int count);
125 
126  int getString(Common::String &line, uint maxLen, int maxWidth);
127 
136  const char *writeString(const Common::String &s, const Common::Rect &clipRect) {
137  return FontSurface::writeString(s, clipRect);
138  }
139 
147  const char *writeString(const Common::String &s) {
148  return FontSurface::writeString(s, _innerBounds);
149  }
150 
155  void writeCharacter(char c) {
156  FontSurface::writeCharacter(c, _innerBounds);
157  }
158 };
159 
160 } // End of namespace Xeen
161 
162 #endif /* XEEN_WINDOW_H */
Definition: str.h:59
const char * writeString(const Common::String &s, const Common::Rect &clipRect)
Definition: xsurface.h:43
Definition: window.h:50
Definition: array.h:52
Definition: window.h:37
Definition: sprites.h:48
Definition: rect.h:144
const char * writeString(const Common::String &s)
Definition: window.h:147
void writeCharacter(char c, const Common::Rect &clipRect)
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: font.h:36
Definition: window.h:79
const char * writeString(const Common::String &s, const Common::Rect &clipRect)
Definition: window.h:136
Window & operator[](int index)
Definition: window.h:61
signed char * fill(signed char *first, signed char *last, Value val)
Definition: algorithm.h:111
void writeCharacter(char c)
Definition: window.h:155
Definition: font.h:45
Definition: character.h:33