From 22f72cc08e20c7871d93f05375fe2bafb0c1023a Mon Sep 17 00:00:00 2001 From: Iain Holmes Date: Fri, 15 Sep 2000 00:08:06 +0000 Subject: Fix some crashes Make double clicking on the header dividers automatically Fix some crashes Make double clicking on the header dividers automatically size the header to it's best fit. When dragging onto the header check the dragged item is a header object. Check the column is resizeable before setting the cursor to <-> Use the font and themes to draw the table and items. svn path=/trunk/; revision=5438 --- widgets/e-table/e-cell-toggle.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'widgets/e-table/e-cell-toggle.c') diff --git a/widgets/e-table/e-cell-toggle.c b/widgets/e-table/e-cell-toggle.c index f0a05b488a..e18f4b33e7 100644 --- a/widgets/e-table/e-cell-toggle.c +++ b/widgets/e-table/e-cell-toggle.c @@ -223,6 +223,28 @@ etog_height (ECellView *ecell_view, int model_col, int view_col, int row) return toggle->height; } +/* + * ECell::max_width method + */ +static int +etog_max_width (ECellView *ecell_view, int model_col, int view_col) +{ + ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell); + void *_value = e_table_model_value_at (ecell_view->e_table_model, model_col, 0); + int max_width = gdk_pixbuf_get_width (toggle->images[GPOINTER_TO_INT (_value)]); + int number_of_rows; + int row; + + number_of_rows = e_table_model_row_count (ecell_view->e_table_model); + for (row = 1; row < number_of_rows; row++) { + void *_value = e_table_model_value_at (ecell_view->e_table_model, + model_col, row); + max_width = MAX (max_width, gdk_pixbuf_get_width (toggle->images[GPOINTER_TO_INT (_value)])); + } + + return max_width; +} + static void etog_destroy (GtkObject *object) { @@ -251,6 +273,7 @@ e_cell_toggle_class_init (GtkObjectClass *object_class) ecc->draw = etog_draw; ecc->event = etog_event; ecc->height = etog_height; + ecc->max_width = etog_max_width; parent_class = gtk_type_class (PARENT_TYPE); } -- cgit v1.2.3