diff options
author | Benjamin Otte <otte@redhat.com> | 2012-11-02 00:42:45 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-11-04 15:24:17 +0100 |
commit | 48ff2fc7ed1f418002def55fc496a7f86f9e7ef7 (patch) | |
tree | b090f8334690a8cbcd0a26b912e7d5e242a293e2 /gtk/gtkwidget.c | |
parent | 9f6067a8043129ddcc0e223111d3b5a79c7b8100 (diff) | |
download | gtk+-48ff2fc7ed1f418002def55fc496a7f86f9e7ef7.tar.gz |
API: Add gtk_widget_is_visible()
This is a recursive gtk_widget_get_visible(): Returns TRUE if the widget
and all its parents are visible.
Diffstat (limited to 'gtk/gtkwidget.c')
-rw-r--r-- | gtk/gtkwidget.c | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 58ad57af23..2f4dc0871c 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -7484,9 +7484,11 @@ _gtk_widget_set_visible_flag (GtkWidget *widget, * gtk_widget_get_visible: * @widget: a #GtkWidget * - * Determines whether the widget is visible. Note that this doesn't - * take into account whether the widget's parent is also visible - * or the widget is obscured in any way. + * Determines whether the widget is visible. If you want to + * take into account whether the widget's parent is also marked as + * visible, use gtk_widget_is_visible() instead. + * + * This function does not check if the widget is obscured in any way. * * See gtk_widget_set_visible(). * @@ -7503,6 +7505,39 @@ gtk_widget_get_visible (GtkWidget *widget) } /** + * gtk_widget_is_visible: + * @widget: a #GtkWidget + * + * Determines whether the widget and all its parents are marked as + * visible. + * + * This function does not check if the widget is obscured in any way. + * + * See also gtk_widget_get_visible() and gtk_widget_set_visible() + * + * Return value: %TRUE if the widget and all its parents are visible + * + * Since: 3.8 + **/ +gboolean +gtk_widget_is_visible (GtkWidget *widget) +{ + g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); + + while (widget) + { + GtkWidgetPrivate *priv = widget->priv; + + if (!priv->visible) + return FALSE; + + widget = priv->parent; + } + + return TRUE; +} + +/** * gtk_widget_set_has_window: * @widget: a #GtkWidget * @has_window: whether or not @widget has a window. |