Re: drawing stuff inside the TreeView

On Wednesday 22 June 2005 17:18, Alexei D wrote:

  I need to create a Tree widget that has 1 column.
Each row in the column should contain a small circle
and some text (filename) next to it. The color of the
circle represents the file type. I have to draw
circles myself with gdk_draw_arc(). But I cannot see
how I can draw something inside the Tree Column.

  Then, how do I pack the circle AND text inside 1
column? Is it possible to put 2 things in 1 column,

The easiest way is to pack a pixbuf renderer with a text renderer into the 
same tree view column and use ready-made circles in form of GdkPixbufs. Just 
add another column of type GDK_TYPE_PIXBUF to your list store for that and 
connect the 'pixbuf' property of the pixbuf renderer to the column number of 
that model column via tree view column attributes (just like you do with the 
'text' property for the text renderer).

Alternatively, if you really must use gdk_draw_arc(), you can write a custom 
cell renderer, but that's a lot more work and probably slower as well.


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