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/gtktoolbar.c | |
parent | 84d9f5f9a13d52cd91bffc6230445d1e0ac73431 (diff) | |
download | gtk+-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/gtktoolbar.c')
-rw-r--r-- | gtk/gtktoolbar.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 546c3e4256..f57412184f 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -389,6 +389,7 @@ gtk_toolbar_size_request (GtkWidget *widget, gint nbuttons; gint button_maxw, button_maxh; gint widget_maxw, widget_maxh; + GtkRequisition child_requisition; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_TOOLBAR (widget)); @@ -423,11 +424,11 @@ gtk_toolbar_size_request (GtkWidget *widget, case GTK_TOOLBAR_CHILD_TOGGLEBUTTON: if (GTK_WIDGET_VISIBLE (child->widget)) { - gtk_widget_size_request (child->widget, &child->widget->requisition); + gtk_widget_size_request (child->widget, &child_requisition); nbuttons++; - button_maxw = MAX (button_maxw, child->widget->requisition.width); - button_maxh = MAX (button_maxh, child->widget->requisition.height); + button_maxw = MAX (button_maxw, child_requisition.width); + button_maxh = MAX (button_maxh, child_requisition.height); } break; @@ -435,15 +436,15 @@ gtk_toolbar_size_request (GtkWidget *widget, case GTK_TOOLBAR_CHILD_WIDGET: if (GTK_WIDGET_VISIBLE (child->widget)) { - gtk_widget_size_request (child->widget, &child->widget->requisition); + gtk_widget_size_request (child->widget, &child_requisition); - widget_maxw = MAX (widget_maxw, child->widget->requisition.width); - widget_maxh = MAX (widget_maxh, child->widget->requisition.height); + widget_maxw = MAX (widget_maxw, child_requisition.width); + widget_maxh = MAX (widget_maxh, child_requisition.height); if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL) - requisition->width += child->widget->requisition.width; + requisition->width += child_requisition.width; else - requisition->height += child->widget->requisition.height; + requisition->height += child_requisition.height; } break; @@ -477,6 +478,7 @@ gtk_toolbar_size_allocate (GtkWidget *widget, GtkToolbarChild *child; GtkToolbarChildSpace *child_space; GtkAllocation alloc; + GtkRequisition child_requisition; gint border_width; g_return_if_fail (widget != NULL); @@ -545,20 +547,22 @@ gtk_toolbar_size_allocate (GtkWidget *widget, if (!GTK_WIDGET_VISIBLE (child->widget)) break; - alloc.width = child->widget->requisition.width; - alloc.height = child->widget->requisition.height; + gtk_widget_get_child_requisition (child->widget, &child_requisition); + + alloc.width = child_requisition.width; + alloc.height = child_requisition.height; if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL) - alloc.y = allocation->y + (allocation->height - child->widget->requisition.height) / 2; + alloc.y = allocation->y + (allocation->height - child_requisition.height) / 2; else - alloc.x = allocation->x + (allocation->width - child->widget->requisition.width) / 2; + alloc.x = allocation->x + (allocation->width - child_requisition.width) / 2; gtk_widget_size_allocate (child->widget, &alloc); if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL) - alloc.x += child->widget->requisition.width; + alloc.x += child_requisition.width; else - alloc.y += child->widget->requisition.height; + alloc.y += child_requisition.height; break; |