1 /**
2 * \brief Inkscape Preferences dialog
3 *
4 * Authors:
5 * Marco Scholten
6 *
7 * Copyright (C) 2004, 2006 Authors
8 *
9 * Released under GNU GPL. Read the file 'COPYING' for more information.
10 */
12 #ifndef INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H
13 #define INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H
15 #include <iostream>
16 #include <vector>
17 #include <gtkmm/table.h>
18 #include <gtkmm/comboboxtext.h>
19 #include <gtkmm/spinbutton.h>
20 #include <gtkmm/tooltips.h>
21 #include <gtkmm/treeview.h>
22 #include <gtkmm/radiobutton.h>
23 #include <gtkmm/frame.h>
24 #include <sigc++/sigc++.h>
25 //#include <glibmm/i18n.h>
27 namespace Inkscape {
28 namespace UI {
29 namespace Widget {
31 class PrefCheckButton : public Gtk::CheckButton
32 {
33 public:
34 void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
35 bool default_value);
36 protected:
37 std::string _prefs_path;
38 std::string _attr;
39 bool _int_value;
40 void on_toggled();
41 };
43 class PrefRadioButton : public Gtk::RadioButton
44 {
45 public:
46 void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
47 int int_value, bool default_value, PrefRadioButton* group_member);
48 void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr,
49 const std::string& string_value, bool default_value, PrefRadioButton* group_member);
50 sigc::signal<void, bool> changed_signal;
51 protected:
52 std::string _prefs_path;
53 std::string _attr;
54 std::string _string_value;
55 int _value_type;
56 enum
57 {
58 VAL_INT,
59 VAL_STRING
60 };
61 int _int_value;
62 void on_toggled();
63 };
65 class PrefSpinButton : public Gtk::SpinButton
66 {
67 public:
68 void init(const std::string& prefs_path, const std::string& attr,
69 double lower, double upper, double step_increment, double page_increment,
70 double default_value, bool is_int, bool is_percent);
71 protected:
72 std::string _prefs_path;
73 std::string _attr;
74 bool _is_int;
75 bool _is_percent;
76 void on_value_changed();
77 };
79 class PrefCombo : public Gtk::ComboBoxText
80 {
81 public:
82 void init(const std::string& prefs_path, const std::string& attr,
83 Glib::ustring labels[], int values[], int num_items, int default_value);
84 protected:
85 std::string _prefs_path;
86 std::string _attr;
87 std::vector<int> _values;
88 void on_changed();
89 };
91 class DialogPage : public Gtk::Table
92 {
93 public:
94 DialogPage();
95 void add_line(bool indent, const Glib::ustring label, Gtk::Widget& widget, const Glib::ustring suffix, const Glib::ustring& tip, bool expand = true);
96 void add_group_header(Glib::ustring name);
97 void set_tip(Gtk::Widget& widget, const Glib::ustring& tip);
98 protected:
99 Gtk::Tooltips _tooltips;
100 };
103 } // namespace Widget
104 } // namespace UI
105 } // namespace Inkscape
107 #endif //INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H
109 /*
110 Local Variables:
111 mode:c++
112 c-file-style:"stroustrup"
113 c-file-offsets:((innamespace . 0)(inline-open . 0))
114 indent-tabs-mode:nil
115 fill-column:99
116 End:
117 */
118 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :