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 Gtk::Label _rgradient[2];
98 Glib::ustring __rgradient[2];
100 Gtk::Label _many[2];
101 Glib::ustring __many[2];
103 Gtk::Label _unset[2];
104 Glib::ustring __unset[2];
106 Gtk::Widget *_color_preview[2];
107 Glib::ustring __color[2];
109 Gtk::Label _averaged[2];
110 Glib::ustring __averaged[2];
111 Gtk::Label _multiple[2];
112 Glib::ustring __multiple[2];
114 Gtk::HBox _stroke;
115 Gtk::EventBox _stroke_width_place;
116 Gtk::Label _stroke_width;
118 guint32 _lastselected[2];
119 guint32 _thisselected[2];
120 Glib::ustring _paintserver_id[2];
122 guint _mode[2];
124 sigc::connection *selection_changed_connection;
125 sigc::connection *selection_modified_connection;
126 sigc::connection *subselection_changed_connection;
128 bool on_fill_click(GdkEventButton *event);
129 bool on_stroke_click(GdkEventButton *event);
130 bool on_opacity_click(GdkEventButton *event);
131 bool on_sw_click(GdkEventButton *event);
133 bool _opacity_blocked;
134 void on_opacity_changed();
135 void on_opacity_menu(Gtk::Menu *menu);
136 void opacity_0();
137 void opacity_025();
138 void opacity_05();
139 void opacity_075();
140 void opacity_1();
142 void on_fill_remove();
143 void on_stroke_remove();
144 void on_fill_lastused();
145 void on_stroke_lastused();
146 void on_fill_lastselected();
147 void on_stroke_lastselected();
148 void on_fill_unset();
149 void on_stroke_unset();
150 void on_fill_edit();
151 void on_stroke_edit();
152 void on_fillstroke_swap();
153 void on_fill_invert();
154 void on_stroke_invert();
155 void on_fill_white();
156 void on_stroke_white();
157 void on_fill_black();
158 void on_stroke_black();
159 void on_fill_copy();
160 void on_stroke_copy();
161 void on_fill_paste();
162 void on_stroke_paste();
163 void on_fill_opaque();
164 void on_stroke_opaque();
166 Gtk::Menu _popup[2];
167 Gtk::MenuItem _popup_edit[2];
168 Gtk::MenuItem _popup_lastused[2];
169 Gtk::MenuItem _popup_lastselected[2];
170 Gtk::MenuItem _popup_invert[2];
171 Gtk::MenuItem _popup_white[2];
172 Gtk::MenuItem _popup_black[2];
173 Gtk::MenuItem _popup_copy[2];
174 Gtk::MenuItem _popup_paste[2];
175 Gtk::MenuItem _popup_swap[2];
176 Gtk::MenuItem _popup_opaque[2];
177 Gtk::MenuItem _popup_unset[2];
178 Gtk::MenuItem _popup_remove[2];
180 Gtk::Menu _popup_sw;
181 Gtk::RadioButtonGroup _sw_group;
182 Gtk::RadioMenuItem _popup_px;
183 void on_popup_px();
184 Gtk::RadioMenuItem _popup_pt;
185 void on_popup_pt();
186 Gtk::RadioMenuItem _popup_mm;
187 void on_popup_mm();
188 void on_popup_preset(int i);
189 Gtk::MenuItem _popup_sw_remove;
191 SPUnit *_sw_unit;
193 Gtk::Tooltips _tooltips;
194 };
197 } // namespace Widget
198 } // namespace UI
199 } // namespace Inkscape
201 #endif // INKSCAPE_UI_WIDGET_BUTTON_H
203 /*
204 Local Variables:
205 mode:c++
206 c-file-style:"stroustrup"
207 c-file-offsets:((innamespace . 0)(inline-open . 0))
208 indent-tabs-mode:nil
209 fill-column:99
210 End:
211 */
212 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :