Commit 48ff2fc7 authored by Benjamin Otte's avatar Benjamin Otte

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.
parent 9f6067a8
......@@ -5291,6 +5291,7 @@ gtk_widget_get_sensitive
gtk_widget_is_sensitive
gtk_widget_get_state
gtk_widget_get_visible
gtk_widget_is_visible
gtk_widget_set_visible
gtk_widget_set_state_flags
gtk_widget_unset_state_flags
......
......@@ -3708,6 +3708,7 @@ gtk_widget_is_composited
gtk_widget_is_drawable
gtk_widget_is_focus
gtk_widget_is_sensitive
gtk_widget_is_visible
gtk_widget_is_toplevel
gtk_widget_keynav_failed
gtk_widget_list_accel_closures
......
......@@ -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().
*
......@@ -7502,6 +7504,39 @@ gtk_widget_get_visible (GtkWidget *widget)
return widget->priv->visible;
}
/**
* 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
......
......@@ -589,6 +589,7 @@ gboolean gtk_widget_is_sensitive (GtkWidget *widget);
void gtk_widget_set_visible (GtkWidget *widget,
gboolean visible);
gboolean gtk_widget_get_visible (GtkWidget *widget);
gboolean gtk_widget_is_visible (GtkWidget *widget);
void gtk_widget_set_has_window (GtkWidget *widget,
gboolean has_window);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment