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