ScummVM API documentation
widget.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 MUTATIONOFJB_WIDGET_H
23#define MUTATIONOFJB_WIDGET_H
24
25#include "common/scummsys.h"
26#include "common/rect.h"
27
28namespace Common {
29struct Event;
30}
31
32namespace Graphics {
33class ManagedSurface;
34}
35
36namespace MutationOfJB {
37
38class GuiScreen;
39
40class Widget {
41public:
42 enum : uint {
43 DIRTY_NONE = 0,
44 DIRTY_ALL = 0xFFFFFFFF
45 };
46
47 Widget(GuiScreen &gui, const Common::Rect &area) : _gui(gui), _area(area), _id(0), _visible(true), _enabled(true), _dirtyBits(DIRTY_NONE) {}
48 virtual ~Widget() {}
49
50 int getId() const;
51 void setId(int id);
52
53 bool isVisible() const;
54 void setVisible(bool visible);
55
56 bool isEnabled() const;
57 void setEnabled(bool enabled);
58
59 Common::Rect getArea() const;
60 void setArea(const Common::Rect &area);
61
62 bool isDirty() const;
63 void markDirty(uint32 dirtyBits = DIRTY_ALL);
64 void update(Graphics::ManagedSurface &);
65
66 virtual void handleEvent(const Common::Event &) {}
67protected:
68 virtual void draw(Graphics::ManagedSurface &) = 0;
69
70 GuiScreen &_gui;
71 Common::Rect _area;
72 int _id;
73 bool _visible;
74 bool _enabled;
75 uint32 _dirtyBits;
76};
77
78}
79
80#endif
Definition: managed_surface.h:51
Definition: guiscreen.h:45
Definition: widget.h:40
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: events.h:218
Definition: rect.h:536