Commit 0e52286d authored by Michael Natterer's avatar Michael Natterer 😴

Bug 69872 - GTK_WIDGET_SET_FLAGS should be deprecated

Add gtk_widget_is_toplevel() for GTK_WIDGET_TOPLEVEL()
and gtk_widget_is_drawable() for GTK_WIDGET_DRAWABLE()
parent e6af9279
......@@ -5018,6 +5018,8 @@ gtk_widget_intersect
gtk_widget_is_ancestor
gtk_widget_is_focus
gtk_widget_is_sensitive
gtk_widget_is_toplevel
gtk_widget_is_drawable
gtk_widget_keynav_failed
gtk_widget_list_accel_closures
gtk_widget_list_mnemonic_labels
......
......@@ -5701,6 +5701,46 @@ gtk_widget_get_has_window (GtkWidget *widget)
return !GTK_WIDGET_NO_WINDOW (widget);
}
/**
* gtk_widget_is_toplevel:
* @widget: a #GtkWidget
*
* Determines whether @widget is a toplevel widget. Currently only
* #GtkWindow and #GtkInvisible are toplevel widgets. Toplevel
* widgets have no parent widget.
*
* Return value: %TRUE if @widget is a toplevel, %FALSE otherwise
*
* Since: 2.18
**/
gboolean
gtk_widget_is_toplevel (GtkWidget *widget)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
return (GTK_WIDGET_FLAGS (widget) & GTK_TOPLEVEL) != 0;
}
/**
* gtk_widget_is_drawable:
* @widget: a #GtkWidget
*
* Determines whether @widget can be drawn to. A widget can be drawn
* to if it is mapped and visible.
*
* Return value: %TRUE if @widget is drawable, %FALSE otherwise
*
* Since: 2.18
**/
gboolean
gtk_widget_is_drawable (GtkWidget *widget)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
return ((GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) != 0 &&
(GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0);
}
/**
* gtk_widget_set_app_paintable:
* @widget: a #GtkWidget
......
......@@ -584,6 +584,9 @@ void gtk_widget_set_has_window (GtkWidget *widget,
gboolean has_window);
gboolean gtk_widget_get_has_window (GtkWidget *widget);
gboolean gtk_widget_is_toplevel (GtkWidget *widget);
gboolean gtk_widget_is_drawable (GtkWidget *widget);
void gtk_widget_set_app_paintable (GtkWidget *widget,
gboolean app_paintable);
gboolean gtk_widget_get_app_paintable (GtkWidget *widget);
......@@ -594,12 +597,15 @@ gboolean gtk_widget_get_double_buffered (GtkWidget *widget);
void gtk_widget_set_redraw_on_allocate (GtkWidget *widget,
gboolean redraw_on_allocate);
void gtk_widget_set_parent (GtkWidget *widget,
GtkWidget *parent);
GtkWidget * gtk_widget_get_parent (GtkWidget *widget);
void gtk_widget_set_parent_window (GtkWidget *widget,
GdkWindow *parent_window);
GdkWindow * gtk_widget_get_parent_window (GtkWidget *widget);
void gtk_widget_set_child_visible (GtkWidget *widget,
gboolean is_visible);
gboolean gtk_widget_get_child_visible (GtkWidget *widget);
......
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