diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-02-14 07:15:13 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-02-14 07:15:13 +0800 |
commit | d4be90f9b25a398cafa91adec4098847ee4198cf (patch) | |
tree | dfbf85264f01cec237ab2785166f9446be124680 /widgets/table | |
parent | 6e67c20da8be56717c25807b65af8c8723e7e78c (diff) | |
download | gsoc2013-evolution-d4be90f9b25a398cafa91adec4098847ee4198cf.tar gsoc2013-evolution-d4be90f9b25a398cafa91adec4098847ee4198cf.tar.gz gsoc2013-evolution-d4be90f9b25a398cafa91adec4098847ee4198cf.tar.bz2 gsoc2013-evolution-d4be90f9b25a398cafa91adec4098847ee4198cf.tar.lz gsoc2013-evolution-d4be90f9b25a398cafa91adec4098847ee4198cf.tar.xz gsoc2013-evolution-d4be90f9b25a398cafa91adec4098847ee4198cf.tar.zst gsoc2013-evolution-d4be90f9b25a398cafa91adec4098847ee4198cf.zip |
This new function updates the minimum width of all of the columns based on
2001-02-13 Christopher James Lahey <clahey@ximian.com>
* e-table-header.c, e-table-header.h
(e_table_header_update_horizontal): This new function updates the
minimum width of all of the columns based on the data contained in
that column.
* e-table.c, e-table.h (changed_idle): Added a
horizontal_scrolling field. Call e_table_header_update_horizontal
if the model changes at all and horizontal_scrolling is set to TRUE.
svn path=/trunk/; revision=8214
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-table-header.c | 21 | ||||
-rw-r--r-- | widgets/table/e-table-header.h | 1 | ||||
-rw-r--r-- | widgets/table/e-table.c | 18 | ||||
-rw-r--r-- | widgets/table/e-table.h | 2 |
4 files changed, 41 insertions, 1 deletions
diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c index 6c0d69a82d..58d60480cd 100644 --- a/widgets/table/e-table-header.c +++ b/widgets/table/e-table-header.c @@ -789,6 +789,26 @@ eth_calc_widths (ETableHeader *eth) gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]); } +void +e_table_header_update_horizontal (ETableHeader *eth) +{ + int i; + int cols; + + cols = eth->col_count; + + for (i = 0; i < cols; i++) { + int width; + + gtk_signal_emit_by_name (GTK_OBJECT (eth), + "request_width", + i, &width); + eth->columns[i]->min_width = width + 10; + eth->columns[i]->expansion = 1; + } + enqueue(eth, -1, eth->nominal_width); +} + GtkType e_table_header_get_type (void) { @@ -811,4 +831,3 @@ e_table_header_get_type (void) return type; } - diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h index 6476c25d47..92ee20c731 100644 --- a/widgets/table/e-table-header.h +++ b/widgets/table/e-table-header.h @@ -79,6 +79,7 @@ int e_table_header_col_diff (ETableHeader *eth, void e_table_header_calc_widths (ETableHeader *eth); GList *e_table_header_get_selected_indexes (ETableHeader *eth); +void e_table_header_update_horizontal (ETableHeader *eth); #endif /* _E_TABLE_HEADER_H_ */ diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index b48d4d95a3..c0841deaf7 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -189,6 +189,8 @@ e_table_init (GtkObject *object) e_table->need_rebuild = 0; e_table->rebuild_idle_id = 0; + e_table->horizontal_scrolling = FALSE; + e_table->click_to_add_message = NULL; e_table->drag_get_data_row = -1; @@ -510,6 +512,9 @@ changed_idle (gpointer data) et->need_rebuild = 0; et->rebuild_idle_id = 0; + if (et->horizontal_scrolling) + e_table_header_update_horizontal(et->header); + return FALSE; } @@ -527,6 +532,8 @@ et_table_row_changed (ETableModel *table_model, int row, ETable *et) if (!et->need_rebuild) { if (e_table_group_remove (et->group, row)) e_table_group_add (et->group, row); + if (et->horizontal_scrolling) + e_table_header_update_horizontal(et->header); } } @@ -545,6 +552,8 @@ et_table_row_inserted (ETableModel *table_model, int row, ETable *et) if (row != row_count - 1) e_table_group_increment(et->group, row, 1); e_table_group_add (et->group, row); + if (et->horizontal_scrolling) + e_table_header_update_horizontal(et->header); } } @@ -556,6 +565,8 @@ et_table_row_deleted (ETableModel *table_model, int row, ETable *et) e_table_group_remove (et->group, row); if (row != row_count) e_table_group_decrement(et->group, row, 1); + if (et->horizontal_scrolling) + e_table_header_update_horizontal(et->header); } } @@ -1025,6 +1036,13 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, gtk_widget_push_colormap (gdk_rgb_get_cmap ()); e_table->header = et_state_to_header (e_table, e_table->full_header, state); + e_table->horizontal_scrolling = specification->horizontal_scrolling; + if (specification->horizontal_scrolling) { + gtk_object_set(GTK_OBJECT(e_table->header), + "horizontal_scrolling", TRUE, + NULL); + } + e_table->sort_info = state->sort_info; e_table->group_info_change_id = diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index 7aea980c13..b2161dd0ef 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -76,6 +76,8 @@ typedef struct { guint draw_grid : 1; guint draw_focus : 1; guint row_selection_active : 1; + + guint horizontal_scrolling : 1; char *click_to_add_message; GnomeCanvasItem *click_to_add; |