Re: cell word wrapping

On Jan 19, 2005, at 11:17 PM, Kevin C. Krinke wrote:

Is there a way to set a Gtk2::CellRendererText to word-wrap it's contents?

Put newlines in the text strings.


I've been trying with Gtk2::Pango::Layouts but can't figure out how to apply them to a cellrenderer.

GtkCellRendererText creates and initializes a new PangoLayout every time it needs to calculate the size of a cell or draw a cell. It's also private, so you can't get a handle to it.

Create your own cell renderer and you can do whatever you want with your layouts. If you let the renderer wrap, then you'll need some "interesting" logic for choosing a size when the column is in autosize mode. My memory may be fuzzy, but i seem to recall learning while writing Mup::CellRendererMultiline in Gtk2/examples/ that there are deficiencies in the TreeView design that make it impossible to write a cellrenderer that can change size while editing. (I wanted to have a Mac Aqua-style multi-line editable cell in Torsten's odot...)

I've also run into the problem of not being able to find any practical help regarding Gtk2::Pango::AttrList. I can get an AttrList from $cell->get_property( 'attributes' ) but what can I do with it? If I try any methods on it I get the "can't call method on an undefined value" even though a Dumper() reveals a blessed Gtk2::Pango::AttrList.

It would appear that you have stumbled into one of the back corners of the API that we don't have bound. A PangoAttrList is what Pango markup gets parsed into; it's a collection object for PangoAttrs, and, well, we never bound it, probably because it seemed pretty esoteric.

If you find you need this, we'll get it on the todo list. If the job isn't too big and we can get it tested quickly, we may be able to make an API freeze break. Otherwise, it will have to wait for 1.10x. :-(

She's obviously your child. She looks like you, she talks a lot, and most of it is gibberish.
  -- Elysse, to me, of Zella.

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