Crazy Eddies GUI System  0.6.2
FalStaticText.h
1 /***********************************************************************
2  filename: FalStaticText.h
3  created: Tue Jul 5 2005
4  author: Paul D Turner <paul@cegui.org.uk>
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  ***************************************************************************/
28 #ifndef _FalStaticText_h_
29 #define _FalStaticText_h_
30 
31 #include "FalModule.h"
32 #include "FalStatic.h"
33 #include "FalStaticTextProperties.h"
34 #include <vector>
35 
36 #if defined(_MSC_VER)
37 # pragma warning(push)
38 # pragma warning(disable : 4251)
39 #endif
40 
41 // Start of CEGUI namespace section
42 namespace CEGUI
43 {
70  class FALAGARDBASE_API FalagardStaticText : public FalagardStatic
71  {
72  public:
73  static const utf8 TypeName[];
74 
75  /*************************************************************************
76  Formatting Enumerations
77  *************************************************************************/
83  {
92  };
93 
99  {
102  VertCentred
103  };
104 
105  /*************************************************************************
106  Child Widget name suffix constants
107  *************************************************************************/
110 
111  /************************************************************************
112  Constructor / Destructor
113  *************************************************************************/
118  FalagardStaticText(const String& type);
119 
120  /************************************************************************
121  Scrolled text implementation
122  *************************************************************************/
127  ColourRect getTextColours(void) const {return d_textCols;}
128 
133  HorzFormatting getHorizontalFormatting(void) const {return d_horzFormatting;}
134 
139  VertFormatting getVerticalFormatting(void) const {return d_vertFormatting;}
140 
145  void setTextColours(const ColourRect& colours);
146 
151  void setVerticalFormatting(VertFormatting v_fmt);
152 
157  void setHorizontalFormatting(HorzFormatting h_fmt);
158 
163  bool isVerticalScrollbarEnabled(void) const {return d_enableVertScrollbar;}
164 
169  bool isHorizontalScrollbarEnabled(void) const {return d_enableHorzScrollbar;}
170 
175  void setVerticalScrollbarEnabled(bool setting);
176 
181  void setHorizontalScrollbarEnabled(bool setting);
182 
183  void render(void);
184 
185  protected:
186  // overridden from FalagardStatic base class
187  void onLookNFeelAssigned();
188  void onLookNFeelUnassigned();
189 
190  // text field with scrollbars methods
191  void renderScrolledText(void);
192  void configureScrollbars(void);
193  Scrollbar* getVertScrollbar(void) const;
194  Scrollbar* getHorzScrollbar(void) const;
195  Rect getTextRenderArea(void) const;
196  Size getDocumentSize(const Rect& renderArea) const;
197 
198  // overridden event handlers
199  bool onTextChanged(const EventArgs& e);
200  bool onSized(const EventArgs& e);
201  bool onFontChanged(const EventArgs& e);
202  bool onMouseWheel(const EventArgs& e);
203 
204  // event subscribers
205  bool handleScrollbarChange(const EventArgs& e);
206 
207  // properties
208  static FalagardStaticTextProperties::TextColours d_textColoursProperty;
209  static FalagardStaticTextProperties::VertFormatting d_vertFormattingProperty;
210  static FalagardStaticTextProperties::HorzFormatting d_horzFormattingProperty;
211  static FalagardStaticTextProperties::VertScrollbar d_vertScrollbarProperty;
212  static FalagardStaticTextProperties::HorzScrollbar d_horzScrollbarProperty;
213 
214  // implementation data
220 
221  typedef std::vector<Event::Connection> ConnectionList;
222  ConnectionList d_connections;
223  };
224 
225 } // End of CEGUI namespace section
226 
227 #if defined(_MSC_VER)
228 # pragma warning(pop)
229 #endif
230 
231 #endif // end of guard _FalStaticText_h_