#include <Slider.h>
Public Member Functions | |
const char * | getTypeName () const |
void | setMin (float min) |
float | getMin () const |
void | setMax (float max) |
float | getMax () const |
void | setStep (float step) |
float | getStep () const |
void | setValue (float value) |
float | getValue () const |
void | setValueTextVisible (bool visible) |
bool | isValueTextVisible () const |
void | setValueTextAlignment (Font::Justify alignment) |
Font::Justify | getValueTextAlignment () const |
void | setValueTextPrecision (unsigned int precision) |
unsigned int | getValueTextPrecision () const |
void | addListener (Control::Listener *listener, int eventFlags) |
Static Public Member Functions | |
static Slider * | create (const char *id, Theme::Style *style=NULL) |
Protected Member Functions | |
Slider () | |
~Slider () | |
void | initialize (const char *typeName, Theme::Style *style, Properties *properties) |
bool | keyEvent (Keyboard::KeyEvent evt, int key) |
bool | touchEvent (Touch::TouchEvent evt, int x, int y, unsigned int contactIndex) |
bool | mouseEvent (Mouse::MouseEvent evt, int x, int y, int wheelDelta) |
bool | gamepadJoystickEvent (Gamepad *gamepad, unsigned int index) |
unsigned int | drawImages (Form *form, const Rectangle &clip) |
unsigned int | drawText (Form *form, const Rectangle &clip) |
void | update (float elapsedTime) |
void | updateState (State state) |
void | updateBounds () |
Static Protected Member Functions | |
static Control * | create (Theme::Style *style, Properties *properties=NULL) |
Protected Attributes | |
float | _min |
float | _max |
float | _step |
float | _value |
float | _delta |
Theme::ThemeImage * | _minImage |
Theme::ThemeImage * | _maxImage |
Theme::ThemeImage * | _trackImage |
Theme::ThemeImage * | _markerImage |
bool | _valueTextVisible |
Font::Justify | _valueTextAlignment |
unsigned int | _valueTextPrecision |
Defines a slider control.
A slider consists of a marker (grabber) that can slide along a track between two end-caps.
gameplay::Slider::Slider | ( | ) | [protected] |
Constructor.
gameplay::Slider::~Slider | ( | ) | [protected] |
Destructor.
void gameplay::Slider::addListener | ( | Control::Listener * | listener, |
int | eventFlags | ||
) | [virtual] |
Add a listener to be notified of specific events affecting this control. Event types can be OR'ed together. E.g. To listen to touch-press and touch-release events, pass Control::Listener::TOUCH | Control::Listener::RELEASE
as the second parameter.
listener | The listener to add. |
eventFlags | The events to listen for. |
Reimplemented from gameplay::Label.
static Slider* gameplay::Slider::create | ( | const char * | id, |
Theme::Style * | style = NULL |
||
) | [static] |
Creates a new Slider.
id | The slider ID. |
style | The slider style (optional). |
Reimplemented from gameplay::Label.
static Control* gameplay::Slider::create | ( | Theme::Style * | style, |
Properties * | properties = NULL |
||
) | [static, protected] |
Create a slider with a given style and properties.
style | The style to apply to this slider. |
properties | A properties object containing a definition of the slider (optional). |
Reimplemented from gameplay::Label.
unsigned int gameplay::Slider::drawImages | ( | Form * | form, |
const Rectangle & | clip | ||
) | [protected, virtual] |
Reimplemented from gameplay::Control.
unsigned int gameplay::Slider::drawText | ( | Form * | form, |
const Rectangle & | clip | ||
) | [protected, virtual] |
Reimplemented from gameplay::Label.
bool gameplay::Slider::gamepadJoystickEvent | ( | Gamepad * | gamepad, |
unsigned int | index | ||
) | [protected, virtual] |
Reimplemented from gameplay::Control.
float gameplay::Slider::getMax | ( | ) | const |
Get the maximum value that can be set on this slider.
float gameplay::Slider::getMin | ( | ) | const |
Get the minimum value that can be set on this slider.
float gameplay::Slider::getStep | ( | ) | const |
Get this slider's step size.
const char* gameplay::Slider::getTypeName | ( | ) | const [virtual] |
Extends ScriptTarget::getTypeName() to return the type name of this class.
Child controls should override this function to return the correct type name.
Reimplemented from gameplay::Label.
float gameplay::Slider::getValue | ( | ) | const |
Get this slider's current value.
Gets the slider value text alignment.
unsigned int gameplay::Slider::getValueTextPrecision | ( | ) | const |
Gets the precision, which is the number floating point digits after the decimal.
void gameplay::Slider::initialize | ( | const char * | typeName, |
Theme::Style * | style, | ||
Properties * | properties | ||
) | [protected, virtual] |
Reimplemented from gameplay::Label.
bool gameplay::Slider::isValueTextVisible | ( | ) | const |
Gets if the slider value text is rendered below the control.
bool gameplay::Slider::keyEvent | ( | Keyboard::KeyEvent | evt, |
int | key | ||
) | [protected, virtual] |
Reimplemented from gameplay::Control.
bool gameplay::Slider::mouseEvent | ( | Mouse::MouseEvent | evt, |
int | x, | ||
int | y, | ||
int | wheelDelta | ||
) | [protected, virtual] |
Reimplemented from gameplay::Control.
void gameplay::Slider::setMax | ( | float | max | ) |
Set the maximum value that can be set on this slider.
max | The new maximum. |
void gameplay::Slider::setMin | ( | float | min | ) |
Set the minimum value that can be set on this slider.
min | The new minimum. |
void gameplay::Slider::setStep | ( | float | step | ) |
Set this slider's step size. If this is greater than zero, the marker will snap to discrete multiples of the step size.
step | The new step size. |
void gameplay::Slider::setValue | ( | float | value | ) |
Set this slider's value. The new value will be clamped to fit within the slider's minimum and maximum values.
value | The new value. |
void gameplay::Slider::setValueTextAlignment | ( | Font::Justify | alignment | ) |
Sets the slider value text alignment.
alignment | the slider value text alignment. |
void gameplay::Slider::setValueTextPrecision | ( | unsigned int | precision | ) |
Sets the precision, which is the number floating point digits after the decimal.
precision | The number floating point precision/digits after the decimal. |
void gameplay::Slider::setValueTextVisible | ( | bool | visible | ) |
Sets if the slider value text is rendered below the control.
visible | If the slider value text is rendered below the control. |
bool gameplay::Slider::touchEvent | ( | Touch::TouchEvent | evt, |
int | x, | ||
int | y, | ||
unsigned int | contactIndex | ||
) | [protected, virtual] |
Reimplemented from gameplay::Control.
void gameplay::Slider::update | ( | float | elapsedTime | ) | [protected, virtual] |
Reimplemented from gameplay::Label.
void gameplay::Slider::updateBounds | ( | ) | [protected, virtual] |
Reimplemented from gameplay::Label.
void gameplay::Slider::updateState | ( | State | state | ) | [protected, virtual] |
Reimplemented from gameplay::Label.
float gameplay::Slider::_delta [protected] |
When a gamepad is in use, this stores how much to move the slider's value.
Theme::ThemeImage* gameplay::Slider::_markerImage [protected] |
The image for the slider marker.
float gameplay::Slider::_max [protected] |
The maximum value for the Slider
Theme::ThemeImage* gameplay::Slider::_maxImage [protected] |
The image for the maximum slider value.
float gameplay::Slider::_min [protected] |
The minimum value for the Slider.
Theme::ThemeImage* gameplay::Slider::_minImage [protected] |
The image for the minimum slider value.
float gameplay::Slider::_step [protected] |
The Slider's step size.
Theme::ThemeImage* gameplay::Slider::_trackImage [protected] |
The image for the slider track.
float gameplay::Slider::_value [protected] |
The Slider's current value.
Font::Justify gameplay::Slider::_valueTextAlignment [protected] |
Alignment of value text.
unsigned int gameplay::Slider::_valueTextPrecision [protected] |
Number of digits after the decimal to draw for value text.
bool gameplay::Slider::_valueTextVisible [protected] |
Whether to display this slider's value.