Rocket::Controls::ElementFormControlSelect Class Reference

#include <ElementFormControlSelect.h>

Inheritance diagram for Rocket::Controls::ElementFormControlSelect:
Collaboration diagram for Rocket::Controls::ElementFormControlSelect:

Public Member Functions

 ElementFormControlSelect (const Rocket::Core::String &tag)
virtual Rocket::Core::String GetValue () const
virtual void SetValue (const Rocket::Core::String &value)
void SetSelection (int selection)
int GetSelection () const
SelectOptionGetOption (int index)
int GetNumOptions ()
int Add (const Rocket::Core::String &rml, const Rocket::Core::String &value, int before=-1, bool selectable=true)
void Remove (int index)
void RemoveAll ()
 Removes all options from the select control.

Protected Member Functions

virtual void OnUpdate ()
 Moves all children to be under control of the widget.
virtual void OnRender ()
 Updates the layout of the widget's elements.
virtual void OnLayout ()
 Forces an internal layout.
virtual bool GetIntrinsicDimensions (Rocket::Core::Vector2f &intrinsic_dimensions)

Protected Attributes

WidgetDropDownwidget

Detailed Description

A drop-down select form control.

Author:
Peter Curry

Constructor & Destructor Documentation

Rocket::Controls::ElementFormControlSelect::ElementFormControlSelect ( const Rocket::Core::String tag  ) 

Constructs a new ElementFormControlSelect. This should not be called directly; use the Factory instead.

Parameters:
[in] tag The tag the element was declared as in RML.


Member Function Documentation

Rocket::Core::String Rocket::Controls::ElementFormControlSelect::GetValue (  )  const [virtual]

Returns a string representation of the current value of the form control.

Returns:
The value of the form control.

Implements Rocket::Controls::ElementFormControl.

void Rocket::Controls::ElementFormControlSelect::SetValue ( const Rocket::Core::String value  )  [virtual]

Sets the current value of the form control.

Parameters:
[in] value The new value of the form control.

Implements Rocket::Controls::ElementFormControl.

void Rocket::Controls::ElementFormControlSelect::SetSelection ( int  selection  ) 

Sets the index of the selection. If the new index lies outside of the bounds, it will be clamped.

Parameters:
[in] selection The new selection index.

int Rocket::Controls::ElementFormControlSelect::GetSelection (  )  const

Returns the index of the currently selected item.

Returns:
The index of the currently selected item.

SelectOption * Rocket::Controls::ElementFormControlSelect::GetOption ( int  index  ) 

Returns one of the select control's option elements.

Parameters:
[in] The index of the desired option element.
Returns:
The option element at the given index. This will be NULL if the index is out of bounds.

int Rocket::Controls::ElementFormControlSelect::GetNumOptions (  ) 

Returns the number of options in the select control.

Returns:
The number of options.

int Rocket::Controls::ElementFormControlSelect::Add ( const Rocket::Core::String rml,
const Rocket::Core::String value,
int  before = -1,
bool  selectable = true 
)

Adds a new option to the select control.

Parameters:
[in] rml The RML content used to represent the option. This is usually a simple string, but can include RML tags.
[in] value The value of the option. This is used to identify the option, but does not necessarily need to be unique.
[in] before The index of the element to insert the new option before. If out of bounds of the control's option list (the default) the new option will be added at the end of the list.
[in] selectable If true this option can be selected. If false, this option is not selectable.
Returns:
The index of the new option.

void Rocket::Controls::ElementFormControlSelect::Remove ( int  index  ) 

Removes an option from the select control.

Parameters:
[in] index The index of the option to remove. If this is outside of the bounds of the control's option list, no option will be removed.

bool Rocket::Controls::ElementFormControlSelect::GetIntrinsicDimensions ( Rocket::Core::Vector2f intrinsic_dimensions  )  [protected, virtual]

Returns true to mark this element as replaced.

Parameters:
[out] intrinsic_dimensions Set to the arbitrary dimensions of 128 x 16 just to give this element a size. Resize with the 'width' and 'height' properties.
Returns:
True.

Reimplemented from Rocket::Core::Element.


The documentation for this class was generated from the following files: