diff options
Diffstat (limited to 'widgets/e-table/e-cell-toggle.c')
-rw-r--r-- | widgets/e-table/e-cell-toggle.c | 23 |
1 files changed, 23 insertions, 0 deletions
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); } |