ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
text.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 DIRECTOR_CASTMEMBER_TEXT_H
23 #define DIRECTOR_CASTMEMBER_TEXT_H
24 
25 #include "director/castmember/castmember.h"
26 
27 namespace Director {
28 
29 class TextCastMember : public CastMember {
30 public:
31  TextCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version, uint8 flags1 = 0, bool asButton = false);
32  TextCastMember(Cast *cast, uint16 castId, TextCastMember &source);
33  void setColors(uint32 *fgcolor, uint32 *bgcolor) override;
34 
35  Graphics::MacWidget *createWidget(Common::Rect &bbox, Channel *channel, SpriteType spriteType) override;
36 
37  Graphics::MacWidget *getWidget();
38 
39  bool isEditable() override { return _editable; }
40  void setEditable(bool editable) override { _editable = editable; }
41  void updateFromWidget(Graphics::MacWidget *widget) override;
42  Graphics::TextAlign getAlignment();
43 
44  uint32 getBackColor() override { return _bgcolor; }
45  void setBackColor(uint32 bgCol) override;
46  uint32 getForeColor() override { return _fgcolor; }
47  uint32 getForeColor(int start, int end);
48  void setForeColor(uint32 fgCol) override;
49  void setForeColor(uint32 fgCol, int start, int end);
50 
51  bool hasField(int field) override;
52  Datum getField(int field) override;
53  bool setField(int field, const Datum &value) override;
54 
55  bool hasChunkField(int field);
56  Datum getChunkField(int field, int start, int end);
57  bool setChunkField(int field, int start, int end, const Datum &value);
58 
59  int getLineCount();
60  int getLineHeight(int line);
61 
62  int getTextHeight();
63 
64  Common::String getTextFont();
65  Common::String getTextFont(int start, int end);
66  void setTextFont(const Common::String &fontName);
67  void setTextFont(const Common::String &fontName, int start, int end);
68 
69  int getTextSize();
70  int getTextSize(int start, int end);
71  void setTextSize(int textSize);
72  void setTextSize(int textSize, int start, int end);
73 
74  Common::String getTextStyle();
75  Common::String getTextStyle(int start, int end);
76  void setTextStyle(const Common::String &textStyle);
77  void setTextStyle(const Common::String &textStyle, int start, int end);
78 
79  Common::String formatInfo() override;
80 
81  void load() override;
82  void unload() override;
83 
84  uint8 _borderSize;
85  uint8 _gutterSize;
86  uint8 _boxShadow;
87  uint16 _maxHeight;
88  uint16 _textHeight;
89 
90  uint32 _fontId;
91  uint16 _fontSize;
92  TextType _textType;
93  TextAlignType _textAlign;
94  uint8 _textShadow;
95  uint16 _scroll;
96  byte _textSlant;
97  byte _textFlags;
98  uint16 _bgpalinfo1, _bgpalinfo2, _bgpalinfo3;
99  uint16 _fgpalinfo1, _fgpalinfo2, _fgpalinfo3;
100  ButtonType _buttonType;
101  bool _editable;
102  int _lineSpacing;
103 
104  Common::U32String _ftext;
105  Common::U32String _ptext;
106  Common::String _rtext;
107  void importStxt(const Stxt *stxt);
108  void importRTE(byte *text);
109 
110  Common::U32String getText();
111  Common::String getRawText();
112  void setRawText(const Common::String &text);
113 
114 private:
115  Graphics::MacWidget *createWindowOrWidget(Common::Rect &bbox, Common::Rect dims, Graphics::MacFont *macFont);
116 
117  uint32 _bgcolor;
118  uint32 _fgcolor;
119 };
120 
121 } // End of namespace Director
122 
123 #endif
Definition: cast.h:85
Definition: str.h:59
TextAlign
Definition: font.h:48
Definition: channel.h:40
Definition: stxt.h:49
Definition: rect.h:144
Definition: archive.h:35
Definition: ustr.h:57
Definition: macwidget.h:39
Definition: lingo.h:130
Definition: macfontmanager.h:106
Definition: stream.h:944
Definition: text.h:29
Definition: castmember.h:45