3 This file is part of libmspgltk
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
13 Slider::Slider(const Resources &r):
23 void Slider::set_value(double v)
25 double old_value=value;
33 unsigned steps=static_cast<unsigned>((v-min)/step+0.5);
38 signal_value_changed.emit(value);
41 void Slider::set_range(double a, double b)
48 void Slider::set_step(double s)
54 void Slider::start_drag(int p)
58 drag_start_value=value;
61 void Slider::drag(int p)
64 set_value(drag_start_value+(p-drag_start_pos)*(max-min)/drag_area_size);
67 void Slider::end_drag()
73 Slider::Loader::Loader(Slider &s):
76 add("range", &Slider::min, &Slider::max);
77 add("step", &Slider::step);
78 add("value", &Slider::value);
81 Slider &Slider::Loader::get_object() const
83 return static_cast<Slider &>(wdg);