1 /**
2 * \brief Groups an HScale and a SpinButton together using the same Adjustment
3 *
4 * Author:
5 * Nicholas Bishop <nicholasbishop@gmail.com>
6 *
7 * Copyright (C) 2007 Author
8 *
9 * Released under GNU GPL. Read the file 'COPYING' for more information.
10 */
12 #ifndef INKSCAPE_UI_WIDGET_SPIN_SLIDER_H
13 #define INKSCAPE_UI_WIDGET_SPIN_SLIDER_H
15 #include <gtkmm/adjustment.h>
16 #include <gtkmm/box.h>
17 #include <gtkmm/scale.h>
18 #include <gtkmm/spinbutton.h>
19 #include "attr-widget.h"
21 namespace Inkscape {
22 namespace UI {
23 namespace Widget {
25 class SpinSlider : public Gtk::HBox, public AttrWidget
26 {
27 public:
28 SpinSlider(double value, double lower, double upper, double step_inc,
29 double climb_rate, int digits, const SPAttributeEnum a = SP_ATTR_INVALID);
31 virtual Glib::ustring get_as_attribute() const;
32 virtual void set_from_attribute(SPObject*);
34 // Shortcuts to _adjustment
35 Glib::SignalProxy0<void> signal_value_changed();
36 double get_value() const;
37 void set_value(const double);
39 const Gtk::Adjustment& get_adjustment() const;
40 Gtk::Adjustment& get_adjustment();
42 const Gtk::HScale& get_scale() const;
43 Gtk::HScale& get_scale();
45 const Gtk::SpinButton& get_spin_button() const;
46 Gtk::SpinButton& get_spin_button();
48 void set_update_policy(const Gtk::UpdateType);
50 // Change the SpinSlider into a SpinButton with AttrWidget support)
51 void remove_scale();
52 private:
53 Gtk::Adjustment _adjustment;
54 Gtk::HScale _scale;
55 Gtk::SpinButton _spin;
56 };
58 // Contains two SpinSliders for controlling number-opt-number attributes
59 class DualSpinSlider : public Gtk::HBox, public AttrWidget
60 {
61 public:
62 DualSpinSlider(double value, double lower, double upper, double step_inc,
63 double climb_rate, int digits, const SPAttributeEnum);
65 virtual Glib::ustring get_as_attribute() const;
66 virtual void set_from_attribute(SPObject*);
68 sigc::signal<void>& signal_value_changed();
70 const SpinSlider& get_spinslider1() const;
71 SpinSlider& get_spinslider1();
73 const SpinSlider& get_spinslider2() const;
74 SpinSlider& get_spinslider2();
76 void set_update_policy(const Gtk::UpdateType);
78 void remove_scale();
79 private:
80 void link_toggled();
81 void update_linked();
82 sigc::signal<void> _signal_value_changed;
83 SpinSlider _s1, _s2;
84 Gtk::ToggleButton _link;
85 };
87 } // namespace Widget
88 } // namespace UI
89 } // namespace Inkscape
91 #endif // INKSCAPE_UI_WIDGET_SPIN_SLIDER_H
93 /*
94 Local Variables:
95 mode:c++
96 c-file-style:"stroustrup"
97 c-file-offsets:((innamespace . 0)(inline-open . 0))
98 indent-tabs-mode:nil
99 fill-column:99
100 End:
101 */
102 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :