|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
gameplay::Slider Class Reference

`#include <Slider.h>`

Inheritance diagram for gameplay::Slider:

List of all members.

## 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

## Detailed Description

Defines a slider control.

A slider consists of a marker (grabber) that can slide along a track between two end-caps.

See also:
  http://gameplay3d.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms

## Constructor & Destructor Documentation

gameplay::Slider::Slider | ( |  | ) | `[protected]`

Constructor.

gameplay::Slider::~Slider | ( |  | ) | `[protected]`

Destructor.

## Member Function Documentation

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.

Parameters:

  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.

Parameters:

  id | The slider ID.
  style | The slider style (optional).

Returns:
  The new slider.

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.

Parameters:

  style | The style to apply to this slider.
  properties | A properties object containing a definition of the slider (optional).

Returns:
  The new slider.

Reimplemented from gameplay::Label.

unsigned int gameplay::Slider::drawImages | ( | Form * | form,
|  | const Rectangle & | clip
| ) |  | `[protected, virtual]`

See also:
  Control::drawImages

Reimplemented from gameplay::Control.

unsigned int gameplay::Slider::drawText | ( | Form * | form,
|  | const Rectangle & | clip
| ) |  | `[protected, virtual]`

See also:
  Control::drawText

Reimplemented from gameplay::Label.

bool gameplay::Slider::gamepadJoystickEvent | ( | Gamepad * | gamepad,
|  | unsigned int | index
| ) |  | `[protected, virtual]`

See also:
  Control::gamepadJoystickEvent

Reimplemented from gameplay::Control.

float gameplay::Slider::getMax | ( |  | ) | const

Get the maximum value that can be set on this slider.

Returns:
  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.

Returns:
  The minimum value that can be set on this slider.

float gameplay::Slider::getStep | ( |  | ) | const

Get this slider's step size.

Returns:
  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.

Returns:
  The type name of this class: "Slider"

See also:
  ScriptTarget::getTypeName()

Reimplemented from gameplay::Label.

float gameplay::Slider::getValue | ( |  | ) | const

Get this slider's current value.

Returns:
  This slider's current value.

Font::Justify gameplay::Slider::getValueTextAlignment | ( |  | ) | const

Gets the slider value text alignment.

Returns:
  The slider value text alignment.

unsigned int gameplay::Slider::getValueTextPrecision | ( |  | ) | const

Gets the precision, which is the number floating point digits after the decimal.

Returns:
  The number floating point precision/digits after the decimal.

void gameplay::Slider::initialize | ( | const char * | typeName,
|  | Theme::Style * | style,
|  | Properties * | properties
| ) |  | `[protected, virtual]`

See also:
  Control::initialize

Reimplemented from gameplay::Label.

bool gameplay::Slider::isValueTextVisible | ( |  | ) | const

Gets if the slider value text is rendered below the control.

Returns:
  true if the slider value text is rendered below the control, false if otherwise.

bool gameplay::Slider::keyEvent | ( | Keyboard::KeyEvent | evt,
|  | int | key
| ) |  | `[protected, virtual]`

See also:
  Control::KeyEvent

Reimplemented from gameplay::Control.

bool gameplay::Slider::mouseEvent | ( | Mouse::MouseEvent | evt,
|  | int | x,
|  | int | y,
|  | int | wheelDelta
| ) |  | `[protected, virtual]`

See also:
  Control::MouseEvent

Reimplemented from gameplay::Control.

void gameplay::Slider::setMax | ( | float | max | ) |

Set the maximum value that can be set on this slider.

Parameters:

  max | The new maximum.

void gameplay::Slider::setMin | ( | float | min | ) |

Set the minimum value that can be set on this slider.

Parameters:

  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.

Parameters:

  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.

Parameters:

  value | The new value.

void gameplay::Slider::setValueTextAlignment | ( | Font::Justify | alignment | ) |

Sets the slider value text alignment.

Parameters:

  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.

Parameters:

  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.

Parameters:

  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]`

See also:
  Control::TouchEvent

Reimplemented from gameplay::Control.

void gameplay::Slider::update | ( | float | elapsedTime | ) | `[protected, virtual]`

See also:
  Control::update

Reimplemented from gameplay::Label.

void gameplay::Slider::updateBounds | ( |  | ) | `[protected, virtual]`

See also:
  Control::updateBounds

Reimplemented from gameplay::Label.

void gameplay::Slider::updateState | ( | State | state | ) | `[protected, virtual]`

See also:
  Control::updateState

Reimplemented from gameplay::Label.

## Member Data Documentation

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.

All Classes Functions Variables Typedefs Enumerations Enumerator