Crazy Eddie's GUI System  0.8.7
CEGUI::FalagardEditbox Class Reference

Editbox class for the FalagardBase module. More...

+ Inheritance diagram for CEGUI::FalagardEditbox:
+ Collaboration diagram for CEGUI::FalagardEditbox:

Public Member Functions

 FalagardEditbox (const String &type)
 Constructor.
 
void setColourRectToUnselectedTextColour (ColourRect &colour_rect) const
 Set the given ColourRect to the colour to be used for rendering Editbox text oustside of the selected region.
 
void setColourRectToSelectedTextColour (ColourRect &colour_rect) const
 Set the given ColourRect to the colour to be used for rendering Editbox text falling within the selected region.
 
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, else the default colour of black. More...
 
bool isCaretBlinkEnabled () const
 return whether the blinking caret is enabled.
 
float getCaretBlinkTimeout () const
 return the caret blink timeout period (only used if blink is enabled).
 
void setCaretBlinkEnabled (bool enable)
 set whether the blinking caret is enabled.
 
void setCaretBlinkTimeout (float seconds)
 set the caret blink timeout period (only used if blink is enabled).
 
void setTextFormatting (const HorizontalTextFormatting format)
 Sets the horizontal text formatting to be used from now onwards. More...
 
HorizontalTextFormatting getTextFormatting () const
 
void render ()
 Populate render cache. More...
 
size_t getTextIndexFromPosition (const Vector2f &pt) const
 Return the text code point index that is rendered closest to screen position pt. More...
 
void update (float elapsed)
 perform any time based updates for this WindowRenderer.
 
bool handleFontRenderSizeChange (const Font *const font)
 Perform any updates needed because the given font's render size has changed. More...
 
- Public Member Functions inherited from CEGUI::EditboxWindowRenderer
 EditboxWindowRenderer (const String &name)
 Constructor.
 
- Public Member Functions inherited from CEGUI::WindowRenderer
 WindowRenderer (const String &name, const String &class_name="Window")
 Constructor. More...
 
virtual ~WindowRenderer ()
 Destructor.
 
const StringgetName () const
 Returns the factory type name of this window renderer.
 
WindowgetWindow () const
 Get the window this windowrenderer is attached to.
 
const StringgetClass () const
 Get the "minimum" Window class this renderer requires.
 
const WidgetLookFeelgetLookNFeel () const
 Get the Look'N'Feel assigned to our window.
 
virtual Rectf getUnclippedInnerRect () const
 Get unclipped inner rectangle that our window should return from its member function with the same name.
 
virtual void performChildWindowLayout ()
 Method called to perform extended laying out of the window's attached child windows.
 
virtual void getRenderingContext (RenderingContext &ctx) const
 update the RenderingContext as needed for our window. This is normally invoked via our window's member function with the same name.
 

Static Public Attributes

static const String TypeName
 type name for this widget.
 
static const String UnselectedTextColourPropertyName
 Name of the optional property to access for the unselected text colour.
 
static const String SelectedTextColourPropertyName
 Name of the optional property to access for the selected text colour.
 
static const String ActiveSelectionColourPropertyName
 Name of the optional property to access to obtain active selection rendering colour.
 
static const String InactiveSelectionColourPropertyName
 Name of the optional property to access to obtain inactive selection rendering colour.
 
static const float DefaultCaretBlinkTimeout
 The default timeout (in seconds) used when blinking the caret.
 

Protected Member Functions

void renderBaseImagery (const WidgetLookFeel &wlf) const
 helper to draw the base imagery (container and what have you)
 
void setupVisualString (String &visual) const
 helper to set 'visual' to the string we will render (part of)
 
size_t getCaretIndex (const String &visual_text) const
 
float calculateTextOffset (const Rectf &text_area, const float text_extent, const float caret_width, const float extent_to_caret)
 
void renderTextNoBidi (const WidgetLookFeel &wlf, const String &text, const Rectf &text_area, float text_offset)
 
void renderTextBidi (const WidgetLookFeel &wlf, const String &text, const Rectf &text_area, float text_offset)
 
bool editboxIsFocussed () const
 
bool editboxIsReadOnly () const
 
void renderCaret (const ImagerySection &imagery, const Rectf &text_area, const float text_offset, const float extent_to_caret) const
 
bool isUnsupportedFormat (const HorizontalTextFormatting format)
 
- Protected Member Functions inherited from CEGUI::WindowRenderer
void registerProperty (Property *property, const bool ban_from_xml)
 Register a property class that will be properly managed by this window renderer. More...
 
void registerProperty (Property *property)
 Register a property class that will be properly managed by this window renderer. More...
 
virtual void onAttach ()
 Handler called when this windowrenderer is attached to a window.
 
virtual void onDetach ()
 Handler called when this windowrenderer is detached from its window.
 
virtual void onLookNFeelAssigned ()
 Handler called when a Look'N'Feel is assigned to our window.
 
virtual void onLookNFeelUnassigned ()
 Handler called when a Look'N'Feel is removed/unassigned from our window.
 

Protected Attributes

float d_lastTextOffset
 x rendering offset used last time we drew the widget.
 
bool d_blinkCaret
 true if the caret imagery should blink.
 
float d_caretBlinkTimeout
 time-out in seconds used for blinking the caret.
 
float d_caretBlinkElapsed
 current time elapsed since last caret blink state change.
 
bool d_showCaret
 true if caret should be shown.
 
HorizontalTextFormatting d_textFormatting
 horizontal formatting. Only supports left, right, and centred.
 
- Protected Attributes inherited from CEGUI::WindowRenderer
Windowd_window
 Pointer to the window this windowrenderer is assigned to.
 
const String d_name
 Name of the factory type used to create this window renderer.
 
const String d_class
 Name of the widget class that is the "minimum" requirement.
 
PropertyList d_properties
 The list of properties that this windowrenderer will be handling.
 

Additional Inherited Members

- Protected Types inherited from CEGUI::WindowRenderer
typedef std::pair< Property *, bool > PropertyEntry
 type used for entries in the PropertyList.
 
typedef std::vector< PropertyEntry CEGUI_VECTOR_ALLOC(PropertyEntry)> PropertyList
 type to use for the property list.
 

Detailed Description

Editbox class for the FalagardBase module.

This class requires LookNFeel to be assigned. The LookNFeel should provide the following:

States:

  • Enabled: Rendering for when the editbox is in enabled and is in read-write mode.
  • ReadOnly: Rendering for when the editbox is in enabled and is in read-only mode.
  • Disabled: Rendering for when the editbox is disabled.
  • ActiveSelection: additional state rendered for text selection (the imagery in this section is rendered within the selection area.)
  • InactiveSelection: additional state rendered for text selection (the imagery in this section is rendered within the selection area.)

NamedAreas:

  • TextArea: area where text, selection, and caret imagery will appear.

PropertyDefinitions (optional)

  • NormalTextColour: property that accesses a colour value to be used to render normal unselected text. If this property is not defined, the colour defaults to black.
  • SelectedTextColour: property that accesses a colour value to be used to render selected text. If this property is not defined, the colour defaults to black.

Imagery Sections:

  • Caret

Member Function Documentation

size_t CEGUI::FalagardEditbox::getTextIndexFromPosition ( const Vector2f pt) const
virtual

Return the text code point index that is rendered closest to screen position pt.

Parameters
ptPoint object describing a position on the screen in pixels.
Returns
Code point index into the text that is rendered closest to screen position pt.

Implements CEGUI::EditboxWindowRenderer.

bool CEGUI::FalagardEditbox::handleFontRenderSizeChange ( const Font *const  font)
virtual

Perform any updates needed because the given font's render size has changed.

/note This base implementation deals with updates needed for various definitions in the assigned widget look. If you override, you should generally always call this base class implementation.

Parameters
fontPointer to the Font whose render size has changed.
Returns
  • true if some action was taken.
  • false if no action was taken (i.e font is not used here).

Reimplemented from CEGUI::WindowRenderer.

void CEGUI::FalagardEditbox::render ( )
virtual

Populate render cache.

This method must be implemented by all window renderers and should perform the rendering operations needed for this widget. Normally using the Falagard API...

Implements CEGUI::WindowRenderer.

void CEGUI::FalagardEditbox::setColourRectToOptionalPropertyColour ( const String propertyName,
ColourRect colour_rect 
) const

Set the given ColourRect to the colour(s) fetched from the named property if it exists, else the default colour of black.

Parameters
propertyNameString object holding the name of the property to be accessed if it exists.
colour_rectReference to a ColourRect that will be set.
void CEGUI::FalagardEditbox::setTextFormatting ( const HorizontalTextFormatting  format)

Sets the horizontal text formatting to be used from now onwards.

Parameters
formatSpecifies the formatting to use. Currently can only be one of the following HorizontalTextFormatting values:
  • HTF_LEFT_ALIGNED (default)
  • HTF_RIGHT_ALIGNED
  • HTF_CENTRE_ALIGNED