ScummVM API documentation
macwidget.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 GRAPHICS_MACGUI_MACWIDGET_H
23#define GRAPHICS_MACGUI_MACWIDGET_H
24
25#include "common/array.h"
26#include "common/events.h"
27#include "common/rect.h"
28#include "graphics/managed_surface.h"
29
30namespace Common {
31 struct Event;
32}
33
34namespace Graphics {
35
36class ManagedSurface;
37class MacWindowManager;
38
39class MacWidget {
40
41public:
42 MacWidget(MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, bool focusable, uint16 border = 0, uint16 gutter = 0, uint16 shadow = 0, uint32 fgcolor = 0, uint32 bgcolor= 0xff);
43 virtual ~MacWidget();
44
49 const Common::Rect &getDimensions() { return _dims; }
50
56 virtual void setActive(bool active);
57
62 void setDirty(bool dirty) { _contentIsDirty = dirty; }
63
64 virtual bool needsRedraw() { return _contentIsDirty; }
65
66 virtual bool draw(ManagedSurface *g, bool forceRedraw = false);
67 virtual bool draw(bool forceRedraw = false);
68 virtual void blit(ManagedSurface *g, Common::Rect &dest);
69 virtual bool processEvent(Common::Event &event);
70 virtual bool hasAllFocus() { return _active; }
71 virtual bool isEditable() { return _editable; }
72
73 virtual void setColors(uint32 fg, uint32 bg);
74 virtual void setBorderColor(uint32 color) {
75 _borderColor = color;
76 _contentIsDirty = true;
77 }
78
79 virtual void setDimensions(const Common::Rect &r) {
80 _dims = r;
81 }
82
83 Common::Point getAbsolutePos();
84 Common::Rect getAbsoluteDimensions();
85 MacWidget *findEventHandler(Common::Event &event, int dx, int dy);
86
87 void removeWidget(MacWidget *child, bool del = true);
88
89 virtual Graphics::ManagedSurface *getSurface() final { return _composeSurface; }
90 void setSurface(Graphics::ManagedSurface *srf, DisposeAfterUse::Flag dispose);
91
92protected:
93 uint16 _border;
94 uint16 _gutter;
95 uint16 _shadow;
96 uint32 _borderColor;
97
98 uint32 _fgcolor, _bgcolor;
99
100 Graphics::ManagedSurface *_composeSurface;
101 DisposeAfterUse::Flag _dispose;
102
103 bool _contentIsDirty;
104
105public:
106 bool _focusable;
107 bool _active;
108 bool _editable;
109 uint _priority;
110
111 Common::Rect _dims;
112
113 MacWindowManager *_wm;
114 MacWidget *_parent;
116};
117
118} // End of namespace Graphics
119
120#endif
Definition: array.h:52
Definition: macwidget.h:39
const Common::Rect & getDimensions()
Definition: macwidget.h:49
void setDirty(bool dirty)
Definition: macwidget.h:62
virtual void setActive(bool active)
Definition: macwindowmanager.h:149
Definition: managed_surface.h:51
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: events.h:218
Definition: rect.h:144
Definition: rect.h:536