1 /**
2 * \brief Selected style indicator (fill, stroke, opacity)
3 *
4 * Authors:
5 * buliabyak@gmail.com
6 * scislac@users.sf.net
7 *
8 * Copyright (C) 2005 authors
9 *
10 * Released under GNU GPL. Read the file 'COPYING' for more information.
11 */
13 #ifndef INKSCAPE_UI_CURRENT_STYLE_H
14 #define INKSCAPE_UI_CURRENT_STYLE_H
16 #include <gtkmm/table.h>
17 #include <gtkmm/label.h>
18 #include <gtkmm/box.h>
19 #include <gtkmm/eventbox.h>
20 #include <gtkmm/enums.h>
21 #include <gtkmm/menu.h>
22 #include <gtkmm/menuitem.h>
23 #include <gtkmm/adjustment.h>
24 #include <gtkmm/spinbutton.h>
26 #include <sigc++/sigc++.h>
28 #include <glibmm/i18n.h>
30 #include <desktop.h>
32 #include "button.h"
34 class SPUnit;
36 namespace Inkscape {
37 namespace UI {
38 namespace Widget {
40 enum {
41 SS_NA,
42 SS_NONE,
43 SS_UNSET,
44 SS_PATTERN,
45 SS_LGRADIENT,
46 SS_RGRADIENT,
47 SS_MANY,
48 SS_COLOR
49 };
51 enum {
52 SS_FILL,
53 SS_STROKE
54 };
56 class SelectedStyle : public Gtk::HBox
57 {
58 public:
59 SelectedStyle(bool layout = true);
61 ~SelectedStyle();
63 void setDesktop(SPDesktop *desktop);
64 void update();
66 protected:
67 SPDesktop *_desktop;
69 Gtk::Table _table;
71 Gtk::Label _fill_label;
72 Gtk::Label _stroke_label;
73 Gtk::Label _opacity_label;
75 Gtk::EventBox _fill_place;
76 Gtk::EventBox _stroke_place;
78 Gtk::EventBox _fill_flag_place;
79 Gtk::EventBox _stroke_flag_place;
81 Gtk::EventBox _opacity_place;
82 Gtk::Adjustment _opacity_adjustment;
83 Gtk::SpinButton _opacity_sb;
85 Gtk::Label _na[2];
86 Glib::ustring __na[2];
88 Gtk::Label _none[2];
89 Glib::ustring __none[2];
91 Gtk::Label _pattern[2];
92 Glib::ustring __pattern[2];
94 Gtk::Label _lgradient[2];
95 Glib::ustring __lgradient[2];
97 GtkWidget *_gradient_preview_l[2];
98 Gtk::HBox _gradient_box_l[2];
100 Gtk::Label _rgradient[2];
101 Glib::ustring __rgradient[2];
103 GtkWidget *_gradient_preview_r[2];
104 Gtk::HBox _gradient_box_r[2];
106 Gtk::Label _many[2];
107 Glib::ustring __many[2];
109 Gtk::Label _unset[2];
110 Glib::ustring __unset[2];
112 Gtk::Widget *_color_preview[2];
113 Glib::ustring __color[2];
115 Gtk::Label _averaged[2];
116 Glib::ustring __averaged[2];
117 Gtk::Label _multiple[2];
118 Glib::ustring __multiple[2];
120 Gtk::HBox _stroke;
121 Gtk::EventBox _stroke_width_place;
122 Gtk::Label _stroke_width;
124 guint32 _lastselected[2];
125 guint32 _thisselected[2];
126 Glib::ustring _paintserver_id[2];
128 guint _mode[2];
130 sigc::connection *selection_changed_connection;
131 sigc::connection *selection_modified_connection;
132 sigc::connection *subselection_changed_connection;
134 static void dragDataReceived( GtkWidget *widget,
135 GdkDragContext *drag_context,
136 gint x, gint y,
137 GtkSelectionData *data,
138 guint info,
139 guint event_time,
140 gpointer user_data );
142 bool on_fill_click(GdkEventButton *event);
143 bool on_stroke_click(GdkEventButton *event);
144 bool on_opacity_click(GdkEventButton *event);
145 bool on_sw_click(GdkEventButton *event);
147 bool _opacity_blocked;
148 void on_opacity_changed();
149 void on_opacity_menu(Gtk::Menu *menu);
150 void opacity_0();
151 void opacity_025();
152 void opacity_05();
153 void opacity_075();
154 void opacity_1();
156 void on_fill_remove();
157 void on_stroke_remove();
158 void on_fill_lastused();
159 void on_stroke_lastused();
160 void on_fill_lastselected();
161 void on_stroke_lastselected();
162 void on_fill_unset();
163 void on_stroke_unset();
164 void on_fill_edit();
165 void on_stroke_edit();
166 void on_fillstroke_swap();
167 void on_fill_invert();
168 void on_stroke_invert();
169 void on_fill_white();
170 void on_stroke_white();
171 void on_fill_black();
172 void on_stroke_black();
173 void on_fill_copy();
174 void on_stroke_copy();
175 void on_fill_paste();
176 void on_stroke_paste();
177 void on_fill_opaque();
178 void on_stroke_opaque();
180 Gtk::Menu _popup[2];
181 Gtk::MenuItem _popup_edit[2];
182 Gtk::MenuItem _popup_lastused[2];
183 Gtk::MenuItem _popup_lastselected[2];
184 Gtk::MenuItem _popup_invert[2];
185 Gtk::MenuItem _popup_white[2];
186 Gtk::MenuItem _popup_black[2];
187 Gtk::MenuItem _popup_copy[2];
188 Gtk::MenuItem _popup_paste[2];
189 Gtk::MenuItem _popup_swap[2];
190 Gtk::MenuItem _popup_opaque[2];
191 Gtk::MenuItem _popup_unset[2];
192 Gtk::MenuItem _popup_remove[2];
194 Gtk::Menu _popup_sw;
195 Gtk::RadioButtonGroup _sw_group;
196 Gtk::RadioMenuItem _popup_px;
197 void on_popup_px();
198 Gtk::RadioMenuItem _popup_pt;
199 void on_popup_pt();
200 Gtk::RadioMenuItem _popup_mm;
201 void on_popup_mm();
202 void on_popup_preset(int i);
203 Gtk::MenuItem _popup_sw_remove;
205 SPUnit *_sw_unit;
207 Gtk::Tooltips _tooltips;
209 void *_drop[2];
210 bool _dropEnabled[2];
211 };
214 } // namespace Widget
215 } // namespace UI
216 } // namespace Inkscape
218 #endif // INKSCAPE_UI_WIDGET_BUTTON_H
220 /*
221 Local Variables:
222 mode:c++
223 c-file-style:"stroustrup"
224 c-file-offsets:((innamespace . 0)(inline-open . 0))
225 indent-tabs-mode:nil
226 fill-column:99
227 End:
228 */
229 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :