diff options
author | Owen Taylor <otaylor@redhat.com> | 1999-02-10 02:35:09 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1999-02-10 02:35:09 +0000 |
commit | d1bda8d56232ff0431796add4029e129f877fd6a (patch) | |
tree | 63c722c3ed4b8a886242bc78ae78dae1811c6b3a /gtk/gtkvbox.c | |
parent | 84d9f5f9a13d52cd91bffc6230445d1e0ac73431 (diff) | |
download | gdk-pixbuf-d1bda8d56232ff0431796add4029e129f877fd6a.tar.gz |
Fixed some bugs with set_default_size.
Sun Feb 7 19:49:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Fixed some
bugs with set_default_size.
Sat Feb 6 13:23:51 1999 Owen Taylor <otaylor@redhat.com>
* docs/Changes-1.2.txt: Added information about
the change to gtk_widget_size_request().
* gtk/gtkentry.c: Call gtk_widget_get_child_requisition
explicitely since we differentiate between the usize
set by the user and what we got. (Ugh)
* gtk/gtkwidget.[ch] (gtk_widget_get_child_requisition):
New function to return the effective size of a widget
as it looks to its parent.
* gtk/gtkwidget.c (gtk_widget_size_request): Leave
widget->requisition set to exactly what the widget
asked for, and then make a copy of that into
the requisition argument. Allow a NULL requisition
argument, and, if G_ENABLE_DEBUG, warn if
requisition == &widget->requisition.
* gtkalignment.c gtkaspectframe.c gtkbutton.c gtkclist.c
gtkcontainer.c gtkentry.c gtkeventbox.c gtkfixed.c
gtkframe.c gtkhandlebox.c gtkhbox.c gtkhpaned.c
gtklayout.c gtklist.c gtklistitem.c gtkmenu.c
gtkmenubar.c gtkmenuitem.c gtknotebook.c
gtkoptionmenu.c gtkpacker.c gtkscrolledwindow.c
gtktable.c gtktoolbar.c gtktree.c gtktreeitem.c
gtkvbox.c gtkviewport.c gtkvpaned.c gtkwindow.c
Avoid calling gtk_widget_size_request with
requisition == widget->requisition; use
gtk_widget_get_child_requisition to get the
size of children.
Diffstat (limited to 'gtk/gtkvbox.c')
-rw-r--r-- | gtk/gtkvbox.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/gtk/gtkvbox.c b/gtk/gtkvbox.c index a4b8d031f..b5c2e9e3b 100644 --- a/gtk/gtkvbox.c +++ b/gtk/gtkvbox.c @@ -89,6 +89,7 @@ gtk_vbox_size_request (GtkWidget *widget, { GtkBox *box; GtkBoxChild *child; + GtkRequisition child_requisition; GList *children; gint nvis_children; gint height; @@ -110,19 +111,19 @@ gtk_vbox_size_request (GtkWidget *widget, if (GTK_WIDGET_VISIBLE (child->widget)) { - gtk_widget_size_request (child->widget, &child->widget->requisition); + gtk_widget_size_request (child->widget, &child_requisition); if (box->homogeneous) { - height = child->widget->requisition.height + child->padding * 2; + height = child_requisition.height + child->padding * 2; requisition->height = MAX (requisition->height, height); } else { - requisition->height += child->widget->requisition.height + child->padding * 2; + requisition->height += child_requisition.height + child->padding * 2; } - requisition->width = MAX (requisition->width, child->widget->requisition.width); + requisition->width = MAX (requisition->width, child_requisition.width); nvis_children += 1; } @@ -189,7 +190,7 @@ gtk_vbox_size_allocate (GtkWidget *widget, } else if (nexpand_children > 0) { - height = (gint)allocation->height - (gint)widget->requisition.height; + height = (gint) allocation->height - (gint) widget->requisition.height; extra = height / nexpand_children; } else @@ -200,7 +201,7 @@ gtk_vbox_size_allocate (GtkWidget *widget, y = allocation->y + GTK_CONTAINER (box)->border_width; child_allocation.x = allocation->x + GTK_CONTAINER (box)->border_width; - child_allocation.width = MAX (1, (gint)allocation->width - (gint)GTK_CONTAINER (box)->border_width * 2); + child_allocation.width = MAX (1, (gint) allocation->width - (gint) GTK_CONTAINER (box)->border_width * 2); children = box->children; while (children) @@ -222,7 +223,10 @@ gtk_vbox_size_allocate (GtkWidget *widget, } else { - child_height = child->widget->requisition.height + child->padding * 2; + GtkRequisition child_requisition; + + gtk_widget_get_child_requisition (child->widget, &child_requisition); + child_height = child_requisition.height + child->padding * 2; if (child->expand) { @@ -243,7 +247,10 @@ gtk_vbox_size_allocate (GtkWidget *widget, } else { - child_allocation.height = child->widget->requisition.height; + GtkRequisition child_requisition; + + gtk_widget_get_child_requisition (child->widget, &child_requisition); + child_allocation.height = child_requisition.height; child_allocation.y = y + (child_height - child_allocation.height) / 2; } @@ -263,6 +270,9 @@ gtk_vbox_size_allocate (GtkWidget *widget, if ((child->pack == GTK_PACK_END) && GTK_WIDGET_VISIBLE (child->widget)) { + GtkRequisition child_requisition; + gtk_widget_get_child_requisition (child->widget, &child_requisition); + if (box->homogeneous) { if (nvis_children == 1) @@ -275,7 +285,7 @@ gtk_vbox_size_allocate (GtkWidget *widget, } else { - child_height = child->widget->requisition.height + child->padding * 2; + child_height = child_requisition.height + child->padding * 2; if (child->expand) { @@ -296,7 +306,7 @@ gtk_vbox_size_allocate (GtkWidget *widget, } else { - child_allocation.height = child->widget->requisition.height; + child_allocation.height = child_requisition.height; child_allocation.y = y + (child_height - child_allocation.height) / 2 - child_height; } |