Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/gui/src/lib/gui/gl_gui/glgui_slider.h @ 7972

Last change on this file since 7972 was 7972, checked in by bensch, 18 years ago

gui: first signal is connected, althought the algorithm is not perfect yet

File size: 1.7 KB
Line 
1/*!
2 * @file glgui_slider.h
3 * The gl_ widget of th openglGUI
4 *
5 */
6
7#ifndef _GLGUI_SLIDER_H
8#define _GLGUI_SLIDER_H
9
10#include "glgui_widget.h"
11#include "glgui_defs.h"
12
13namespace OrxGui
14{
15  // FORWARD DECLARATION
16
17  //! This is part of the openglGUI class
18  /**
19   * The Slider is a Widget, with a Range and a Value.
20   */
21  class GLGuiSlider : public GLGuiWidget
22  {
23
24  public:
25    GLGuiSlider();
26    virtual ~GLGuiSlider();
27
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; };
36
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);
51    virtual void draw() const;
52
53    DeclareSignal(valueChanged, (float));
54
55  protected:
56    virtual void resize();
57
58    virtual void clicked(const Vector2D& pos);
59    virtual void released(const Vector2D& pos);
60    virtual void removedFocus();
61
62  private:
63    void init();
64    float sliderPosition() const;
65    float sliderValue(float position) const;
66
67  private:
68    Orientation      orientation;
69
70    float            _maxValue;
71    float            _minValue;
72    float            _step;
73
74    float            _value;
75
76    float            _sliderWidth;
77
78    bool             grabbed;
79
80  };
81}
82#endif /* _GLGUI_SLIDER_H */
Note: See TracBrowser for help on using the repository browser.