Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
WindowRendererSets/Core/Editbox.h
1 /***********************************************************************
2  created: Sat Jun 25 2005
3  author: Paul D Turner <paul@cegui.org.uk>
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2009 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 _FalEditbox_h_
28 #define _FalEditbox_h_
29 
30 #include "CEGUI/WindowRendererSets/Core/Module.h"
31 #include "CEGUI/widgets/Editbox.h"
32 
33 #if defined(_MSC_VER)
34 # pragma warning(push)
35 # pragma warning(disable : 4251)
36 #endif
37 
38 // Start of CEGUI namespace section
39 namespace CEGUI
40 {
75 class COREWRSET_API FalagardEditbox : public EditboxWindowRenderer
76 {
77 public:
79  static const String TypeName;
80 
86  static const float DefaultCaretBlinkTimeout;
87 
92  FalagardEditbox(const String& type);
93 
99  void setColourRectToUnselectedTextColour(ColourRect& colour_rect) const;
100 
106  void setColourRectToSelectedTextColour(ColourRect& colour_rect) const;
107 
120  void setColourRectToOptionalPropertyColour(const String& propertyName,
121  ColourRect& colour_rect) const;
122 
124  bool isCaretBlinkEnabled() const;
126  float getCaretBlinkTimeout() const;
128  void setCaretBlinkEnabled(bool enable);
130  void setCaretBlinkTimeout(float seconds);
131 
143  void setTextFormatting(const HorizontalTextFormatting format);
144  HorizontalTextFormatting getTextFormatting() const;
145 
146  void render();
147 
148  // overridden from EditboxWindowRenderer base class.
149  size_t getTextIndexFromPosition(const Vector2f& pt) const;
150  // overridden from WindowRenderer class
151  void update(float elapsed);
152  bool handleFontRenderSizeChange(const Font* const font);
153 
154 protected:
156  void renderBaseImagery(const WidgetLookFeel& wlf) const;
158  void setupVisualString(String& visual) const;
159  size_t getCaretIndex(const String& visual_string) const;
160  float calculateTextOffset(const Rectf& text_area,
161  const float text_extent,
162  const float caret_width,
163  const float extent_to_caret);
164  void renderTextNoBidi(const WidgetLookFeel& wlf,
165  const String& text,
166  const Rectf& text_area,
167  float text_offset);
168  void renderTextBidi(const WidgetLookFeel& wlf,
169  const String& text,
170  const Rectf& text_area,
171  float text_offset);
172  bool editboxIsFocussed() const;
173  bool editboxIsReadOnly() const;
174  void renderCaret(const ImagerySection& imagery,
175  const Rectf& text_area,
176  const float text_offset,
177  const float extent_to_caret) const;
178 
179  bool isUnsupportedFormat(const HorizontalTextFormatting format);
180 
193 };
194 
195 } // End of CEGUI namespace section
196 
197 #if defined(_MSC_VER)
198 # pragma warning(pop)
199 #endif
200 
201 #endif // end of guard _FalEditbox_h_