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/spacebar/baglib/object.h"
27 #include "bagel/spacebar/boflib/gfx/text.h"
28 
29 namespace Bagel {
30 namespace SpaceBar {
31 
32 // local prototypes...
33 int MapFont(int nFont);
34 
38 class CBagTextObject : public CBagObject {
39 private:
40  CBofString *_psInitInfo; // Aux info
41 
42  COLORREF _nFGColor;
43 
44  int16 _nDX;
45  int16 _nDY;
46 
47  byte _nPointSize;
48  int _nTextFont;
49 
50  CBagObject *_pRPObject;
51 
52 protected:
53  bool _bCaption : true;
54  bool _bTitle : true;
55  bool _bReAttach : true;
56  CBofString *_psText;
57 
58 public:
60  virtual ~CBagTextObject();
61 
62  CBofRect getRect() override;
63 
64  CBofSize getSize() const {
65  return CBofSize(_nDX, _nDY);
66  }
67  void setSize(const CBofSize &xSize) override {
68  _nDX = (int16)xSize.cx;
69  _nDY = (int16)xSize.cy;
70  }
71 
72  int getPointSize() const {
73  return _nPointSize;
74  }
75  void setPointSize(int xSize) {
76  assert(xSize >= 0 && xSize <= 255);
77  _nPointSize = (byte)xSize;
78  }
79  int getColor() const {
80  return 0;
81  }
82  void setColor(int nColor);
83 
84  // Font support for text objects
85  int getFont() const {
86  return _nTextFont;
87  }
88  void setFont(int nFont) {
89  _nTextFont = nFont;
90  }
91 
92  bool runObject() override;
93 
94  const CBofString *getInitInfo() const override {
95  return _psInitInfo;
96  }
97  void setInitInfo(const CBofString &info) override {
98  delete _psInitInfo;
99  _psInitInfo = new CBofString();
100  *_psInitInfo = info;
101  }
102 
103  CBofString *getPSText() const {
104  return _psText;
105  }
106  void setPSText(CBofString *p);
107 
108  const CBofString &getText();
109  void setText(const CBofString &s);
110 
114  void recalcTextRect(bool bTextFromFile);
115 
116  ErrorCode update(CBofBitmap *pBmp, CBofPoint pt, CBofRect * /*pSrcRect*/ = nullptr, int /*nMaskColor*/ = -1) override;
117 
118  ErrorCode attach() override;
119  ErrorCode detach() override;
120 
121  ParseCodes setInfo(CBagIfstream &istr) override;
122 
123  void setProperty(const CBofString &sProp, int nVal) override;
124  int getProperty(const CBofString &sProp) override;
125 
126  bool isCaption() const {
127  return _bCaption;
128  }
129 
130  void setTitle(bool b = true) {
131  _bTitle = b;
132  }
133  bool isTitle() const {
134  return _bTitle;
135  }
136 
137  // Extra stuff to handle mouse downs on floaters in the log pda/residue printing code.
138  void onLButtonUp(uint32, CBofPoint *, void * = nullptr) override;
139 
140  void setRPObject(CBagObject *prp) {
141  _pRPObject = prp;
142  }
143  CBagObject *getRPObject() const {
144  return _pRPObject;
145  }
146 };
147 
148 } // namespace SpaceBar
149 } // namespace Bagel
150 
151 #endif
Definition: ifstream.h:32
Definition: size.h:32
Definition: object.h:86
Definition: rect.h:35
Definition: text_object.h:38
Definition: string.h:38
Definition: afxwin.h:27
ParseCodes setInfo(CBagIfstream &istr) override
Definition: point.h:32
void recalcTextRect(bool bTextFromFile)
Definition: bitmap.h:57