1 | /* |
2 | * Copyright © 2012 Red Hat Inc. |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Lesser General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2.1 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Lesser General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Lesser General Public |
15 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
16 | * |
17 | * Authors: Benjamin Otte <otte@gnome.org> |
18 | */ |
19 | |
20 | #ifndef __GTK_CSS_STYLE_PRIVATE_H__ |
21 | #define __GTK_CSS_STYLE_PRIVATE_H__ |
22 | |
23 | #include <glib-object.h> |
24 | #include <gtk/css/gtkcss.h> |
25 | |
26 | #include "gtk/gtkbitmaskprivate.h" |
27 | #include "gtk/gtkcssvalueprivate.h" |
28 | |
29 | G_BEGIN_DECLS |
30 | |
31 | #define GTK_TYPE_CSS_STYLE (gtk_css_style_get_type ()) |
32 | #define GTK_CSS_STYLE(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_CSS_STYLE, GtkCssStyle)) |
33 | #define GTK_CSS_STYLE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_CSS_STYLE, GtkCssStyleClass)) |
34 | #define GTK_IS_CSS_STYLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_CSS_STYLE)) |
35 | #define GTK_IS_CSS_STYLE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_CSS_STYLE)) |
36 | #define GTK_CSS_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CSS_STYLE, GtkCssStyleClass)) |
37 | |
38 | typedef enum { |
39 | GTK_CSS_CORE_VALUES, |
40 | GTK_CSS_CORE_INITIAL_VALUES, |
41 | GTK_CSS_BACKGROUND_VALUES, |
42 | GTK_CSS_BACKGROUND_INITIAL_VALUES, |
43 | GTK_CSS_BORDER_VALUES, |
44 | GTK_CSS_BORDER_INITIAL_VALUES, |
45 | GTK_CSS_ICON_VALUES, |
46 | GTK_CSS_ICON_INITIAL_VALUES, |
47 | GTK_CSS_OUTLINE_VALUES, |
48 | GTK_CSS_OUTLINE_INITIAL_VALUES, |
49 | GTK_CSS_FONT_VALUES, |
50 | GTK_CSS_FONT_INITIAL_VALUES, |
51 | GTK_CSS_FONT_VARIANT_VALUES, |
52 | GTK_CSS_FONT_VARIANT_INITIAL_VALUES, |
53 | GTK_CSS_ANIMATION_VALUES, |
54 | GTK_CSS_ANIMATION_INITIAL_VALUES, |
55 | GTK_CSS_TRANSITION_VALUES, |
56 | GTK_CSS_TRANSITION_INITIAL_VALUES, |
57 | GTK_CSS_SIZE_VALUES, |
58 | GTK_CSS_SIZE_INITIAL_VALUES, |
59 | GTK_CSS_OTHER_VALUES, |
60 | GTK_CSS_OTHER_INITIAL_VALUES, |
61 | } GtkCssValuesType; |
62 | |
63 | typedef struct _GtkCssValues GtkCssValues; |
64 | typedef struct _GtkCssCoreValues GtkCssCoreValues; |
65 | typedef struct _GtkCssBackgroundValues GtkCssBackgroundValues; |
66 | typedef struct _GtkCssBorderValues GtkCssBorderValues; |
67 | typedef struct _GtkCssIconValues GtkCssIconValues; |
68 | typedef struct _GtkCssOutlineValues GtkCssOutlineValues; |
69 | typedef struct _GtkCssFontValues GtkCssFontValues; |
70 | typedef struct _GtkCssFontVariantValues GtkCssFontVariantValues; |
71 | typedef struct _GtkCssAnimationValues GtkCssAnimationValues; |
72 | typedef struct _GtkCssTransitionValues GtkCssTransitionValues; |
73 | typedef struct _GtkCssSizeValues GtkCssSizeValues; |
74 | typedef struct _GtkCssOtherValues GtkCssOtherValues; |
75 | |
76 | struct _GtkCssValues { |
77 | int ref_count; |
78 | GtkCssValuesType type; |
79 | }; |
80 | |
81 | struct _GtkCssCoreValues { |
82 | GtkCssValues base; |
83 | GtkCssValue *color; |
84 | GtkCssValue *dpi; |
85 | GtkCssValue *font_size; |
86 | GtkCssValue *icon_palette; |
87 | }; |
88 | |
89 | struct _GtkCssBackgroundValues { |
90 | GtkCssValues base; |
91 | GtkCssValue *background_color; |
92 | GtkCssValue *box_shadow; |
93 | GtkCssValue *background_clip; |
94 | GtkCssValue *background_origin; |
95 | GtkCssValue *background_size; |
96 | GtkCssValue *background_position; |
97 | GtkCssValue *background_repeat; |
98 | GtkCssValue *background_image; |
99 | GtkCssValue *background_blend_mode; |
100 | }; |
101 | |
102 | struct _GtkCssBorderValues { |
103 | GtkCssValues base; |
104 | GtkCssValue *border_top_style; |
105 | GtkCssValue *border_top_width; |
106 | GtkCssValue *border_left_style; |
107 | GtkCssValue *border_left_width; |
108 | GtkCssValue *border_bottom_style; |
109 | GtkCssValue *border_bottom_width; |
110 | GtkCssValue *border_right_style; |
111 | GtkCssValue *border_right_width; |
112 | GtkCssValue *border_top_left_radius; |
113 | GtkCssValue *border_top_right_radius; |
114 | GtkCssValue *border_bottom_right_radius; |
115 | GtkCssValue *border_bottom_left_radius; |
116 | GtkCssValue *border_top_color; // NULL if currentColor |
117 | GtkCssValue *border_right_color; // NULL if currentColor |
118 | GtkCssValue *border_bottom_color; // NULL if currentColor |
119 | GtkCssValue *border_left_color; // NULL if currentColor |
120 | GtkCssValue *border_image_source; |
121 | GtkCssValue *border_image_repeat; |
122 | GtkCssValue *border_image_slice; |
123 | GtkCssValue *border_image_width; |
124 | }; |
125 | |
126 | struct _GtkCssIconValues { |
127 | GtkCssValues base; |
128 | GtkCssValue *icon_size; |
129 | GtkCssValue *icon_shadow; |
130 | GtkCssValue *icon_style; |
131 | }; |
132 | |
133 | |
134 | struct _GtkCssOutlineValues { |
135 | GtkCssValues base; |
136 | GtkCssValue *outline_style; |
137 | GtkCssValue *outline_width; |
138 | GtkCssValue *outline_offset; |
139 | GtkCssValue *outline_color; // NULL if currentColor |
140 | }; |
141 | |
142 | struct _GtkCssFontValues { |
143 | GtkCssValues base; |
144 | GtkCssValue *font_family; |
145 | GtkCssValue *font_style; |
146 | GtkCssValue *font_weight; |
147 | GtkCssValue *font_stretch; |
148 | GtkCssValue *letter_spacing; |
149 | GtkCssValue *text_shadow; |
150 | GtkCssValue *caret_color; // NULL if currentColor |
151 | GtkCssValue *secondary_caret_color; // NULL if currentColor |
152 | GtkCssValue *font_feature_settings; |
153 | GtkCssValue *font_variation_settings; |
154 | GtkCssValue *line_height; |
155 | }; |
156 | |
157 | struct _GtkCssFontVariantValues { |
158 | GtkCssValues base; |
159 | GtkCssValue *text_decoration_line; |
160 | GtkCssValue *text_decoration_color; // NULL if currentColor |
161 | GtkCssValue *text_decoration_style; |
162 | GtkCssValue *text_transform; |
163 | GtkCssValue *font_kerning; |
164 | GtkCssValue *font_variant_ligatures; |
165 | GtkCssValue *font_variant_position; |
166 | GtkCssValue *font_variant_caps; |
167 | GtkCssValue *font_variant_numeric; |
168 | GtkCssValue *font_variant_alternates; |
169 | GtkCssValue *font_variant_east_asian; |
170 | }; |
171 | |
172 | struct _GtkCssAnimationValues { |
173 | GtkCssValues base; |
174 | GtkCssValue *animation_name; |
175 | GtkCssValue *animation_duration; |
176 | GtkCssValue *animation_timing_function; |
177 | GtkCssValue *animation_iteration_count; |
178 | GtkCssValue *animation_direction; |
179 | GtkCssValue *animation_play_state; |
180 | GtkCssValue *animation_delay; |
181 | GtkCssValue *animation_fill_mode; |
182 | }; |
183 | |
184 | struct _GtkCssTransitionValues { |
185 | GtkCssValues base; |
186 | GtkCssValue *transition_property; |
187 | GtkCssValue *transition_duration; |
188 | GtkCssValue *transition_timing_function; |
189 | GtkCssValue *transition_delay; |
190 | }; |
191 | |
192 | struct _GtkCssSizeValues { |
193 | GtkCssValues base; |
194 | GtkCssValue *margin_top; |
195 | GtkCssValue *margin_left; |
196 | GtkCssValue *margin_bottom; |
197 | GtkCssValue *margin_right; |
198 | GtkCssValue *padding_top; |
199 | GtkCssValue *padding_left; |
200 | GtkCssValue *padding_bottom; |
201 | GtkCssValue *padding_right; |
202 | GtkCssValue *border_spacing; |
203 | GtkCssValue *min_width; |
204 | GtkCssValue *min_height; |
205 | }; |
206 | |
207 | struct _GtkCssOtherValues { |
208 | GtkCssValues base; |
209 | GtkCssValue *icon_source; |
210 | GtkCssValue *icon_transform; |
211 | GtkCssValue *icon_filter; |
212 | GtkCssValue *transform; |
213 | GtkCssValue *transform_origin; |
214 | GtkCssValue *opacity; |
215 | GtkCssValue *filter; |
216 | }; |
217 | |
218 | /* typedef struct _GtkCssStyle GtkCssStyle; */ |
219 | typedef struct _GtkCssStyleClass GtkCssStyleClass; |
220 | |
221 | struct _GtkCssStyle |
222 | { |
223 | GObject parent; |
224 | |
225 | GtkCssCoreValues *core; |
226 | GtkCssBackgroundValues *background; |
227 | GtkCssBorderValues *border; |
228 | GtkCssIconValues *icon; |
229 | GtkCssOutlineValues *outline; |
230 | GtkCssFontValues *font; |
231 | GtkCssFontVariantValues *font_variant; |
232 | GtkCssAnimationValues *animation; |
233 | GtkCssTransitionValues *transition; |
234 | GtkCssSizeValues *size; |
235 | GtkCssOtherValues *other; |
236 | }; |
237 | |
238 | struct _GtkCssStyleClass |
239 | { |
240 | GObjectClass parent_class; |
241 | |
242 | /* Get the section the value at the given id was declared at or NULL if unavailable. |
243 | * Optional: default impl will just return NULL */ |
244 | GtkCssSection * (* get_section) (GtkCssStyle *style, |
245 | guint id); |
246 | /* TRUE if this style will require changes based on timestamp */ |
247 | gboolean (* is_static) (GtkCssStyle *style); |
248 | |
249 | GtkCssStaticStyle * (* get_static_style) (GtkCssStyle *style); |
250 | }; |
251 | |
252 | GType gtk_css_style_get_type (void) G_GNUC_CONST; |
253 | |
254 | GtkCssValue * gtk_css_style_get_value (GtkCssStyle *style, |
255 | guint id) G_GNUC_PURE; |
256 | GtkCssSection * gtk_css_style_get_section (GtkCssStyle *style, |
257 | guint id) G_GNUC_PURE; |
258 | gboolean gtk_css_style_is_static (GtkCssStyle *style) G_GNUC_PURE; |
259 | GtkCssStaticStyle * gtk_css_style_get_static_style (GtkCssStyle *style); |
260 | |
261 | char * gtk_css_style_to_string (GtkCssStyle *style); |
262 | gboolean gtk_css_style_print (GtkCssStyle *style, |
263 | GString *string, |
264 | guint indent, |
265 | gboolean skip_initial); |
266 | |
267 | PangoTextTransform gtk_css_style_get_pango_text_transform (GtkCssStyle *style); |
268 | char * gtk_css_style_compute_font_features (GtkCssStyle *style); |
269 | PangoAttrList * gtk_css_style_get_pango_attributes (GtkCssStyle *style); |
270 | PangoFontDescription * gtk_css_style_get_pango_font (GtkCssStyle *style); |
271 | |
272 | GtkCssValues *gtk_css_values_new (GtkCssValuesType type); |
273 | GtkCssValues *gtk_css_values_ref (GtkCssValues *values); |
274 | void gtk_css_values_unref (GtkCssValues *values); |
275 | GtkCssValues *gtk_css_values_copy (GtkCssValues *values); |
276 | |
277 | void gtk_css_core_values_compute_changes_and_affects (GtkCssStyle *style1, |
278 | GtkCssStyle *style2, |
279 | GtkBitmask **changes, |
280 | GtkCssAffects *affects); |
281 | void gtk_css_background_values_compute_changes_and_affects (GtkCssStyle *style1, |
282 | GtkCssStyle *style2, |
283 | GtkBitmask **changes, |
284 | GtkCssAffects *affects); |
285 | void gtk_css_border_values_compute_changes_and_affects (GtkCssStyle *style1, |
286 | GtkCssStyle *style2, |
287 | GtkBitmask **changes, |
288 | GtkCssAffects *affects); |
289 | void gtk_css_icon_values_compute_changes_and_affects (GtkCssStyle *style1, |
290 | GtkCssStyle *style2, |
291 | GtkBitmask **changes, |
292 | GtkCssAffects *affects); |
293 | void gtk_css_outline_values_compute_changes_and_affects (GtkCssStyle *style1, |
294 | GtkCssStyle *style2, |
295 | GtkBitmask **changes, |
296 | GtkCssAffects *affects); |
297 | void gtk_css_font_values_compute_changes_and_affects (GtkCssStyle *style1, |
298 | GtkCssStyle *style2, |
299 | GtkBitmask **changes, |
300 | GtkCssAffects *affects); |
301 | void gtk_css_font_variant_values_compute_changes_and_affects (GtkCssStyle *style1, |
302 | GtkCssStyle *style2, |
303 | GtkBitmask **changes, |
304 | GtkCssAffects *affects); |
305 | void gtk_css_animation_values_compute_changes_and_affects (GtkCssStyle *style1, |
306 | GtkCssStyle *style2, |
307 | GtkBitmask **changes, |
308 | GtkCssAffects *affects); |
309 | void gtk_css_transition_values_compute_changes_and_affects (GtkCssStyle *style1, |
310 | GtkCssStyle *style2, |
311 | GtkBitmask **changes, |
312 | GtkCssAffects *affects); |
313 | void gtk_css_size_values_compute_changes_and_affects (GtkCssStyle *style1, |
314 | GtkCssStyle *style2, |
315 | GtkBitmask **changes, |
316 | GtkCssAffects *affects); |
317 | void gtk_css_other_values_compute_changes_and_affects (GtkCssStyle *style1, |
318 | GtkCssStyle *style2, |
319 | GtkBitmask **changes, |
320 | GtkCssAffects *affects); |
321 | |
322 | G_END_DECLS |
323 | |
324 | #endif /* __GTK_CSS_STYLE_PRIVATE_H__ */ |
325 | |