summaryrefslogtreecommitdiff
path: root/gtk/gtktable.c
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>1998-10-10 01:55:09 +0000
committerTim Janik <timj@src.gnome.org>1998-10-10 01:55:09 +0000
commit357c50b14ed672559582e44b9ea1547497ca2e3b (patch)
tree35372550087e0da154c91d81f8d35288742b89a4 /gtk/gtktable.c
parent922d7fd0ae22fb62d8aaae2b7210362a1e1bae31 (diff)
downloadgtk+-357c50b14ed672559582e44b9ea1547497ca2e3b.tar.gz
take the left, right, top and bottom attach arguments as mandatory and
Sat Oct 10 03:37:50 1998 Tim Janik <timj@gtk.org> * gtk/gtktable.c (gtk_table_set_child_arg): take the left, right, top and bottom attach arguments as mandatory and readjust the table size and opposing edge accordingly if required. this way the order in which the arguments are set doesn't matter.
Diffstat (limited to 'gtk/gtktable.c')
-rw-r--r--gtk/gtktable.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/gtk/gtktable.c b/gtk/gtktable.c
index 08e048f266..ad09b98bc2 100644
--- a/gtk/gtktable.c
+++ b/gtk/gtktable.c
@@ -258,25 +258,39 @@ gtk_table_set_child_arg (GtkContainer *container,
switch (arg_id)
{
case CHILD_ARG_LEFT_ATTACH:
- if (GTK_VALUE_UINT (*arg) < table_child->right_attach)
- table_child->left_attach = GTK_VALUE_UINT (*arg);
- break;
- case CHILD_ARG_RIGHT_ATTACH:
- if (GTK_VALUE_UINT (*arg) > table_child->left_attach)
- table_child->right_attach = GTK_VALUE_UINT (*arg);
+ table_child->left_attach = GTK_VALUE_UINT (*arg);
+ if (table_child->right_attach <= table_child->left_attach)
+ table_child->right_attach = table_child->left_attach + 1;
if (table_child->right_attach >= table->ncols)
gtk_table_resize (table, table->ncols, table_child->right_attach);
break;
- case CHILD_ARG_TOP_ATTACH:
- if (GTK_VALUE_UINT (*arg) < table_child->bottom_attach)
- table_child->top_attach = GTK_VALUE_UINT (*arg);
+ case CHILD_ARG_RIGHT_ATTACH:
+ if (GTK_VALUE_UINT (*arg) > 0)
+ {
+ table_child->right_attach = GTK_VALUE_UINT (*arg);
+ if (table_child->right_attach <= table_child->left_attach)
+ table_child->left_attach = table_child->right_attach - 1;
+ if (table_child->right_attach >= table->ncols)
+ gtk_table_resize (table, table->ncols, table_child->right_attach);
+ }
break;
- case CHILD_ARG_BOTTOM_ATTACH:
- if (GTK_VALUE_UINT (*arg) > table_child->top_attach)
- table_child->bottom_attach = GTK_VALUE_UINT (*arg);
+ case CHILD_ARG_TOP_ATTACH:
+ table_child->top_attach = GTK_VALUE_UINT (*arg);
+ if (table_child->bottom_attach <= table_child->top_attach)
+ table_child->bottom_attach = table_child->top_attach + 1;
if (table_child->bottom_attach >= table->nrows)
gtk_table_resize (table, table_child->bottom_attach, table->ncols);
break;
+ case CHILD_ARG_BOTTOM_ATTACH:
+ if (GTK_VALUE_UINT (*arg) > 0)
+ {
+ table_child->bottom_attach = GTK_VALUE_UINT (*arg);
+ if (table_child->bottom_attach <= table_child->top_attach)
+ table_child->top_attach = table_child->bottom_attach - 1;
+ if (table_child->bottom_attach >= table->nrows)
+ gtk_table_resize (table, table_child->bottom_attach, table->ncols);
+ }
+ break;
case CHILD_ARG_X_OPTIONS:
table_child->xexpand = (GTK_VALUE_FLAGS (*arg) & GTK_EXPAND) != 0;
table_child->xshrink = (GTK_VALUE_FLAGS (*arg) & GTK_SHRINK) != 0;