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);
49 private:
50 Gtk::Adjustment _adjustment;
51 Gtk::HScale _scale;
52 Gtk::SpinButton _spin;
53 };
55 // Contains two SpinSliders for controlling number-opt-number attributes
56 class DualSpinSlider : public AttrWidget
57 {
58 public:
59 DualSpinSlider(double value, double lower, double upper, double step_inc,
60 double climb_rate, int digits, const SPAttributeEnum);
62 virtual Glib::ustring get_as_attribute() const;
63 virtual void set_from_attribute(SPObject*);
65 sigc::signal<void>& signal_value_changed();
67 const SpinSlider& get_spinslider1() const;
68 SpinSlider& get_spinslider1();
70 const SpinSlider& get_spinslider2() const;
71 SpinSlider& get_spinslider2();
73 void set_update_policy(const Gtk::UpdateType);
74 private:
75 sigc::signal<void> _signal_value_changed;
76 SpinSlider _s1, _s2;
77 };
79 } // namespace Widget
80 } // namespace UI
81 } // namespace Inkscape
83 #endif // INKSCAPE_UI_WIDGET_SPIN_SLIDER_H
85 /*
86 Local Variables:
87 mode:c++
88 c-file-style:"stroustrup"
89 c-file-offsets:((innamespace . 0)(inline-open . 0))
90 indent-tabs-mode:nil
91 fill-column:99
92 End:
93 */
94 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :