From aa49527fa78bf5b3a3f1394092b248e27e1bfa3f Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 19 Jul 2001 14:57:15 +0000 Subject: Enforce the widget/child realization/mapping invariants. Sat Jul 7 02:50:14 2001 Owen Taylor * gtk/gtkwidget.c (gtk_widget_set_parent): Enforce the widget/child realization/mapping invariants. * gtk/gtkwidget.[ch] gtk/gtkprivate.h: Add functions gtk_widget_[get/set]_child_visible() to control whether visible children of a mapped window are mapped. * docs/widget_system.txt: Updated for changes in container contract, and addition of GTK_CHILD_VISIBLE. * gtk/gtkcontainer.c: Add generic map()/unmap() functions that work for almost all containers. * gtk/gtknotebook.c gtk/gtkpacker.c: Use gtk_widget_set_child_visible() where necessary. * gtk/*.c: Remove excess map(), unmap(), and realization/mapping invariant enforcing code from many containers. --- gtk/gtktable.c | 63 ---------------------------------------------------------- 1 file changed, 63 deletions(-) (limited to 'gtk/gtktable.c') diff --git a/gtk/gtktable.c b/gtk/gtktable.c index 64c07fb362..e85f122d4a 100644 --- a/gtk/gtktable.c +++ b/gtk/gtktable.c @@ -54,8 +54,6 @@ enum static void gtk_table_class_init (GtkTableClass *klass); static void gtk_table_init (GtkTable *table); static void gtk_table_finalize (GObject *object); -static void gtk_table_map (GtkWidget *widget); -static void gtk_table_unmap (GtkWidget *widget); static void gtk_table_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_table_size_allocate (GtkWidget *widget, @@ -141,8 +139,6 @@ gtk_table_class_init (GtkTableClass *class) gobject_class->get_property = gtk_table_get_property; gobject_class->set_property = gtk_table_set_property; - widget_class->map = gtk_table_map; - widget_class->unmap = gtk_table_unmap; widget_class->size_request = gtk_table_size_request; widget_class->size_allocate = gtk_table_size_allocate; @@ -610,17 +606,6 @@ gtk_table_attach (GtkTable *table, table->children = g_list_prepend (table->children, table_child); gtk_widget_set_parent (child, GTK_WIDGET (table)); - - if (GTK_WIDGET_REALIZED (child->parent)) - gtk_widget_realize (child); - - if (GTK_WIDGET_VISIBLE (child->parent) && GTK_WIDGET_VISIBLE (child)) - { - if (GTK_WIDGET_MAPPED (child->parent)) - gtk_widget_map (child); - - gtk_widget_queue_resize (child); - } } void @@ -833,54 +818,6 @@ gtk_table_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); } -static void -gtk_table_map (GtkWidget *widget) -{ - GtkTable *table; - GtkTableChild *child; - GList *children; - - g_return_if_fail (GTK_IS_TABLE (widget)); - - table = GTK_TABLE (widget); - GTK_WIDGET_SET_FLAGS (table, GTK_MAPPED); - - children = table->children; - while (children) - { - child = children->data; - children = children->next; - - if (GTK_WIDGET_VISIBLE (child->widget) && - !GTK_WIDGET_MAPPED (child->widget)) - gtk_widget_map (child->widget); - } -} - -static void -gtk_table_unmap (GtkWidget *widget) -{ - GtkTable *table; - GtkTableChild *child; - GList *children; - - g_return_if_fail (GTK_IS_TABLE (widget)); - - table = GTK_TABLE (widget); - GTK_WIDGET_UNSET_FLAGS (table, GTK_MAPPED); - - children = table->children; - while (children) - { - child = children->data; - children = children->next; - - if (GTK_WIDGET_VISIBLE (child->widget) && - GTK_WIDGET_MAPPED (child->widget)) - gtk_widget_unmap (child->widget); - } -} - static void gtk_table_size_request (GtkWidget *widget, GtkRequisition *requisition) -- cgit v1.2.1