ScummVM API documentation
text_view.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 MM1_VIEWS_TEXT_VIEW_H
23 #define MM1_VIEWS_TEXT_VIEW_H
24 
25 #include "mm/mm1/events.h"
26 
27 namespace MM {
28 namespace MM1 {
29 namespace Views {
30 
31 #define FONT_SIZE 8
32 #define TEXT_W 40
33 #define TEXT_H 25
34 
35 class TextView : public UIElement {
36 protected:
37  Common::Point _textPos;
38  byte _bgColor = 0xff;
39 
43  void setTextColor(byte col) {
44  _bgColor = col;
45  }
46 
50  void writeChar(unsigned char c);
51  void writeChar(int x, int y, unsigned char c);
52 
56  void writeString(const Common::String &str);
57  void writeString(int x, int y, const Common::String &str);
58 
62  void writeNumber(int val);
63  void writeNumber(int x, int y, int val);
64 
68  void newLine();
69 
73  void writeSpaces(size_t count);
74 
78  void clearSurface() override;
79 
83  void clearLines(int y1, int y2);
84 
88  void drawTextBorder();
89 
93  void escToGoBack(int x = 12, int y = -1);
94 
98  virtual void timeout() override;
99 
100  void drawGraphic(int gfxNum);
101 
102 public:
103  TextView(const Common::String &name);
104  TextView(const Common::String &name, UIElement *owner);
105  virtual ~TextView() {}
106 
107  bool msgDrawGraphic(const DrawGraphicMessage &msg) override;
108 };
109 
110 } // namespace Views
111 } // namespace MM1
112 } // namespace MM
113 
114 #endif
void writeSpaces(size_t count)
void writeNumber(int val)
Definition: str.h:59
void clearLines(int y1, int y2)
void writeString(const Common::String &str)
virtual void timeout() override
Definition: text_view.h:35
void escToGoBack(int x=12, int y=-1)
void setTextColor(byte col)
Definition: text_view.h:43
Definition: detection.h:27
Definition: rect.h:45
void clearSurface() override
Definition: messages.h:198
void writeChar(unsigned char c)
Definition: events.h:68