ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
text_cursor.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_TEXT_CURSOR_H
23 #define ULTIMA_SHARED_GFX_TEXT_CURSOR_H
24 
25 #include "ultima/shared/core/rect.h"
26 #include "ultima/shared/gfx/screen.h"
27 
28 namespace Ultima {
29 namespace Shared {
30 namespace Gfx {
31 
35 class TextCursor : public Cursor {
36 protected:
37  bool _visible;
38  Common::Rect _bounds;
39 protected:
43  void markAsDirty();
44 public:
45  TextCursor() : _visible(false) {
46  }
47  ~TextCursor() override {
48  }
49 
53  bool isVisible() const {
54  return _visible;
55  }
56 
60  virtual void setVisible(bool isVis) {
61  _visible = isVis;
62  markAsDirty();
63  }
64 
68  Common::Rect getBounds() const override { return _bounds; }
69 
73  Point getPosition() const { return Point(_bounds.left, _bounds.top); }
74 
78  void setPosition(const Point &pt) {
79  bool vis = _visible;
80  setVisible(false);
81  _bounds.moveTo(pt);
82  setVisible(vis);
83  }
84 
88  virtual void update() = 0;
89 };
90 
91 } // End of namespace Gfx
92 } // End of namespace Shared
93 } // End of namespace Ultima
94 
95 #endif
virtual void setVisible(bool isVis)
Definition: text_cursor.h:60
Common::Rect getBounds() const override
Definition: text_cursor.h:68
Definition: rect.h:144
Definition: detection.h:27
Point getPosition() const
Definition: text_cursor.h:73
Definition: screen.h:42
Definition: text_cursor.h:35
Definition: rect.h:45
int16 left
Definition: rect.h:145
void moveTo(int16 x, int16 y)
Definition: rect.h:345
bool isVisible() const
Definition: text_cursor.h:53
void setPosition(const Point &pt)
Definition: text_cursor.h:78