GtkBitmask * _gtk_css_computed_values_advance (GtkCssComputedValues *values, gint64 timestamp) { GtkBitmask *changed; GPtrArray *old_computed_values; GSList *list; guint i; gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL); gtk_internal_return_val_if_fail (timestamp >= values->current_time, NULL); values->current_time = timestamp; old_computed_values = values->animated_values; values->animated_values = NULL; list = values->animations; while (list) { GtkStyleAnimation *animation = list->data; list = list->next; _gtk_style_animation_set_values (animation, timestamp, GTK_CSS_COMPUTED_VALUES (values)); if (_gtk_style_animation_is_finished (animation, timestamp)) { values->animations = g_slist_remove (values->animations, animation); g_object_unref (animation); } } /* figure out changes */ changed = _gtk_bitmask_new (); for (i = 0; i < GTK_CSS_PROPERTY_N_PROPERTIES; i++) { GtkCssValue *old_animated, *new_animated; old_animated = old_computed_values && i < old_computed_values->len ? g_ptr_array_index (old_computed_values, i) : NULL; new_animated = values->animated_values && i < values->animated_values->len ? g_ptr_array_index (values->animated_values, i) : NULL; if (!_gtk_css_value_equal0 (old_animated, new_animated)) changed = _gtk_bitmask_set (changed, i, TRUE); } if (old_computed_values) g_ptr_array_unref (old_computed_values); return changed; }
/** * _gtk_css_style_property_get_affects: * @property: the property * * Returns all the things this property affects. See @GtkCssAffects for what * the flags mean. * * Returns: The things this property affects. **/ GtkCssAffects _gtk_css_style_property_get_affects (GtkCssStyleProperty *property) { gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), 0); return property->affects; }
/** * _gtk_css_style_property_get_id: * @property: the property * * Gets the id for the given property. IDs are used to allow using arrays * for style lookups. * * Returns: The id of the property **/ guint _gtk_css_style_property_get_id (GtkCssStyleProperty *property) { gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), 0); return property->id; }
int _gtk_style_cascade_get_scale (GtkStyleCascade *cascade) { gtk_internal_return_val_if_fail (GTK_IS_STYLE_CASCADE (cascade), 1); return cascade->scale; }
/** * _gtk_css_style_property_get_initial_value: * @property: the property * * Queries the initial value of the given @property. See the * [CSS Documentation](http://www.w3.org/TR/css3-cascade/#intial) * for an explanation of this concept. * * Returns: (transfer none): the initial value. The value will never change. **/ GtkCssValue * _gtk_css_style_property_get_initial_value (GtkCssStyleProperty *property) { gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), NULL); return property->initial_value; }
/** * gtk_css_section_get_file: * @section: the section * * Gets the file that @section was parsed from. If no such file exists, * for example because the CSS was loaded via * @gtk_css_provider_load_from_data(), then %NULL is returned. * * Returns: (transfer none): the #GFile that @section was parsed from * or %NULL if @section was parsed from other data * * Since: 3.2 **/ GFile * gtk_css_section_get_file (const GtkCssSection *section) { gtk_internal_return_val_if_fail (section != NULL, NULL); return section->file; }
/** * gtk_css_section_get_start_position: * @section: the section * * Returns the offset in bytes from the start of the current line * returned via gtk_css_section_get_start_line(). * * Returns: the offset in bytes from the start of the line. * * Since: 3.2 **/ guint gtk_css_section_get_start_position (const GtkCssSection *section) { gtk_internal_return_val_if_fail (section != NULL, 0); return section->start_position; }
/** * gtk_css_section_get_section_type: * @section: the section * * Gets the type of information that @section describes. * * Returns: the type of @section * * Since: 3.2 **/ GtkCssSectionType gtk_css_section_get_section_type (const GtkCssSection *section) { gtk_internal_return_val_if_fail (section != NULL, GTK_CSS_SECTION_DOCUMENT); return section->section_type; }
/** * gtk_css_section_get_parent: * @section: the section * * Gets the parent section for the given @section. The parent section is * the section that contains this @section. A special case are sections of * type #GTK_CSS_SECTION_DOCUMENT. Their parent will either be %NULL * if they are the original CSS document that was loaded by * gtk_css_provider_load_from_file() or a section of type * #GTK_CSS_SECTION_IMPORT if it was loaded with an import rule from * a different file. * * Returns: (nullable) (transfer none): the parent section or %NULL if none * * Since: 3.2 **/ GtkCssSection * gtk_css_section_get_parent (const GtkCssSection *section) { gtk_internal_return_val_if_fail (section != NULL, NULL); return section->parent; }
GtkWidgetPath * gtk_css_path_node_get_widget_path (GtkCssPathNode *node) { gtk_internal_return_val_if_fail (GTK_IS_CSS_PATH_NODE (node), NULL); return node->path; }
GtkWidget * gtk_css_widget_node_get_widget (GtkCssWidgetNode *node) { gtk_internal_return_val_if_fail (GTK_IS_CSS_WIDGET_NODE (node), NULL); return node->widget; }
gboolean gtk_css_style_is_static (GtkCssStyle *style) { gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), TRUE); return GTK_CSS_STYLE_GET_CLASS (style)->is_static (style); }
GtkCssKeyframes * _gtk_style_provider_private_get_keyframes (GtkStyleProviderPrivate *provider, const char *name) { GtkStyleProviderPrivateInterface *iface; gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL); gtk_internal_return_val_if_fail (name != NULL, NULL); iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider); if (!iface->get_keyframes) return NULL; return iface->get_keyframes (provider, name); }
/** * _gtk_css_style_property_is_animated: * @property: the property * * Queries if the given @property can be is animated. See the * [CSS Documentation](http://www.w3.org/TR/css3-transitions/#animatable-css) * for animatable properties. * * Returns: %TRUE if the property can be animated. **/ gboolean _gtk_css_style_property_is_animated (GtkCssStyleProperty *property) { gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), FALSE); return property->animated; }
/** * gtk_widget_path_length: * @path: a #GtkWidgetPath * * Returns the number of #GtkWidget #GTypes between the represented * widget and its topmost container. * * Returns: the number of elements in the path * * Since: 3.0 **/ gint gtk_widget_path_length (const GtkWidgetPath *path) { gtk_internal_return_val_if_fail (path != NULL, 0); return path->elems->len; }
GtkCssValue * gtk_css_animated_style_get_intrinsic_value (GtkCssAnimatedStyle *style, guint id) { gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (style), NULL); return gtk_css_style_get_value (style->style, id); }
GtkCssSection * gtk_css_style_get_section (GtkCssStyle *style, guint id) { gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL); return GTK_CSS_STYLE_GET_CLASS (style)->get_section (style, id); }
gboolean _gtk_css_lookup_is_missing (const GtkCssLookup *lookup, guint id) { gtk_internal_return_val_if_fail (lookup != NULL, FALSE); return _gtk_bitmask_get (lookup->missing, id); }
/** * gtk_css_section_ref: * @section: a #GtkCssSection * * Increments the reference count on @section. * * Returns: @section itself. * * Since: 3.2 **/ GtkCssSection * gtk_css_section_ref (GtkCssSection *section) { gtk_internal_return_val_if_fail (section != NULL, NULL); section->ref_count += 1; return section; }
/** * gtk_widget_path_ref: * @path: a #GtkWidgetPath * * Increments the reference count on @path. * * Returns: @path itself. * * Since: 3.2 **/ GtkWidgetPath * gtk_widget_path_ref (GtkWidgetPath *path) { gtk_internal_return_val_if_fail (path != NULL, path); path->ref_count += 1; return path; }
/** * gtk_css_section_get_end_position: * @section: the section * * Returns the offset in bytes from the start of the current line * returned via gtk_css_section_get_end_line(). * This value may change in future invocations of this function if * @section is not yet parsed completely. This will for example * happen in the GtkCssProvider::parsing-error signal. * The end position and line may be identical to the start * position and line for sections which failed to parse anything * successfully. * * Returns: the offset in bytes from the start of the line. * * Since: 3.2 **/ guint gtk_css_section_get_end_position (const GtkCssSection *section) { gtk_internal_return_val_if_fail (section != NULL, 0); if (section->parser) return _gtk_css_parser_get_position (section->parser); else return section->end_position; }
GtkCssStyle * gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source, GtkCssStyle *base, gint64 timestamp) { GtkCssAnimatedStyle *result; GSList *l, *animations; gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (source), NULL); gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (base), NULL); if (timestamp == 0 || timestamp == source->current_time) return g_object_ref (source->style); gtk_internal_return_val_if_fail (timestamp > source->current_time, NULL); animations = NULL; for (l = source->animations; l; l = l->next) { GtkStyleAnimation *animation = l->data; if (_gtk_style_animation_is_finished (animation)) continue; animation = _gtk_style_animation_advance (animation, timestamp); animations = g_slist_prepend (animations, animation); } animations = g_slist_reverse (animations); if (animations == NULL) return g_object_ref (source->style); result = g_object_new (GTK_TYPE_CSS_ANIMATED_STYLE, NULL); result->style = g_object_ref (base); result->current_time = timestamp; result->animations = animations; gtk_css_animated_style_apply_animations (result); return GTK_CSS_STYLE (result); }
GtkCssSection * _gtk_css_computed_values_get_section (GtkCssComputedValues *values, guint id) { gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL); if (values->sections == NULL || id >= values->sections->len) return NULL; return g_ptr_array_index (values->sections, id); }
char * _gtk_css_section_to_string (const GtkCssSection *section) { GString *string; gtk_internal_return_val_if_fail (section != NULL, NULL); string = g_string_new (NULL); _gtk_css_section_print (section, string); return g_string_free (string, FALSE); }
GtkCssValue * _gtk_css_computed_values_get_value (GtkCssComputedValues *values, guint id) { gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL); if (values->animated_values && id < values->animated_values->len && g_ptr_array_index (values->animated_values, id)) return g_ptr_array_index (values->animated_values, id); return _gtk_css_computed_values_get_intrinsic_value (values, id); }
GtkSettings * _gtk_style_provider_private_get_settings (GtkStyleProviderPrivate *provider) { GtkStyleProviderPrivateInterface *iface; gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL); iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider); if (!iface->get_settings) return NULL; return iface->get_settings (provider); }
GtkCssNode * gtk_css_widget_node_new (GtkWidget *widget) { GtkCssWidgetNode *result; gtk_internal_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); result = g_object_new (GTK_TYPE_CSS_WIDGET_NODE, NULL); result->widget = widget; gtk_css_node_set_visible (GTK_CSS_NODE (result), gtk_widget_get_visible (widget)); return GTK_CSS_NODE (result); }
int _gtk_style_provider_private_get_scale (GtkStyleProviderPrivate *provider) { GtkStyleProviderPrivateInterface *iface; gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), 1); iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider); if (!iface->get_scale) return 1; return iface->get_scale (provider); }
/** * _gtk_css_style_property_lookup_by_id: * @id: the id of the property * * Gets the style property with the given id. All style properties (but not * shorthand properties) are indexable by id so that it’s easy to use arrays * when doing style lookups. * * Returns: (transfer none): The style property with the given id **/ GtkCssStyleProperty * _gtk_css_style_property_lookup_by_id (guint id) { if (G_UNLIKELY (gtk_css_style_property_class == NULL)) { _gtk_style_property_init_properties (); g_assert (gtk_css_style_property_class); } gtk_internal_return_val_if_fail (id < gtk_css_style_property_class->style_properties->len, NULL); return g_ptr_array_index (gtk_css_style_property_class->style_properties, id); }
GtkCssStyle * gtk_css_animated_style_new (GtkCssStyle *base_style, GtkCssStyle *parent_style, gint64 timestamp, GtkStyleProviderPrivate *provider, GtkCssStyle *previous_style) { GtkCssAnimatedStyle *result; GSList *animations; gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (base_style), NULL); gtk_internal_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL); gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL); gtk_internal_return_val_if_fail (previous_style == NULL || GTK_IS_CSS_STYLE (previous_style), NULL); if (timestamp == 0) return g_object_ref (base_style); animations = NULL; if (previous_style != NULL) animations = gtk_css_animated_style_create_css_transitions (animations, base_style, timestamp, previous_style); animations = gtk_css_animated_style_create_css_animations (animations, base_style, parent_style, timestamp, provider, previous_style); if (animations == NULL) return g_object_ref (base_style); result = g_object_new (GTK_TYPE_CSS_ANIMATED_STYLE, NULL); result->style = g_object_ref (base_style); result->current_time = timestamp; result->animations = animations; gtk_css_animated_style_apply_animations (result); return GTK_CSS_STYLE (result); }