ScummVM API documentation
text_object.h
1 
2 /* ScummVM - Graphic Adventure Engine
3  *
4  * ScummVM is the legal property of its developers, whose names
5  * are too numerous to list here. Please refer to the COPYRIGHT
6  * file distributed with this source distribution.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef BAGEL_BAGLIB_TEXT_OBJECT_H
24 #define BAGEL_BAGLIB_TEXT_OBJECT_H
25 
26 #include "bagel/baglib/object.h"
27 #include "bagel/boflib/gfx/text.h"
28 
29 namespace Bagel {
30 
31 // local prototypes...
32 int MapFont(int nFont);
33 
37 class CBagTextObject : public CBagObject {
38 private:
39  CBofString *_psInitInfo; // Aux info
40 
41  RGBCOLOR _nFGColor;
42 
43  int16 _nDX;
44  int16 _nDY;
45 
46  byte _nPointSize;
47  int _nTextFont;
48 
49  CBagObject *_pRPObject;
50 
51 protected:
52  bool _bCaption : true;
53  bool _bTitle : true;
54  bool _bReAttach : true;
55  CBofString *_psText;
56 
57 public:
59  virtual ~CBagTextObject();
60 
61  CBofRect getRect() override;
62 
63  CBofSize getSize() const {
64  return CBofSize(_nDX, _nDY);
65  }
66  void setSize(const CBofSize &xSize) override {
67  _nDX = (int16)xSize.cx;
68  _nDY = (int16)xSize.cy;
69  }
70 
71  int getPointSize() const {
72  return _nPointSize;
73  }
74  void setPointSize(int xSize) {
75  assert(xSize >= 0 && xSize <= 255);
76  _nPointSize = (byte)xSize;
77  }
78  int getColor() const {
79  return 0;
80  }
81  void setColor(int nColor);
82 
83  // Font support for text objects
84  int getFont() const {
85  return _nTextFont;
86  }
87  void setFont(int nFont) {
88  _nTextFont = nFont;
89  }
90 
91  bool runObject() override;
92 
93  const CBofString *getInitInfo() const override {
94  return _psInitInfo;
95  }
96  void setInitInfo(const CBofString &info) override {
97  delete _psInitInfo;
98  _psInitInfo = new CBofString();
99  *_psInitInfo = info;
100  }
101 
102  CBofString *getPSText() const {
103  return _psText;
104  }
105  void setPSText(CBofString *p);
106 
107  const CBofString &getText();
108  void setText(const CBofString &s);
109 
113  void recalcTextRect(bool bTextFromFile);
114 
115  ErrorCode update(CBofBitmap *pBmp, CBofPoint pt, CBofRect * /*pSrcRect*/ = nullptr, int /*nMaskColor*/ = -1) override;
116 
117  ErrorCode attach() override;
118  ErrorCode detach() override;
119 
120  ParseCodes setInfo(CBagIfstream &istr) override;
121 
122  void setProperty(const CBofString &sProp, int nVal) override;
123  int getProperty(const CBofString &sProp) override;
124 
125  bool isCaption() const {
126  return _bCaption;
127  }
128 
129  void setTitle(bool b = true) {
130  _bTitle = b;
131  }
132  bool isTitle() const {
133  return _bTitle;
134  }
135 
136  // Extra stuff to handle mouse downs on floaters in the log pda/residue printing code.
137  void onLButtonUp(uint32, CBofPoint *, void * = nullptr) override;
138 
139  void setRPObject(CBagObject *prp) {
140  _pRPObject = prp;
141  }
142  CBagObject *getRPObject() const {
143  return _pRPObject;
144  }
145 };
146 
147 } // namespace Bagel
148 
149 #endif
Definition: size.h:31
void recalcTextRect(bool bTextFromFile)
Definition: bitmap.h:55
Definition: text_object.h:37
Definition: rect.h:36
ParseCodes setInfo(CBagIfstream &istr) override
Definition: object.h:85
Definition: ifstream.h:31
Definition: string.h:38
Definition: bagel.h:31
Definition: point.h:34