word wrapping in GtkCellRendererText



Hi,

I'm trying to add word-wrapping to GtkCellRendererText.  So far I have
added a word_wrap property and used it when setting up the PangoLayout. 
This works great when testing if I hardcode a width by calling
pango_layout_set_width().  However I don't want to add another property
for the wrap width, I want to set the layout width from the current
width of the column.

The layout is created in get_layout(), which is passed cell_area.  I
have found that cell_area->width is larger than the visible column
width, so it's of no use to set the layout width.

I found the following code in GtkTreeView.  It determines the real
column width to pass to the cell editor.  This is the width I need for
the layout, but unfortunately this code can not be used in the cell
renderer as the renderer has no knowledge of the column.

gint left, right;
GdkRectangle area;
                                                                                                                  area = cell_area;
_gtk_tree_view_column_get_neighbor_sizes (column,
    _gtk_tree_view_column_get_edited_cell (column), &left, &right);
                                                                                                                                area.x += left;
area.width -= right + left;

How can I determine the actual column width from get_layout() in the
renderer?

Thanks,
Nathan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]