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 
30 namespace Common {
31  struct Event;
32 }
33 
34 namespace Graphics {
35 
36 class ManagedSurface;
37 class MacWindowManager;
38 
39 class MacWidget {
40 
41 public:
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 
75  virtual void setDimensions(const Common::Rect &r) {
76  _dims = r;
77  }
78 
79  Common::Point getAbsolutePos();
80  MacWidget *findEventHandler(Common::Event &event, int dx, int dy);
81 
82  void removeWidget(MacWidget *child, bool del = true);
83 
84  Graphics::ManagedSurface *getSurface() { return _composeSurface; }
85 
86 protected:
87  uint16 _border;
88  uint16 _gutter;
89  uint16 _shadow;
90 
91  uint32 _fgcolor, _bgcolor;
92 
93  Graphics::ManagedSurface *_composeSurface;
94 
95  bool _contentIsDirty;
96 
97 public:
98  bool _focusable;
99  bool _active;
100  bool _editable;
101  uint _priority;
102 
103  Common::Rect _dims;
104 
105  MacWindowManager *_wm;
106  MacWidget *_parent;
107  Common::Array<MacWidget *> _children;
108 };
109 
110 } // End of namespace Graphics
111 
112 #endif
Definition: managed_surface.h:51
Definition: array.h:52
void setDirty(bool dirty)
Definition: macwidget.h:62
Definition: rect.h:144
Definition: macwindowmanager.h:149
const Common::Rect & getDimensions()
Definition: macwidget.h:49
Definition: events.h:199
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: rect.h:45
Definition: macwidget.h:39