Add gtk_overlay_remove_overlay

Now that GtkOverlay is not a container anymore,
gtk_container_remove can't be used for this anymore,
so add a separate api.
This commit is contained in:
Matthias Clasen 2020-05-03 10:51:49 -04:00
parent edd5d36159
commit b96d7b62d1
3 changed files with 24 additions and 0 deletions

View File

@ -5485,6 +5485,7 @@ gtk_overlay_new
gtk_overlay_set_child
gtk_overlay_get_child
gtk_overlay_add_overlay
gtk_overlay_remove_overlay
gtk_overlay_get_measure_overlay
gtk_overlay_set_measure_overlay
gtk_overlay_get_clip_overlay

View File

@ -433,10 +433,30 @@ gtk_overlay_add_overlay (GtkOverlay *overlay,
{
g_return_if_fail (GTK_IS_OVERLAY (overlay));
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (widget != overlay->child);
gtk_widget_insert_before (widget, GTK_WIDGET (overlay), NULL);
}
/**
* gtk_overlay_remove_overlay:
* @overlay: a #GtkOverlay
* @widget: a #GtkWidget to be removed
*
* Removes an overlay that was added with gtk_overlay_add_overlay().
*/
void
gtk_overlay_remove_overlay (GtkOverlay *overlay,
GtkWidget *widget)
{
g_return_if_fail (GTK_IS_OVERLAY (overlay));
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (overlay));
g_return_if_fail (widget != overlay->child);
gtk_widget_unparent (widget);
}
/**
* gtk_overlay_set_measure_overlay:
* @overlay: a #GtkOverlay

View File

@ -42,6 +42,9 @@ GtkWidget *gtk_overlay_new (void);
GDK_AVAILABLE_IN_ALL
void gtk_overlay_add_overlay (GtkOverlay *overlay,
GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_overlay_remove_overlay (GtkOverlay *overlay,
GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_overlay_set_child (GtkOverlay *overlay,