Code

reorganize flow, prevent infinite loop, fixes #1509854
[inkscape.git] / src / ui / widget / registered-widget.h
1 /** \file
2  * \brief 
3  *
4  * Authors:
5  *   Ralf Stephan <ralf@ark.in-berlin.de>
6  *
7  * Copyright (C) 2005 Authors
8  *
9  * Released under GNU GPL.  Read the file 'COPYING' for more information.
10  */
12 #ifndef INKSCAPE_UI_WIDGET_REGISTERED_WIDGET__H_
13 #define INKSCAPE_UI_WIDGET_REGISTERED_WIDGET__H_
15 #include <gtkmm/box.h>
16 #include <gtkmm/adjustment.h>
18 class SPUnit;
20 namespace Gtk {
21     class HScale;
22     class RadioButton;
23     class SpinButton;
24     class ToggleButton;
25 }
27 namespace Inkscape {
28 namespace UI {
29 namespace Widget {
31 class ColorPicker;
32 class Registry;
33 class ScalarUnit;
34 class UnitMenu;
36 class RegisteredCheckButton {
37 public:
38     RegisteredCheckButton();
39     ~RegisteredCheckButton();
40     void init (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true);
41     void setActive (bool);
43     Gtk::ToggleButton *_button;
45 protected:
46     Gtk::Tooltips     _tt;
47     sigc::connection  _toggled_connection;
48     Registry    *_wr;
49     Glib::ustring      _key;
50     void on_toggled();
51 };
53 class RegisteredUnitMenu {
54 public:
55     RegisteredUnitMenu();
56     ~RegisteredUnitMenu();
57     void init (const Glib::ustring& label, const Glib::ustring& key, Registry& wr);
58     void setUnit (const SPUnit*);
59     Gtk::Label   *_label;
60     UnitMenu     *_sel;
61     sigc::connection _changed_connection;
63 protected:
64     void on_changed();
65     Registry     *_wr;
66     Glib::ustring _key;
67 };
69 class RegisteredScalarUnit {
70 public:
71     RegisteredScalarUnit();
72     ~RegisteredScalarUnit();
73     void init (const Glib::ustring& label, 
74             const Glib::ustring& tip, 
75             const Glib::ustring& key, 
76             const RegisteredUnitMenu &rum,
77             Registry& wr);
78     ScalarUnit* getSU();
79     void setValue (double);
81 protected:
82     ScalarUnit   *_widget;
83     sigc::connection  _value_changed_connection;
84     UnitMenu         *_um;
85     Registry         *_wr;
86     Glib::ustring    _key;
87     void on_value_changed();
88 };
90 class RegisteredColorPicker {
91 public:
92     RegisteredColorPicker();
93     ~RegisteredColorPicker();
94     void init (const Glib::ustring& label, 
95             const Glib::ustring& title, 
96             const Glib::ustring& tip, 
97             const Glib::ustring& ckey, 
98             const Glib::ustring& akey,
99             Registry& wr);
100     void setRgba32 (guint32);
101     void closeWindow();
103     Gtk::Label *_label;
104     ColorPicker *_cp;
106 protected:
107     Glib::ustring _ckey, _akey;
108     Registry      *_wr;
109     void on_changed (guint32);
110     sigc::connection _changed_connection;
111 };
113 class RegisteredSuffixedInteger {
114 public:
115     RegisteredSuffixedInteger();
116     ~RegisteredSuffixedInteger();
117     void init (const Glib::ustring& label1, 
118                const Glib::ustring& label2, 
119                const Glib::ustring& key,
120                Registry& wr);
121     void setValue (int);
122     Gtk::Label *_label;
123     Gtk::HBox _hbox;
125 protected:
126     Gtk::SpinButton *_sb;
127     Gtk::Adjustment _adj;
128     Gtk::Label      *_suffix;
129     Glib::ustring   _key;
130     Registry        *_wr;
131     sigc::connection _changed_connection;
132     void on_value_changed();
133 };
135 class RegisteredRadioButtonPair {
136 public:
137     RegisteredRadioButtonPair();
138     ~RegisteredRadioButtonPair();
139     void init (const Glib::ustring& label, 
140                const Glib::ustring& label1, 
141                const Glib::ustring& label2, 
142                const Glib::ustring& tip1, 
143                const Glib::ustring& tip2, 
144                const Glib::ustring& key,
145                Registry& wr);
146     void setValue (bool second);
147     Gtk::HBox *_hbox;
149 protected:
150     Gtk::RadioButton *_rb1, *_rb2;
151     Gtk::Tooltips     _tt;
152     Glib::ustring   _key;
153     Registry        *_wr;
154     sigc::connection _changed_connection;
155     void on_value_changed();
156 };
160 } // namespace Widget
161 } // namespace UI
162 } // namespace Inkscape
164 #endif // INKSCAPE_UI_WIDGET_REGISTERED_WIDGET__H_
166 /*
167   Local Variables:
168   mode:c++
169   c-file-style:"stroustrup"
170   c-file-offsets:((innamespace . 0)(inline-open . 0))
171   indent-tabs-mode:nil
172   fill-column:99
173   End:
174 */
175 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :