From 99d71d11328fa1f6d2f0156de63a44142cf99d9c Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Mon, 7 Feb 2000 13:08:33 +0000 Subject: Setup the scroll region of the table canvas on size allocation. 2000-02-07 Miguel de Icaza * e-table.c (e_table_setup_table): Setup the scroll region of the table canvas on size allocation. (e_table_canvas_realize): Do not set the scrollregion here. (e_table_canvas_init): Move root initialization here. svn path=/trunk/; revision=1683 --- widgets/e-table/e-table.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'widgets/e-table/e-table.c') diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c index a42aaf111b..c9a85b87b6 100644 --- a/widgets/e-table/e-table.c +++ b/widgets/e-table/e-table.c @@ -434,23 +434,11 @@ e_table_canvas_realize (GtkWidget *widget) groups = group_spec_to_desc (e_table->group_spec); - e_table->root = gnome_canvas_item_new ( - GNOME_CANVAS_GROUP (e_table->table_canvas->root), - gnome_canvas_group_get_type (), - "x", 0.0, - "y", 0.0, - NULL); - leaf = e_table_create_nodes ( e_table, e_table->model, e_table->header, GNOME_CANVAS_GROUP (e_table->root), 0, groups); - gnome_canvas_set_scroll_region ( - GNOME_CANVAS (e_table_canvas), - 0, 0, - e_table_header_total_width (e_table->header) + 200, - leaf_height (leaf)); - + if (groups) g_free (groups); } @@ -482,6 +470,14 @@ static void e_table_canvas_init (GtkObject *canvas) { GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS); + + e_table->root = gnome_canvas_item_new ( + GNOME_CANVAS_GROUP (e_table->table_canvas->root), + gnome_canvas_group_get_type (), + "x", 0.0, + "y", 0.0, + NULL); + } GtkType e_table_canvas_get_type (void); @@ -500,10 +496,21 @@ e_table_canvas_new (ETable *e_table) return GNOME_CANVAS (e_table_canvas); } +static void +table_canvas_size_alocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table) +{ + gnome_canvas_set_scroll_region ( + GNOME_CANVAS (e_table->table_canvas), + 0, 0, alloc->width, alloc->height); +} + static void e_table_setup_table (ETable *e_table) { e_table->table_canvas = e_table_canvas_new (e_table); + gtk_signal_connect ( + GTK_OBJECT (e_table->table_canvas), "size_allocate", + GTK_SIGNAL_FUNC (table_canvas_size_alocate), e_table); gtk_widget_show (GTK_WIDGET (e_table->table_canvas)); gtk_table_attach ( -- cgit v1.2.3