1997-11-24 22:37:52 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
1998-06-16 05:20:05 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
1997-11-24 22:37:52 +00:00
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
|
|
|
#include "gtktable.h"
|
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ARG_0,
|
|
|
|
ARG_N_ROWS,
|
|
|
|
ARG_N_COLUMNS,
|
|
|
|
ARG_COLUMN_SPACING,
|
|
|
|
ARG_ROW_SPACING,
|
1998-08-17 14:48:51 +00:00
|
|
|
ARG_HOMOGENEOUS
|
1998-06-16 05:20:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
CHILD_ARG_0,
|
|
|
|
CHILD_ARG_LEFT_ATTACH,
|
|
|
|
CHILD_ARG_RIGHT_ATTACH,
|
|
|
|
CHILD_ARG_TOP_ATTACH,
|
|
|
|
CHILD_ARG_BOTTOM_ATTACH,
|
|
|
|
CHILD_ARG_X_OPTIONS,
|
|
|
|
CHILD_ARG_Y_OPTIONS,
|
|
|
|
CHILD_ARG_X_PADDING,
|
|
|
|
CHILD_ARG_Y_PADDING
|
|
|
|
};
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
static void gtk_table_class_init (GtkTableClass *klass);
|
1998-06-16 05:20:05 +00:00
|
|
|
static void gtk_table_init (GtkTable *table);
|
|
|
|
static void gtk_table_finalize (GtkObject *object);
|
|
|
|
static void gtk_table_map (GtkWidget *widget);
|
|
|
|
static void gtk_table_unmap (GtkWidget *widget);
|
|
|
|
static void gtk_table_draw (GtkWidget *widget,
|
1997-11-24 22:37:52 +00:00
|
|
|
GdkRectangle *area);
|
1998-06-16 05:20:05 +00:00
|
|
|
static gint gtk_table_expose (GtkWidget *widget,
|
1997-11-24 22:37:52 +00:00
|
|
|
GdkEventExpose *event);
|
1998-06-16 05:20:05 +00:00
|
|
|
static void gtk_table_size_request (GtkWidget *widget,
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkRequisition *requisition);
|
1998-06-16 05:20:05 +00:00
|
|
|
static void gtk_table_size_allocate (GtkWidget *widget,
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkAllocation *allocation);
|
1998-06-16 05:20:05 +00:00
|
|
|
static void gtk_table_add (GtkContainer *container,
|
|
|
|
GtkWidget *widget);
|
|
|
|
static void gtk_table_remove (GtkContainer *container,
|
|
|
|
GtkWidget *widget);
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
static void gtk_table_forall (GtkContainer *container,
|
|
|
|
gboolean include_internals,
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkCallback callback,
|
1998-06-16 05:20:05 +00:00
|
|
|
gpointer callback_data);
|
|
|
|
static void gtk_table_get_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
|
|
|
static void gtk_table_set_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
|
|
|
static void gtk_table_set_child_arg (GtkContainer *container,
|
|
|
|
GtkWidget *child,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
|
|
|
static void gtk_table_get_child_arg (GtkContainer *container,
|
|
|
|
GtkWidget *child,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
|
|
|
static GtkType gtk_table_child_type (GtkContainer *container);
|
|
|
|
|
|
|
|
|
|
|
|
static void gtk_table_size_request_init (GtkTable *table);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_table_size_request_pass1 (GtkTable *table);
|
|
|
|
static void gtk_table_size_request_pass2 (GtkTable *table);
|
|
|
|
static void gtk_table_size_request_pass3 (GtkTable *table);
|
|
|
|
|
|
|
|
static void gtk_table_size_allocate_init (GtkTable *table);
|
|
|
|
static void gtk_table_size_allocate_pass1 (GtkTable *table);
|
|
|
|
static void gtk_table_size_allocate_pass2 (GtkTable *table);
|
|
|
|
|
|
|
|
|
|
|
|
static GtkContainerClass *parent_class = NULL;
|
|
|
|
|
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
GtkType
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_table_get_type (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-16 05:20:05 +00:00
|
|
|
static GtkType table_type = 0;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!table_type)
|
|
|
|
{
|
|
|
|
GtkTypeInfo table_info =
|
|
|
|
{
|
|
|
|
"GtkTable",
|
|
|
|
sizeof (GtkTable),
|
|
|
|
sizeof (GtkTableClass),
|
|
|
|
(GtkClassInitFunc) gtk_table_class_init,
|
|
|
|
(GtkObjectInitFunc) gtk_table_init,
|
1998-07-04 15:31:30 +00:00
|
|
|
/* reserved_1 */ NULL,
|
|
|
|
/* reserved_2 */ NULL,
|
1998-06-28 07:46:10 +00:00
|
|
|
(GtkClassInitFunc) NULL,
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
table_type = gtk_type_unique (gtk_container_get_type (), &table_info);
|
|
|
|
}
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return table_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_class_init (GtkTableClass *class)
|
|
|
|
{
|
|
|
|
GtkObjectClass *object_class;
|
|
|
|
GtkWidgetClass *widget_class;
|
|
|
|
GtkContainerClass *container_class;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
object_class = (GtkObjectClass*) class;
|
|
|
|
widget_class = (GtkWidgetClass*) class;
|
|
|
|
container_class = (GtkContainerClass*) class;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
parent_class = gtk_type_class (gtk_container_get_type ());
|
1998-06-16 05:20:05 +00:00
|
|
|
|
|
|
|
gtk_object_add_arg_type ("GtkTable::n_rows", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_N_ROWS);
|
|
|
|
gtk_object_add_arg_type ("GtkTable::n_columns", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_N_COLUMNS);
|
|
|
|
gtk_object_add_arg_type ("GtkTable::row_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_ROW_SPACING);
|
|
|
|
gtk_object_add_arg_type ("GtkTable::column_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_COLUMN_SPACING);
|
|
|
|
gtk_object_add_arg_type ("GtkTable::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS);
|
|
|
|
gtk_container_add_child_arg_type ("GtkTable::left_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_LEFT_ATTACH);
|
|
|
|
gtk_container_add_child_arg_type ("GtkTable::right_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_RIGHT_ATTACH);
|
|
|
|
gtk_container_add_child_arg_type ("GtkTable::top_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_TOP_ATTACH);
|
|
|
|
gtk_container_add_child_arg_type ("GtkTable::bottom_attach", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_BOTTOM_ATTACH);
|
|
|
|
gtk_container_add_child_arg_type ("GtkTable::x_options", GTK_TYPE_ATTACH_OPTIONS, GTK_ARG_READWRITE, CHILD_ARG_X_OPTIONS);
|
|
|
|
gtk_container_add_child_arg_type ("GtkTable::y_options", GTK_TYPE_ATTACH_OPTIONS, GTK_ARG_READWRITE, CHILD_ARG_Y_OPTIONS);
|
|
|
|
gtk_container_add_child_arg_type ("GtkTable::x_padding", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_X_PADDING);
|
|
|
|
gtk_container_add_child_arg_type ("GtkTable::y_padding", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_Y_PADDING);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-06-28 07:46:10 +00:00
|
|
|
object_class->get_arg = gtk_table_get_arg;
|
|
|
|
object_class->set_arg = gtk_table_set_arg;
|
1998-01-30 23:47:09 +00:00
|
|
|
object_class->finalize = gtk_table_finalize;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
widget_class->map = gtk_table_map;
|
|
|
|
widget_class->unmap = gtk_table_unmap;
|
|
|
|
widget_class->draw = gtk_table_draw;
|
|
|
|
widget_class->expose_event = gtk_table_expose;
|
|
|
|
widget_class->size_request = gtk_table_size_request;
|
|
|
|
widget_class->size_allocate = gtk_table_size_allocate;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
container_class->add = gtk_table_add;
|
|
|
|
container_class->remove = gtk_table_remove;
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
container_class->forall = gtk_table_forall;
|
1998-06-16 05:20:05 +00:00
|
|
|
container_class->child_type = gtk_table_child_type;
|
|
|
|
container_class->set_child_arg = gtk_table_set_child_arg;
|
|
|
|
container_class->get_child_arg = gtk_table_get_child_arg;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkType
|
|
|
|
gtk_table_child_type (GtkContainer *container)
|
|
|
|
{
|
|
|
|
return GTK_TYPE_WIDGET;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-06-16 05:20:05 +00:00
|
|
|
gtk_table_get_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-16 05:20:05 +00:00
|
|
|
GtkTable *table;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
table = GTK_TABLE (object);
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case ARG_N_ROWS:
|
|
|
|
GTK_VALUE_UINT (*arg) = table->nrows;
|
|
|
|
break;
|
|
|
|
case ARG_N_COLUMNS:
|
|
|
|
GTK_VALUE_UINT (*arg) = table->ncols;
|
|
|
|
break;
|
|
|
|
case ARG_ROW_SPACING:
|
|
|
|
GTK_VALUE_UINT (*arg) = table->row_spacing;
|
|
|
|
break;
|
|
|
|
case ARG_COLUMN_SPACING:
|
|
|
|
GTK_VALUE_UINT (*arg) = table->column_spacing;
|
|
|
|
break;
|
|
|
|
case ARG_HOMOGENEOUS:
|
|
|
|
GTK_VALUE_BOOL (*arg) = table->homogeneous;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
arg->type = GTK_TYPE_INVALID;
|
|
|
|
break;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-01-27 23:40:51 +00:00
|
|
|
static void
|
1998-06-16 05:20:05 +00:00
|
|
|
gtk_table_set_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-16 05:20:05 +00:00
|
|
|
GtkTable *table;
|
|
|
|
|
|
|
|
table = GTK_TABLE (object);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
switch (arg_id)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-16 05:20:05 +00:00
|
|
|
case ARG_N_ROWS:
|
|
|
|
gtk_table_resize (table, GTK_VALUE_UINT (*arg), table->ncols);
|
|
|
|
break;
|
|
|
|
case ARG_N_COLUMNS:
|
|
|
|
gtk_table_resize (table, table->nrows, GTK_VALUE_UINT (*arg));
|
|
|
|
break;
|
|
|
|
case ARG_ROW_SPACING:
|
|
|
|
gtk_table_set_row_spacings (table, GTK_VALUE_UINT (*arg));
|
|
|
|
break;
|
|
|
|
case ARG_COLUMN_SPACING:
|
|
|
|
gtk_table_set_col_spacings (table, GTK_VALUE_UINT (*arg));
|
|
|
|
break;
|
|
|
|
case ARG_HOMOGENEOUS:
|
|
|
|
gtk_table_set_homogeneous (table, GTK_VALUE_BOOL (*arg));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-01-27 23:40:51 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-27 23:40:51 +00:00
|
|
|
static void
|
1998-06-16 05:20:05 +00:00
|
|
|
gtk_table_set_child_arg (GtkContainer *container,
|
|
|
|
GtkWidget *child,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
1998-01-27 23:40:51 +00:00
|
|
|
{
|
1998-06-16 05:20:05 +00:00
|
|
|
GtkTable *table;
|
|
|
|
GtkTableChild *table_child;
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
table = GTK_TABLE (container);
|
|
|
|
table_child = NULL;
|
|
|
|
for (list = table->children; list; list = list->next)
|
|
|
|
{
|
|
|
|
table_child = list->data;
|
|
|
|
|
|
|
|
if (table_child->widget == child)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!list)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (arg_id)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-16 05:20:05 +00:00
|
|
|
case CHILD_ARG_LEFT_ATTACH:
|
1998-10-10 01:55:09 +00:00
|
|
|
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;
|
1998-06-16 05:20:05 +00:00
|
|
|
if (table_child->right_attach >= table->ncols)
|
1998-06-16 21:09:24 +00:00
|
|
|
gtk_table_resize (table, table->ncols, table_child->right_attach);
|
1998-06-16 05:20:05 +00:00
|
|
|
break;
|
1998-10-10 01:55:09 +00:00
|
|
|
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);
|
|
|
|
}
|
1998-06-16 05:20:05 +00:00
|
|
|
break;
|
1998-10-10 01:55:09 +00:00
|
|
|
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;
|
1998-06-16 05:20:05 +00:00
|
|
|
if (table_child->bottom_attach >= table->nrows)
|
1998-06-16 21:09:24 +00:00
|
|
|
gtk_table_resize (table, table_child->bottom_attach, table->ncols);
|
1998-06-16 05:20:05 +00:00
|
|
|
break;
|
1998-10-10 01:55:09 +00:00
|
|
|
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;
|
1998-06-16 05:20:05 +00:00
|
|
|
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;
|
|
|
|
table_child->xfill = (GTK_VALUE_FLAGS (*arg) & GTK_FILL) != 0;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_Y_OPTIONS:
|
|
|
|
table_child->yexpand = (GTK_VALUE_FLAGS (*arg) & GTK_EXPAND) != 0;
|
|
|
|
table_child->yshrink = (GTK_VALUE_FLAGS (*arg) & GTK_SHRINK) != 0;
|
|
|
|
table_child->yfill = (GTK_VALUE_FLAGS (*arg) & GTK_FILL) != 0;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_X_PADDING:
|
|
|
|
table_child->xpadding = GTK_VALUE_UINT (*arg);
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_Y_PADDING:
|
|
|
|
table_child->ypadding = GTK_VALUE_UINT (*arg);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-06-16 05:20:05 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (table))
|
1998-06-24 06:25:14 +00:00
|
|
|
gtk_widget_queue_resize (child);
|
1998-01-27 23:40:51 +00:00
|
|
|
}
|
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
static void
|
|
|
|
gtk_table_get_child_arg (GtkContainer *container,
|
|
|
|
GtkWidget *child,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
1998-01-27 23:40:51 +00:00
|
|
|
{
|
|
|
|
GtkTable *table;
|
1998-06-16 05:20:05 +00:00
|
|
|
GtkTableChild *table_child;
|
|
|
|
GList *list;
|
1998-01-27 23:40:51 +00:00
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
table = GTK_TABLE (container);
|
|
|
|
table_child = NULL;
|
|
|
|
for (list = table->children; list; list = list->next)
|
|
|
|
{
|
|
|
|
table_child = list->data;
|
1998-01-27 23:40:51 +00:00
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
if (table_child->widget == child)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!list)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case CHILD_ARG_LEFT_ATTACH:
|
|
|
|
GTK_VALUE_UINT (*arg) = table_child->left_attach;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_RIGHT_ATTACH:
|
|
|
|
GTK_VALUE_UINT (*arg) = table_child->right_attach;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_TOP_ATTACH:
|
|
|
|
GTK_VALUE_UINT (*arg) = table_child->top_attach;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_BOTTOM_ATTACH:
|
|
|
|
GTK_VALUE_UINT (*arg) = table_child->bottom_attach;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_X_OPTIONS:
|
|
|
|
GTK_VALUE_FLAGS (*arg) = (table_child->xexpand * GTK_EXPAND |
|
|
|
|
table_child->xshrink * GTK_SHRINK |
|
|
|
|
table_child->xfill * GTK_FILL);
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_Y_OPTIONS:
|
|
|
|
GTK_VALUE_FLAGS (*arg) = (table_child->yexpand * GTK_EXPAND |
|
|
|
|
table_child->yshrink * GTK_SHRINK |
|
|
|
|
table_child->yfill * GTK_FILL);
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_X_PADDING:
|
|
|
|
GTK_VALUE_UINT (*arg) = table_child->xpadding;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_Y_PADDING:
|
|
|
|
GTK_VALUE_UINT (*arg) = table_child->ypadding;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
arg->type = GTK_TYPE_INVALID;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_init (GtkTable *table)
|
|
|
|
{
|
|
|
|
GTK_WIDGET_SET_FLAGS (table, GTK_NO_WINDOW | GTK_BASIC);
|
|
|
|
|
|
|
|
table->children = NULL;
|
|
|
|
table->rows = NULL;
|
|
|
|
table->cols = NULL;
|
|
|
|
table->nrows = 0;
|
|
|
|
table->ncols = 0;
|
1998-01-27 23:40:51 +00:00
|
|
|
table->column_spacing = 0;
|
|
|
|
table->row_spacing = 0;
|
1998-06-16 05:20:05 +00:00
|
|
|
table->homogeneous = FALSE;
|
1998-06-17 08:48:22 +00:00
|
|
|
|
|
|
|
gtk_table_resize (table, 1, 1);
|
1998-06-16 05:20:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget*
|
|
|
|
gtk_table_new (guint rows,
|
|
|
|
guint columns,
|
|
|
|
gboolean homogeneous)
|
|
|
|
{
|
|
|
|
GtkTable *table;
|
1998-01-27 23:40:51 +00:00
|
|
|
|
1998-06-23 15:55:51 +00:00
|
|
|
if (rows == 0)
|
|
|
|
rows = 1;
|
|
|
|
if (columns == 0)
|
|
|
|
columns = 1;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
|
|
|
table = gtk_type_new (gtk_table_get_type ());
|
|
|
|
|
|
|
|
table->homogeneous = (homogeneous ? TRUE : FALSE);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
gtk_table_resize (table, rows, columns);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return GTK_WIDGET (table);
|
|
|
|
}
|
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
void
|
|
|
|
gtk_table_resize (GtkTable *table,
|
|
|
|
guint n_rows,
|
|
|
|
guint n_cols)
|
1998-01-27 23:40:51 +00:00
|
|
|
{
|
1998-06-16 05:20:05 +00:00
|
|
|
g_return_if_fail (table != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (table));
|
1998-01-27 23:40:51 +00:00
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
n_rows = MAX (n_rows, 1);
|
|
|
|
n_cols = MAX (n_cols, 1);
|
|
|
|
|
|
|
|
if (n_rows != table->nrows ||
|
|
|
|
n_cols != table->ncols)
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
for (list = table->children; list; list = list->next)
|
|
|
|
{
|
|
|
|
GtkTableChild *child;
|
|
|
|
|
|
|
|
child = list->data;
|
|
|
|
|
1998-06-16 21:09:24 +00:00
|
|
|
n_rows = MAX (n_rows, child->bottom_attach);
|
|
|
|
n_cols = MAX (n_cols, child->right_attach);
|
1998-06-16 05:20:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (n_rows != table->nrows)
|
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
i = table->nrows;
|
|
|
|
table->nrows = n_rows;
|
|
|
|
table->rows = g_realloc (table->rows, table->nrows * sizeof (GtkTableRowCol));
|
|
|
|
|
|
|
|
for (; i < table->nrows; i++)
|
|
|
|
{
|
|
|
|
table->rows[i].requisition = 0;
|
|
|
|
table->rows[i].allocation = 0;
|
|
|
|
table->rows[i].spacing = table->row_spacing;
|
|
|
|
table->rows[i].need_expand = 0;
|
|
|
|
table->rows[i].need_shrink = 0;
|
|
|
|
table->rows[i].expand = 0;
|
|
|
|
table->rows[i].shrink = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n_cols != table->ncols)
|
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
i = table->ncols;
|
|
|
|
table->ncols = n_cols;
|
|
|
|
table->cols = g_realloc (table->cols, table->ncols * sizeof (GtkTableRowCol));
|
|
|
|
|
|
|
|
for (; i < table->ncols; i++)
|
|
|
|
{
|
|
|
|
table->cols[i].requisition = 0;
|
|
|
|
table->cols[i].allocation = 0;
|
|
|
|
table->cols[i].spacing = table->column_spacing;
|
|
|
|
table->cols[i].need_expand = 0;
|
|
|
|
table->cols[i].need_shrink = 0;
|
|
|
|
table->cols[i].expand = 0;
|
|
|
|
table->cols[i].shrink = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1998-01-27 23:40:51 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
1998-06-16 05:20:05 +00:00
|
|
|
gtk_table_attach (GtkTable *table,
|
|
|
|
GtkWidget *child,
|
|
|
|
guint left_attach,
|
|
|
|
guint right_attach,
|
|
|
|
guint top_attach,
|
|
|
|
guint bottom_attach,
|
|
|
|
GtkAttachOptions xoptions,
|
|
|
|
GtkAttachOptions yoptions,
|
|
|
|
guint xpadding,
|
|
|
|
guint ypadding)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkTableChild *table_child;
|
1998-01-27 23:40:51 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (table != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (table));
|
|
|
|
g_return_if_fail (child != NULL);
|
1998-06-16 05:20:05 +00:00
|
|
|
g_return_if_fail (GTK_IS_WIDGET (child));
|
|
|
|
g_return_if_fail (child->parent == NULL);
|
|
|
|
|
|
|
|
/* g_return_if_fail (left_attach >= 0); */
|
1998-01-27 23:40:51 +00:00
|
|
|
g_return_if_fail (left_attach < right_attach);
|
1998-06-16 05:20:05 +00:00
|
|
|
/* g_return_if_fail (top_attach >= 0); */
|
1998-01-27 23:40:51 +00:00
|
|
|
g_return_if_fail (top_attach < bottom_attach);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1998-01-27 23:40:51 +00:00
|
|
|
if (right_attach >= table->ncols)
|
1998-06-16 21:09:24 +00:00
|
|
|
gtk_table_resize (table, table->nrows, right_attach);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1998-01-27 23:40:51 +00:00
|
|
|
if (bottom_attach >= table->nrows)
|
1998-06-16 21:09:24 +00:00
|
|
|
gtk_table_resize (table, bottom_attach, table->ncols);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
table_child = g_new (GtkTableChild, 1);
|
|
|
|
table_child->widget = child;
|
|
|
|
table_child->left_attach = left_attach;
|
|
|
|
table_child->right_attach = right_attach;
|
|
|
|
table_child->top_attach = top_attach;
|
|
|
|
table_child->bottom_attach = bottom_attach;
|
|
|
|
table_child->xexpand = (xoptions & GTK_EXPAND) != 0;
|
|
|
|
table_child->xshrink = (xoptions & GTK_SHRINK) != 0;
|
|
|
|
table_child->xfill = (xoptions & GTK_FILL) != 0;
|
|
|
|
table_child->xpadding = xpadding;
|
|
|
|
table_child->yexpand = (yoptions & GTK_EXPAND) != 0;
|
|
|
|
table_child->yshrink = (yoptions & GTK_SHRINK) != 0;
|
|
|
|
table_child->yfill = (yoptions & GTK_FILL) != 0;
|
|
|
|
table_child->ypadding = ypadding;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
table->children = g_list_prepend (table->children, table_child);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_set_parent (child, GTK_WIDGET (table));
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (GTK_WIDGET (table)))
|
|
|
|
{
|
|
|
|
if (GTK_WIDGET_REALIZED (GTK_WIDGET (table)) &&
|
|
|
|
!GTK_WIDGET_REALIZED (child))
|
|
|
|
gtk_widget_realize (child);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_MAPPED (GTK_WIDGET (table)) &&
|
|
|
|
!GTK_WIDGET_MAPPED (child))
|
|
|
|
gtk_widget_map (child);
|
|
|
|
}
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (table))
|
1998-06-24 06:25:14 +00:00
|
|
|
gtk_widget_queue_resize (child);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_table_attach_defaults (GtkTable *table,
|
|
|
|
GtkWidget *widget,
|
1998-06-16 05:20:05 +00:00
|
|
|
guint left_attach,
|
|
|
|
guint right_attach,
|
|
|
|
guint top_attach,
|
|
|
|
guint bottom_attach)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gtk_table_attach (table, widget,
|
|
|
|
left_attach, right_attach,
|
|
|
|
top_attach, bottom_attach,
|
|
|
|
GTK_EXPAND | GTK_FILL,
|
|
|
|
GTK_EXPAND | GTK_FILL,
|
|
|
|
0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_table_set_row_spacing (GtkTable *table,
|
1998-06-16 05:20:05 +00:00
|
|
|
guint row,
|
|
|
|
guint spacing)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (table != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (table));
|
1998-06-17 08:48:22 +00:00
|
|
|
g_return_if_fail (row + 1 < table->nrows);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (table->rows[row].spacing != spacing)
|
|
|
|
{
|
|
|
|
table->rows[row].spacing = spacing;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (table))
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (table));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_table_set_col_spacing (GtkTable *table,
|
1998-06-16 05:20:05 +00:00
|
|
|
guint column,
|
|
|
|
guint spacing)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (table != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (table));
|
1998-06-17 08:48:22 +00:00
|
|
|
g_return_if_fail (column + 1 < table->ncols);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (table->cols[column].spacing != spacing)
|
|
|
|
{
|
|
|
|
table->cols[column].spacing = spacing;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (table))
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (table));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_table_set_row_spacings (GtkTable *table,
|
1998-06-16 05:20:05 +00:00
|
|
|
guint spacing)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-16 05:20:05 +00:00
|
|
|
guint row;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (table != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (table));
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1998-01-28 05:55:54 +00:00
|
|
|
table->row_spacing = spacing;
|
1998-06-17 08:48:22 +00:00
|
|
|
for (row = 0; row + 1 < table->nrows; row++)
|
1997-11-24 22:37:52 +00:00
|
|
|
table->rows[row].spacing = spacing;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (table))
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (table));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_table_set_col_spacings (GtkTable *table,
|
1998-06-16 05:20:05 +00:00
|
|
|
guint spacing)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-16 05:20:05 +00:00
|
|
|
guint col;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (table != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (table));
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1998-01-28 05:55:54 +00:00
|
|
|
table->column_spacing = spacing;
|
1998-06-17 08:48:22 +00:00
|
|
|
for (col = 0; col + 1 < table->ncols; col++)
|
1997-11-24 22:37:52 +00:00
|
|
|
table->cols[col].spacing = spacing;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (table))
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (table));
|
|
|
|
}
|
|
|
|
|
1998-04-06 22:33:32 +00:00
|
|
|
void
|
|
|
|
gtk_table_set_homogeneous (GtkTable *table,
|
1998-06-16 05:20:05 +00:00
|
|
|
gboolean homogeneous)
|
1998-04-06 22:33:32 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (table != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (table));
|
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
homogeneous = (homogeneous != 0);
|
|
|
|
if (homogeneous != table->homogeneous)
|
|
|
|
{
|
|
|
|
table->homogeneous = homogeneous;
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (table))
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (table));
|
|
|
|
}
|
1998-04-06 22:33:32 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
1998-01-30 23:47:09 +00:00
|
|
|
gtk_table_finalize (GtkObject *object)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkTable *table;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (object != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (object));
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
table = GTK_TABLE (object);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_free (table->rows);
|
|
|
|
g_free (table->cols);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_map (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkTable *table;
|
|
|
|
GtkTableChild *child;
|
|
|
|
GList *children;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (widget));
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
table = GTK_TABLE (widget);
|
|
|
|
GTK_WIDGET_SET_FLAGS (table, GTK_MAPPED);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
children = table->children;
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (child->widget) &&
|
1998-06-16 05:20:05 +00:00
|
|
|
!GTK_WIDGET_MAPPED (child->widget))
|
|
|
|
gtk_widget_map (child->widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_unmap (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkTable *table;
|
|
|
|
GtkTableChild *child;
|
|
|
|
GList *children;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (widget));
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
table = GTK_TABLE (widget);
|
|
|
|
GTK_WIDGET_UNSET_FLAGS (table, GTK_MAPPED);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
children = table->children;
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (child->widget) &&
|
1998-06-16 05:20:05 +00:00
|
|
|
GTK_WIDGET_MAPPED (child->widget))
|
|
|
|
gtk_widget_unmap (child->widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_draw (GtkWidget *widget,
|
|
|
|
GdkRectangle *area)
|
|
|
|
{
|
|
|
|
GtkTable *table;
|
|
|
|
GtkTableChild *child;
|
|
|
|
GList *children;
|
|
|
|
GdkRectangle child_area;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (widget));
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
|
|
|
|
{
|
|
|
|
table = GTK_TABLE (widget);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
children = table->children;
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (gtk_widget_intersect (child->widget, area, &child_area))
|
|
|
|
gtk_widget_draw (child->widget, &child_area);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
1998-06-16 05:20:05 +00:00
|
|
|
gtk_table_expose (GtkWidget *widget,
|
1997-11-24 22:37:52 +00:00
|
|
|
GdkEventExpose *event)
|
|
|
|
{
|
|
|
|
GtkTable *table;
|
|
|
|
GtkTableChild *child;
|
|
|
|
GList *children;
|
|
|
|
GdkEventExpose child_event;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_TABLE (widget), FALSE);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
|
|
|
|
{
|
|
|
|
table = GTK_TABLE (widget);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
child_event = *event;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
children = table->children;
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_NO_WINDOW (child->widget) &&
|
|
|
|
gtk_widget_intersect (child->widget, &event->area, &child_event.area))
|
|
|
|
gtk_widget_event (child->widget, (GdkEvent*) &child_event);
|
|
|
|
}
|
|
|
|
}
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition)
|
|
|
|
{
|
|
|
|
GtkTable *table;
|
|
|
|
gint row, col;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (widget));
|
|
|
|
g_return_if_fail (requisition != NULL);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
table = GTK_TABLE (widget);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
requisition->width = 0;
|
|
|
|
requisition->height = 0;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_table_size_request_init (table);
|
|
|
|
gtk_table_size_request_pass1 (table);
|
|
|
|
gtk_table_size_request_pass2 (table);
|
|
|
|
gtk_table_size_request_pass3 (table);
|
|
|
|
gtk_table_size_request_pass2 (table);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (col = 0; col < table->ncols; col++)
|
|
|
|
requisition->width += table->cols[col].requisition;
|
1998-06-17 08:48:22 +00:00
|
|
|
for (col = 0; col + 1 < table->ncols; col++)
|
1997-11-24 22:37:52 +00:00
|
|
|
requisition->width += table->cols[col].spacing;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (row = 0; row < table->nrows; row++)
|
|
|
|
requisition->height += table->rows[row].requisition;
|
1998-06-17 08:48:22 +00:00
|
|
|
for (row = 0; row + 1 < table->nrows; row++)
|
1997-11-24 22:37:52 +00:00
|
|
|
requisition->height += table->rows[row].spacing;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
requisition->width += GTK_CONTAINER (table)->border_width * 2;
|
|
|
|
requisition->height += GTK_CONTAINER (table)->border_width * 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation)
|
|
|
|
{
|
|
|
|
GtkTable *table;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (widget));
|
|
|
|
g_return_if_fail (allocation != NULL);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
widget->allocation = *allocation;
|
|
|
|
table = GTK_TABLE (widget);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_table_size_allocate_init (table);
|
|
|
|
gtk_table_size_allocate_pass1 (table);
|
|
|
|
gtk_table_size_allocate_pass2 (table);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_add (GtkContainer *container,
|
|
|
|
GtkWidget *widget)
|
|
|
|
{
|
|
|
|
g_return_if_fail (container != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (container));
|
|
|
|
g_return_if_fail (widget != NULL);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (container), widget, 0, 1, 0, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_remove (GtkContainer *container,
|
|
|
|
GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkTable *table;
|
|
|
|
GtkTableChild *child;
|
|
|
|
GList *children;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (container != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (container));
|
|
|
|
g_return_if_fail (widget != NULL);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
table = GTK_TABLE (container);
|
|
|
|
children = table->children;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (child->widget == widget)
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
1998-05-01 04:23:59 +00:00
|
|
|
gboolean was_visible = GTK_WIDGET_VISIBLE (widget);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_unparent (widget);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
|
|
|
table->children = g_list_remove (table->children, child);
|
|
|
|
g_free (child);
|
|
|
|
|
|
|
|
if (was_visible && GTK_WIDGET_VISIBLE (container))
|
1998-06-24 06:25:14 +00:00
|
|
|
gtk_container_queue_resize (container);
|
1998-06-16 05:20:05 +00:00
|
|
|
break;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
gtk_table_forall (GtkContainer *container,
|
|
|
|
gboolean include_internals,
|
|
|
|
GtkCallback callback,
|
|
|
|
gpointer callback_data)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkTable *table;
|
|
|
|
GtkTableChild *child;
|
|
|
|
GList *children;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (container != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TABLE (container));
|
|
|
|
g_return_if_fail (callback != NULL);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
table = GTK_TABLE (container);
|
|
|
|
children = table->children;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
(* callback) (child->widget, callback_data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_size_request_init (GtkTable *table)
|
|
|
|
{
|
|
|
|
GtkTableChild *child;
|
|
|
|
GList *children;
|
|
|
|
gint row, col;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (row = 0; row < table->nrows; row++)
|
|
|
|
table->rows[row].requisition = 0;
|
|
|
|
for (col = 0; col < table->ncols; col++)
|
|
|
|
table->cols[col].requisition = 0;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
children = table->children;
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (child->widget))
|
|
|
|
gtk_widget_size_request (child->widget, &child->widget->requisition);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_size_request_pass1 (GtkTable *table)
|
|
|
|
{
|
|
|
|
GtkTableChild *child;
|
|
|
|
GList *children;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
children = table->children;
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (child->widget))
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
|
|
|
/* Child spans a single column.
|
|
|
|
*/
|
|
|
|
if (child->left_attach == (child->right_attach - 1))
|
|
|
|
{
|
|
|
|
width = child->widget->requisition.width + child->xpadding * 2;
|
|
|
|
table->cols[child->left_attach].requisition = MAX (table->cols[child->left_attach].requisition, width);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Child spans a single row.
|
|
|
|
*/
|
|
|
|
if (child->top_attach == (child->bottom_attach - 1))
|
|
|
|
{
|
|
|
|
height = child->widget->requisition.height + child->ypadding * 2;
|
|
|
|
table->rows[child->top_attach].requisition = MAX (table->rows[child->top_attach].requisition, height);
|
|
|
|
}
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_size_request_pass2 (GtkTable *table)
|
|
|
|
{
|
|
|
|
gint max_width;
|
|
|
|
gint max_height;
|
|
|
|
gint row, col;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (table->homogeneous)
|
|
|
|
{
|
|
|
|
max_width = 0;
|
|
|
|
max_height = 0;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (col = 0; col < table->ncols; col++)
|
1998-06-16 05:20:05 +00:00
|
|
|
max_width = MAX (max_width, table->cols[col].requisition);
|
1997-11-24 22:37:52 +00:00
|
|
|
for (row = 0; row < table->nrows; row++)
|
1998-06-16 05:20:05 +00:00
|
|
|
max_height = MAX (max_height, table->rows[row].requisition);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (col = 0; col < table->ncols; col++)
|
1998-06-16 05:20:05 +00:00
|
|
|
table->cols[col].requisition = max_width;
|
1997-11-24 22:37:52 +00:00
|
|
|
for (row = 0; row < table->nrows; row++)
|
1998-06-16 05:20:05 +00:00
|
|
|
table->rows[row].requisition = max_height;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_size_request_pass3 (GtkTable *table)
|
|
|
|
{
|
|
|
|
GtkTableChild *child;
|
|
|
|
GList *children;
|
|
|
|
gint width, height;
|
|
|
|
gint row, col;
|
|
|
|
gint extra;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
children = table->children;
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (child->widget))
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
|
|
|
/* Child spans multiple columns.
|
|
|
|
*/
|
|
|
|
if (child->left_attach != (child->right_attach - 1))
|
|
|
|
{
|
|
|
|
/* Check and see if there is already enough space
|
|
|
|
* for the child.
|
|
|
|
*/
|
|
|
|
width = 0;
|
|
|
|
for (col = child->left_attach; col < child->right_attach; col++)
|
|
|
|
{
|
|
|
|
width += table->cols[col].requisition;
|
|
|
|
if ((col + 1) < child->right_attach)
|
|
|
|
width += table->cols[col].spacing;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we need to request more space for this child to fill
|
|
|
|
* its requisition, then divide up the needed space evenly
|
|
|
|
* amongst the columns it spans.
|
|
|
|
*/
|
|
|
|
if (width < child->widget->requisition.width + child->xpadding * 2)
|
|
|
|
{
|
|
|
|
width = child->widget->requisition.width + child->xpadding * 2 - width;
|
|
|
|
|
|
|
|
for (col = child->left_attach; col < child->right_attach; col++)
|
|
|
|
{
|
|
|
|
extra = width / (child->right_attach - col);
|
1998-02-03 05:23:03 +00:00
|
|
|
table->cols[col].requisition += extra;
|
1998-06-16 05:20:05 +00:00
|
|
|
width -= extra;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Child spans multiple rows.
|
|
|
|
*/
|
|
|
|
if (child->top_attach != (child->bottom_attach - 1))
|
|
|
|
{
|
|
|
|
/* Check and see if there is already enough space
|
|
|
|
* for the child.
|
|
|
|
*/
|
|
|
|
height = 0;
|
|
|
|
for (row = child->top_attach; row < child->bottom_attach; row++)
|
|
|
|
{
|
|
|
|
height += table->rows[row].requisition;
|
|
|
|
if ((row + 1) < child->bottom_attach)
|
|
|
|
height += table->rows[row].spacing;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we need to request more space for this child to fill
|
|
|
|
* its requisition, then divide up the needed space evenly
|
|
|
|
* amongst the columns it spans.
|
|
|
|
*/
|
|
|
|
if (height < child->widget->requisition.height + child->ypadding * 2)
|
|
|
|
{
|
|
|
|
height = child->widget->requisition.height + child->ypadding * 2 - height;
|
|
|
|
|
|
|
|
for (row = child->top_attach; row < child->bottom_attach; row++)
|
|
|
|
{
|
|
|
|
extra = height / (child->bottom_attach - row);
|
1998-02-03 05:23:03 +00:00
|
|
|
table->rows[row].requisition += extra;
|
1998-06-16 05:20:05 +00:00
|
|
|
height -= extra;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_size_allocate_init (GtkTable *table)
|
|
|
|
{
|
|
|
|
GtkTableChild *child;
|
|
|
|
GList *children;
|
|
|
|
gint row, col;
|
|
|
|
gint has_expand;
|
|
|
|
gint has_shrink;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Initialize the rows and cols.
|
|
|
|
* By default, rows and cols do not expand and do shrink.
|
|
|
|
* Those values are modified by the children that occupy
|
|
|
|
* the rows and cols.
|
|
|
|
*/
|
|
|
|
for (col = 0; col < table->ncols; col++)
|
|
|
|
{
|
|
|
|
table->cols[col].allocation = table->cols[col].requisition;
|
|
|
|
table->cols[col].need_expand = FALSE;
|
|
|
|
table->cols[col].need_shrink = TRUE;
|
|
|
|
table->cols[col].expand = FALSE;
|
|
|
|
table->cols[col].shrink = TRUE;
|
1998-08-04 14:55:04 +00:00
|
|
|
table->cols[col].empty = TRUE;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
for (row = 0; row < table->nrows; row++)
|
|
|
|
{
|
|
|
|
table->rows[row].allocation = table->rows[row].requisition;
|
|
|
|
table->rows[row].need_expand = FALSE;
|
|
|
|
table->rows[row].need_shrink = TRUE;
|
|
|
|
table->rows[row].expand = FALSE;
|
|
|
|
table->rows[row].shrink = TRUE;
|
1998-08-04 14:55:04 +00:00
|
|
|
table->rows[row].empty = TRUE;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Loop over all the children and adjust the row and col values
|
|
|
|
* based on whether the children want to be allowed to expand
|
|
|
|
* or shrink. This loop handles children that occupy a single
|
|
|
|
* row or column.
|
|
|
|
*/
|
|
|
|
children = table->children;
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (child->widget))
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
|
|
|
if (child->left_attach == (child->right_attach - 1))
|
|
|
|
{
|
|
|
|
if (child->xexpand)
|
|
|
|
table->cols[child->left_attach].expand = TRUE;
|
|
|
|
|
|
|
|
if (!child->xshrink)
|
|
|
|
table->cols[child->left_attach].shrink = FALSE;
|
1998-08-04 14:55:04 +00:00
|
|
|
|
|
|
|
table->cols[child->left_attach].empty = FALSE;
|
1998-06-16 05:20:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (child->top_attach == (child->bottom_attach - 1))
|
|
|
|
{
|
|
|
|
if (child->yexpand)
|
|
|
|
table->rows[child->top_attach].expand = TRUE;
|
|
|
|
|
|
|
|
if (!child->yshrink)
|
|
|
|
table->rows[child->top_attach].shrink = FALSE;
|
1998-08-04 14:55:04 +00:00
|
|
|
|
|
|
|
table->rows[child->top_attach].empty = FALSE;
|
1998-06-16 05:20:05 +00:00
|
|
|
}
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Loop over all the children again and this time handle children
|
|
|
|
* which span multiple rows or columns.
|
|
|
|
*/
|
|
|
|
children = table->children;
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (child->widget))
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
|
|
|
if (child->left_attach != (child->right_attach - 1))
|
|
|
|
{
|
1998-08-04 14:55:04 +00:00
|
|
|
for (col = child->left_attach; col < child->right_attach; col++)
|
|
|
|
table->cols[col].empty = FALSE;
|
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
if (child->xexpand)
|
|
|
|
{
|
|
|
|
has_expand = FALSE;
|
|
|
|
for (col = child->left_attach; col < child->right_attach; col++)
|
|
|
|
if (table->cols[col].expand)
|
|
|
|
{
|
|
|
|
has_expand = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!has_expand)
|
|
|
|
for (col = child->left_attach; col < child->right_attach; col++)
|
|
|
|
table->cols[col].need_expand = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!child->xshrink)
|
|
|
|
{
|
|
|
|
has_shrink = TRUE;
|
|
|
|
for (col = child->left_attach; col < child->right_attach; col++)
|
|
|
|
if (!table->cols[col].shrink)
|
|
|
|
{
|
|
|
|
has_shrink = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (has_shrink)
|
|
|
|
for (col = child->left_attach; col < child->right_attach; col++)
|
|
|
|
table->cols[col].need_shrink = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (child->top_attach != (child->bottom_attach - 1))
|
|
|
|
{
|
1998-08-04 14:55:04 +00:00
|
|
|
for (row = child->top_attach; row < child->bottom_attach; row++)
|
|
|
|
table->rows[row].empty = FALSE;
|
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
if (child->yexpand)
|
|
|
|
{
|
|
|
|
has_expand = FALSE;
|
|
|
|
for (row = child->top_attach; row < child->bottom_attach; row++)
|
|
|
|
if (table->rows[row].expand)
|
|
|
|
{
|
|
|
|
has_expand = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!has_expand)
|
|
|
|
for (row = child->top_attach; row < child->bottom_attach; row++)
|
|
|
|
table->rows[row].need_expand = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!child->yshrink)
|
|
|
|
{
|
|
|
|
has_shrink = TRUE;
|
|
|
|
for (row = child->top_attach; row < child->bottom_attach; row++)
|
|
|
|
if (!table->rows[row].shrink)
|
|
|
|
{
|
|
|
|
has_shrink = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (has_shrink)
|
|
|
|
for (row = child->top_attach; row < child->bottom_attach; row++)
|
|
|
|
table->rows[row].need_shrink = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Loop over the columns and set the expand and shrink values
|
|
|
|
* if the column can be expanded or shrunk.
|
|
|
|
*/
|
|
|
|
for (col = 0; col < table->ncols; col++)
|
|
|
|
{
|
1998-08-04 14:55:04 +00:00
|
|
|
if (table->cols[col].empty)
|
|
|
|
{
|
|
|
|
table->cols[col].expand = FALSE;
|
|
|
|
table->cols[col].shrink = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (table->cols[col].need_expand)
|
|
|
|
table->cols[col].expand = TRUE;
|
|
|
|
if (!table->cols[col].need_shrink)
|
|
|
|
table->cols[col].shrink = FALSE;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Loop over the rows and set the expand and shrink values
|
|
|
|
* if the row can be expanded or shrunk.
|
|
|
|
*/
|
|
|
|
for (row = 0; row < table->nrows; row++)
|
|
|
|
{
|
1998-08-04 14:55:04 +00:00
|
|
|
if (table->rows[row].empty)
|
|
|
|
{
|
|
|
|
table->rows[row].expand = FALSE;
|
|
|
|
table->rows[row].shrink = FALSE;
|
|
|
|
}
|
1998-08-04 15:07:55 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (table->rows[row].need_expand)
|
|
|
|
table->rows[row].expand = TRUE;
|
|
|
|
if (!table->rows[row].need_shrink)
|
|
|
|
table->rows[row].shrink = FALSE;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_size_allocate_pass1 (GtkTable *table)
|
|
|
|
{
|
|
|
|
gint real_width;
|
|
|
|
gint real_height;
|
|
|
|
gint width, height;
|
|
|
|
gint row, col;
|
|
|
|
gint nexpand;
|
|
|
|
gint nshrink;
|
|
|
|
gint extra;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* If we were allocated more space than we requested
|
|
|
|
* then we have to expand any expandable rows and columns
|
|
|
|
* to fill in the extra space.
|
|
|
|
*/
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
real_width = GTK_WIDGET (table)->allocation.width - GTK_CONTAINER (table)->border_width * 2;
|
|
|
|
real_height = GTK_WIDGET (table)->allocation.height - GTK_CONTAINER (table)->border_width * 2;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (table->homogeneous)
|
|
|
|
{
|
|
|
|
nexpand = 0;
|
|
|
|
for (col = 0; col < table->ncols; col++)
|
1998-06-16 05:20:05 +00:00
|
|
|
if (table->cols[col].expand)
|
|
|
|
{
|
|
|
|
nexpand += 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (nexpand > 0)
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
|
|
|
width = real_width;
|
|
|
|
|
1998-06-17 08:48:22 +00:00
|
|
|
for (col = 0; col + 1 < table->ncols; col++)
|
1998-06-16 05:20:05 +00:00
|
|
|
width -= table->cols[col].spacing;
|
|
|
|
|
|
|
|
for (col = 0; col < table->ncols; col++)
|
|
|
|
{
|
|
|
|
extra = width / (table->ncols - col);
|
1998-04-07 23:59:25 +00:00
|
|
|
table->cols[col].allocation = MAX (1, extra);
|
1998-06-16 05:20:05 +00:00
|
|
|
width -= extra;
|
|
|
|
}
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
width = 0;
|
|
|
|
nexpand = 0;
|
|
|
|
nshrink = 0;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (col = 0; col < table->ncols; col++)
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
|
|
|
width += table->cols[col].requisition;
|
|
|
|
if (table->cols[col].expand)
|
|
|
|
nexpand += 1;
|
|
|
|
if (table->cols[col].shrink)
|
|
|
|
nshrink += 1;
|
|
|
|
}
|
1998-06-17 08:48:22 +00:00
|
|
|
for (col = 0; col + 1 < table->ncols; col++)
|
1998-06-16 05:20:05 +00:00
|
|
|
width += table->cols[col].spacing;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Check to see if we were allocated more width than we requested.
|
|
|
|
*/
|
|
|
|
if ((width < real_width) && (nexpand >= 1))
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
|
|
|
width = real_width - width;
|
|
|
|
|
|
|
|
for (col = 0; col < table->ncols; col++)
|
|
|
|
if (table->cols[col].expand)
|
|
|
|
{
|
|
|
|
extra = width / nexpand;
|
1998-02-03 05:57:31 +00:00
|
|
|
table->cols[col].allocation += extra;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
|
|
|
width -= extra;
|
|
|
|
nexpand -= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Check to see if we were allocated less width than we requested.
|
|
|
|
*/
|
|
|
|
if ((width > real_width) && (nshrink >= 1))
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
|
|
|
width = width - real_width;
|
|
|
|
|
|
|
|
for (col = 0; col < table->ncols; col++)
|
|
|
|
if (table->cols[col].shrink)
|
|
|
|
{
|
|
|
|
extra = width / nshrink;
|
1998-04-07 23:59:25 +00:00
|
|
|
table->cols[col].allocation = MAX (1, table->cols[col].allocation - extra);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
|
|
|
width -= extra;
|
|
|
|
nshrink -= 1;
|
|
|
|
}
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (table->homogeneous)
|
|
|
|
{
|
|
|
|
nexpand = 0;
|
|
|
|
for (row = 0; row < table->nrows; row++)
|
1998-06-16 05:20:05 +00:00
|
|
|
if (table->rows[row].expand)
|
|
|
|
{
|
|
|
|
nexpand += 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (nexpand > 0)
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
|
|
|
height = real_height;
|
|
|
|
|
1998-06-17 08:48:22 +00:00
|
|
|
for (row = 0; row + 1 < table->nrows; row++)
|
1998-06-16 05:20:05 +00:00
|
|
|
height -= table->rows[row].spacing;
|
|
|
|
|
|
|
|
|
|
|
|
for (row = 0; row < table->nrows; row++)
|
|
|
|
{
|
|
|
|
extra = height / (table->nrows - row);
|
1998-04-07 23:59:25 +00:00
|
|
|
table->rows[row].allocation = MAX (1, extra);
|
1998-06-16 05:20:05 +00:00
|
|
|
height -= extra;
|
|
|
|
}
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
height = 0;
|
|
|
|
nexpand = 0;
|
|
|
|
nshrink = 0;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (row = 0; row < table->nrows; row++)
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
|
|
|
height += table->rows[row].requisition;
|
|
|
|
if (table->rows[row].expand)
|
|
|
|
nexpand += 1;
|
|
|
|
if (table->rows[row].shrink)
|
|
|
|
nshrink += 1;
|
|
|
|
}
|
1998-06-17 08:48:22 +00:00
|
|
|
for (row = 0; row + 1 < table->nrows; row++)
|
1998-06-16 05:20:05 +00:00
|
|
|
height += table->rows[row].spacing;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Check to see if we were allocated more height than we requested.
|
|
|
|
*/
|
|
|
|
if ((height < real_height) && (nexpand >= 1))
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
|
|
|
height = real_height - height;
|
|
|
|
|
|
|
|
for (row = 0; row < table->nrows; row++)
|
|
|
|
if (table->rows[row].expand)
|
|
|
|
{
|
|
|
|
extra = height / nexpand;
|
1998-02-03 05:57:31 +00:00
|
|
|
table->rows[row].allocation += extra;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
|
|
|
height -= extra;
|
|
|
|
nexpand -= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Check to see if we were allocated less height than we requested.
|
|
|
|
*/
|
|
|
|
if ((height > real_height) && (nshrink >= 1))
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
|
|
|
height = height - real_height;
|
|
|
|
|
|
|
|
for (row = 0; row < table->nrows; row++)
|
|
|
|
if (table->rows[row].shrink)
|
|
|
|
{
|
|
|
|
extra = height / nshrink;
|
1998-04-07 23:59:25 +00:00
|
|
|
table->rows[row].allocation = MAX (1, table->rows[row].allocation - extra);
|
1998-06-16 05:20:05 +00:00
|
|
|
|
|
|
|
height -= extra;
|
|
|
|
nshrink -= 1;
|
|
|
|
}
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_table_size_allocate_pass2 (GtkTable *table)
|
|
|
|
{
|
|
|
|
GtkTableChild *child;
|
|
|
|
GList *children;
|
|
|
|
gint max_width;
|
|
|
|
gint max_height;
|
|
|
|
gint x, y;
|
|
|
|
gint row, col;
|
|
|
|
GtkAllocation allocation;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
children = table->children;
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
1998-06-16 05:20:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (child->widget))
|
1998-06-16 05:20:05 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
max_height = 0;
|
|
|
|
|
|
|
|
for (col = 0; col < child->left_attach; col++)
|
|
|
|
{
|
|
|
|
x += table->cols[col].allocation;
|
|
|
|
x += table->cols[col].spacing;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (col = child->left_attach; col < child->right_attach; col++)
|
|
|
|
{
|
|
|
|
max_width += table->cols[col].allocation;
|
|
|
|
if ((col + 1) < child->right_attach)
|
|
|
|
max_width += table->cols[col].spacing;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (row = 0; row < child->top_attach; row++)
|
|
|
|
{
|
|
|
|
y += table->rows[row].allocation;
|
|
|
|
y += table->rows[row].spacing;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (row = child->top_attach; row < child->bottom_attach; row++)
|
|
|
|
{
|
|
|
|
max_height += table->rows[row].allocation;
|
|
|
|
if ((row + 1) < child->bottom_attach)
|
|
|
|
max_height += table->rows[row].spacing;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (child->xfill)
|
|
|
|
{
|
|
|
|
allocation.width = MAX (1, max_width - child->xpadding * 2);
|
|
|
|
allocation.x = x + (max_width - allocation.width) / 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
allocation.width = child->widget->requisition.width;
|
|
|
|
allocation.x = x + (max_width - allocation.width) / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (child->yfill)
|
|
|
|
{
|
|
|
|
allocation.height = MAX (1, max_height - child->ypadding * 2);
|
|
|
|
allocation.y = y + (max_height - allocation.height) / 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
allocation.height = child->widget->requisition.height;
|
|
|
|
allocation.y = y + (max_height - allocation.height) / 2;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_size_allocate (child->widget, &allocation);
|
1998-06-16 05:20:05 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|