X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fslider.h;h=6c95526f13f2699f14c89049fe5f252510383a2e;hb=3db68f2604b657e79f1b2b317c19c41c2d5a985b;hp=d4ae46b632040fe9b6fb8dd8c90a21a7a5125af8;hpb=c062ca892fc6e10f74a76991b5d4b4349c046b5f;p=libs%2Fgltk.git diff --git a/source/slider.h b/source/slider.h index d4ae46b..6c95526 100644 --- a/source/slider.h +++ b/source/slider.h @@ -1,3 +1,10 @@ +/* $Id$ + +This file is part of libmspgltk +Copyright © 2007 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + #ifndef MSP_GLTK_SLIDER_H_ #define MSP_GLTK_SLIDER_H_ @@ -7,21 +14,45 @@ namespace Msp { namespace GLtk { +/** +Sliders are used to adjust numeric values visually. This class provides the +common interface for sliders - see classes HSlider and VSlider for concrete +variations. +*/ class Slider: public Widget { public: - sigc::signal signal_value_changed; + class Loader: public Widget::Loader + { + public: + Loader(Slider &); + Slider &get_object() const; + }; - void set_value(double); - void set_range(double, double); - void set_step(double); - double get_value() const { return value; } protected: double min, max; double value; double step; + bool dragging; + double drag_start_pos; + double drag_start_value; + unsigned drag_area_size; + +public: + sigc::signal signal_value_changed; + +protected: Slider(const Resources &); +public: + void set_value(double); + void set_range(double, double); + void set_step(double); + double get_value() const { return value; } +protected: + void start_drag(int); + void drag(int); + void end_drag(); }; } // namespace GLtk