ScummVM API documentation
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  bool isEditable() override { return _editable; }
38  void setEditable(bool editable) override { _editable = editable; }
39  void updateFromWidget(Graphics::MacWidget *widget) override;
40  Graphics::TextAlign getAlignment();
41 
42  uint32 getBackColor() override { return _bgcolor; }
43  void setBackColor(uint32 bgCol) override;
44  uint32 getForeColor() override { return _fgcolor; }
45  void setForeColor(uint32 fgCol) override;
46 
47  bool hasField(int field) override;
48  Datum getField(int field) override;
49  bool setField(int field, const Datum &value) override;
50 
51  bool hasChunkField(int field);
52  Datum getChunkField(int field, int start, int end);
53  bool setChunkField(int field, int start, int end, const Datum &value);
54 
55  int getTextHeight();
56 
57  int getTextSize();
58  void setTextSize(int textSize);
59 
60  Common::String formatInfo() override;
61 
62  void load() override;
63  void unload() override;
64 
65  SizeType _borderSize;
66  SizeType _gutterSize;
67  SizeType _boxShadow;
68  uint16 _maxHeight;
69  uint16 _textHeight;
70 
71  uint32 _fontId;
72  uint16 _fontSize;
73  TextType _textType;
74  TextAlignType _textAlign;
75  SizeType _textShadow;
76  uint16 _scroll;
77  byte _textSlant;
78  byte _textFlags;
79  uint16 _bgpalinfo1, _bgpalinfo2, _bgpalinfo3;
80  uint16 _fgpalinfo1, _fgpalinfo2, _fgpalinfo3;
81  ButtonType _buttonType;
82  bool _editable;
83  int _lineSpacing;
84 
85  Common::U32String _ftext;
86  Common::U32String _ptext;
87  Common::String _rtext;
88  void importStxt(const Stxt *stxt);
89  void importRTE(byte *text);
90 
91  Common::U32String getText();
92  Common::String getRawText();
93  void setRawText(const Common::String &text);
94 
95 private:
96  Graphics::MacWidget *createWindowOrWidget(Common::Rect &bbox, Channel *channel, Common::Rect dims, Graphics::MacFont *macFont);
97 
98  uint32 _bgcolor;
99  uint32 _fgcolor;
100 };
101 
103 public:
104  RTECastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version);
105 
106  void loadChunks();
107  void load() override;
108 };
109 
110 } // End of namespace Director
111 
112 #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:85
Definition: stream.h:944
Definition: text.h:29
Definition: castmember.h:45
Definition: text.h:102