aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-cell-text.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-01-22 01:55:16 +0800
committerChris Lahey <clahey@src.gnome.org>2002-01-22 01:55:16 +0800
commita10b9d3aa15f17e0693345979a2d219220761eb3 (patch)
tree586679c4b2fa1ac1523f9f8f48e27d06c062a495 /widgets/table/e-cell-text.c
parent88646d5173fa9a3a3db43c328a76f10d3787b26c (diff)
downloadgsoc2013-evolution-a10b9d3aa15f17e0693345979a2d219220761eb3.tar.gz
gsoc2013-evolution-a10b9d3aa15f17e0693345979a2d219220761eb3.tar.zst
gsoc2013-evolution-a10b9d3aa15f17e0693345979a2d219220761eb3.zip
Implement max_width_by_row.
2002-01-21 Christopher James Lahey <clahey@ximian.com> * e-cell-text.c: Implement max_width_by_row. * e-cell-tree.c: Use max_width_by_row in max_width function. * e-cell.c, e-cell.h (e_cell_max_width_by_row): Added this new method to ECell. svn path=/trunk/; revision=15418
Diffstat (limited to 'widgets/table/e-cell-text.c')
-rw-r--r--widgets/table/e-cell-text.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 63a78a5a98..1fc6b1ef50 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -1209,6 +1209,34 @@ ect_max_width (ECellView *ecell_view,
return max_width;
}
+static int
+ect_max_width_by_row (ECellView *ecell_view,
+ int model_col,
+ int view_col,
+ int row)
+{
+ /* New ECellText */
+ ECellTextView *text_view = (ECellTextView *) ecell_view;
+ CurrentCell cell;
+ struct line *line;
+ int width;
+
+ if (row >= e_table_model_row_count (ecell_view->e_table_model))
+ return 0;
+
+ build_current_cell (&cell, text_view, model_col, view_col, row);
+ split_into_lines (&cell);
+ calc_line_widths (&cell);
+
+ line = (struct line *)cell.breaks->lines;
+ width = e_font_utf8_text_width (text_view->font, cell.style,
+ line->text, line->length);
+ unref_lines (&cell);
+ unbuild_current_cell (&cell);
+
+ return width;
+}
+
static gint
tooltip_event (GtkWidget *window,
GdkEvent *event,
@@ -1505,6 +1533,7 @@ e_cell_text_class_init (GtkObjectClass *object_class)
ecc->print = ect_print;
ecc->print_height = ect_print_height;
ecc->max_width = ect_max_width;
+ ecc->max_width_by_row = ect_max_width_by_row;
ecc->show_tooltip = ect_show_tooltip;
ecc->get_bg_color = ect_get_bg_color;