Code

factor filter and opacity controls into separate metawidget
[inkscape.git] / src / ui / dialog / fill-and-stroke.cpp
1 /**
2  * \brief Fill and Stroke dialog,
3  * based on sp_object_properties_dialog
4  *
5  * Authors:
6  *   Bryce W. Harrington <bryce@bryceharrington.org>
7  *   Gustav Broberg <broberg@kth.se>
8  *
9  * Copyright (C) 2004--2007 Authors
10  *
11  * Released under GNU GPL.  Read the file 'COPYING' for more information.
12  */
14 #ifdef HAVE_CONFIG_H
15 # include <config.h>
16 #endif
18 #include "desktop-handles.h"
19 #include "desktop-style.h"
20 #include "document.h"
21 #include "fill-and-stroke.h"
22 #include "filter-chemistry.h"
23 #include "inkscape.h"
24 #include "inkscape-stock.h"
25 #include "selection.h"
26 #include "style.h"
27 #include "svg/css-ostringstream.h"
28 #include "verbs.h"
29 #include "xml/repr.h"
30 #include "widgets/icon.h"
32 #include "dialogs/fill-style.h"
33 #include "dialogs/stroke-style.h"
35 #include <widgets/paint-selector.h>
37 namespace Inkscape {
38 namespace UI {
39 namespace Dialog {
41 FillAndStroke::FillAndStroke()
42     : UI::Widget::Panel ("", "dialogs.fillstroke", SP_VERB_DIALOG_FILL_STROKE),
43       _page_fill(1, 1, true, true),
44       _page_stroke_paint(1, 1, true, true),
45       _page_stroke_style(1, 1, true, true)
46 {
47     Gtk::Box *contents = _getContents();
48     contents->set_spacing(0);
50     contents->pack_start(_notebook, true, true);
52     _notebook.append_page(_page_fill, _createPageTabLabel(_("Fill"), INKSCAPE_STOCK_PROPERTIES_FILL_PAGE));
53     _notebook.append_page(_page_stroke_paint, _createPageTabLabel(_("Stroke _paint"), INKSCAPE_STOCK_PROPERTIES_STROKE_PAINT_PAGE));
54     _notebook.append_page(_page_stroke_style, _createPageTabLabel(_("Stroke st_yle"), INKSCAPE_STOCK_PROPERTIES_STROKE_PAGE));
56     _layoutPageFill();
57     _layoutPageStrokePaint();
58     _layoutPageStrokeStyle();
60     contents->pack_start(_composite_settings, false, false, 0);
62     show_all_children();
63 }
65 FillAndStroke::~FillAndStroke()
66 {
67 }
69 void
70 FillAndStroke::_layoutPageFill()
71 {
72     Gtk::Widget *fs = manage(Glib::wrap(sp_fill_style_widget_new()));
73     _page_fill.table().attach(*fs, 0, 1, 0, 1);
74 }
76 void
77 FillAndStroke::_layoutPageStrokePaint()
78 {
79     Gtk::Widget *ssp = manage(Glib::wrap(sp_stroke_style_paint_widget_new()));
80     _page_stroke_paint.table().attach(*ssp, 0, 1, 0, 1);
81 }
83 void
84 FillAndStroke::_layoutPageStrokeStyle()
85 {
86     Gtk::Widget *ssl = manage(Glib::wrap(sp_stroke_style_line_widget_new()));
87     _page_stroke_style.table().attach(*ssl, 0, 1, 0, 1);
88 }
90 void
91 FillAndStroke::showPageFill()
92 {
93     present();
94     _notebook.set_current_page(0);
95 }
97 void
98 FillAndStroke::showPageStrokePaint()
99 {
100     present();
101     _notebook.set_current_page(1);
104 void
105 FillAndStroke::showPageStrokeStyle()
107     present();
108     _notebook.set_current_page(2);
111 Gtk::HBox&
112 FillAndStroke::_createPageTabLabel(const Glib::ustring& label, const char *label_image)
114     Gtk::HBox *_tab_label_box = manage(new Gtk::HBox(false, 0));
115     _tab_label_box->pack_start(*Glib::wrap(sp_icon_new(Inkscape::ICON_SIZE_DECORATION,
116                                                        label_image)));
118     Gtk::Label *_tab_label = manage(new Gtk::Label(label, true));
119     _tab_label_box->pack_start(*_tab_label);
120     _tab_label_box->show_all();
122     return *_tab_label_box;
125 } // namespace Dialog
126 } // namespace UI
127 } // namespace Inkscape
129 /*
130   Local Variables:
131   mode:c++
132   c-file-style:"stroustrup"
133   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
134   indent-tabs-mode:nil
135   fill-column:99
136   End:
137 */
138 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :