Crazy Eddie's GUI System  0.8.7
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 
90  static const float DefaultCaretBlinkTimeout;
91 
96  FalagardEditbox(const String& type);
97 
104 
111 
125  ColourRect& colour_rect) const;
126 
128  bool isCaretBlinkEnabled() const;
130  float getCaretBlinkTimeout() const;
132  void setCaretBlinkEnabled(bool enable);
134  void setCaretBlinkTimeout(float seconds);
135 
148  HorizontalTextFormatting getTextFormatting() const;
149 
150  void render();
151 
152  // overridden from EditboxWindowRenderer base class.
153  size_t getTextIndexFromPosition(const Vector2f& pt) const;
154  // overridden from WindowRenderer class
155  void update(float elapsed);
156  bool handleFontRenderSizeChange(const Font* const font);
157 
158 protected:
160  void renderBaseImagery(const WidgetLookFeel& wlf) const;
162  void setupVisualString(String& visual) const;
163  size_t getCaretIndex(const String& visual_text) const;
164  float calculateTextOffset(const Rectf& text_area,
165  const float text_extent,
166  const float caret_width,
167  const float extent_to_caret);
168  void renderTextNoBidi(const WidgetLookFeel& wlf,
169  const String& text,
170  const Rectf& text_area,
171  float text_offset);
172  void renderTextBidi(const WidgetLookFeel& wlf,
173  const String& text,
174  const Rectf& text_area,
175  float text_offset);
176  bool editboxIsFocussed() const;
177  bool editboxIsReadOnly() const;
178  void renderCaret(const ImagerySection& imagery,
179  const Rectf& text_area,
180  const float text_offset,
181  const float extent_to_caret) const;
182 
183  bool isUnsupportedFormat(const HorizontalTextFormatting format);
184 
197 };
198 
199 } // End of CEGUI namespace section
200 
201 #if defined(_MSC_VER)
202 # pragma warning(pop)
203 #endif
204 
205 #endif // end of guard _FalEditbox_h_
CEGUI::Font
Class that encapsulates a typeface.
Definition: Font.h:62
CEGUI::FalagardEditbox::DefaultCaretBlinkTimeout
static const float DefaultCaretBlinkTimeout
The default timeout (in seconds) used when blinking the caret.
Definition: WindowRendererSets/Core/Editbox.h:90
CEGUI::FalagardEditbox::setupVisualString
void setupVisualString(String &visual) const
helper to set 'visual' to the string we will render (part of)
CEGUI::FalagardEditbox::d_lastTextOffset
float d_lastTextOffset
x rendering offset used last time we drew the widget.
Definition: WindowRendererSets/Core/Editbox.h:186
CEGUI::EditboxWindowRenderer
Base class for the EditboxWindowRenderer class.
Definition: widgets/Editbox.h:46
CEGUI::FalagardEditbox::setCaretBlinkTimeout
void setCaretBlinkTimeout(float seconds)
set the caret blink timeout period (only used if blink is enabled).
CEGUI::FalagardEditbox::d_caretBlinkElapsed
float d_caretBlinkElapsed
current time elapsed since last caret blink state change.
Definition: WindowRendererSets/Core/Editbox.h:192
CEGUI::FalagardEditbox::SelectedTextColourPropertyName
static const String SelectedTextColourPropertyName
Name of the optional property to access for the selected text colour.
Definition: WindowRendererSets/Core/Editbox.h:84
CEGUI::FalagardEditbox::ActiveSelectionColourPropertyName
static const String ActiveSelectionColourPropertyName
Name of the optional property to access to obtain active selection rendering colour.
Definition: WindowRendererSets/Core/Editbox.h:86
CEGUI
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
CEGUI::FalagardEditbox::d_caretBlinkTimeout
float d_caretBlinkTimeout
time-out in seconds used for blinking the caret.
Definition: WindowRendererSets/Core/Editbox.h:190
CEGUI::FalagardEditbox::render
void render()
Populate render cache.
CEGUI::Vector2< float >
CEGUI::ColourRect
Class that holds details of colours for the four corners of a rectangle.
Definition: ColourRect.h:45
CEGUI::FalagardEditbox::handleFontRenderSizeChange
bool handleFontRenderSizeChange(const Font *const font)
Perform any updates needed because the given font's render size has changed.
CEGUI::FalagardEditbox::InactiveSelectionColourPropertyName
static const String InactiveSelectionColourPropertyName
Name of the optional property to access to obtain inactive selection rendering colour.
Definition: WindowRendererSets/Core/Editbox.h:88
CEGUI::FalagardEditbox
Editbox class for the FalagardBase module.
Definition: WindowRendererSets/Core/Editbox.h:76
CEGUI::WidgetLookFeel
Class that encapsulates Look N' Feel information for a widget.
Definition: WidgetLookFeel.h:56
CEGUI::FalagardEditbox::setColourRectToUnselectedTextColour
void setColourRectToUnselectedTextColour(ColourRect &colour_rect) const
Set the given ColourRect to the colour to be used for rendering Editbox text oustside of the selected...
CEGUI::FalagardEditbox::update
void update(float elapsed)
perform any time based updates for this WindowRenderer.
CEGUI::FalagardEditbox::renderBaseImagery
void renderBaseImagery(const WidgetLookFeel &wlf) const
helper to draw the base imagery (container and what have you)
CEGUI::HorizontalTextFormatting
HorizontalTextFormatting
Enumeration of possible values to indicate the horizontal formatting to be used for a text component.
Definition: Enums.h:96
CEGUI::FalagardEditbox::UnselectedTextColourPropertyName
static const String UnselectedTextColourPropertyName
Name of the optional property to access for the unselected text colour.
Definition: WindowRendererSets/Core/Editbox.h:82
CEGUI::FalagardEditbox::getCaretBlinkTimeout
float getCaretBlinkTimeout() const
return the caret blink timeout period (only used if blink is enabled).
CEGUI::FalagardEditbox::d_blinkCaret
bool d_blinkCaret
true if the caret imagery should blink.
Definition: WindowRendererSets/Core/Editbox.h:188
CEGUI::FalagardEditbox::d_showCaret
bool d_showCaret
true if caret should be shown.
Definition: WindowRendererSets/Core/Editbox.h:194
CEGUI::String
String class used within the GUI system.
Definition: String.h:64
CEGUI::FalagardEditbox::setColourRectToOptionalPropertyColour
void setColourRectToOptionalPropertyColour(const String &propertyName, ColourRect &colour_rect) const
Set the given ColourRect to the colour(s) fetched from the named property if it exists,...
CEGUI::FalagardEditbox::setColourRectToSelectedTextColour
void setColourRectToSelectedTextColour(ColourRect &colour_rect) const
Set the given ColourRect to the colour to be used for rendering Editbox text falling within the selec...
CEGUI::FalagardEditbox::FalagardEditbox
FalagardEditbox(const String &type)
Constructor.
CEGUI::Rect< float >
CEGUI::FalagardEditbox::TypeName
static const String TypeName
type name for this widget.
Definition: WindowRendererSets/Core/Editbox.h:79
CEGUI::FalagardEditbox::setTextFormatting
void setTextFormatting(const HorizontalTextFormatting format)
Sets the horizontal text formatting to be used from now onwards.
CEGUI::FalagardEditbox::d_textFormatting
HorizontalTextFormatting d_textFormatting
horizontal formatting. Only supports left, right, and centred.
Definition: WindowRendererSets/Core/Editbox.h:196
CEGUI::FalagardEditbox::getTextIndexFromPosition
size_t getTextIndexFromPosition(const Vector2f &pt) const
Return the text code point index that is rendered closest to screen position pt.
CEGUI::FalagardEditbox::setCaretBlinkEnabled
void setCaretBlinkEnabled(bool enable)
set whether the blinking caret is enabled.
CEGUI::ImagerySection
Class that encapsulates a re-usable collection of imagery specifications.
Definition: ImagerySection.h:49
CEGUI::FalagardEditbox::isCaretBlinkEnabled
bool isCaretBlinkEnabled() const
return whether the blinking caret is enabled.