File: | ctk/ctkcssstyleproperty.c |
Warning: | line 414, column 10 Using a fixed address is not portable because that address will probably not be valid in all environments or platforms |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* |
2 | * Copyright © 2011 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 | #include "config.h" |
21 | |
22 | #include "ctkcssstylepropertyprivate.h" |
23 | |
24 | #include "ctkcssenumvalueprivate.h" |
25 | #include "ctkcssinheritvalueprivate.h" |
26 | #include "ctkcssinitialvalueprivate.h" |
27 | #include "ctkcssstylefuncsprivate.h" |
28 | #include "ctkcsstypesprivate.h" |
29 | #include "ctkcssunsetvalueprivate.h" |
30 | #include "ctkintl.h" |
31 | #include "ctkprivatetypebuiltins.h" |
32 | #include "ctkstylepropertiesprivate.h" |
33 | #include "ctkprivate.h" |
34 | |
35 | /* this is in case round() is not provided by the compiler, |
36 | * such as in the case of C89 compilers, like MSVC |
37 | */ |
38 | #include "fallback-c89.c" |
39 | |
40 | enum { |
41 | PROP_0, |
42 | PROP_ANIMATED, |
43 | PROP_AFFECTS, |
44 | PROP_ID, |
45 | PROP_INHERIT, |
46 | PROP_INITIAL |
47 | }; |
48 | |
49 | G_DEFINE_TYPE (CtkCssStyleProperty, _ctk_css_style_property, CTK_TYPE_STYLE_PROPERTY)static void _ctk_css_style_property_init (CtkCssStyleProperty *self); static void _ctk_css_style_property_class_init (CtkCssStylePropertyClass *klass); static GType _ctk_css_style_property_get_type_once ( void); static gpointer _ctk_css_style_property_parent_class = ((void*)0); static gint CtkCssStyleProperty_private_offset; static void _ctk_css_style_property_class_intern_init (gpointer klass ) { _ctk_css_style_property_parent_class = g_type_class_peek_parent (klass); if (CtkCssStyleProperty_private_offset != 0) g_type_class_adjust_private_offset (klass, &CtkCssStyleProperty_private_offset); _ctk_css_style_property_class_init ((CtkCssStylePropertyClass*) klass); } __attribute__ ((__unused__ )) static inline gpointer _ctk_css_style_property_get_instance_private (CtkCssStyleProperty *self) { return (((gpointer) ((guint8*) (self) + (glong) (CtkCssStyleProperty_private_offset)))); } GType _ctk_css_style_property_get_type (void) { static GType static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id ) == sizeof (gpointer), "Expression evaluates to false"); (void ) (0 ? (gpointer) * (&static_g_define_type_id) : ((void*) 0)); (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id ) == sizeof (gpointer), "Expression evaluates to false"); __typeof__ (*(&static_g_define_type_id)) gapg_temp_newval; __typeof__ ((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id ); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5) ; gapg_temp_newval; })) && g_once_init_enter_pointer ( &static_g_define_type_id)); })) ) { GType g_define_type_id = _ctk_css_style_property_get_type_once (); (__extension__ ( { _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); 0 ? (void) (*( &static_g_define_type_id) = (g_define_type_id)) : (void) 0 ; g_once_init_leave_pointer ((&static_g_define_type_id), ( gpointer) (guintptr) (g_define_type_id)); })) ; } return static_g_define_type_id ; } __attribute__ ((__noinline__)) static GType _ctk_css_style_property_get_type_once (void) { GType g_define_type_id = g_type_register_static_simple ((_ctk_style_property_get_type ()), g_intern_static_string ( "CtkCssStyleProperty"), sizeof (CtkCssStylePropertyClass), (GClassInitFunc )(void (*)(void)) _ctk_css_style_property_class_intern_init, sizeof (CtkCssStyleProperty), (GInstanceInitFunc)(void (*)(void)) _ctk_css_style_property_init , (GTypeFlags) 0); { {{};} } return g_define_type_id; } |
50 | |
51 | static CtkCssStylePropertyClass *ctk_css_style_property_class = NULL((void*)0); |
52 | |
53 | static void |
54 | ctk_css_style_property_constructed (GObject *object) |
55 | { |
56 | CtkCssStyleProperty *property = CTK_CSS_STYLE_PROPERTY (object)((((CtkCssStyleProperty*) (void *) g_type_check_instance_cast ((GTypeInstance*) (object), ((_ctk_css_style_property_get_type ())))))); |
57 | CtkCssStylePropertyClass *klass = CTK_CSS_STYLE_PROPERTY_GET_CLASS (property)((((CtkCssStylePropertyClass*) (((GTypeInstance*) ((property) ))->g_class)))); |
58 | |
59 | property->id = klass->style_properties->len; |
60 | g_ptr_array_add (klass->style_properties, property); |
61 | |
62 | G_OBJECT_CLASS (_ctk_css_style_property_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((_ctk_css_style_property_parent_class)), (((GType) ((20) << (2))))))))->constructed (object); |
63 | } |
64 | |
65 | static void |
66 | ctk_css_style_property_set_property (GObject *object, |
67 | guint prop_id, |
68 | const GValue *value, |
69 | GParamSpec *pspec) |
70 | { |
71 | CtkCssStyleProperty *property = CTK_CSS_STYLE_PROPERTY (object)((((CtkCssStyleProperty*) (void *) g_type_check_instance_cast ((GTypeInstance*) (object), ((_ctk_css_style_property_get_type ())))))); |
72 | |
73 | switch (prop_id) |
74 | { |
75 | case PROP_ANIMATED: |
76 | property->animated = g_value_get_boolean (value); |
77 | break; |
78 | case PROP_AFFECTS: |
79 | property->affects = g_value_get_flags (value); |
80 | break; |
81 | case PROP_INHERIT: |
82 | property->inherit = g_value_get_boolean (value); |
83 | break; |
84 | case PROP_INITIAL: |
85 | property->initial_value = g_value_dup_boxed (value); |
86 | g_assert (property->initial_value != NULL)do { if (property->initial_value != ((void*)0)) ; else g_assertion_message_expr ("Ctk", "ctkcssstyleproperty.c", 86, ((const char*) (__func__ )), "property->initial_value != NULL"); } while (0); |
87 | break; |
88 | default: |
89 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec *_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id = ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'" , "ctkcssstyleproperty.c", 89, ("property"), _glib__property_id , _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance *) (_glib__pspec))->g_class))->g_type)))), (g_type_name ((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class ))->g_type)))))); } while (0); |
90 | break; |
91 | } |
92 | } |
93 | |
94 | static void |
95 | ctk_css_style_property_get_property (GObject *object, |
96 | guint prop_id, |
97 | GValue *value, |
98 | GParamSpec *pspec) |
99 | { |
100 | CtkCssStyleProperty *property = CTK_CSS_STYLE_PROPERTY (object)((((CtkCssStyleProperty*) (void *) g_type_check_instance_cast ((GTypeInstance*) (object), ((_ctk_css_style_property_get_type ())))))); |
101 | |
102 | switch (prop_id) |
103 | { |
104 | case PROP_ANIMATED: |
105 | g_value_set_boolean (value, property->animated); |
106 | break; |
107 | case PROP_AFFECTS: |
108 | g_value_set_flags (value, property->affects); |
109 | break; |
110 | case PROP_ID: |
111 | g_value_set_boolean (value, property->id); |
112 | break; |
113 | case PROP_INHERIT: |
114 | g_value_set_boolean (value, property->inherit); |
115 | break; |
116 | case PROP_INITIAL: |
117 | g_value_set_boxed (value, property->initial_value); |
118 | break; |
119 | default: |
120 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec *_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id = ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'" , "ctkcssstyleproperty.c", 120, ("property"), _glib__property_id , _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance *) (_glib__pspec))->g_class))->g_type)))), (g_type_name ((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class ))->g_type)))))); } while (0); |
121 | break; |
122 | } |
123 | } |
124 | |
125 | static void |
126 | _ctk_css_style_property_assign (CtkStyleProperty *property, |
127 | CtkStyleProperties *props, |
128 | CtkStateFlags state, |
129 | const GValue *value) |
130 | { |
131 | CtkCssStyleProperty *style; |
132 | CtkCssValue *css_value; |
133 | |
134 | style = CTK_CSS_STYLE_PROPERTY (property)((((CtkCssStyleProperty*) (void *) g_type_check_instance_cast ((GTypeInstance*) (property), ((_ctk_css_style_property_get_type ())))))); |
135 | css_value = style->assign_value (style, value); |
136 | |
137 | _ctk_style_properties_set_property_by_property (props, |
138 | style, |
139 | state, |
140 | css_value); |
141 | _ctk_css_value_unref (css_value); |
142 | } |
143 | |
144 | static void |
145 | _ctk_css_style_property_query (CtkStyleProperty *property, |
146 | GValue *value, |
147 | CtkStyleQueryFunc query_func, |
148 | gpointer query_data) |
149 | { |
150 | CtkCssStyleProperty *style_property = CTK_CSS_STYLE_PROPERTY (property)((((CtkCssStyleProperty*) (void *) g_type_check_instance_cast ((GTypeInstance*) (property), ((_ctk_css_style_property_get_type ())))))); |
151 | CtkCssValue *css_value; |
152 | |
153 | css_value = (* query_func) (CTK_CSS_STYLE_PROPERTY (property)((((CtkCssStyleProperty*) (void *) g_type_check_instance_cast ((GTypeInstance*) (property), ((_ctk_css_style_property_get_type ()))))))->id, query_data); |
154 | if (css_value == NULL((void*)0)) |
155 | css_value =_ctk_css_style_property_get_initial_value (style_property); |
156 | |
157 | style_property->query_value (style_property, css_value, value); |
158 | } |
159 | |
160 | static CtkCssValue * |
161 | ctk_css_style_property_parse_value (CtkStyleProperty *property, |
162 | CtkCssParser *parser) |
163 | { |
164 | CtkCssStyleProperty *style_property = CTK_CSS_STYLE_PROPERTY (property)((((CtkCssStyleProperty*) (void *) g_type_check_instance_cast ((GTypeInstance*) (property), ((_ctk_css_style_property_get_type ())))))); |
165 | |
166 | if (_ctk_css_parser_try (parser, "initial", TRUE(!(0)))) |
167 | { |
168 | /* the initial value can be explicitly specified with the |
169 | * ‘initial’ keyword which all properties accept. |
170 | */ |
171 | return _ctk_css_initial_value_new (); |
172 | } |
173 | else if (_ctk_css_parser_try (parser, "inherit", TRUE(!(0)))) |
174 | { |
175 | /* All properties accept the ‘inherit’ value which |
176 | * explicitly specifies that the value will be determined |
177 | * by inheritance. The ‘inherit’ value can be used to |
178 | * strengthen inherited values in the cascade, and it can |
179 | * also be used on properties that are not normally inherited. |
180 | */ |
181 | return _ctk_css_inherit_value_new (); |
182 | } |
183 | else if (_ctk_css_parser_try (parser, "unset", TRUE(!(0)))) |
184 | { |
185 | /* If the cascaded value of a property is the unset keyword, |
186 | * then if it is an inherited property, this is treated as |
187 | * inherit, and if it is not, this is treated as initial. |
188 | */ |
189 | return _ctk_css_unset_value_new (); |
190 | } |
191 | |
192 | return (* style_property->parse_value) (style_property, parser); |
193 | } |
194 | |
195 | static void |
196 | _ctk_css_style_property_class_init (CtkCssStylePropertyClass *klass) |
197 | { |
198 | GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((klass)), (((GType) ((20) << (2)))))))); |
199 | CtkStylePropertyClass *property_class = CTK_STYLE_PROPERTY_CLASS (klass)((((CtkStylePropertyClass*) (void *) g_type_check_class_cast ( (GTypeClass*) (klass), ((_ctk_style_property_get_type ()))))) ); |
200 | |
201 | object_class->constructed = ctk_css_style_property_constructed; |
202 | object_class->set_property = ctk_css_style_property_set_property; |
203 | object_class->get_property = ctk_css_style_property_get_property; |
204 | |
205 | g_object_class_install_property (object_class, |
206 | PROP_ANIMATED, |
207 | g_param_spec_boolean ("animated", |
208 | P_("Animated")g_dgettext("ctk30" "-properties","Animated"), |
209 | P_("Set if the value can be animated")g_dgettext("ctk30" "-properties","Set if the value can be animated" ), |
210 | FALSE(0), |
211 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
212 | g_object_class_install_property (object_class, |
213 | PROP_AFFECTS, |
214 | g_param_spec_flags ("affects", |
215 | P_("Affects")g_dgettext("ctk30" "-properties","Affects"), |
216 | P_("Set if the value affects the sizing of elements")g_dgettext("ctk30" "-properties","Set if the value affects the sizing of elements" ), |
217 | CTK_TYPE_CSS_AFFECTS(_ctk_css_affects_get_type ()), |
218 | 0, |
219 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
220 | g_object_class_install_property (object_class, |
221 | PROP_ID, |
222 | g_param_spec_uint ("id", |
223 | P_("ID")g_dgettext("ctk30" "-properties","ID"), |
224 | P_("The numeric id for quick access")g_dgettext("ctk30" "-properties","The numeric id for quick access" ), |
225 | 0, G_MAXUINT(2147483647 *2U +1U), 0, |
226 | G_PARAM_READABLE)); |
227 | g_object_class_install_property (object_class, |
228 | PROP_INHERIT, |
229 | g_param_spec_boolean ("inherit", |
230 | P_("Inherit")g_dgettext("ctk30" "-properties","Inherit"), |
231 | P_("Set if the value is inherited by default")g_dgettext("ctk30" "-properties","Set if the value is inherited by default" ), |
232 | FALSE(0), |
233 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
234 | g_object_class_install_property (object_class, |
235 | PROP_INITIAL, |
236 | g_param_spec_boxed ("initial-value", |
237 | P_("Initial value")g_dgettext("ctk30" "-properties","Initial value"), |
238 | P_("The initial specified value used for this property")g_dgettext("ctk30" "-properties","The initial specified value used for this property" ), |
239 | CTK_TYPE_CSS_VALUE(_ctk_css_value_get_type ()), |
240 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
241 | |
242 | property_class->assign = _ctk_css_style_property_assign; |
243 | property_class->query = _ctk_css_style_property_query; |
244 | property_class->parse_value = ctk_css_style_property_parse_value; |
245 | |
246 | klass->style_properties = g_ptr_array_new (); |
247 | |
248 | ctk_css_style_property_class = klass; |
249 | } |
250 | |
251 | static CtkCssValue * |
252 | ctk_css_style_property_real_parse_value (CtkCssStyleProperty *property G_GNUC_UNUSED__attribute__ ((__unused__)), |
253 | CtkCssParser *parser G_GNUC_UNUSED__attribute__ ((__unused__))) |
254 | { |
255 | g_assert_not_reached ()do { g_assertion_message_expr ("Ctk", "ctkcssstyleproperty.c" , 255, ((const char*) (__func__)), ((void*)0)); } while (0); |
256 | return NULL((void*)0); |
257 | } |
258 | |
259 | static void |
260 | _ctk_css_style_property_init (CtkCssStyleProperty *property) |
261 | { |
262 | property->parse_value = ctk_css_style_property_real_parse_value; |
263 | } |
264 | |
265 | /** |
266 | * _ctk_css_style_property_get_n_properties: |
267 | * |
268 | * Gets the number of style properties. This number can increase when new |
269 | * theme engines are loaded. Shorthand properties are not included here. |
270 | * |
271 | * Returns: The number of style properties. |
272 | **/ |
273 | guint |
274 | _ctk_css_style_property_get_n_properties (void) |
275 | { |
276 | if (G_UNLIKELY (ctk_css_style_property_class == NULL)(ctk_css_style_property_class == ((void*)0))) |
277 | { |
278 | _ctk_style_property_init_properties (); |
279 | g_assert (ctk_css_style_property_class)do { if (ctk_css_style_property_class) ; else g_assertion_message_expr ("Ctk", "ctkcssstyleproperty.c", 279, ((const char*) (__func__ )), "ctk_css_style_property_class"); } while (0); |
280 | } |
281 | |
282 | return ctk_css_style_property_class->style_properties->len; |
283 | } |
284 | |
285 | /** |
286 | * _ctk_css_style_property_lookup_by_id: |
287 | * @id: the id of the property |
288 | * |
289 | * Gets the style property with the given id. All style properties (but not |
290 | * shorthand properties) are indexable by id so that it’s easy to use arrays |
291 | * when doing style lookups. |
292 | * |
293 | * Returns: (transfer none): The style property with the given id |
294 | **/ |
295 | CtkCssStyleProperty * |
296 | _ctk_css_style_property_lookup_by_id (guint id) |
297 | { |
298 | |
299 | if (G_UNLIKELY (ctk_css_style_property_class == NULL)(ctk_css_style_property_class == ((void*)0))) |
300 | { |
301 | _ctk_style_property_init_properties (); |
302 | g_assert (ctk_css_style_property_class)do { if (ctk_css_style_property_class) ; else g_assertion_message_expr ("Ctk", "ctkcssstyleproperty.c", 302, ((const char*) (__func__ )), "ctk_css_style_property_class"); } while (0); |
303 | } |
304 | |
305 | ctk_internal_return_val_if_fail (id < ctk_css_style_property_class->style_properties->len, NULL)do { if ((id < ctk_css_style_property_class->style_properties ->len)) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "id < ctk_css_style_property_class->style_properties->len" ); return (((void*)0)); } } while (0); |
306 | |
307 | return g_ptr_array_index (ctk_css_style_property_class->style_properties, id)((ctk_css_style_property_class->style_properties)->pdata )[id]; |
308 | } |
309 | |
310 | /** |
311 | * _ctk_css_style_property_is_inherit: |
312 | * @property: the property |
313 | * |
314 | * Queries if the given @property is inherited. See the |
315 | * [CSS Documentation](http://www.w3.org/TR/css3-cascade/#inheritance) |
316 | * for an explanation of this concept. |
317 | * |
318 | * Returns: %TRUE if the property is inherited by default. |
319 | **/ |
320 | gboolean |
321 | _ctk_css_style_property_is_inherit (CtkCssStyleProperty *property) |
322 | { |
323 | ctk_internal_return_val_if_fail (CTK_IS_CSS_STYLE_PROPERTY (property), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) (property); GType __t = ((_ctk_css_style_property_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (property); GType __t = ((_ctk_css_style_property_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))" ); return ((0)); } } while (0); |
324 | |
325 | return property->inherit; |
326 | } |
327 | |
328 | /** |
329 | * _ctk_css_style_property_is_animated: |
330 | * @property: the property |
331 | * |
332 | * Queries if the given @property can be is animated. See the |
333 | * [CSS Documentation](http://www.w3.org/TR/css3-transitions/#animatable-css) |
334 | * for animatable properties. |
335 | * |
336 | * Returns: %TRUE if the property can be animated. |
337 | **/ |
338 | gboolean |
339 | _ctk_css_style_property_is_animated (CtkCssStyleProperty *property) |
340 | { |
341 | ctk_internal_return_val_if_fail (CTK_IS_CSS_STYLE_PROPERTY (property), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) (property); GType __t = ((_ctk_css_style_property_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (property); GType __t = ((_ctk_css_style_property_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))" ); return ((0)); } } while (0); |
342 | |
343 | return property->animated; |
344 | } |
345 | |
346 | /** |
347 | * _ctk_css_style_property_get_affects: |
348 | * @property: the property |
349 | * |
350 | * Returns all the things this property affects. See @CtkCssAffects for what |
351 | * the flags mean. |
352 | * |
353 | * Returns: The things this property affects. |
354 | **/ |
355 | CtkCssAffects |
356 | _ctk_css_style_property_get_affects (CtkCssStyleProperty *property) |
357 | { |
358 | ctk_internal_return_val_if_fail (CTK_IS_CSS_STYLE_PROPERTY (property), 0)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) (property); GType __t = ((_ctk_css_style_property_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (property); GType __t = ((_ctk_css_style_property_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))" ); return (0); } } while (0); |
359 | |
360 | return property->affects; |
361 | } |
362 | |
363 | /** |
364 | * _ctk_css_style_property_get_id: |
365 | * @property: the property |
366 | * |
367 | * Gets the id for the given property. IDs are used to allow using arrays |
368 | * for style lookups. |
369 | * |
370 | * Returns: The id of the property |
371 | **/ |
372 | guint |
373 | _ctk_css_style_property_get_id (CtkCssStyleProperty *property) |
374 | { |
375 | ctk_internal_return_val_if_fail (CTK_IS_CSS_STYLE_PROPERTY (property), 0)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) (property); GType __t = ((_ctk_css_style_property_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (property); GType __t = ((_ctk_css_style_property_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))" ); return (0); } } while (0); |
376 | |
377 | return property->id; |
378 | } |
379 | |
380 | /** |
381 | * _ctk_css_style_property_get_initial_value: |
382 | * @property: the property |
383 | * |
384 | * Queries the initial value of the given @property. See the |
385 | * [CSS Documentation](http://www.w3.org/TR/css3-cascade/#intial) |
386 | * for an explanation of this concept. |
387 | * |
388 | * Returns: (transfer none): the initial value. The value will never change. |
389 | **/ |
390 | CtkCssValue * |
391 | _ctk_css_style_property_get_initial_value (CtkCssStyleProperty *property) |
392 | { |
393 | ctk_internal_return_val_if_fail (CTK_IS_CSS_STYLE_PROPERTY (property), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) (property); GType __t = ((_ctk_css_style_property_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__)), "(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (property); GType __t = ((_ctk_css_style_property_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))" ); return (((void*)0)); } } while (0); |
394 | |
395 | return property->initial_value; |
396 | } |
397 | |
398 | /** |
399 | * _ctk_css_style_property_get_mask_affecting: |
400 | * @flags: the flags that are affected |
401 | * |
402 | * Computes a bitmask for all properties that have at least one of @flags |
403 | * set. |
404 | * |
405 | * Returns: (transfer full): A #CtkBitmask with the bit set for every |
406 | * property that has at least one of @flags set. |
407 | */ |
408 | CtkBitmask * |
409 | _ctk_css_style_property_get_mask_affecting (CtkCssAffects affects) |
410 | { |
411 | CtkBitmask *result; |
412 | guint i; |
413 | |
414 | result = _ctk_bitmask_new (); |
Using a fixed address is not portable because that address will probably not be valid in all environments or platforms | |
415 | |
416 | for (i = 0; i < _ctk_css_style_property_get_n_properties (); i++) |
417 | { |
418 | CtkCssStyleProperty *prop = _ctk_css_style_property_lookup_by_id (i); |
419 | |
420 | if (_ctk_css_style_property_get_affects (prop) & affects) |
421 | result = _ctk_bitmask_set (result, i, TRUE(!(0))); |
422 | } |
423 | |
424 | return result; |
425 | } |
426 |