summaryrefslogtreecommitdiff
path: root/gtk/gtknotebook.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>1999-02-10 02:35:09 +0000
committerOwen Taylor <otaylor@src.gnome.org>1999-02-10 02:35:09 +0000
commitd1bda8d56232ff0431796add4029e129f877fd6a (patch)
tree63c722c3ed4b8a886242bc78ae78dae1811c6b3a /gtk/gtknotebook.c
parent84d9f5f9a13d52cd91bffc6230445d1e0ac73431 (diff)
downloadgdk-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/gtknotebook.c')
-rw-r--r--gtk/gtknotebook.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 88dd82905..b8d3cb75c 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -563,6 +563,7 @@ gtk_notebook_size_request (GtkWidget *widget,
GtkNotebook *notebook;
GtkNotebookPage *page;
GList *children;
+ GtkRequisition child_requisition;
gboolean switch_page = FALSE;
gint vis_pages;
@@ -582,12 +583,12 @@ gtk_notebook_size_request (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (page->child))
{
vis_pages++;
- gtk_widget_size_request (page->child, &page->child->requisition);
+ gtk_widget_size_request (page->child, &child_requisition);
widget->requisition.width = MAX (widget->requisition.width,
- page->child->requisition.width);
+ child_requisition.width);
widget->requisition.height = MAX (widget->requisition.height,
- page->child->requisition.height);
+ child_requisition.height);
if (GTK_WIDGET_MAPPED (page->child) && page != notebook->cur_page)
gtk_widget_unmap (page->child);
@@ -627,14 +628,14 @@ gtk_notebook_size_request (GtkWidget *widget,
if (!GTK_WIDGET_VISIBLE (page->tab_label))
gtk_widget_show (page->tab_label);
- gtk_widget_size_request (page->tab_label,
- &page->tab_label->requisition);
+ gtk_widget_size_request (page->tab_label,
+ &child_requisition);
page->requisition.width =
- page->tab_label->requisition.width +
+ child_requisition.width +
2 * widget->style->klass->xthickness;
page->requisition.height =
- page->tab_label->requisition.height +
+ child_requisition.height +
2 * widget->style->klass->ythickness;
switch (notebook->tab_pos)
@@ -2990,6 +2991,7 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
{
GtkWidget *widget;
GtkAllocation child_allocation;
+ GtkRequisition tab_requisition;
gint xthickness;
gint ythickness;
gint padding;
@@ -3051,6 +3053,7 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
}
page->allocation = *allocation;
+ gtk_widget_get_child_requisition (page->tab_label, &tab_requisition);
if (notebook->cur_page != page)
{
@@ -3086,8 +3089,8 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
{
child_allocation.x = (page->allocation.x +
(page->allocation.width -
- page->tab_label->requisition.width) / 2);
- child_allocation.width = page->tab_label->requisition.width;
+ tab_requisition.width) / 2);
+ child_allocation.width = tab_requisition.width;
}
child_allocation.y = (notebook->tab_vborder + FOCUS_WIDTH +
page->allocation.y);
@@ -3110,8 +3113,8 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
{
child_allocation.y = (page->allocation.y +
(page->allocation.height -
- page->tab_label->requisition.height) / 2);
- child_allocation.height = page->tab_label->requisition.height;
+ tab_requisition.height) / 2);
+ child_allocation.height = tab_requisition.height;
}
child_allocation.x = (page->allocation.x + notebook->tab_hborder +
FOCUS_WIDTH);