views:

50

answers:

1

Hi.

I trying to create custom GtkCellRenderer with some text. And I want this text truncated, when a size of GtkCellRenderer is smaller than size of text. For example:

alt text

How can I do this? Is this some property of CellRenderer or PangoLayout or I need to do this manually?

P.S. Sorry for my English.

A: 

Use the ellipsize and ellipsize-set properties of GtkCellRendererText.

If you want to do it manually with Pango, use pango_layout_set_ellipsize().

ptomato
But I'm extending GtkCellRenderer, not GtkCellRendererText.
troorl
Why not subclass `GtkCellRendererText`? Do you want to make something like in the picture you posted? Then you would be better off using two columns, one with `GtkCellRendererPixbuf` and one `GtkCellRendererText`. But also see edit above.
ptomato
Thank you, pango_layout_set_ellipsize - probably is what I need. But when I use it, instead of the text displayed only three dots. Maybe I missed something.
troorl
You need to use it in combination with `pango_layout_set_width()`.
ptomato