#include <slider.hpp>
Inheritance diagram for gcn::Slider:
You can set the scale of the slider yourself so that it ranges between, for example, -1.0 and 2.0.
Definition at line 68 of file slider.hpp.
Public Types | |
enum | { HORIZONTAL = 0, VERTICAL } |
Draw orientations for the slider. More... | |
Public Member Functions | |
Slider (double scaleEnd=1.0) | |
Constructor. | |
Slider (double scaleStart, double scaleEnd) | |
Constructor. | |
virtual | ~Slider () |
Destructor. | |
virtual void | setScale (double scaleStart, double scaleEnd) |
Sets the scale. | |
virtual double | getScaleStart () const |
Gets the scale start. | |
virtual void | setScaleStart (double scaleStart) |
Sets the scale start. | |
virtual double | getScaleEnd () const |
Gets the scale end. | |
virtual void | setScaleEnd (double scaleEnd) |
Sets the scale end. | |
virtual double | getValue () const |
Gets the current value. | |
virtual void | setValue (double value) |
Sets the current value. | |
virtual void | drawMarker (gcn::Graphics *graphics) |
Draws the marker. | |
virtual void | setMarkerLength (int length) |
Sets the length of the marker. | |
virtual int | getMarkerLength () const |
Gets the length of the marker. | |
virtual void | setOrientation (unsigned int orientation) |
Sets the orientation of the slider. | |
virtual unsigned int | getOrientation () const |
Gets the orientation of the slider. | |
virtual void | setStepLength (double length) |
Sets the step length. | |
virtual double | getStepLength () const |
Gets the step length. | |
virtual void | draw (gcn::Graphics *graphics) |
virtual void | drawBorder (gcn::Graphics *graphics) |
virtual void | lostFocus () |
Called if the Widget looses focus. | |
virtual void | mousePress (int x, int y, int button) |
Called when a mouse button is pressed when the mouse is in the Widget area or if the Widget has focus. | |
virtual void | mouseRelease (int x, int y, int button) |
Called when a mouse button is released when the mouse is in the Widget area or if the Widget has focus. | |
virtual void | mouseMotion (int x, int y) |
Called when the mouse moves and the mouse is in the Widget area or if the Widget has focus. | |
virtual void | keyPress (const Key &key) |
Called if a key is pressed when the widget has keyboard focus. | |
Protected Member Functions | |
virtual double | markerPositionToValue (int v) const |
Converts a marker position to a value. | |
virtual int | valueToMarkerPosition (double value) const |
Converts a value to a marker position. | |
virtual int | getMarkerPosition () const |
Gets the marker position for the current value. | |
Protected Attributes | |
bool | mMouseDrag |
double | mValue |
double | mStepLength |
int | mMarkerLength |
double | mScaleStart |
double | mScaleEnd |
unsigned int | mOrientation |
|
Draw orientations for the slider. It can be drawn verticaly or horizontaly. Definition at line 223 of file slider.hpp. |
|
Constructor. Scale start is 0.
Definition at line 64 of file slider.cpp. References gcn::Widget::addKeyListener(), gcn::Widget::addMouseListener(), gcn::Widget::setBorderSize(), gcn::Widget::setFocusable(), setMarkerLength(), setOrientation(), setStepLength(), and setValue(). |
|
Constructor.
Definition at line 83 of file slider.cpp. References gcn::Widget::addKeyListener(), gcn::Widget::addMouseListener(), gcn::Widget::setBorderSize(), gcn::Widget::setFocusable(), setMarkerLength(), setOrientation(), setStepLength(), and setValue(). |
|
Draws the marker.
Definition at line 163 of file slider.cpp. References gcn::Color::a, gcn::Widget::getBaseColor(), gcn::Widget::getForegroundColor(), gcn::Widget::getHeight(), getMarkerLength(), getMarkerPosition(), getOrientation(), gcn::Widget::getWidth(), and gcn::Widget::hasFocus(). |
|
Gets the length of the marker.
Definition at line 284 of file slider.cpp. Referenced by drawMarker(), markerPositionToValue(), mouseMotion(), mousePress(), and valueToMarkerPosition(). |
|
Gets the marker position for the current value.
Definition at line 390 of file slider.cpp. References getValue(), and valueToMarkerPosition(). Referenced by drawMarker(). |
|
Gets the orientation of the slider. Se the enum in this class.
Definition at line 329 of file slider.cpp. Referenced by drawMarker(), keyPress(), markerPositionToValue(), mouseMotion(), mousePress(), and valueToMarkerPosition(). |
|
Gets the scale end.
Definition at line 117 of file slider.cpp. Referenced by markerPositionToValue(), setValue(), and valueToMarkerPosition(). |
|
Gets the scale start.
Definition at line 107 of file slider.cpp. Referenced by markerPositionToValue(), setValue(), and valueToMarkerPosition(). |
|
Gets the step length.
Definition at line 385 of file slider.cpp. Referenced by keyPress(). |
|
Gets the current value.
Definition at line 279 of file slider.cpp. Referenced by getMarkerPosition(), and keyPress(). |
|
Called if a key is pressed when the widget has keyboard focus. If a key is held down the widget will generate multiple key presses.
Reimplemented from gcn::KeyListener. Definition at line 294 of file slider.cpp. References gcn::Widget::generateAction(), getOrientation(), getStepLength(), getValue(), and setValue(). |
|
Converts a marker position to a value.
Definition at line 334 of file slider.cpp. References gcn::Widget::getHeight(), getMarkerLength(), getOrientation(), getScaleEnd(), getScaleStart(), and gcn::Widget::getWidth(). Referenced by mouseMotion(), and mousePress(). |
|
Called when the mouse moves and the mouse is in the Widget area or if the Widget has focus.
Reimplemented from gcn::MouseListener. Definition at line 245 of file slider.cpp. References gcn::Widget::generateAction(), gcn::Widget::getHeight(), getMarkerLength(), getOrientation(), markerPositionToValue(), and setValue(). |
|
Called when a mouse button is pressed when the mouse is in the Widget area or if the Widget has focus. NOTE: A mouse press is NOT equal to a mouse click. Use mouseClickMessage to check for mouse clicks.
Reimplemented from gcn::MouseListener. Definition at line 211 of file slider.cpp. References gcn::Widget::generateAction(), gcn::Widget::getHeight(), getMarkerLength(), getOrientation(), gcn::Widget::getWidth(), markerPositionToValue(), and setValue(). |
|
Called when a mouse button is released when the mouse is in the Widget area or if the Widget has focus.
Reimplemented from gcn::MouseListener. Definition at line 235 of file slider.cpp. |
|
Sets the length of the marker.
Definition at line 289 of file slider.cpp. Referenced by Slider(). |
|
Sets the orientation of the slider. A slider can be drawn verticaly or horizontaly. For orientation, see the enum in this class.
Definition at line 324 of file slider.cpp. Referenced by Slider(). |
|
Sets the scale.
Definition at line 101 of file slider.cpp. |
|
Sets the scale end.
Definition at line 122 of file slider.cpp. |
|
Sets the scale start.
Definition at line 112 of file slider.cpp. |
|
Sets the step length. Step length is used when the keys left and right are pressed.
Definition at line 380 of file slider.cpp. Referenced by Slider(). |
|
Sets the current value.
Definition at line 262 of file slider.cpp. References getScaleEnd(), and getScaleStart(). Referenced by keyPress(), mouseMotion(), mousePress(), and Slider(). |
|
Converts a value to a marker position.
Definition at line 351 of file slider.cpp. References gcn::Widget::getHeight(), getMarkerLength(), getOrientation(), getScaleEnd(), getScaleStart(), and gcn::Widget::getWidth(). Referenced by getMarkerPosition(). |