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