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 <sigc++/sigc++.h>
27 //#include <glibmm/i18n.h>
29 namespace Inkscape {
30 namespace UI {
31 namespace Widget {
33 class PrefCheckButton : public Gtk::CheckButton
34 {
35 public:
36 void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
37 bool default_value);
38 protected:
39 std::string _prefs_path;
40 std::string _attr;
41 bool _int_value;
42 void on_toggled();
43 };
45 class PrefRadioButton : public Gtk::RadioButton
46 {
47 public:
48 void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
49 int int_value, bool default_value, PrefRadioButton* group_member);
50 void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
51 const std::string& string_value, bool default_value, PrefRadioButton* group_member);
52 sigc::signal<void, bool> changed_signal;
53 protected:
54 std::string _prefs_path;
55 std::string _attr;
56 std::string _string_value;
57 int _value_type;
58 enum
59 {
60 VAL_INT,
61 VAL_STRING
62 };
63 int _int_value;
64 void on_toggled();
65 };
67 class PrefSpinButton : public Gtk::SpinButton
68 {
69 public:
70 void init(const std::string& prefs_path, const std::string& attr,
71 double lower, double upper, double step_increment, double page_increment,
72 double default_value, bool is_int, bool is_percent);
73 protected:
74 std::string _prefs_path;
75 std::string _attr;
76 bool _is_int;
77 bool _is_percent;
78 void on_value_changed();
79 };
81 class PrefCombo : public Gtk::ComboBoxText
82 {
83 public:
84 void init(const std::string& prefs_path, const std::string& attr,
85 Glib::ustring labels[], int values[], int num_items, int default_value);
86 protected:
87 std::string _prefs_path;
88 std::string _attr;
89 std::vector<int> _values;
90 void on_changed();
91 };
93 class PrefEntry : public Gtk::Entry
94 {
95 public:
96 void init(const std::string& prefs_path, const std::string& attr,
97 bool mask);
98 protected:
99 std::string _prefs_path;
100 std::string _attr;
101 void on_changed();
102 };
104 class PrefEntryButtonHBox : public Gtk::HBox
105 {
106 public:
107 void init(const std::string& prefs_path, const std::string& attr,
108 bool mask, gchar* default_string);
109 protected:
110 std::string _prefs_path;
111 std::string _attr;
112 gchar* _default_string;
113 Gtk::Button *relatedButton;
114 Gtk::Entry *relatedEntry;
115 void onRelatedEntryChangedCallback();
116 void onRelatedButtonClickedCallback();
117 };
119 class DialogPage : public Gtk::Table
120 {
121 public:
122 DialogPage();
123 void add_line(bool indent, const Glib::ustring label, Gtk::Widget& widget, const Glib::ustring suffix, const Glib::ustring& tip, bool expand = true);
124 void add_group_header(Glib::ustring name);
125 void set_tip(Gtk::Widget& widget, const Glib::ustring& tip);
126 protected:
127 Gtk::Tooltips _tooltips;
128 };
131 } // namespace Widget
132 } // namespace UI
133 } // namespace Inkscape
135 #endif //INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H
137 /*
138 Local Variables:
139 mode:c++
140 c-file-style:"stroustrup"
141 c-file-offsets:((innamespace . 0)(inline-open . 0))
142 indent-tabs-mode:nil
143 fill-column:99
144 End:
145 */
146 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :