diff options
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/e-table/ChangeLog | 5 | ||||
-rw-r--r-- | widgets/e-table/e-table.c | 19 | ||||
-rw-r--r-- | widgets/table/e-table.c | 19 |
3 files changed, 37 insertions, 6 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog index 6b281a5964..b5a2bf56c9 100644 --- a/widgets/e-table/ChangeLog +++ b/widgets/e-table/ChangeLog @@ -1,3 +1,8 @@ +2000-03-21 Christopher James Lahey <clahey@helixcode.com> + + * e-table.c: Make rectangles resize properly when receiving the + "model_changed" signal. + 2000-03-20 Christopher James Lahey <clahey@helixcode.com> * e-table-group-container.c, e-table-group-container.h, diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c index 43d3ba6e89..dfd3dda162 100644 --- a/widgets/e-table/e-table.c +++ b/widgets/e-table/e-table.c @@ -119,7 +119,7 @@ e_table_make_header (ETable *e_table, ETableHeader *full_header, xmlNode *xmlCol } static void -header_canvas_size_alocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table) +header_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table) { gnome_canvas_set_scroll_region ( GNOME_CANVAS (e_table->header_canvas), @@ -171,8 +171,8 @@ e_table_setup_header (ETable *e_table) gtk_signal_connect ( GTK_OBJECT (e_table->header_canvas), "size_allocate", - GTK_SIGNAL_FUNC (header_canvas_size_alocate), e_table); - + GTK_SIGNAL_FUNC (header_canvas_size_allocate), e_table); + gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -1, COLUMN_HEADER_HEIGHT); } @@ -593,6 +593,12 @@ table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_t } static void +table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table) +{ + table_canvas_size_allocate (GTK_WIDGET(canvas), &(GTK_WIDGET(canvas)->allocation), e_table); +} + +static void change_row (gpointer key, gpointer value, gpointer data) { ETable *et = E_TABLE(data); @@ -624,6 +630,10 @@ changed_idle (gpointer data) gtk_signal_connect(GTK_OBJECT(et->group), "row_selection", GTK_SIGNAL_FUNC(group_row_selection), et); e_table_fill_table(et, et->model); + + gtk_object_set(GTK_OBJECT(et->group), + "width", (double) GTK_WIDGET(et->table_canvas)->allocation.width, + NULL); } else if (et->need_row_changes) { g_hash_table_foreach(et->row_changes_list, change_row, et); } @@ -676,6 +686,9 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h GTK_OBJECT (e_table->table_canvas), "size_allocate", GTK_SIGNAL_FUNC (table_canvas_size_allocate), e_table); + gtk_signal_connect (GTK_OBJECT(e_table->table_canvas), "reflow", + GTK_SIGNAL_FUNC (table_canvas_reflow), e_table); + gtk_widget_show (GTK_WIDGET (e_table->table_canvas)); e_table->group = e_table_group_new(GNOME_CANVAS_GROUP(e_table->table_canvas->root), diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 43d3ba6e89..dfd3dda162 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -119,7 +119,7 @@ e_table_make_header (ETable *e_table, ETableHeader *full_header, xmlNode *xmlCol } static void -header_canvas_size_alocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table) +header_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table) { gnome_canvas_set_scroll_region ( GNOME_CANVAS (e_table->header_canvas), @@ -171,8 +171,8 @@ e_table_setup_header (ETable *e_table) gtk_signal_connect ( GTK_OBJECT (e_table->header_canvas), "size_allocate", - GTK_SIGNAL_FUNC (header_canvas_size_alocate), e_table); - + GTK_SIGNAL_FUNC (header_canvas_size_allocate), e_table); + gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -1, COLUMN_HEADER_HEIGHT); } @@ -593,6 +593,12 @@ table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_t } static void +table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table) +{ + table_canvas_size_allocate (GTK_WIDGET(canvas), &(GTK_WIDGET(canvas)->allocation), e_table); +} + +static void change_row (gpointer key, gpointer value, gpointer data) { ETable *et = E_TABLE(data); @@ -624,6 +630,10 @@ changed_idle (gpointer data) gtk_signal_connect(GTK_OBJECT(et->group), "row_selection", GTK_SIGNAL_FUNC(group_row_selection), et); e_table_fill_table(et, et->model); + + gtk_object_set(GTK_OBJECT(et->group), + "width", (double) GTK_WIDGET(et->table_canvas)->allocation.width, + NULL); } else if (et->need_row_changes) { g_hash_table_foreach(et->row_changes_list, change_row, et); } @@ -676,6 +686,9 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h GTK_OBJECT (e_table->table_canvas), "size_allocate", GTK_SIGNAL_FUNC (table_canvas_size_allocate), e_table); + gtk_signal_connect (GTK_OBJECT(e_table->table_canvas), "reflow", + GTK_SIGNAL_FUNC (table_canvas_reflow), e_table); + gtk_widget_show (GTK_WIDGET (e_table->table_canvas)); e_table->group = e_table_group_new(GNOME_CANVAS_GROUP(e_table->table_canvas->root), |