1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
|
[CCode (cprefix = "ccss_", lower_case_cprefix = "ccss_", cheader_filename = "ccss/ccss.h")]
namespace CCss {
[Compact]
[CCode (cprefix = "ccss_background_attachment_", cname = "ccss_background_attachment_t")]
public class BackgroundAttachment: Property {
[CCode (cprefix = "CCSS_BACKGROUND_", has_type_id = false, cname = "ccss_background_attachment_type_t")]
public enum Type {
SCROLL,
FIXED
}
public Type attachment {
get;
}
}
[Compact]
[CCode (cprefix = "ccss_background_image_", cname = "ccss_background_image_t")]
public class BackgroundImage: Property {
public string uri {
get;
}
}
[Compact]
[CCode (cprefix = "ccss_background_position_", cname = "ccss_background_position_t")]
public class BackgroundPosition: Property {
public Position horizontal_position {
get;
}
public Position vertical_position {
get;
}
}
[Compact]
[CCode (cprefix = "ccss_background_repeat_", cname = "ccss_background_repeat_t")]
public class BackgroundRepeat: Property {
[CCode (cprefix = "CCSS_BACKGROUND_", has_type_id = false, cname = "ccss_background_repeat_type_t")]
public enum Type {
REPEAT,
REPEAT_X,
REPEAT_Y,
NO_REPEAT
}
public Type repeat {
get;
}
}
[Compact]
[CCode (cprefix = "ccss_background_size_", cname = "ccss_background_size_t")]
public class BackgroundSize: Property {
public Position height {
get;
}
public Position width {
get;
}
}
[Compact]
[CCode (cprefix = "ccss_background_", cname = "ccss_background_t")]
public class Background: Property {
public BackgroundAttachment attachment {
get;
}
public Color color {
get;
}
public BackgroundImage image {
get;
}
public BackgroundPosition position {
get;
}
public BackgroundRepeat repeat {
get;
}
public BackgroundSize size {
get;
}
}
[Compact]
[CCode (cprefix = "ccss_block_", cname = "ccss_block_t")]
public class Block {
public void add_property (string property_name, Property property);
}
[Compact]
[CCode (cprefix = "ccss_border_image_", cname = "ccss_border_image_t")]
public class BorderImage: Property {
[CCode (cprefix = "CCSS_BORDER_IMAGE_TILING_", has_type_id = false, cname = "ccss_border_image_tiling_t")]
public enum Tiling {
REPEAT,
ROUND,
STRETCH
}
public string uri {
get;
}
public Position top {
get;
}
public Position right {
get;
}
public Position bottom {
get;
}
public Position left {
get;
}
public Tiling top_middle_bottom_horizontal_tiling {
get;
}
public Tiling left_middle_right_vertical_tiling {
get;
}
}
[Compact]
[CCode (cprefix = "ccss_border_join_", cname = "ccss_border_join_t")]
public class BorderRadius: Property {
public double radius {
get;
}
}
[Compact]
[CCode (cprefix = "ccss_border_spacing_", cname = "ccss_border_spacing_t")]
public class BorderSpacing: Property {
public double spacing {
get;
}
}
[Compact]
[CCode (cprefix = "ccss_border_style_", cname = "ccss_border_style_t")]
public class BorderStyle: Property {
[CCode (cprefix = "CCSS_BORDER_STYLE_", has_type_id = false, cname = "ccss_border_style_type_t")]
public enum Type {
HIDDEN,
DOTTED,
DASHED,
SOLID,
DOUBLE,
GROOVE,
RIDGE,
INSET,
OUTSET
}
public Type style {
get;
}
}
[Compact]
[CCode (cprefix = "ccss_border_width_", cname = "ccss_border_width_t")]
public class BorderWidth: Property {
public double width {
get;
}
}
[Compact]
[CCode (cprefix = "ccss_color_", cname = "ccss_color_t", free_function = "ccss_color_destroy")]
public class Color: Property {
public double alpha {
get;
}
public double blue {
get;
}
public double green {
get;
}
public double red {
get;
}
}
[Compact]
[CCode (cprefix = "ccss_function_", cname = "ccss_function_t", ref_function = "ccss_function_reference", unref_function = "ccss_function_destroy")]
public class Function {
[CCode (cname = "ccss_function_create")]
public Function (string name, FunctionDelegate function);
}
[CCode (cname = "ccss_function_f", has_target = false)]
public delegate string? FunctionDelegate (GLib.SList<string> args, void* user_data);
[Compact]
[CCode (cprefix = "ccss_grammar_", cname = "ccss_grammar_t", ref_function = "ccss_grammar_reference", unref_function = "ccss_grammar_destroy")]
public class Grammar {
[CCode (cname = "ccss_grammar_create_generic")]
public Grammar.generic ();
[CCode (cname = "ccss_grammar_create_css")]
public Grammar.css ();
/*public void add_properties (PropertyClass properties);
public unowned PropertyClass lookup_property (string name);*/
public void add_function (Function function);
public unowned Function lookup_function (string name);
public Stylesheet create_stylesheet ();
public Stylesheet create_stylesheet_from_buffer (char[] buffer, void* user_data);
public Stylesheet create_stylesheet_from_file (string css_file, void* user_data);
}
[CCode (cname = "ccss_node_class_t")]
public struct NodeClass {
public Node.IsA is_a;
public Node.GetContainer get_container;
public Node.GetBaseStyle get_base_style;
public Node.GetInstance get_instance;
public Node.GetId get_id;
public Node.GetType get_type;
public Node.GetClasses get_classes;
public Node.GetPseudoClasses get_pseudo_classes;
public Node.GetAttribute get_attribute;
public Node.GetStyle get_style;
public Node.GetViewport get_viewport;
public Node.Release release;
}
[Compact]
[CCode (cprefix = "ccss_node_", cname = "ccss_node_t", free_function = "ccss_node_destroy")]
public class Node {
[CCode (cname = "ccss_node_create")]
public Node (NodeClass node_class, uint n_methods, void* user_data);
public void* get_user_data ();
[CCode (cname = "ccss_node_get_attribute_f", has_target = false)]
public delegate string? GetAttribute (Node node, string name);
[CCode (cname = "ccss_node_get_base_style_f", has_target = false)]
public delegate Node? GetBaseStyle (Node node);
[CCode (cname = "ccss_node_get_classes_f", array_length = false, array_null_terminated = true, has_target = false)]
public delegate string[]? GetClasses (Node node);
[CCode (cname = "ccss_node_get_container_f", has_target = false)]
public delegate Node? GetContainer (Node node);
[CCode (cname = "ccss_node_get_id_f", has_target = false)]
public delegate string? GetId (Node node);
[CCode (cname = "ccss_node_get_instance_f", has_target = false)]
public delegate long GetInstance (Node node);
[CCode (cname = "ccss_node_get_pseudo_classes_f", array_length = false, array_null_terminated = true, has_target = false)]
public delegate string[]? GetPseudoClasses (Node node);
[CCode (cname = "ccss_node_get_style_f", has_target = false)]
public delegate string? GetStyle (Node node, uint descriptor);
[CCode (cname = "ccss_node_get_type_f", has_target = false)]
public delegate string? GetType (Node node);
[CCode (cname = "ccss_node_get_viewport_f", has_target = false)]
public delegate bool GetViewport (Node node, double x, double y, double width, double height);
[CCode (cname = "ccss_node_is_a_f", has_target = false)]
public delegate bool IsA (Node node, string type_name);
[CCode (cname = "ccss_node_release_f", has_target = false)]
public delegate void Release (Node node);
}
[Compact]
[CCode (cname = "ccss_padding_t")]
public class Padding: Property {
public double padding {
get;
}
}
[Compact]
[CCode (cprefix = "ccss_position_", cname = "ccss_position_t")]
public class Position: Property {
[CCode (cprefix = "CCSS_POSITION_", has_type_id = false, cname = "ccss_position_type_t")]
public enum Type {
LENGTH,
PERCENTAGE,
MASK_NUMERIC,
LEFT,
TOP,
RIGHT,
BOTTOM,
CENTER,
MASK_HORIZONTAL,
MASK_VERTICAL,
AUTO,
CONTAIN,
COVER,
MASK_AUTO
}
public double get_hsize (double extent_x, double extent_y, double width, double height);
public double get_pos (double extent, double size);
public double get_size (double extent);
public double get_vsize (double extent_x, double extent_y, double width, double height);
public string serialize ();
}
[Compact]
[CCode (cname = "ccss_property_class_t")]
public class PropertyClass {
public string name;
public Property.Convert convert;
public Property.Create create;
public Property.Destroy destroy;
public Property.Factory factory;
public Property.Inherit inherit;
public Property.Serialize serialize;
}
/*[Compact]
[CCode (cname = "ccss_property_generic_t")]
public class PropertyGeneric: Property {
public weak string name;
public void* values;
}*/
[Compact]
[CCode (cprefix = "ccss_property_", cname = "ccss_property_t", free_function = "ccss_property_destroy")]
public class Property {
[CCode (cprefix = "CCSS_PROPERTY_STATE_", has_type_id = false, cname = "ccss_property_state_t")]
public enum State {
INVALID,
NONE,
INHERIT,
SET,
ERROR_OVERFLOW;
[CCode (cname = "ccss_property_parse_state")]
public static State parse (string value);
[CCode (cname = "ccss_property_state_serialize")]
public unowned string serialize ();
}
[CCode (cprefix = "CCSS_PROPERTY_TYPE_", has_type_id = false, cname = "ccss_property_type_t")]
public enum Type {
DOUBLE,
STRING
}
public Type type {
get;
}
public State get_state {
get;
}
[CCode (cname = "ccss_property_create_f")]
public delegate Property Create (Grammar grammar, void* values);
[CCode (cname = "ccss_property_convert_f", has_target = false)]
public delegate bool Convert (Property property, Type target, void* value);
[CCode (cname = "ccss_property_destroy_f", has_target = false)]
public delegate void Destroy (Property property);
[CCode (cname = "ccss_property_factory_f")]
public delegate bool Factory (Grammar grammar, Block block, string name, void* values);
[CCode (cname = "ccss_property_inherit_f", has_target = false)]
public delegate bool Inherit (Style container_style, Style style);
[CCode (cname = "ccss_property_serialize_f", has_target = false)]
public delegate string Serialize (Property property);
}
[Compact]
[CCode (cprefix = "ccss_style_", cname = "ccss_style_t", free_function = "ccss_style_destroy")]
public class Style {
public void dump ();
public void @foreach (Iterator func);
public bool get_double (string property_name, out double value);
public bool get_property (string property_name, out unowned Property value);
public bool get_string (string property_name, out unowned string value);
public Stylesheet stylesheet {
get;
}
[CCode (cname = "ccss_style_iterator_f")]
public delegate void Iterator (Style style, string property_name);
public static GLib.HashFunc hash;
}
[Compact]
[CCode (cprefix = "ccss_stylesheet_", cname = "ccss_stylesheet_t", ref_function = "ccss_stylesheet_reference", unref_function = "ccss_stylesheet_destroy")]
public class Stylesheet {
[CCode (cprefix = "CCSS_STYLESHEET_", has_type_id = false, cname = "ccss_stylesheet_precedence_t")]
public enum Precedence {
USER_AGENT,
USER,
AUTHOR
}
public uint add_from_buffer (char[] buffer, Precedence precedence, void* user_data);
public uint add_from_file (string css_file, Precedence precedence, void* user_data);
public void dump ();
public void @foreach (Iterator func);
public Grammar grammar {
owned get;
}
public Style? query (Node node);
public Style? query_type (string type_name);
public bool unload (uint descriptor);
[CCode (cname = "ccss_stylesheet_iterator_f")]
public delegate void Iterator (Stylesheet stylesheet, string type_name);
}
}
|