grid: Add gtk_grid_remove

This is a replacement for gtk_container_remove.
This commit is contained in:
Matthias Clasen 2020-05-07 14:22:12 -04:00
parent 1a33278703
commit 5cda824784
3 changed files with 31 additions and 7 deletions

View File

@ -5284,6 +5284,7 @@ GtkGridClass
gtk_grid_new
gtk_grid_attach
gtk_grid_attach_next_to
gtk_grid_remove
gtk_grid_get_child_at
gtk_grid_insert_row
gtk_grid_insert_column

View File

@ -287,8 +287,8 @@ gtk_grid_add (GtkContainer *container,
}
static void
gtk_grid_remove (GtkContainer *container,
GtkWidget *child)
gtk_grid_real_remove (GtkContainer *container,
GtkWidget *child)
{
GtkGrid *grid = GTK_GRID (container);
gboolean was_visible;
@ -335,7 +335,7 @@ gtk_grid_class_init (GtkGridClass *class)
object_class->set_property = gtk_grid_set_property;
container_class->add = gtk_grid_add;
container_class->remove = gtk_grid_remove;
container_class->remove = gtk_grid_real_remove;
container_class->forall = gtk_grid_forall;
container_class->child_type = gtk_grid_child_type;
@ -580,6 +580,25 @@ gtk_grid_get_child_at (GtkGrid *grid,
return NULL;
}
/**
* gtk_grid_remove:
* @grid: a #GtkGrid
* @child: the child widget to remove
*
* Removes a child from @grid, after it has been added
* with gtk_grid_attach() or gtk_grid_attach_next_to().
*/
void
gtk_grid_remove (GtkGrid *grid,
GtkWidget *child)
{
g_return_if_fail (GTK_IS_GRID (grid));
g_return_if_fail (GTK_IS_WIDGET (child));
g_return_if_fail (gtk_widget_get_parent (child) == grid);
gtk_widget_unparent (child);
}
/**
* gtk_grid_insert_row:
* @grid: a #GtkGrid

View File

@ -82,6 +82,10 @@ GtkWidget *gtk_grid_get_child_at (GtkGrid *grid,
gint left,
gint top);
GDK_AVAILABLE_IN_ALL
void gtk_grid_remove (GtkGrid *grid,
GtkWidget *child);
GDK_AVAILABLE_IN_ALL
void gtk_grid_insert_row (GtkGrid *grid,
gint position);
GDK_AVAILABLE_IN_ALL
@ -119,14 +123,14 @@ GDK_AVAILABLE_IN_ALL
guint gtk_grid_get_column_spacing (GtkGrid *grid);
GDK_AVAILABLE_IN_ALL
void gtk_grid_set_row_baseline_position (GtkGrid *grid,
gint row,
GtkBaselinePosition pos);
gint row,
GtkBaselinePosition pos);
GDK_AVAILABLE_IN_ALL
GtkBaselinePosition gtk_grid_get_row_baseline_position (GtkGrid *grid,
gint row);
gint row);
GDK_AVAILABLE_IN_ALL
void gtk_grid_set_baseline_row (GtkGrid *grid,
gint row);
gint row);
GDK_AVAILABLE_IN_ALL
gint gtk_grid_get_baseline_row (GtkGrid *grid);