Code

Warning cleanup
[inkscape.git] / src / ui / widget / selected-style.h
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"
33 #include "rotateable.h"
35 class SPUnit;
37 namespace Inkscape {
38 namespace UI {
39 namespace Widget {
41 enum {
42     SS_NA,
43     SS_NONE,
44     SS_UNSET,
45     SS_PATTERN,
46     SS_LGRADIENT,
47     SS_RGRADIENT,
48     SS_MANY,
49     SS_COLOR
50 };
52 enum {
53     SS_FILL,
54     SS_STROKE
55 };
57 class SelectedStyle;
59 class RotateableSwatch: public Rotateable 
60 {
61 public:
62     RotateableSwatch(guint mode);
63     ~RotateableSwatch();
65     guint fillstroke;
67     SelectedStyle *parent;
69     guint32 startcolor;
70     bool startcolor_set;
72     gchar *undokey;
74     GdkCursor *cr;
75     bool cr_set;
77     double color_adjust (float *hsl, double by, guint32 cc, guint state);
78     virtual void do_motion (double by, guint state);
79     virtual void do_release (double by, guint state);
80 };
82 class SelectedStyle : public Gtk::HBox
83 {
84 public:
85     SelectedStyle(bool layout = true);
87     ~SelectedStyle();
89     void setDesktop(SPDesktop *desktop);
90     SPDesktop *getDesktop() {return _desktop;}
91     void update();
93     guint32 _lastselected[2];
94     guint32 _thisselected[2];
96     guint _mode[2];
98 protected:
99     SPDesktop *_desktop;
101     Gtk::Table _table;
103     Gtk::Label _fill_label;
104     Gtk::Label _stroke_label;
105     Gtk::Label _opacity_label;
107     RotateableSwatch _fill_place;
108     RotateableSwatch _stroke_place;
110     Gtk::EventBox _fill_flag_place;
111     Gtk::EventBox _stroke_flag_place;
113     Gtk::EventBox _opacity_place;
114     Gtk::Adjustment _opacity_adjustment;
115     Gtk::SpinButton _opacity_sb;
117     Gtk::Label _na[2];
118     Glib::ustring __na[2];
120     Gtk::Label _none[2];
121     Glib::ustring __none[2];
123     Gtk::Label _pattern[2];
124     Glib::ustring __pattern[2];
126     Gtk::Label _lgradient[2];
127     Glib::ustring __lgradient[2];
129     GtkWidget *_gradient_preview_l[2];
130     Gtk::HBox _gradient_box_l[2];
132     Gtk::Label _rgradient[2];
133     Glib::ustring __rgradient[2];
135     GtkWidget *_gradient_preview_r[2];
136     Gtk::HBox _gradient_box_r[2];
138     Gtk::Label _many[2];
139     Glib::ustring __many[2];
141     Gtk::Label _unset[2];
142     Glib::ustring __unset[2];
144     Gtk::Widget *_color_preview[2];
145     Glib::ustring __color[2];
147     Gtk::Label _averaged[2];
148     Glib::ustring __averaged[2];
149     Gtk::Label _multiple[2];
150     Glib::ustring __multiple[2];
152     Gtk::HBox _stroke;
153     Gtk::EventBox _stroke_width_place;
154     Gtk::Label _stroke_width;
156     Glib::ustring _paintserver_id[2];
158     sigc::connection *selection_changed_connection;
159     sigc::connection *selection_modified_connection;
160     sigc::connection *subselection_changed_connection;
162     static void dragDataReceived( GtkWidget *widget,
163                                   GdkDragContext *drag_context,
164                                   gint x, gint y,
165                                   GtkSelectionData *data,
166                                   guint info,
167                                   guint event_time,
168                                   gpointer user_data );
170     bool on_fill_click(GdkEventButton *event);
171     bool on_stroke_click(GdkEventButton *event);
172     bool on_opacity_click(GdkEventButton *event);
173     bool on_sw_click(GdkEventButton *event);
175     bool _opacity_blocked;
176     void on_opacity_changed();
177     void on_opacity_menu(Gtk::Menu *menu);
178     void opacity_0();
179     void opacity_025();
180     void opacity_05();
181     void opacity_075();
182     void opacity_1();
184     void on_fill_remove();
185     void on_stroke_remove();
186     void on_fill_lastused();
187     void on_stroke_lastused();
188     void on_fill_lastselected();
189     void on_stroke_lastselected();
190     void on_fill_unset();
191     void on_stroke_unset();
192     void on_fill_edit();
193     void on_stroke_edit();
194     void on_fillstroke_swap();
195     void on_fill_invert();
196     void on_stroke_invert();
197     void on_fill_white();
198     void on_stroke_white();
199     void on_fill_black();
200     void on_stroke_black();
201     void on_fill_copy();
202     void on_stroke_copy();
203     void on_fill_paste();
204     void on_stroke_paste();
205     void on_fill_opaque();
206     void on_stroke_opaque();
208     Gtk::Menu _popup[2];
209     Gtk::MenuItem _popup_edit[2];
210     Gtk::MenuItem _popup_lastused[2];
211     Gtk::MenuItem _popup_lastselected[2];
212     Gtk::MenuItem _popup_invert[2];
213     Gtk::MenuItem _popup_white[2];
214     Gtk::MenuItem _popup_black[2];
215     Gtk::MenuItem _popup_copy[2];
216     Gtk::MenuItem _popup_paste[2];
217     Gtk::MenuItem _popup_swap[2];
218     Gtk::MenuItem _popup_opaque[2];
219     Gtk::MenuItem _popup_unset[2];
220     Gtk::MenuItem _popup_remove[2];
222     Gtk::Menu _popup_sw; 
223     Gtk::RadioButtonGroup _sw_group;
224     Gtk::RadioMenuItem _popup_px; 
225     void on_popup_px();
226     Gtk::RadioMenuItem _popup_pt; 
227     void on_popup_pt();
228     Gtk::RadioMenuItem _popup_mm;
229     void on_popup_mm();
230     void on_popup_preset(int i);
231     Gtk::MenuItem _popup_sw_remove;
233     SPUnit *_sw_unit;
235     Gtk::Tooltips _tooltips;
237     void *_drop[2];
238     bool _dropEnabled[2];
239 };
242 } // namespace Widget
243 } // namespace UI
244 } // namespace Inkscape
246 #endif // INKSCAPE_UI_WIDGET_BUTTON_H
248 /* 
249   Local Variables:
250   mode:c++
251   c-file-style:"stroustrup"
252   c-file-offsets:((innamespace . 0)(inline-open . 0))
253   indent-tabs-mode:nil
254   fill-column:99
255   End:
256 */
257 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :