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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
/*
* Authors:
* Bryce Harrington <bryce@bryceharrington.org>
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2004 Bryce Harrington
* Copyright (C) 2005 Jon A. Cruz
* Copyright (C) 2012 Kris De Gussem
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
*/
#ifndef SEEN_INKSCAPE_UI_WIDGET_PANEL_H
#define SEEN_INKSCAPE_UI_WIDGET_PANEL_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H
#include <glibmm/threads.h>
#endif
#include <gtkmm/box.h>
#include <gtkmm/arrow.h>
#include <gtkmm/button.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/label.h>
#include "enums.h"
#include <vector>
#include <map>
class SPDesktop;
class SPDocument;
namespace Gtk {
class CheckMenuItem;
#if WITH_GTKMM_3_0
class ButtonBox;
#else
class HButtonBox;
#endif
class MenuItem;
}
namespace Inkscape {
struct Application;
class Selection;
namespace UI {
class PreviewFillable;
namespace Widget {
/**
* A generic dockable container.
*
* Inkscape::UI::Widget::Panel is a base class from which dockable dialogs
* are created. A new dockable dialog is created by deriving a class from panel.
* Child widgets are private data members of Panel (no need to use pointers and
* new).
*
* @see UI::Dialog::DesktopTracker to handle desktop change, selection change and selected object modifications.
* @see UI::Dialog::DialogManager manages the dialogs within inkscape.
*/
class Panel : public Gtk::VBox {
public:
static void prep();
/**
* Construct a Panel.
*
* @param label label for the panel of a dialog, shown at the top.
* @param prefs_path characteristic path to load/save dialog position.
* @param verb_num the dialog verb.
*/
Panel(Glib::ustring const &label = "", gchar const *prefs_path = 0,
int verb_num = 0, Glib::ustring const &apply_label = "",
bool menu_desired = false);
virtual ~Panel();
gchar const *getPrefsPath() const;
/**
* Sets a label for the panel and displays it in the panel at the top (is not the title bar of a floating dialog).
*/
void setLabel(Glib::ustring const &label);
Glib::ustring const &getLabel() const;
int const &getVerb() const;
Glib::ustring const &getApplyLabel() const;
virtual void setOrientation(SPAnchorType how);
virtual void present(); //< request to be present
void restorePanelPrefs();
virtual void setDesktop(SPDesktop *desktop);
SPDesktop *getDesktop() { return _desktop; }
/* Signal accessors */
virtual sigc::signal<void, int> &signalResponse();
virtual sigc::signal<void> &signalPresent();
/* Methods providing a Gtk::Dialog like interface for adding buttons that emit Gtk::RESPONSE
* signals on click. */
Gtk::Button* addResponseButton (const Glib::ustring &button_text, int response_id, bool pack_start=false);
Gtk::Button* addResponseButton (const Gtk::StockID &stock_id, int response_id, bool pack_start=false);
void setDefaultResponse(int response_id);
void setResponseSensitive(int response_id, bool setting);
virtual sigc::signal<void, SPDesktop *, SPDocument *> &signalDocumentReplaced();
virtual sigc::signal<void, Inkscape::Application *, SPDesktop *> &signalActivateDesktop();
virtual sigc::signal<void, Inkscape::Application *, SPDesktop *> &signalDeactiveDesktop();
protected:
/**
* Returns a pointer to a Gtk::Box containing the child widgets.
*/
Gtk::Box *_getContents() { return &_contents; }
void _setTargetFillable(PreviewFillable *target);
void _regItem(Gtk::MenuItem* item, int group, int id);
virtual void _handleAction(int set_id, int item_id);
virtual void _apply();
virtual void _handleResponse(int response_id);
/* Helper methods */
void _addResponseButton(Gtk::Button *button, int response_id, bool pack_start=false);
Inkscape::Selection *_getSelection();
/**
* Stores characteristic path for loading/saving the dialog position.
*/
Glib::ustring const _prefs_path;
bool _menu_desired;
SPAnchorType _anchor;
/* Signals */
sigc::signal<void, int> _signal_response;
sigc::signal<void> _signal_present;
sigc::signal<void, SPDesktop *, SPDocument *> _signal_document_replaced;
sigc::signal<void, Inkscape::Application *, SPDesktop *> _signal_activate_desktop;
sigc::signal<void, Inkscape::Application *, SPDesktop *> _signal_deactive_desktop;
private:
void _init();
void _bounceCall(int i, int j);
void _popper(GdkEventButton *btn);
void _wrapToggled(Gtk::CheckMenuItem *toggler);
SPDesktop *_desktop;
Glib::ustring _label;
Glib::ustring _apply_label;
int _verb_num;
Gtk::HBox _top_bar;
Gtk::VBox _right_bar;
Gtk::VBox _contents;
Gtk::Label _tab_title;
Gtk::Arrow _temp_arrow;
Gtk::EventBox _menu_popper;
Gtk::Button _close_button;
Gtk::Menu *_menu;
#if WITH_GTKMM_3_0
Gtk::ButtonBox *_action_area; //< stores response buttons
#else
Gtk::HButtonBox *_action_area; //< stores response buttons
#endif
std::vector<Gtk::Widget *> _non_horizontal;
std::vector<Gtk::Widget *> _non_vertical;
PreviewFillable *_fillable;
/* A map to store which widget that emits a certain response signal */
typedef std::map<int, Gtk::Widget *> ResponseMap;
ResponseMap _response_map;
};
} // namespace Widget
} // namespace UI
} // namespace Inkscape
#endif // SEEN_INKSCAPE_UI_WIDGET_PANEL_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
|