Changing color for a peculiar GtkCellRendererText
- From: Julien Portalier <julien portalier com>
- To: gtk-app-devel-list gnome org
- Subject: Changing color for a peculiar GtkCellRendererText
- Date: Mon, 29 Jul 2002 01:00:02 +0200
Hello,
I dare say I'm completely lost with the new GtkTree code of GTK2.0...
I've been able to set everything, and things looks like to work
(hopefully)
But, i would like to be able to set a foreground color to a text in a
particuliar GtkCellRendererCell, i can do it quite easily when creating
the GtkListStore, by changing the property "foreground" (that's python
code) :
---
// Creating GtkTreeView object :
treeview = gtk.TreeView( gtk.ListStore( gobject.TYPE_STRING,
gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING,
gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING ) )
treeview.set_rules_hint( gtk.TRUE )
treeview.set_search_column( COL_Line )
cell = gtk.CellRendererText()
// Setting a foreground color (red) to the cell's text :
cell.set_property( "foreground-set", gtk.TRUE )
cell.set_property( "foreground", "#ff0000" )
column = gtk.TreeViewColumn( '', cell, text=COL_Line )
column.set_sizing( gtk.TREE_VIEW_COLUMN_FIXED )
column.set_fixed_width( 30 )
column.set_clickable( gtk.TRUE )
treeview.append_column( column )
---
But, i'd like to be able to change the foreground color whenever i want,
and not only during creation... the best way to achieve it would be to
change properties like above, but i can't find a way to get the
GtkCellRenderer Object for a peculiar cell ... something like :
---
cell = TreeView.get_Model().get_cell_renderer_text( iter, column )
cell.set_property( "foreground-set", gtk.TRUE )
cell.set_property( "foreground", "#ff0000" )
---
Is there another way to achieve this, or did i miss something in Gtk+
2.0 API Ref. ?
thx in advance,
Julien
ps: i'm using python code here, but you can give me C way to go, it
doesn't matter.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]