Re: colors in treeview



Karel Honzl wrote:
Is it possible to create treeview in which I can set color (text color) of
certain row?
I want to hightlight some rows.

You may want to take a look at the way GtkCellRenderers [1] work.
Before rendering a particular row, your tree view sets the attributes registered with gtk_tree_view_insert_column_with_attributes on the cell renderer based on the column data you specified, afterwards requesting a render. The properties not registered with the GtkTreeView are used for rendering but not modified by the tree view. For instance for getting bold text, you can set the "weight" attribute of the cell renderer to PANGO_WEIGHT_BOLD, and add a new boolean column to your model which is passed as "weight-set" attribute column inside the treeview registration call. If you don't want to mess around with additional columns, and your "weight-set" value depends on the state of some object, you can also use


     gtk_tree_view_insert_column_with_data_func for the column and
     manually set all the attributes based on the object state.


[1] http://developer.gnome.org/doc/API/2.0/gtk/GtkCellRendererText.html



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