Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
StaticText.h
1 /***********************************************************************
2  created: Tue Jul 5 2005
3  author: Paul D Turner <paul@cegui.org.uk>
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  ***************************************************************************/
27 #ifndef _FalStaticText_h_
28 #define _FalStaticText_h_
29 
30 #include "CEGUI/WindowRendererSets/Core/Module.h"
31 #include "CEGUI/WindowRendererSets/Core/Static.h"
32 #include "CEGUI/falagard/Enums.h"
33 #include "CEGUI/ColourRect.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 COREWRSET_API FalagardStaticText : public FalagardStatic
71  {
72  public:
73  static const String TypeName;
74 
75  /*************************************************************************
76  Child Widget name constants
77  *************************************************************************/
78  static const String VertScrollbarName;
79  static const String HorzScrollbarName;
80 
81  /************************************************************************
82  Constructor / Destructor
83  *************************************************************************/
88  FalagardStaticText(const String& type);
89 
92 
93  /************************************************************************
94  Scrolled text implementation
95  *************************************************************************/
100  ColourRect getTextColours(void) const {return d_textCols;}
101 
106  HorizontalTextFormatting getHorizontalFormatting(void) const {return d_horzFormatting;}
107 
112  VerticalTextFormatting getVerticalFormatting(void) const {return d_vertFormatting;}
113 
118  void setTextColours(const ColourRect& colours);
119 
124  void setVerticalFormatting(VerticalTextFormatting v_fmt);
125 
130  void setHorizontalFormatting(HorizontalTextFormatting h_fmt);
131 
136  bool isVerticalScrollbarEnabled(void) const {return d_enableVertScrollbar;}
137 
142  bool isHorizontalScrollbarEnabled(void) const {return d_enableHorzScrollbar;}
143 
148  void setVerticalScrollbarEnabled(bool setting);
149 
154  void setHorizontalScrollbarEnabled(bool setting);
155 
157  float getHorizontalTextExtent() const;
158 
160  float getVerticalTextExtent() const;
161 
162  // overridden from base class
163  bool handleFontRenderSizeChange(const Font* const font);
164  void render(void);
165 
166  protected:
168  void updateFormatting() const;
170  void updateFormatting(const Sizef& sz) const;
171 
172  // overridden from FalagardStatic base class
173  void onLookNFeelAssigned();
174  void onLookNFeelUnassigned();
175 
176  // text field with scrollbars methods
177  void renderScrolledText(void);
178  void configureScrollbars(void);
179  Scrollbar* getVertScrollbar(void) const;
180  Scrollbar* getHorzScrollbar(void) const;
181  Rectf getTextRenderArea(void) const;
182  Sizef getDocumentSize(const Rectf& renderArea) const;
183  void setupStringFormatter() const;
184 
185  // overridden event handlers
186  bool onTextChanged(const EventArgs& e);
187  bool onSized(const EventArgs& e);
188  bool onFontChanged(const EventArgs& e);
189  bool onMouseWheel(const EventArgs& e);
190 
191  // event subscribers
192  bool handleScrollbarChange(const EventArgs& e);
193 
194  // implementation data
202 
205 
206  typedef std::vector<Event::Connection> ConnectionList;
207  ConnectionList d_connections;
208 
210  mutable bool d_formatValid;
211  };
212 
213 } // End of CEGUI namespace section
214 
215 #if defined(_MSC_VER)
216 # pragma warning(pop)
217 #endif
218 
219 #endif // end of guard _FalStaticText_h_