Public Types | |
enum | TextInputMode { FloatingPoint, Integer, Hexadecimal, Octal } |
Enumerated type specifying possible input and/or display modes for the spinner. More... | |
Public Member Functions | |
Spinner (const String &type, const String &name) | |
Constructor for Spinner objects. | |
virtual | ~Spinner (void) |
Destructor for Spinner objects. | |
void | initialiseComponents (void) |
Initialises the Window based object ready for use. | |
float | getCurrentValue (void) const |
Return the current spinner value. | |
float | getStepSize (void) const |
Return the current step value. | |
float | getMaximumValue (void) const |
Return the current maximum limit value for the Spinner. | |
float | getMinimumValue (void) const |
Return the current minimum limit value for the Spinner. | |
TextInputMode | getTextInputMode (void) const |
Return the current text input / display mode setting. | |
void | setCurrentValue (float value) |
Set the current spinner value. | |
void | setStepSize (float step) |
Set the current step value. | |
void | setMaximumValue (float maxValue) |
Set the spinner maximum value. | |
void | setMinimumValue (float minVaue) |
Set the spinner minimum value. | |
void | setTextInputMode (TextInputMode mode) |
Set the spinner input / display mode. | |
Static Public Attributes | |
static const String | WidgetTypeName |
Window factory name. | |
static const String | EventNamespace |
Namespace for global events. | |
static const String | EventValueChanged |
Event fired when the spinner value changes. | |
static const String | EventStepChanged |
Event fired when the step value changes. | |
static const String | EventMaximumValueChanged |
Event fired when the maximum spinner value changes. | |
static const String | EventMinimumValueChanged |
Event fired when the minimum spinner value changes. | |
static const String | EventTextInputModeChanged |
Event fired when the input/display mode is changed. | |
static const String | EditboxNameSuffix |
Widget name suffix for the editbox thumb component. | |
static const String | IncreaseButtonNameSuffix |
Widget name suffix for the increase button component. | |
static const String | DecreaseButtonNameSuffix |
Widget name suffix for the decrease button component. | |
Protected Member Functions | |
virtual float | getValueFromText (void) const |
Returns the numerical representation of the current editbox text. | |
virtual String | getTextFromValue (void) const |
Returns the textual representation of the current spinner value. | |
virtual bool | testClassName_impl (const String &class_name) const |
Return whether this window was inherited from the given class name at some point in the inheritance hierarchy. | |
PushButton * | getIncreaseButton () const |
Return a pointer to the 'increase' PushButtoncomponent widget for this Spinner. | |
PushButton * | getDecreaseButton () const |
Return a pointer to the 'decrease' PushButton component widget for this Spinner. | |
Editbox * | getEditbox () const |
Return a pointer to the Editbox component widget for this Spinner. | |
virtual void | onFontChanged (WindowEventArgs &e) |
Handler called when the window's font is changed. | |
virtual void | onTextChanged (WindowEventArgs &e) |
Handler called when the window's text is changed. | |
virtual void | onActivated (ActivationEventArgs &e) |
Handler called when this window has become the active window. | |
virtual void | onValueChanged (WindowEventArgs &e) |
Method called when the spinner value changes. | |
virtual void | onStepChanged (WindowEventArgs &e) |
Method called when the step value changes. | |
virtual void | onMaximumValueChanged (WindowEventArgs &e) |
Method called when the maximum value setting changes. | |
virtual void | onMinimumValueChanged (WindowEventArgs &e) |
Method called when the minimum value setting changes. | |
virtual void | onTextInputModeChanged (WindowEventArgs &e) |
Method called when the text input/display mode is changed. | |
bool | handleIncreaseButton (const EventArgs &e) |
bool | handleDecreaseButton (const EventArgs &e) |
bool | handleEditTextChange (const EventArgs &e) |
Protected Attributes | |
float | d_stepSize |
Step size value used y the increase & decrease buttons. | |
float | d_currentValue |
Numerical copy of the text in d_editbox. | |
float | d_maxValue |
Maximum value for spinner. | |
float | d_minValue |
Minimum value for spinner. | |
TextInputMode | d_inputMode |
Current text display/input mode. | |
Static Protected Attributes | |
static const String | FloatValidator |
Validator regex used for floating point mode. | |
static const String | IntegerValidator |
Validator regex used for decimal integer mode. | |
static const String | HexValidator |
Validator regex used for hexadecimal mode. | |
static const String | OctalValidator |
Validator regex used for octal mode. |
The spinner widget has a text area where numbers may be entered and two buttons which may be used to increase or decrease the value in the text area by a user specified amount.
float CEGUI::Spinner::getCurrentValue | ( | void | ) | const |
Return the current spinner value.
References d_currentValue.
PushButton * CEGUI::Spinner::getDecreaseButton | ( | ) | const [protected] |
Return a pointer to the 'decrease' PushButton component widget for this Spinner.
UnknownObjectException | Thrown if the 'decrease' PushButton component does not exist. |
References DecreaseButtonNameSuffix, and CEGUI::Window::getName().
Referenced by initialiseComponents().
Editbox * CEGUI::Spinner::getEditbox | ( | ) | const [protected] |
Return a pointer to the Editbox component widget for this Spinner.
UnknownObjectException | Thrown if the Editbox component does not exist. |
References EditboxNameSuffix, and CEGUI::Window::getName().
Referenced by getValueFromText(), initialiseComponents(), onActivated(), onFontChanged(), onTextChanged(), onTextInputModeChanged(), onValueChanged(), and setTextInputMode().
PushButton * CEGUI::Spinner::getIncreaseButton | ( | ) | const [protected] |
Return a pointer to the 'increase' PushButtoncomponent widget for this Spinner.
UnknownObjectException | Thrown if the increase PushButton component does not exist. |
References CEGUI::Window::getName(), and IncreaseButtonNameSuffix.
Referenced by initialiseComponents().
float CEGUI::Spinner::getMaximumValue | ( | void | ) | const |
Return the current maximum limit value for the Spinner.
References d_maxValue.
float CEGUI::Spinner::getMinimumValue | ( | void | ) | const |
Return the current minimum limit value for the Spinner.
References d_minValue.
float CEGUI::Spinner::getStepSize | ( | void | ) | const |
Return the current step value.
References d_stepSize.
String CEGUI::Spinner::getTextFromValue | ( | void | ) | const [protected, virtual] |
Returns the textual representation of the current spinner value.
References d_currentValue, d_inputMode, FloatingPoint, Hexadecimal, Integer, and Octal.
Referenced by onTextInputModeChanged(), and onValueChanged().
Spinner::TextInputMode CEGUI::Spinner::getTextInputMode | ( | void | ) | const |
Return the current text input / display mode setting.
References d_inputMode.
float CEGUI::Spinner::getValueFromText | ( | void | ) | const [protected, virtual] |
Returns the numerical representation of the current editbox text.
InvalidRequestException | thrown if the text can not be converted. |
References CEGUI::String::c_str(), d_inputMode, CEGUI::String::empty(), FloatingPoint, getEditbox(), CEGUI::Window::getText(), Hexadecimal, Integer, and Octal.
void CEGUI::Spinner::initialiseComponents | ( | void | ) | [virtual] |
Initialises the Window based object ready for use.
Reimplemented from CEGUI::Window.
References CEGUI::Window::EventMouseButtonDown, CEGUI::Window::EventTextChanged, getDecreaseButton(), getEditbox(), getIncreaseButton(), Integer, CEGUI::Window::performChildWindowLayout(), setCurrentValue(), CEGUI::Window::setMouseAutoRepeatEnabled(), setTextInputMode(), CEGUI::Window::setWantsMultiClickEvents(), and CEGUI::EventSet::subscribeEvent().
void CEGUI::Spinner::onActivated | ( | ActivationEventArgs & | e | ) | [protected, virtual] |
Handler called when this window has become the active window.
e | ActivationEventArgs class whose 'otherWindow' field is set to the window that previously was active, or NULL for none. |
Reimplemented from CEGUI::Window.
References CEGUI::Window::activate(), getEditbox(), and CEGUI::Window::isActive().
void CEGUI::Spinner::onFontChanged | ( | WindowEventArgs & | e | ) | [protected, virtual] |
Handler called when the window's font is changed.
e | WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event. For this event the trigger window is always 'this'. |
Reimplemented from CEGUI::Window.
References getEditbox(), CEGUI::Window::getFont(), and CEGUI::Window::setFont().
void CEGUI::Spinner::onMaximumValueChanged | ( | WindowEventArgs & | e | ) | [protected, virtual] |
Method called when the maximum value setting changes.
e | WindowEventArgs object containing any relevant data. |
References d_currentValue, d_maxValue, EventMaximumValueChanged, EventNamespace, CEGUI::EventSet::fireEvent(), and setCurrentValue().
Referenced by setMaximumValue().
void CEGUI::Spinner::onMinimumValueChanged | ( | WindowEventArgs & | e | ) | [protected, virtual] |
Method called when the minimum value setting changes.
e | WindowEventArgs object containing any relevant data. |
References d_currentValue, d_minValue, EventMinimumValueChanged, EventNamespace, CEGUI::EventSet::fireEvent(), and setCurrentValue().
Referenced by setMinimumValue().
void CEGUI::Spinner::onStepChanged | ( | WindowEventArgs & | e | ) | [protected, virtual] |
Method called when the step value changes.
e | WindowEventArgs object containing any relevant data. |
References EventNamespace, EventStepChanged, and CEGUI::EventSet::fireEvent().
Referenced by setStepSize().
void CEGUI::Spinner::onTextChanged | ( | WindowEventArgs & | e | ) | [protected, virtual] |
Handler called when the window's text is changed.
e | WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event. For this event the trigger window is always 'this'. |
Reimplemented from CEGUI::Window.
References CEGUI::Window::d_text, getEditbox(), CEGUI::Window::getText(), CEGUI::EventArgs::handled, and CEGUI::Window::setText().
void CEGUI::Spinner::onTextInputModeChanged | ( | WindowEventArgs & | e | ) | [protected, virtual] |
Method called when the text input/display mode is changed.
e | WindowEventArgs object containing any relevant data. |
References EventNamespace, EventTextInputModeChanged, CEGUI::EventSet::fireEvent(), getEditbox(), getTextFromValue(), CEGUI::EventSet::isMuted(), CEGUI::EventSet::setMutedState(), and CEGUI::Window::setText().
Referenced by setTextInputMode().
void CEGUI::Spinner::onValueChanged | ( | WindowEventArgs & | e | ) | [protected, virtual] |
Method called when the spinner value changes.
e | WindowEventArgs object containing any relevant data. |
References d_currentValue, CEGUI::String::empty(), EventNamespace, EventValueChanged, CEGUI::EventSet::fireEvent(), getEditbox(), CEGUI::Window::getText(), getTextFromValue(), CEGUI::EventSet::isMuted(), CEGUI::EventSet::setMutedState(), and CEGUI::Window::setText().
Referenced by setCurrentValue().
void CEGUI::Spinner::setCurrentValue | ( | float | value | ) |
Set the current spinner value.
value | value to be assigned to the Spinner. |
References d_currentValue, d_maxValue, d_minValue, and onValueChanged().
Referenced by initialiseComponents(), onMaximumValueChanged(), and onMinimumValueChanged().
void CEGUI::Spinner::setMaximumValue | ( | float | maxValue | ) |
Set the spinner maximum value.
maxValue | The maximum value to be allowed by the spinner. |
References d_maxValue, and onMaximumValueChanged().
void CEGUI::Spinner::setMinimumValue | ( | float | minVaue | ) |
Set the spinner minimum value.
minVaue | The minimum value to be allowed by the spinner. |
References d_minValue, and onMinimumValueChanged().
void CEGUI::Spinner::setStepSize | ( | float | step | ) |
Set the current step value.
step | The value added to be the spinner value when the up / down buttons are clicked. |
References d_stepSize, and onStepChanged().
void CEGUI::Spinner::setTextInputMode | ( | TextInputMode | mode | ) |
Set the spinner input / display mode.
mode | One of the TextInputMode enumerated values indicating the text input / display mode to be used by the spinner. |
References d_inputMode, FloatingPoint, FloatValidator, getEditbox(), Hexadecimal, HexValidator, Integer, IntegerValidator, Octal, OctalValidator, onTextInputModeChanged(), and CEGUI::Editbox::setValidationString().
Referenced by initialiseComponents().
virtual bool CEGUI::Spinner::testClassName_impl | ( | const String & | class_name | ) | const [inline, protected, virtual] |
Return whether this window was inherited from the given class name at some point in the inheritance hierarchy.
class_name | The class name that is to be checked. |
Reimplemented from CEGUI::Window.
References CEGUI::Window::testClassName_impl().