| [4838] | 1 | /*! |
|---|
| [5365] | 2 | * @file glgui_slider.h |
|---|
| [5360] | 3 | * The gl_ widget of th openglGUI |
|---|
| 4 | * |
|---|
| 5 | */ |
|---|
| [1853] | 6 | |
|---|
| [5365] | 7 | #ifndef _GLGUI_SLIDER_H |
|---|
| 8 | #define _GLGUI_SLIDER_H |
|---|
| [1853] | 9 | |
|---|
| [7919] | 10 | #include "glgui_widget.h" |
|---|
| 11 | #include "glgui_defs.h" |
|---|
| [1853] | 12 | |
|---|
| [7779] | 13 | namespace OrxGui |
|---|
| 14 | { |
|---|
| 15 | // FORWARD DECLARATION |
|---|
| [3543] | 16 | |
|---|
| [7779] | 17 | //! This is part of the openglGUI class |
|---|
| 18 | /** |
|---|
| [8035] | 19 | * The Slider is a Widget, with a Range and a Value. |
|---|
| [7779] | 20 | */ |
|---|
| [7919] | 21 | class GLGuiSlider : public GLGuiWidget |
|---|
| [7779] | 22 | { |
|---|
| [2036] | 23 | |
|---|
| [7779] | 24 | public: |
|---|
| 25 | GLGuiSlider(); |
|---|
| 26 | virtual ~GLGuiSlider(); |
|---|
| [1853] | 27 | |
|---|
| [8035] | 28 | /** @returns the Value of the Slider. */ |
|---|
| 29 | float value() const { return this->_value; } |
|---|
| 30 | /** @returns the minimum of the sliders range */ |
|---|
| 31 | float min() const { return this->_minValue; }; |
|---|
| 32 | /** @returns the maximum of the sliders range */ |
|---|
| 33 | float max() const { return this->_maxValue; }; |
|---|
| 34 | /** @returns the step size */ |
|---|
| 35 | float step() const { return this->_step; }; |
|---|
| [1853] | 36 | |
|---|
| [8035] | 37 | void setValue(float value); |
|---|
| 38 | |
|---|
| 39 | void setMin(float minimum); |
|---|
| 40 | void setMax(float maximum); |
|---|
| 41 | void setRange(float minimum, float maximum); |
|---|
| 42 | |
|---|
| 43 | void setStep(float step); |
|---|
| 44 | |
|---|
| 45 | void stepPlus(); |
|---|
| 46 | void stepMinus(); |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | virtual void tick(float dt); |
|---|
| 50 | virtual bool processEvent(const Event& event); |
|---|
| [7919] | 51 | virtual void draw() const; |
|---|
| [3245] | 52 | |
|---|
| [8035] | 53 | DeclareSignal1(valueChanged, float); |
|---|
| 54 | DeclareSignal2(rangeChanged, float, float); |
|---|
| 55 | |
|---|
| 56 | protected: |
|---|
| 57 | virtual void resize(); |
|---|
| 58 | |
|---|
| 59 | virtual void clicking(const Vector2D& pos); |
|---|
| 60 | virtual void releasing(const Vector2D& pos); |
|---|
| 61 | virtual void removedFocus(); |
|---|
| 62 | |
|---|
| [7779] | 63 | private: |
|---|
| [8035] | 64 | void init(); |
|---|
| 65 | float sliderPosition() const; |
|---|
| 66 | float sliderValue(float position) const; |
|---|
| 67 | |
|---|
| 68 | private: |
|---|
| [7919] | 69 | Orientation orientation; |
|---|
| [1853] | 70 | |
|---|
| [7919] | 71 | float _maxValue; |
|---|
| 72 | float _minValue; |
|---|
| [8035] | 73 | float _step; |
|---|
| [7919] | 74 | |
|---|
| 75 | float _value; |
|---|
| 76 | |
|---|
| [8035] | 77 | float _sliderWidth; |
|---|
| 78 | |
|---|
| 79 | bool grabbed; |
|---|
| 80 | |
|---|
| [7779] | 81 | }; |
|---|
| 82 | } |
|---|
| [5365] | 83 | #endif /* _GLGUI_SLIDER_H */ |
|---|