[gtk+] Add API for some sealed widget flags
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+] Add API for some sealed widget flags
- Date: Tue, 14 Jul 2009 00:14:11 +0000 (UTC)
commit 8f6017622937770082f7b49dfbe135fae5608704
Author: Michael Natterer <mitch gimp org>
Date: Tue Jul 14 02:12:40 2009 +0200
Add API for some sealed widget flags
- gtk_widget_has_focus() for GTK_WIDGET_HAS_FOCUS()
- gtk_widget_get_sensitive() for GTK_WIDGET_SENSITIVE()
- gtk_widget_is_sensitive() for GTK_WIDGET_IS_SENSITIVE()
gtk/gtk.symbols | 3 ++
gtk/gtkwidget.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
gtk/gtkwidget.h | 5 ++++
3 files changed, 64 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index aa0e34f..6e5ccc3 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -4978,6 +4978,7 @@ gtk_widget_get_parent_window
gtk_widget_get_pointer
gtk_widget_get_root_window
gtk_widget_get_screen
+gtk_widget_get_sensitive
gtk_widget_get_settings
gtk_widget_get_size_request
gtk_widget_get_snapshot
@@ -4990,6 +4991,7 @@ gtk_widget_get_type G_GNUC_CONST
gtk_widget_get_visual
gtk_widget_grab_default
gtk_widget_grab_focus
+gtk_widget_has_focus
gtk_widget_has_screen
gtk_widget_hide
gtk_widget_hide_all
@@ -4997,6 +4999,7 @@ gtk_widget_hide_on_delete
gtk_widget_intersect
gtk_widget_is_ancestor
gtk_widget_is_focus
+gtk_widget_is_sensitive
gtk_widget_keynav_failed
gtk_widget_list_accel_closures
gtk_widget_list_mnemonic_labels
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index e263660..56edc71 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5259,6 +5259,26 @@ gtk_widget_real_keynav_failed (GtkWidget *widget,
}
/**
+ * gtk_widget_has_focus:
+ * @widget: a #GtkWidget
+ *
+ * Determines if the widget has the global input focus. See
+ * gtk_widget_is_focus() for the difference between having the global
+ * input focus, and only having the focus within a toplevel.
+ *
+ * Return value: %TRUE if the widget has the global input focus.
+ *
+ * Since: 2.18
+ **/
+gboolean
+gtk_widget_has_focus (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+ return GTK_WIDGET_HAS_FOCUS (widget);
+}
+
+/**
* gtk_widget_is_focus:
* @widget: a #GtkWidget
*
@@ -5567,6 +5587,42 @@ gtk_widget_set_sensitive (GtkWidget *widget,
}
/**
+ * gtk_widget_get_sensitive:
+ * @widget: a #GtkWidget
+ *
+ * Returns: %TRUE if the widget is sensitive (in the sense of returning
+ * the value that has been set using gtk_widget_set_sensitive()). The
+ * effective sensitivity of a widget is however determined by both its
+ * own and its parent widget's sensitivity. See gtk_widget_is_sensitive().
+ *
+ * Since: 2.18
+ **/
+gboolean
+gtk_widget_get_sensitive (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+ return GTK_WIDGET_SENSITIVE (widget);
+}
+
+/**
+ * gtk_widget_is_sensitive:
+ * @widget: a #GtkWidget
+ *
+ * Returns: %TRUE if the widget is effectively sensitive, which means
+ * it is sensitive itself and also its parent widget is sensntive
+ *
+ * Since: 2.18
+ **/
+gboolean
+gtk_widget_is_sensitive (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+ return GTK_WIDGET_IS_SENSITIVE (widget);
+}
+
+/**
* gtk_widget_set_parent:
* @widget: a #GtkWidget
* @parent: parent container
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 2d89fb0..af091be 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -548,6 +548,7 @@ void gtk_widget_child_notify (GtkWidget *widget,
const gchar *child_property);
void gtk_widget_thaw_child_notify (GtkWidget *widget);
+gboolean gtk_widget_has_focus (GtkWidget *widget);
gboolean gtk_widget_is_focus (GtkWidget *widget);
void gtk_widget_grab_focus (GtkWidget *widget);
void gtk_widget_grab_default (GtkWidget *widget);
@@ -557,8 +558,12 @@ void gtk_widget_set_name (GtkWidget *widget,
G_CONST_RETURN gchar* gtk_widget_get_name (GtkWidget *widget);
void gtk_widget_set_state (GtkWidget *widget,
GtkStateType state);
+
void gtk_widget_set_sensitive (GtkWidget *widget,
gboolean sensitive);
+gboolean gtk_widget_get_sensitive (GtkWidget *widget);
+gboolean gtk_widget_is_sensitive (GtkWidget *widget);
+
void gtk_widget_set_app_paintable (GtkWidget *widget,
gboolean app_paintable);
void gtk_widget_set_double_buffered (GtkWidget *widget,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]