CEGUI::Slider Class Reference

Base class for Slider widgets. More...

Inheritance diagram for CEGUI::Slider:

Inheritance graph
[legend]
Collaboration diagram for CEGUI::Slider:

Collaboration graph
[legend]

List of all members.

Public Member Functions

float getCurrentValue (void) const
 return the current slider value.
float getMaxValue (void) const
 return the maximum value set for this widget
float getClickStep (void) const
 return the current click step setting for the slider.
ThumbgetThumb () const
 Return a pointer to the Thumb component widget for this Slider.
virtual void initialiseComponents (void)
 Initialises the Window based object ready for use.
void setMaxValue (float maxVal)
 set the maximum value for the slider. Note that the minimum value is fixed at 0.
void setCurrentValue (float value)
 set the current slider value.
void setClickStep (float step)
 set the current click step setting for the slider.
 Slider (const String &type, const String &name)
 Slider base class constructor.
virtual ~Slider (void)
 Slider base class destructor.

Static Public Attributes

static const String EventNamespace
 Namespace for global events.
static const String WidgetTypeName
 Window factory name.
static const String EventValueChanged
 Event fired when the slider value changes.
static const String EventThumbTrackStarted
 Name of the event fired when the user begins dragging the thumb.
static const String EventThumbTrackEnded
 Name of the event fired when the user releases the thumb.
static const String ThumbNameSuffix
 Widget name suffix for the thumb component.

Protected Member Functions

virtual void updateThumb (void)
 update the size and location of the thumb to properly represent the current state of the slider
virtual float getValueFromThumb (void) const
 return value that best represents current slider value given the current location of the thumb.
virtual float getAdjustDirectionFromPoint (const Point &pt) const
 Given window location pt, return a value indicating what change should be made to the slider.
bool handleThumbMoved (const EventArgs &e)
 update the size and location of the thumb to properly represent the current state of the slider
bool handleThumbTrackStarted (const EventArgs &e)
 handler function for when thumb tracking begins
bool handleThumbTrackEnded (const EventArgs &e)
 handler function for when thumb tracking begins
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.
virtual bool validateWindowRenderer (const String &name) const
 Function used in checking if a WindowRenderer is valid for this window.
virtual void onValueChanged (WindowEventArgs &e)
 Handler triggered when the slider value changes.
virtual void onThumbTrackStarted (WindowEventArgs &e)
 Handler triggered when the user begins to drag the slider thumb.
virtual void onThumbTrackEnded (WindowEventArgs &e)
 Handler triggered when the slider thumb is released.
virtual void onMouseButtonDown (MouseEventArgs &e)
 Handler called when a mouse button has been depressed within this window's area.
virtual void onMouseWheel (MouseEventArgs &e)
 Handler called when the mouse wheel (z-axis) position changes within this window's area.

Protected Attributes

float d_value
 current slider value
float d_maxValue
 slider maximum value (minimum is fixed at 0)
float d_step
 amount to adjust slider by when clicked (and not dragged).


Detailed Description

Base class for Slider widgets.

The slider widget has a default range of 0.0f - 1.0f. This enables use of the slider value to scale any value needed by way of a simple multiplication.


Member Function Documentation

float CEGUI::Slider::getAdjustDirectionFromPoint ( const Point pt  )  const [protected, virtual]

Given window location pt, return a value indicating what change should be made to the slider.

Parameters:
pt Point object describing a pixel position in window space.
Returns:
  • -1 to indicate slider should be moved to a lower setting.
  • 0 to indicate slider should not be moved.
  • +1 to indicate slider should be moved to a higher setting.

References CEGUI::Window::d_windowRenderer, and CEGUI::SliderWindowRenderer::getAdjustDirectionFromPoint().

Referenced by onMouseButtonDown().

float CEGUI::Slider::getClickStep ( void   )  const [inline]

return the current click step setting for the slider.

The click step size is the amount the slider value will be adjusted when the widget is clicked wither side of the slider thumb.

Returns:
float value representing the current click step setting.

float CEGUI::Slider::getCurrentValue ( void   )  const [inline]

return the current slider value.

Returns:
float value equal to the sliders current value.

Referenced by CEGUI::FalagardSlider::updateThumb().

float CEGUI::Slider::getMaxValue ( void   )  const [inline]

return the maximum value set for this widget

Returns:
float value equal to the currently set maximum value for this slider.

Referenced by CEGUI::FalagardSlider::getValueFromThumb(), and CEGUI::FalagardSlider::updateThumb().

Thumb * CEGUI::Slider::getThumb (  )  const

Return a pointer to the Thumb component widget for this Slider.

Returns:
Pointer to a Thumb object.
Exceptions:
UnknownObjectException Thrown if the Thumb component does not exist.

References CEGUI::Window::getName(), and ThumbNameSuffix.

Referenced by CEGUI::FalagardSlider::getAdjustDirectionFromPoint(), CEGUI::FalagardSlider::getValueFromThumb(), initialiseComponents(), and CEGUI::FalagardSlider::updateThumb().

float CEGUI::Slider::getValueFromThumb ( void   )  const [protected, virtual]

return value that best represents current slider value given the current location of the thumb.

Returns:
float value that, given the thumb widget position, best represents the current value for the slider.

References CEGUI::Window::d_windowRenderer, and CEGUI::SliderWindowRenderer::getValueFromThumb().

Referenced by handleThumbMoved().

bool CEGUI::Slider::handleThumbMoved ( const EventArgs e  )  [protected]

update the size and location of the thumb to properly represent the current state of the slider

return value that best represents current slider value given the current location of the thumb.

Returns:
float value that, given the thumb widget position, best represents the current value for the slider.
Given window location pt, return a value indicating what change should be made to the slider.
Parameters:
pt Point object describing a pixel position in window space.
Returns:
  • -1 to indicate slider should be moved to a lower setting.
  • 0 to indicate slider should not be moved.
  • +1 to indicate slider should be moved to a higher setting.
handler function for when thumb moves.

References getValueFromThumb(), and setCurrentValue().

Referenced by initialiseComponents().

void CEGUI::Slider::initialiseComponents ( void   )  [virtual]

Initialises the Window based object ready for use.

Note:
This must be called for every window created. Normally this is handled automatically by the WindowFactory for each Window type.
Returns:
Nothing

Reimplemented from CEGUI::Window.

References CEGUI::Thumb::EventThumbPositionChanged, CEGUI::Thumb::EventThumbTrackEnded, CEGUI::Thumb::EventThumbTrackStarted, getThumb(), handleThumbMoved(), handleThumbTrackEnded(), handleThumbTrackStarted(), CEGUI::Window::performChildWindowLayout(), and CEGUI::EventSet::subscribeEvent().

void CEGUI::Slider::onMouseButtonDown ( MouseEventArgs e  )  [protected, virtual]

Handler called when a mouse button has been depressed within this window's area.

Parameters:
e MouseEventArgs object. All fields are valid.

Reimplemented from CEGUI::Window.

References CEGUI::MouseEventArgs::button, d_step, d_value, getAdjustDirectionFromPoint(), CEGUI::EventArgs::handled, CEGUI::LeftButton, CEGUI::MouseEventArgs::position, and setCurrentValue().

void CEGUI::Slider::onMouseWheel ( MouseEventArgs e  )  [protected, virtual]

Handler called when the mouse wheel (z-axis) position changes within this window's area.

Parameters:
e MouseEventArgs object. All fields are valid.

Reimplemented from CEGUI::Window.

References d_step, d_value, CEGUI::EventArgs::handled, setCurrentValue(), and CEGUI::MouseEventArgs::wheelChange.

void CEGUI::Slider::setClickStep ( float  step  )  [inline]

set the current click step setting for the slider.

The click step size is the amount the slider value will be adjusted when the widget is clicked wither side of the slider thumb.

Parameters:
step float value representing the click step setting to use.
Returns:
Nothing.

void CEGUI::Slider::setCurrentValue ( float  value  ) 

set the current slider value.

Parameters:
value float value specifying the new value for this slider widget.
Returns:
Nothing.

References d_maxValue, d_value, onValueChanged(), and updateThumb().

Referenced by handleThumbMoved(), onMouseButtonDown(), and onMouseWheel().

void CEGUI::Slider::setMaxValue ( float  maxVal  ) 

set the maximum value for the slider. Note that the minimum value is fixed at 0.

Parameters:
maxVal float value specifying the maximum value for this slider widget.
Returns:
Nothing.

References d_maxValue, d_value, onValueChanged(), and updateThumb().

virtual bool CEGUI::Slider::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.

Parameters:
class_name The class name that is to be checked.
Returns:
true if this window was inherited from class_name. false if not.

Reimplemented from CEGUI::Window.

References CEGUI::Window::testClassName_impl().

virtual bool CEGUI::Slider::validateWindowRenderer ( const String name  )  const [inline, protected, virtual]

Function used in checking if a WindowRenderer is valid for this window.

Returns:
Returns true if the given WindowRenderer class name is valid for this window. False if not.

Reimplemented from CEGUI::Window.


Generated on Thu Nov 27 20:34:38 2008 for Crazy Eddies GUI System by  doxygen 1.5.7.1