[gtk+] Add gtk_widget_get_state() for accessing the sealed member "state"



commit 2686930bfd9c26757e1e2281657ee7d04278a7e6
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jul 14 02:45:42 2009 +0200

    Add gtk_widget_get_state() for accessing the sealed member "state"

 gtk/gtk.symbols |    1 +
 gtk/gtkwidget.c |   15 +++++++++++++++
 gtk/gtkwidget.h |    2 ++
 3 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 6e5ccc3..a6ee554 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -4982,6 +4982,7 @@ gtk_widget_get_sensitive
 gtk_widget_get_settings
 gtk_widget_get_size_request
 gtk_widget_get_snapshot
+gtk_widget_get_state
 gtk_widget_get_style
 gtk_widget_get_tooltip_markup
 gtk_widget_get_tooltip_text
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 56edc71..44fd9cd 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5421,6 +5421,21 @@ gtk_widget_set_state (GtkWidget           *widget,
     }
 }
 
+/**
+ * gtk_widget_get_state:
+ * @widget: a #GtkWidget
+ *
+ * Returns: the state of @widget. See gtk_widget_set_state().
+ *
+ * Since: 2.18
+ **/
+GtkStateType
+gtk_widget_get_state (GtkWidget *widget)
+{
+  g_return_val_if_fail (GTK_IS_WIDGET (widget), GTK_STATE_NORMAL);
+
+  return widget->state;
+}
 
 /**
  * gtk_widget_set_app_paintable:
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index af091be..36869f9 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -556,8 +556,10 @@ void	   gtk_widget_grab_default	  (GtkWidget	       *widget);
 void                  gtk_widget_set_name               (GtkWidget    *widget,
 							 const gchar  *name);
 G_CONST_RETURN gchar* gtk_widget_get_name               (GtkWidget    *widget);
+
 void                  gtk_widget_set_state              (GtkWidget    *widget,
 							 GtkStateType  state);
+GtkStateType          gtk_widget_get_state              (GtkWidget    *widget);
 
 void                  gtk_widget_set_sensitive          (GtkWidget    *widget,
 							 gboolean      sensitive);



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