Code

The dialog to panel refactoring:
[inkscape.git] / src / ui / widget / preferences-widget.h
1 /**
2  * \brief Inkscape Preferences dialog
3  *
4  * Authors:
5  *   Marco Scholten
6  *   Bruno Dilly <bruno.dilly@gmail.com>
7  *
8  * Copyright (C) 2004, 2006, 2007  Authors
9  *
10  * Released under GNU GPL.  Read the file 'COPYING' for more information.
11  */
13 #ifndef INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H
14 #define INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H
16 #include <iostream>
17 #include <vector>
18 #include <gtkmm/table.h>
19 #include <gtkmm/comboboxtext.h>
20 #include <gtkmm/spinbutton.h>
21 #include <gtkmm/tooltips.h>
22 #include <gtkmm/treeview.h>
23 #include <gtkmm/radiobutton.h>
24 #include <gtkmm/box.h>
25 #include <gtkmm/frame.h>
26 #include <gtkmm/filechooserbutton.h>
27 #include <sigc++/sigc++.h>
28 //#include <glibmm/i18n.h>
30 namespace Inkscape {
31 namespace UI {
32 namespace Widget {
34 class PrefCheckButton : public Gtk::CheckButton
35 {
36 public:
37     void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
38               bool default_value);
39 protected:
40     std::string _prefs_path;
41     std::string _attr;
42     bool _int_value;
43     void on_toggled();
44 };
46 class PrefRadioButton : public Gtk::RadioButton
47 {
48 public:
49     void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
50               int int_value, bool default_value, PrefRadioButton* group_member);
51     void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
52               const std::string& string_value, bool default_value, PrefRadioButton* group_member);
53     sigc::signal<void, bool> changed_signal;
54 protected:
55     std::string _prefs_path;
56     std::string _attr;
57     std::string _string_value;
58     int _value_type;
59     enum
60     {
61         VAL_INT,
62         VAL_STRING
63     };
64     int _int_value;
65     void on_toggled();
66 };
68 class PrefSpinButton : public Gtk::SpinButton
69 {
70 public:
71     void init(const std::string& prefs_path, const std::string& attr,
72               double lower, double upper, double step_increment, double page_increment,
73               double default_value, bool is_int, bool is_percent);
74 protected:
75     std::string _prefs_path;
76     std::string _attr;
77     bool _is_int;
78     bool _is_percent;
79     void on_value_changed();
80 };
82 class PrefCombo : public Gtk::ComboBoxText
83 {
84 public:
85     void init(const std::string& prefs_path, const std::string& attr,
86               Glib::ustring labels[], int values[], int num_items, int default_value);
87 protected:
88     std::string _prefs_path;
89     std::string _attr;
90     std::vector<int> _values;
91     void on_changed();
92 };
94 class PrefEntry : public Gtk::Entry
95 {
96 public:
97     void init(const std::string& prefs_path, const std::string& attr,
98             bool mask);
99 protected:
100     std::string _prefs_path;
101     std::string _attr;
102     void on_changed();
103 };
105 class PrefEntryButtonHBox : public Gtk::HBox
107 public:
108     void init(const std::string& prefs_path, const std::string& attr,
109             bool mask, gchar* default_string);
110 protected:
111     std::string _prefs_path;
112     std::string _attr;
113     gchar* _default_string;
114     Gtk::Button *relatedButton;
115     Gtk::Entry *relatedEntry;
116     void onRelatedEntryChangedCallback();
117     void onRelatedButtonClickedCallback();
118 };
120 class PrefFileButton : public Gtk::FileChooserButton
122 public:
123     void init(const std::string& prefs_path, const std::string& attr);
125 protected:
126     std::string _prefs_path;
127     std::string _attr;
128     void onFileChanged();
129 };
131 class DialogPage : public Gtk::Table
133 public:
134     DialogPage();
135     void add_line(bool indent, const Glib::ustring label, Gtk::Widget& widget, const Glib::ustring suffix, const Glib::ustring& tip, bool expand = true);
136     void add_group_header(Glib::ustring name);
137     void set_tip(Gtk::Widget& widget, const Glib::ustring& tip);
138 protected:
139     Gtk::Tooltips _tooltips;
140 };
143 } // namespace Widget
144 } // namespace UI
145 } // namespace Inkscape
147 #endif //INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H
149 /*
150   Local Variables:
151   mode:c++
152   c-file-style:"stroustrup"
153   c-file-offsets:((innamespace . 0)(inline-open . 0))
154   indent-tabs-mode:nil
155   fill-column:99
156   End:
157 */
158 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :