diff options
author | Benjamin Otte <otte@redhat.com> | 2012-11-30 18:57:56 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-11-30 20:10:23 +0100 |
commit | a5770cef36d08c8539d31aca6256b7fc158d2f9c (patch) | |
tree | fe49e0380a8b13ac22e770b51293d693ad2bd7a3 /gtk/gtkcssstyleproperty.c | |
parent | 4ccb8e5d330aa448cfb8263feba5c59c367957d2 (diff) | |
download | gtk+-a5770cef36d08c8539d31aca6256b7fc158d2f9c.tar.gz |
styleproperty: Add an affects-size property
This property will be used to avoid gtk_widget_queue_resize() calls in
favor of gtk_widget_queue_draw().
Diffstat (limited to 'gtk/gtkcssstyleproperty.c')
-rw-r--r-- | gtk/gtkcssstyleproperty.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c index 7bb1e688e2..9327921d5a 100644 --- a/gtk/gtkcssstyleproperty.c +++ b/gtk/gtkcssstyleproperty.c @@ -38,6 +38,7 @@ enum { PROP_0, PROP_ANIMATED, + PROP_AFFECTS_SIZE, PROP_ID, PROP_INHERIT, PROP_INITIAL @@ -70,6 +71,9 @@ gtk_css_style_property_set_property (GObject *object, case PROP_ANIMATED: property->animated = g_value_get_boolean (value); break; + case PROP_AFFECTS_SIZE: + property->affects_size = g_value_get_boolean (value); + break; case PROP_INHERIT: property->inherit = g_value_get_boolean (value); break; @@ -96,6 +100,9 @@ gtk_css_style_property_get_property (GObject *object, case PROP_ANIMATED: g_value_set_boolean (value, property->animated); break; + case PROP_AFFECTS_SIZE: + g_value_set_boolean (value, property->affects_size); + break; case PROP_ID: g_value_set_boolean (value, property->id); break; @@ -252,6 +259,13 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass) FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (object_class, + PROP_AFFECTS_SIZE, + g_param_spec_boolean ("affects-size", + P_("Affects size"), + P_("Set if the value affects the sizing of elements"), + TRUE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (object_class, PROP_ID, g_param_spec_uint ("id", P_("ID"), @@ -382,6 +396,23 @@ _gtk_css_style_property_is_animated (GtkCssStyleProperty *property) } /** + * _gtk_css_style_property_affects_size: + * @property: the property + * + * Queries if the given @property affects the size of elements. This is + * used for optimizations inside GTK, where a gtk_widget_queue_resize() + * can be avoided if the property does not affect size. + * + * Returns: %TRUE if the property affects sizing of elements. + **/ +gboolean +_gtk_css_style_property_affects_size (GtkCssStyleProperty *property) +{ + g_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), FALSE); + + return property->affects_size; +} +/** * _gtk_css_style_property_get_id: * @property: the property * |