diff options
author | Owen Taylor <otaylor@redhat.com> | 2001-07-19 14:57:15 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2001-07-19 14:57:15 +0000 |
commit | aa49527fa78bf5b3a3f1394092b248e27e1bfa3f (patch) | |
tree | a1b7651c9e379ab1f7ffe2af68727cdccdf682e6 /gtk/gtktoolbar.c | |
parent | 8f2bf7976d73ba58b808002268c49a19e9b586ee (diff) | |
download | gtk+-aa49527fa78bf5b3a3f1394092b248e27e1bfa3f.tar.gz |
Enforce the widget/child realization/mapping invariants.
Sat Jul 7 02:50:14 2001 Owen Taylor <otaylor@redhat.com>
* 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.
Diffstat (limited to 'gtk/gtktoolbar.c')
-rw-r--r-- | gtk/gtktoolbar.c | 63 |
1 files changed, 1 insertions, 62 deletions
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 3d851ddd21..fd6a809c55 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -81,8 +81,6 @@ static void gtk_toolbar_get_property (GObject *object, GValue *value, GParamSpec *pspec); static void gtk_toolbar_destroy (GtkObject *object); -static void gtk_toolbar_map (GtkWidget *widget); -static void gtk_toolbar_unmap (GtkWidget *widget); static gint gtk_toolbar_expose (GtkWidget *widget, GdkEventExpose *event); static void gtk_toolbar_size_request (GtkWidget *widget, @@ -188,8 +186,6 @@ gtk_toolbar_class_init (GtkToolbarClass *class) gobject_class->set_property = gtk_toolbar_set_property; gobject_class->get_property = gtk_toolbar_get_property; - widget_class->map = gtk_toolbar_map; - widget_class->unmap = gtk_toolbar_unmap; widget_class->expose_event = gtk_toolbar_expose; widget_class->size_request = gtk_toolbar_size_request; widget_class->size_allocate = gtk_toolbar_size_allocate; @@ -473,50 +469,6 @@ gtk_toolbar_destroy (GtkObject *object) } static void -gtk_toolbar_map (GtkWidget *widget) -{ - GtkToolbar *toolbar; - GList *children; - GtkToolbarChild *child; - - g_return_if_fail (GTK_IS_TOOLBAR (widget)); - - toolbar = GTK_TOOLBAR (widget); - GTK_WIDGET_SET_FLAGS (toolbar, GTK_MAPPED); - - for (children = toolbar->children; children; children = children->next) - { - child = children->data; - - if ((child->type != GTK_TOOLBAR_CHILD_SPACE) - && GTK_WIDGET_VISIBLE (child->widget) && !GTK_WIDGET_MAPPED (child->widget)) - gtk_widget_map (child->widget); - } -} - -static void -gtk_toolbar_unmap (GtkWidget *widget) -{ - GtkToolbar *toolbar; - GList *children; - GtkToolbarChild *child; - - g_return_if_fail (GTK_IS_TOOLBAR (widget)); - - toolbar = GTK_TOOLBAR (widget); - GTK_WIDGET_UNSET_FLAGS (toolbar, GTK_MAPPED); - - for (children = toolbar->children; children; children = children->next) - { - child = children->data; - - if ((child->type != GTK_TOOLBAR_CHILD_SPACE) - && GTK_WIDGET_VISIBLE (child->widget) && GTK_WIDGET_MAPPED (child->widget)) - gtk_widget_unmap (child->widget); - } -} - -static void gtk_toolbar_paint_space_line (GtkWidget *widget, GdkRectangle *area, GtkToolbarChild *child) @@ -1436,20 +1388,7 @@ gtk_toolbar_internal_insert_element (GtkToolbar *toolbar, toolbar->num_children++; if (type != GTK_TOOLBAR_CHILD_SPACE) - { - gtk_widget_set_parent (child->widget, GTK_WIDGET (toolbar)); - - if (GTK_WIDGET_REALIZED (child->widget->parent)) - gtk_widget_realize (child->widget); - - if (GTK_WIDGET_VISIBLE (child->widget->parent) && GTK_WIDGET_VISIBLE (child->widget)) - { - if (GTK_WIDGET_MAPPED (child->widget->parent)) - gtk_widget_map (child->widget); - - gtk_widget_queue_resize (child->widget); - } - } + gtk_widget_set_parent (child->widget, GTK_WIDGET (toolbar)); else gtk_widget_queue_resize (GTK_WIDGET (toolbar)); |