Re: Coloring an entire row at a GtkTreeView



On Sat, 2007-06-30 at 17:50 -0300, Diogo Ramos wrote:

> Sorry to bother you with, which seems to be a simple question, but I am
>  out of ideas.
> 
> I am trying to coloring an entire row of a GtkTreeView.
> After some search I discovered "GTK+ 2.0 Tree View Tutorial" from
> Tim-Philipp M�which taught me A LOT about tree views and the
> paradigm of model-view.
> Ok, said that, I am now able to paint an entire row, and just the row,
> with a color of my choice but, the problem is that I am unable to do
> that at execution time, just at the compilation time because the column
> which has to be read for the renderer knows if the color should be
> displayed or not isn't and I do not know why.

To colour things at run-time, based on data in your model, use 
gtk_tree_view_column_set_cell_data_func() on each column you want to
colour:
http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeViewColumn.html#gtk-tree-view-column-set-cell-data-func

This will get called for every cell, each time it's rendered, and it's
in here that you set the renderer's background to your desired colour.

See also:
http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeViewColumn.html#GtkTreeCellDataFunc


--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au




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