1 #ifndef __SP_DESKTOP_STYLE_H__
2 #define __SP_DESKTOP_STYLE_H__
4 /*
5 * Desktop style management
6 *
7 * Authors:
8 * bulia byak
9 *
10 * Copyright (C) 2004 authors
11 *
12 * Released under GNU GPL, read the file 'COPYING' for more information
13 */
15 #include <glib/gtypes.h>
17 class ColorRGBA;
18 struct SPCSSAttr;
19 struct SPDesktop;
20 struct SPObject;
21 struct SPStyle;
22 namespace Inkscape {
23 namespace XML {
24 struct Node;
25 }
26 }
28 enum { // what kind of a style the query is returning
29 QUERY_STYLE_NOTHING, // nothing was queried - e.g. no selection
30 QUERY_STYLE_SINGLE, // single object was queried
31 QUERY_STYLE_MULTIPLE_SAME, // multiple objects were queried, the results were the same
32 QUERY_STYLE_MULTIPLE_DIFFERENT, // multiple objects were queried, the results could NOT be meaningfully averaged
33 QUERY_STYLE_MULTIPLE_AVERAGED // multiple objects were queried, the results were meaningfully averaged
34 };
36 enum { // which property was queried (add when you need more)
37 QUERY_STYLE_PROPERTY_EVERYTHING,
38 QUERY_STYLE_PROPERTY_FILL, // fill, fill-opacity
39 QUERY_STYLE_PROPERTY_STROKE, // stroke, stroke-opacity
40 QUERY_STYLE_PROPERTY_STROKEWIDTH, // stroke-width
41 QUERY_STYLE_PROPERTY_STROKEMITERLIMIT, // miter limit
42 QUERY_STYLE_PROPERTY_STROKEJOIN, // stroke join
43 QUERY_STYLE_PROPERTY_STROKECAP, // stroke cap
44 QUERY_STYLE_PROPERTY_STROKESTYLE, // markers, dasharray, miterlimit, stroke-width, stroke-cap, stroke-join
45 QUERY_STYLE_PROPERTY_FONTFAMILY, // font-family
46 QUERY_STYLE_PROPERTY_FONTSTYLE, // font style
47 QUERY_STYLE_PROPERTY_FONTNUMBERS, // size, spacings
48 QUERY_STYLE_PROPERTY_MASTEROPACITY // opacity
49 };
51 void sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines);
52 void sp_desktop_set_color(SPDesktop *desktop, ColorRGBA const &color, bool is_relative, bool fill);
53 void sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change = true, bool write_current = true);
54 SPCSSAttr *sp_desktop_get_style(SPDesktop *desktop, bool with_text);
55 guint32 sp_desktop_get_color (SPDesktop *desktop, bool is_fill);
56 double sp_desktop_get_font_size_tool (SPDesktop *desktop);
57 void sp_desktop_apply_style_tool(SPDesktop *desktop, Inkscape::XML::Node *repr, char const *tool, bool with_text);
59 gdouble stroke_average_width (GSList const *objects);
61 int objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill);
62 int objects_query_fontnumbers (GSList *objects, SPStyle *style_res);
63 int objects_query_fontstyle (GSList *objects, SPStyle *style_res);
64 int objects_query_fontfamily (GSList *objects, SPStyle *style_res);
65 int objects_query_opacity (GSList *objects, SPStyle *style_res);
66 int objects_query_strokewidth (GSList *objects, SPStyle *style_res);
67 int objects_query_miterlimit (GSList *objects, SPStyle *style_res);
68 int objects_query_strokecap (GSList *objects, SPStyle *style_res);
69 int objects_query_strokejoin (GSList *objects, SPStyle *style_res);
71 int sp_desktop_query_style_from_list (GSList *list, SPStyle *style, int property);
72 int sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property);
73 bool sp_desktop_query_style_all (SPDesktop *desktop, SPStyle *query);
75 #endif
78 /*
79 Local Variables:
80 mode:c++
81 c-file-style:"stroustrup"
82 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
83 indent-tabs-mode:nil
84 fill-column:99
85 End:
86 */
87 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :