]> git.tdb.fi Git - libs/gltk.git/blob - source/slider.h
Move all child widget handling into Container
[libs/gltk.git] / source / slider.h
1 #ifndef MSP_GLTK_SLIDER_H_
2 #define MSP_GLTK_SLIDER_H_
3
4 #include <sigc++/sigc++.h>
5 #include "widget.h"
6
7 namespace Msp {
8 namespace GLtk {
9
10 /**
11 Sliders are used to adjust numeric values visually.  This class provides the
12 common interface for sliders - see classes HSlider and VSlider for concrete
13 variations.
14 */
15 class Slider: public Widget
16 {
17 public:
18         class Loader: public Widget::Loader
19         {
20         public:
21                 Loader(Slider &);
22                 Slider &get_object() const;
23         };
24
25         sigc::signal<void, double> signal_value_changed;
26
27 protected:
28         double min, max;
29         double value;
30         double step;
31
32         bool dragging;
33         double drag_start_pos;
34         double drag_start_value;
35         unsigned drag_area_size;
36
37         Slider();
38
39 public:
40         void set_value(double);
41         void set_range(double, double);
42         void set_step(double);
43         double get_value() const { return value; }
44
45 protected:
46         void start_drag(int);
47         void drag(int);
48         void end_drag();
49 };
50
51 } // namespace GLtk
52 } // namespace Msp
53
54 #endif