summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/preferences-widget.h
blob: b48672d39b128be5c191f23e0cb0afa825fd8331 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/**
 * \brief Inkscape Preferences dialog
 *
 * Authors:
 *   Marco Scholten
 *   Bruno Dilly <bruno.dilly@gmail.com>
 *
 * Copyright (C) 2004, 2006, 2007  Authors
 *
 * Released under GNU GPL.  Read the file 'COPYING' for more information.
 */

#ifndef INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H
#define INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H

#include <iostream>
#include <vector>
#include <gtkmm/table.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/tooltips.h>
#include <gtkmm/treeview.h>
#include <gtkmm/radiobutton.h>
#include <gtkmm/box.h>
#include <gtkmm/frame.h>
#include <sigc++/sigc++.h>
//#include <glibmm/i18n.h>

namespace Inkscape {
namespace UI {
namespace Widget {

class PrefCheckButton : public Gtk::CheckButton
{
public:
    void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr, 
              bool default_value);
protected:
    std::string _prefs_path;
    std::string _attr;
    bool _int_value;
    void on_toggled();
};

class PrefRadioButton : public Gtk::RadioButton
{
public:
    void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr, 
              int int_value, bool default_value, PrefRadioButton* group_member);
    void init(const Glib::ustring& label, const std::string& prefs_path, const std::string& attr, 
              const std::string& string_value, bool default_value, PrefRadioButton* group_member);
    sigc::signal<void, bool> changed_signal;
protected:
    std::string _prefs_path;
    std::string _attr;
    std::string _string_value;
    int _value_type;
    enum
    {
        VAL_INT,
        VAL_STRING
    };
    int _int_value;
    void on_toggled();
};

class PrefSpinButton : public Gtk::SpinButton
{
public:
    void init(const std::string& prefs_path, const std::string& attr,
              double lower, double upper, double step_increment, double page_increment, 
              double default_value, bool is_int, bool is_percent);
protected:
    std::string _prefs_path;
    std::string _attr;
    bool _is_int;
    bool _is_percent;
    void on_value_changed();
};

class PrefCombo : public Gtk::ComboBoxText
{
public:
    void init(const std::string& prefs_path, const std::string& attr,
              Glib::ustring labels[], int values[], int num_items, int default_value);
protected:
    std::string _prefs_path;
    std::string _attr;
    std::vector<int> _values;
    void on_changed();
};

class PrefEntry : public Gtk::Entry
{
public:
    void init(const std::string& prefs_path, const std::string& attr,
            bool mask);
protected:
    std::string _prefs_path;
    std::string _attr;
    void on_changed();
};

class PrefEntryButtonHBox : public Gtk::HBox
{
public:
    void init(const std::string& prefs_path, const std::string& attr,
            bool mask, gchar* default_string);
protected:
    std::string _prefs_path;
    std::string _attr;
    gchar* _default_string;
    Gtk::Button *relatedButton;
    Gtk::Entry *relatedEntry;
    void onRelatedEntryChangedCallback();
    void onRelatedButtonClickedCallback();
};

class DialogPage : public Gtk::Table
{
public:
    DialogPage();
    void add_line(bool indent, const Glib::ustring label, Gtk::Widget& widget, const Glib::ustring suffix, const Glib::ustring& tip, bool expand = true);
    void add_group_header(Glib::ustring name);
    void set_tip(Gtk::Widget& widget, const Glib::ustring& tip);
protected:
    Gtk::Tooltips _tooltips;
};


} // namespace Widget
} // namespace UI
} // namespace Inkscape

#endif //INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H

/* 
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :