[gtk+/wip/cssnode3: 11/18] cssnode: Add gtk_css_node_add/remove_state() API



commit 85d86d61dedf1977d21929bda5334efa924b320a
Author: Benjamin Otte <otte redhat com>
Date:   Tue Mar 10 17:31:16 2015 +0100

    cssnode: Add gtk_css_node_add/remove_state() API
    
    This mirrors gtk_css_node_add/remove_class() APIs and allows you to
    specify a (set of) state(s) to set or unset.
    
    These functions are purely convenience.

 gtk/gtkcssnode.c        |   16 ++++++++++++++++
 gtk/gtkcssnodeprivate.h |    4 ++++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index 39b481a..c409bee 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -951,6 +951,22 @@ gtk_css_node_get_state (GtkCssNode *cssnode)
 }
 
 void
+gtk_css_node_add_state (GtkCssNode    *cssnode,
+                        GtkStateFlags  state_flags)
+{
+  gtk_css_node_set_state (cssnode,
+                          gtk_css_node_get_state (cssnode) | state_flags);
+}
+
+void
+gtk_css_node_remove_state (GtkCssNode    *cssnode,
+                           GtkStateFlags  state_flags)
+{
+  gtk_css_node_set_state (cssnode,
+                          gtk_css_node_get_state (cssnode) & ~state_flags);
+}
+
+void
 gtk_css_node_set_junction_sides (GtkCssNode       *cssnode,
                                  GtkJunctionSides  junction_sides)
 {
diff --git a/gtk/gtkcssnodeprivate.h b/gtk/gtkcssnodeprivate.h
index 8a155a7..90a811f 100644
--- a/gtk/gtkcssnodeprivate.h
+++ b/gtk/gtkcssnodeprivate.h
@@ -122,6 +122,10 @@ const char *            gtk_css_node_get_id             (GtkCssNode            *
 void                    gtk_css_node_set_state          (GtkCssNode            *cssnode,
                                                          GtkStateFlags          state_flags);
 GtkStateFlags           gtk_css_node_get_state          (GtkCssNode            *cssnode);
+void                    gtk_css_node_add_state          (GtkCssNode            *cssnode,
+                                                         GtkStateFlags          state_flags);
+void                    gtk_css_node_remove_state       (GtkCssNode            *cssnode,
+                                                         GtkStateFlags          state_flags);
 void                    gtk_css_node_set_junction_sides (GtkCssNode            *cssnode,
                                                          GtkJunctionSides       junction_sides);
 GtkJunctionSides        gtk_css_node_get_junction_sides (GtkCssNode            *cssnode);


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