summaryrefslogtreecommitdiff
path: root/gtk/gtktable.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/gtktable.c
parent84d9f5f9a13d52cd91bffc6230445d1e0ac73431 (diff)
downloadgtk+-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/gtktable.c')
-rw-r--r--gtk/gtktable.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/gtk/gtktable.c b/gtk/gtktable.c
index f3e5aca30d..ec4c927aea 100644
--- a/gtk/gtktable.c
+++ b/gtk/gtktable.c
@@ -919,7 +919,7 @@ gtk_table_size_request_init (GtkTable *table)
children = children->next;
if (GTK_WIDGET_VISIBLE (child->widget))
- gtk_widget_size_request (child->widget, &child->widget->requisition);
+ gtk_widget_size_request (child->widget, NULL);
}
}
@@ -939,11 +939,14 @@ gtk_table_size_request_pass1 (GtkTable *table)
if (GTK_WIDGET_VISIBLE (child->widget))
{
+ GtkRequisition child_requisition;
+ gtk_widget_get_child_requisition (child->widget, &child_requisition);
+
/* Child spans a single column.
*/
if (child->left_attach == (child->right_attach - 1))
{
- width = child->widget->requisition.width + child->xpadding * 2;
+ width = child_requisition.width + child->xpadding * 2;
table->cols[child->left_attach].requisition = MAX (table->cols[child->left_attach].requisition, width);
}
@@ -951,7 +954,7 @@ gtk_table_size_request_pass1 (GtkTable *table)
*/
if (child->top_attach == (child->bottom_attach - 1))
{
- height = child->widget->requisition.height + child->ypadding * 2;
+ height = child_requisition.height + child->ypadding * 2;
table->rows[child->top_attach].requisition = MAX (table->rows[child->top_attach].requisition, height);
}
}
@@ -1003,6 +1006,10 @@ gtk_table_size_request_pass3 (GtkTable *table)
*/
if (child->left_attach != (child->right_attach - 1))
{
+ GtkRequisition child_requisition;
+
+ gtk_widget_get_child_requisition (child->widget, &child_requisition);
+
/* Check and see if there is already enough space
* for the child.
*/
@@ -1018,9 +1025,9 @@ gtk_table_size_request_pass3 (GtkTable *table)
* its requisition, then divide up the needed space evenly
* amongst the columns it spans.
*/
- if (width < child->widget->requisition.width + child->xpadding * 2)
+ if (width < child_requisition.width + child->xpadding * 2)
{
- width = child->widget->requisition.width + child->xpadding * 2 - width;
+ width = child_requisition.width + child->xpadding * 2 - width;
for (col = child->left_attach; col < child->right_attach; col++)
{
@@ -1035,6 +1042,10 @@ gtk_table_size_request_pass3 (GtkTable *table)
*/
if (child->top_attach != (child->bottom_attach - 1))
{
+ GtkRequisition child_requisition;
+
+ gtk_widget_get_child_requisition (child->widget, &child_requisition);
+
/* Check and see if there is already enough space
* for the child.
*/
@@ -1050,9 +1061,9 @@ gtk_table_size_request_pass3 (GtkTable *table)
* its requisition, then divide up the needed space evenly
* amongst the columns it spans.
*/
- if (height < child->widget->requisition.height + child->ypadding * 2)
+ if (height < child_requisition.height + child->ypadding * 2)
{
- height = child->widget->requisition.height + child->ypadding * 2 - height;
+ height = child_requisition.height + child->ypadding * 2 - height;
for (row = child->top_attach; row < child->bottom_attach; row++)
{
@@ -1454,6 +1465,9 @@ gtk_table_size_allocate_pass2 (GtkTable *table)
if (GTK_WIDGET_VISIBLE (child->widget))
{
+ GtkRequisition child_requisition;
+ gtk_widget_get_child_requisition (child->widget, &child_requisition);
+
x = GTK_WIDGET (table)->allocation.x + GTK_CONTAINER (table)->border_width;
y = GTK_WIDGET (table)->allocation.y + GTK_CONTAINER (table)->border_width;
max_width = 0;
@@ -1492,7 +1506,7 @@ gtk_table_size_allocate_pass2 (GtkTable *table)
}
else
{
- allocation.width = child->widget->requisition.width;
+ allocation.width = child_requisition.width;
allocation.x = x + (max_width - allocation.width) / 2;
}
@@ -1503,7 +1517,7 @@ gtk_table_size_allocate_pass2 (GtkTable *table)
}
else
{
- allocation.height = child->widget->requisition.height;
+ allocation.height = child_requisition.height;
allocation.y = y + (max_height - allocation.height) / 2;
}