summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-01-27 04:32:09 +0100
committerBenjamin Otte <otte@redhat.com>2015-01-27 05:04:34 +0100
commitc0650057c11b87cf7c2c063b160c54080318f7f7 (patch)
tree3ecc4f8612c66d92b4e0cfbcddea7ec503e80249 /gtk
parent11d70f1ac30dd491d9d8dac9b9e2c31cee073cc9 (diff)
downloadgtk+-c0650057c11b87cf7c2c063b160c54080318f7f7.tar.gz
css: Add GtkCssStyleProperty::affects property
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkcssstyleproperty.c32
-rw-r--r--gtk/gtkcssstylepropertyimpl.c1
-rw-r--r--gtk/gtkcssstylepropertyprivate.h2
-rw-r--r--gtk/gtkcsstypesprivate.h2
4 files changed, 36 insertions, 1 deletions
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c
index 1590ed28ae..5f99a1bc68 100644
--- a/gtk/gtkcssstyleproperty.c
+++ b/gtk/gtkcssstyleproperty.c
@@ -39,6 +39,7 @@
enum {
PROP_0,
PROP_ANIMATED,
+ PROP_AFFECTS,
PROP_AFFECTS_SIZE,
PROP_AFFECTS_FONT,
PROP_ID,
@@ -84,6 +85,9 @@ gtk_css_style_property_set_property (GObject *object,
case PROP_ANIMATED:
property->animated = g_value_get_boolean (value);
break;
+ case PROP_AFFECTS:
+ property->affects = g_value_get_flags (value);
+ break;
case PROP_AFFECTS_SIZE:
property->affects_size = g_value_get_boolean (value);
break;
@@ -116,6 +120,9 @@ gtk_css_style_property_get_property (GObject *object,
case PROP_ANIMATED:
g_value_set_boolean (value, property->animated);
break;
+ case PROP_AFFECTS:
+ g_value_set_flags (value, property->affects);
+ break;
case PROP_AFFECTS_SIZE:
g_value_set_boolean (value, property->affects_size);
break;
@@ -225,6 +232,14 @@ _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,
+ g_param_spec_flags ("affects",
+ P_("Affects"),
+ P_("Set if the value affects the sizing of elements"),
+ GTK_TYPE_CSS_AFFECTS,
+ 0,
+ 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"),
@@ -368,6 +383,23 @@ _gtk_css_style_property_is_animated (GtkCssStyleProperty *property)
}
/**
+ * _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)
+{
+ g_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), 0);
+
+ return property->affects;
+}
+
+/**
* _gtk_css_style_property_affects_size:
* @property: the property
*
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 9f6b48192d..d1ce9725cd 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -91,6 +91,7 @@ gtk_css_style_property_register (const char * name,
node = g_object_new (GTK_TYPE_CSS_STYLE_PROPERTY,
"value-type", value_type,
+ "affects", affects,
"affects-size", (affects & (GTK_CSS_AFFECTS_CLIP | GTK_CSS_AFFECTS_SIZE)) ? TRUE : FALSE,
"affects-font", (affects & GTK_CSS_AFFECTS_FONT) ? TRUE : FALSE,
"animated", (flags & GTK_STYLE_PROPERTY_ANIMATED) ? TRUE : FALSE,
diff --git a/gtk/gtkcssstylepropertyprivate.h b/gtk/gtkcssstylepropertyprivate.h
index fb851899eb..bd72bc9676 100644
--- a/gtk/gtkcssstylepropertyprivate.h
+++ b/gtk/gtkcssstylepropertyprivate.h
@@ -47,6 +47,7 @@ struct _GtkCssStyleProperty
GtkCssValue *initial_value;
guint id;
+ GtkCssAffects affects;
guint inherit :1;
guint animated :1;
guint affects_size :1;
@@ -73,6 +74,7 @@ GtkCssStyleProperty * _gtk_css_style_property_lookup_by_id (guint
gboolean _gtk_css_style_property_is_inherit (GtkCssStyleProperty *property);
gboolean _gtk_css_style_property_is_animated (GtkCssStyleProperty *property);
+GtkCssAffects _gtk_css_style_property_get_affects (GtkCssStyleProperty *property);
gboolean _gtk_css_style_property_affects_size (GtkCssStyleProperty *property);
gboolean _gtk_css_style_property_affects_font (GtkCssStyleProperty *property);
guint _gtk_css_style_property_get_id (GtkCssStyleProperty *property);
diff --git a/gtk/gtkcsstypesprivate.h b/gtk/gtkcsstypesprivate.h
index b586623185..1f96f7d7bb 100644
--- a/gtk/gtkcsstypesprivate.h
+++ b/gtk/gtkcsstypesprivate.h
@@ -96,7 +96,7 @@ typedef enum /*< skip >*/ {
*
* Note that multiple values can be set.
*/
-typedef enum /*< skip >*/ {
+typedef enum {
GTK_CSS_AFFECTS_FOREGROUND = (1 << 0),
GTK_CSS_AFFECTS_BACKGROUND = (1 << 1),
GTK_CSS_AFFECTS_BORDER = (1 << 2),