[gtk+] css: Add _gtk_css_style_property_get_mask_affecting()



commit c42e54e9494d7d56634bd9bbafe38ddf6ee8daa8
Author: Benjamin Otte <otte redhat com>
Date:   Tue Jan 27 04:47:55 2015 +0100

    css: Add _gtk_css_style_property_get_mask_affecting()
    
    Computes a bitmask for all properties that affect the given flags.

 gtk/gtkcssstyleproperty.c        |   29 +++++++++++++++++++++++++++++
 gtk/gtkcssstylepropertyprivate.h |    2 ++
 2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c
index 4d04dc7..55da7d1 100644
--- a/gtk/gtkcssstyleproperty.c
+++ b/gtk/gtkcssstyleproperty.c
@@ -406,6 +406,35 @@ _gtk_css_style_property_get_initial_value (GtkCssStyleProperty *property)
   return property->initial_value;
 }
 
+/**
+ * _gtk_css_style_property_get_mask_affecting:
+ * @flags: the flags that are affected
+ *
+ * Computes a bitmask for all properties that have at least one of @flags
+ * set.
+ *
+ * Returns: (transfer: full): A #GtkBitmask with the bit set for every
+ *          property that has at least one of @flags set.
+ */
+GtkBitmask *
+_gtk_css_style_property_get_mask_affecting (GtkCssAffects affects)
+{
+  GtkBitmask *result;
+  guint i;
+
+  result = _gtk_bitmask_new ();
+
+  for (i = 0; i < _gtk_css_style_property_get_n_properties (); i++)
+    {
+      GtkCssStyleProperty *prop = _gtk_css_style_property_lookup_by_id (i);
+
+      if (_gtk_css_style_property_get_affects (prop) & affects)
+        result = _gtk_bitmask_set (result, i, TRUE);
+    }
+
+  return result;
+}
+
 gboolean
 _gtk_css_style_property_changes_affect_size (const GtkBitmask *changes)
 {
diff --git a/gtk/gtkcssstylepropertyprivate.h b/gtk/gtkcssstylepropertyprivate.h
index 47cd051..fbc8489 100644
--- a/gtk/gtkcssstylepropertyprivate.h
+++ b/gtk/gtkcssstylepropertyprivate.h
@@ -83,6 +83,8 @@ void                    _gtk_css_style_property_print_value     (GtkCssStyleProp
                                                                  GtkCssValue            *value,
                                                                  GString                *string);
 
+GtkBitmask *            _gtk_css_style_property_get_mask_affecting
+                                                                (GtkCssAffects           affects);
 gboolean                _gtk_css_style_property_changes_affect_size
                                                                 (const GtkBitmask       *changes);
 gboolean                _gtk_css_style_property_changes_affect_font


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]