ScummVM API documentation
text_box.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_BOFLIB_GUI_TEXT_BOX_H
24 #define BAGEL_BOFLIB_GUI_TEXT_BOX_H
25 
26 #include "bagel/boflib/gfx/bitmap.h"
27 #include "bagel/boflib/error.h"
28 #include "bagel/boflib/string.h"
29 #include "bagel/boflib/gfx/text.h"
30 #include "bagel/boflib/gui/window.h"
31 
32 namespace Bagel {
33 
34 class CBofTextBox : public CBofObject, public CBofError {
35 public:
36  CBofTextBox();
37  CBofTextBox(CBofWindow *pWindow, const CBofRect *pRect, const CBofString &cText);
38  CBofTextBox(CBofBitmap *pBitmap, const CBofRect *pRect, const CBofString &cText);
39  virtual ~CBofTextBox();
40 
41  void setText(const CBofString &cText);
42  ErrorCode setBox(const CBofRect *pRect);
43  void setDisplay(CBofWindow *pWindow);
44  void setDisplay(CBofBitmap *pBitmap);
45 
46  void setTextAttribs(int nSize, int nWeight, RGBCOLOR cColor = CTEXT_COLOR, int nFont = FONT_DEFAULT);
47 
48  void setPointSize(const int nSize) {
49  _nPointSize = nSize;
50  }
51  int getPointSize() const {
52  return _nPointSize;
53  }
54 
55  void setWeight(const int nWeight) {
56  _nWeight = nWeight;
57  }
58  int getWeight() const {
59  return _nWeight;
60  }
61 
62  void setPageLength(const int nSize) {
63  _nPageSize = nSize;
64  }
65  int getPageLength() const {
66  return _nPageSize;
67  }
68 
69  void setColor(const RGBCOLOR cColor) {
70  _cTextColor = cColor;
71  }
72  RGBCOLOR getColor() const {
73  return _cTextColor;
74  }
75 
76  void setFont(int nFont) {
77  _nTextFont = nFont;
78  }
79  int getFont() const {
80  return _nTextFont;
81  }
82 
83  ErrorCode lineUp() {
84  return scrollUp(1);
85  }
86  ErrorCode lineDown() {
87  return scrollDown(1);
88  }
89 
90  ErrorCode pageUp() {
91  return scrollUp(_nPageSize);
92  }
93  ErrorCode pageDown() {
94  return scrollDown(_nPageSize);
95  }
96 
97  ErrorCode scrollUp(int nLines);
98  ErrorCode scrollDown(const int nLines) {
99  return scrollUp(-nLines);
100  }
101 
102  ErrorCode scrollTo(int nLine);
103 
104  ErrorCode display();
105  ErrorCode erase();
106 
107  void flushBackground();
108 
109  int getCurrLine() {
110  return _nCurrentLine;
111  }
112  ErrorCode setCurrLine(const int nLine) {
113  return scrollTo(nLine);
114  }
115 
116 protected:
117  int getIndex(int nLines);
118 
119  // Data
120  CBofString _cBuffer;
121  CBofText *_pTextField;
122  CBofWindow *_pDestWindow;
123  CBofBitmap *_pDestBitmap;
124 
125  int _nCurrentLine;
126  int _nCurrentIndex;
127  int _nNumLines;
128  int _nPageSize;
129 
130  RGBCOLOR _cTextColor;
131  int _nPointSize;
132  int _nWeight;
133  int _nTextFont;
134 };
135 
136 } // namespace Bagel
137 
138 #endif
Definition: window.h:50
Definition: object.h:28
Definition: bitmap.h:55
Definition: rect.h:36
Definition: error.h:50
Definition: text_box.h:34
Definition: string.h:38
Definition: bagel.h:31
Definition: text.h:122