ScummVM API documentation
visual_item.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 ULTIMA_SHARED_GFX_VISUAL_ITEM_H
23#define ULTIMA_SHARED_GFX_VISUAL_ITEM_H
24
25#include "graphics/managed_surface.h"
26#include "ultima/shared/core/named_item.h"
27#include "ultima/shared/gfx/screen.h"
28#include "ultima/shared/gfx/visual_surface.h"
29
30namespace Ultima {
31namespace Shared {
32namespace Gfx {
33
34class Popup;
35
39class VisualItem : public NamedItem {
40 friend class VisualSurface;
41 DECLARE_MESSAGE_MAP;
42 bool ShowMsg(CShowMsg *msg);
43 bool HideMsg(CHideMsg *msg);
44private:
48 void init(TreeItem *parent = nullptr);
49protected:
50 Rect _bounds;
51 bool _isDirty;
52public:
53 CLASSDEF;
54 VisualItem(TreeItem *parent = nullptr) { init(parent); }
55 VisualItem(const Rect &r, TreeItem *parent = nullptr) : _bounds(r) { init(parent); }
56 VisualItem(const Common::String &name, TreeItem *parent = nullptr) : NamedItem(name) { init(parent); }
57 VisualItem(const Common::String &name, const Rect &r, TreeItem *parent = nullptr) : NamedItem(name),
58 _bounds(r) { init(parent); }
59
60 ~VisualItem() override {
61 }
62
66 virtual void draw() {
67 _isDirty = false;
68 }
69
75
79 const Rect &getBounds() { return _bounds; }
80
85 void setBounds(const Rect &r);
86
91 void setPosition(const Point &pt);
92
96 virtual void setDirty(bool dirty = true);
97
101 void clearDirty() { setDirty(false); }
102
106 virtual bool isDirty() const { return _isDirty; }
107
111 void setView(const Common::String &viewName);
112
116 void setPopup(Gfx::Popup *popup);
117
121 void setView();
122};
123
124} // End of namespace Gfx
125} // End of namespace Shared
126} // End of namespace Ultima
127
128#endif
Definition: str.h:59
Definition: messages.h:230
Definition: messages.h:280
Definition: popup.h:38
Definition: visual_item.h:39
virtual void draw()
Definition: visual_item.h:66
void setView(const Common::String &viewName)
virtual void setDirty(bool dirty=true)
const Rect & getBounds()
Definition: visual_item.h:79
void setPopup(Gfx::Popup *popup)
void clearDirty()
Definition: visual_item.h:101
virtual bool isDirty() const
Definition: visual_item.h:106
void setPosition(const Point &pt)
void setBounds(const Rect &r)
Definition: visual_surface.h:39
Definition: named_item.h:33
Definition: tree_item.h:50
Definition: rect.h:144
Definition: rect.h:536