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 #include "ui/widget/color-picker.h"
32 namespace Inkscape {
33 namespace UI {
34 namespace Widget {
36 class PrefCheckButton : public Gtk::CheckButton
37 {
38 public:
39 void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
40 bool default_value);
41 protected:
42 std::string _prefs_path;
43 std::string _attr;
44 bool _int_value;
45 void on_toggled();
46 };
48 class PrefRadioButton : public Gtk::RadioButton
49 {
50 public:
51 void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
52 int int_value, bool default_value, PrefRadioButton* group_member);
53 void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
54 const std::string& string_value, bool default_value, PrefRadioButton* group_member);
55 sigc::signal<void, bool> changed_signal;
56 protected:
57 std::string _prefs_path;
58 std::string _attr;
59 std::string _string_value;
60 int _value_type;
61 enum
62 {
63 VAL_INT,
64 VAL_STRING
65 };
66 int _int_value;
67 void on_toggled();
68 };
70 class PrefSpinButton : public Gtk::SpinButton
71 {
72 public:
73 void init(const std::string& prefs_path, const std::string& attr,
74 double lower, double upper, double step_increment, double page_increment,
75 double default_value, bool is_int, bool is_percent);
76 protected:
77 std::string _prefs_path;
78 std::string _attr;
79 bool _is_int;
80 bool _is_percent;
81 void on_value_changed();
82 };
84 class PrefCombo : public Gtk::ComboBoxText
85 {
86 public:
87 void init(const std::string& prefs_path, const std::string& attr,
88 Glib::ustring labels[], int values[], int num_items, int default_value);
89 protected:
90 std::string _prefs_path;
91 std::string _attr;
92 std::vector<int> _values;
93 void on_changed();
94 };
96 class PrefEntry : public Gtk::Entry
97 {
98 public:
99 void init(const std::string& prefs_path, const std::string& attr,
100 bool mask);
101 protected:
102 std::string _prefs_path;
103 std::string _attr;
104 void on_changed();
105 };
107 class PrefEntryButtonHBox : public Gtk::HBox
108 {
109 public:
110 void init(const std::string& prefs_path, const std::string& attr,
111 bool mask, gchar* default_string);
112 protected:
113 std::string _prefs_path;
114 std::string _attr;
115 gchar* _default_string;
116 Gtk::Button *relatedButton;
117 Gtk::Entry *relatedEntry;
118 void onRelatedEntryChangedCallback();
119 void onRelatedButtonClickedCallback();
120 };
122 class PrefFileButton : public Gtk::FileChooserButton
123 {
124 public:
125 void init(const std::string& prefs_path, const std::string& attr);
127 protected:
128 std::string _prefs_path;
129 std::string _attr;
130 void onFileChanged();
131 };
133 class PrefColorPicker : public ColorPicker
134 {
135 public:
136 PrefColorPicker() : ColorPicker("", "", 0, false) {};
137 virtual ~PrefColorPicker() {};
139 void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
140 guint32 default_rgba);
142 protected:
143 std::string _prefs_path;
144 std::string _attr;
145 virtual void on_changed (guint32 rgba);
146 };
149 class DialogPage : public Gtk::Table
150 {
151 public:
152 DialogPage();
153 void add_line(bool indent, const Glib::ustring label, Gtk::Widget& widget, const Glib::ustring suffix, const Glib::ustring& tip, bool expand = true);
154 void add_group_header(Glib::ustring name);
155 void set_tip(Gtk::Widget& widget, const Glib::ustring& tip);
156 protected:
157 Gtk::Tooltips _tooltips;
158 };
161 } // namespace Widget
162 } // namespace UI
163 } // namespace Inkscape
165 #endif //INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H
167 /*
168 Local Variables:
169 mode:c++
170 c-file-style:"stroustrup"
171 c-file-offsets:((innamespace . 0)(inline-open . 0))
172 indent-tabs-mode:nil
173 fill-column:99
174 End:
175 */
176 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :