Question about CellRendererText foreground font color change...



Hi all,

I have a TreeView widget and I'm trying to get the font color in a
column to change to something other than black.

For example, say I create a column:

Gtk::TreeView::Column* col = Gtk::manage(
    new Gtk::TreeView::Column( "First Column"));
col->pack_start( columns.first_column, TRUE );


Then I grab the cell renderers for the newly created column and
convert to a CellRendererText pointer (because columns.first_column is
a TreeModelColumn<Glib::ustring> type).

std::vector<Gtk::CellRenderer*> rends = col->get_cell_renderers();
Gtk::CellRendererText* name_rend = rends[0];


Now, I want to set the background color. No problem.

name_rend->property_background() = "red";

This will produce a red column with black text printed over it.

But if I try to set the foreground color, like so:

name_rend->property_foreground() = "green";

...the text stays black. I've even tried setting the
property_foreground_set() property to "true" but that seems to do
nothing. I've looked at the Pango::FontDescription to see if that
would help me, but it has no reference at all to color of any kind.
The only thing I could find was the Pango::AttrColor, but I have no
idea how to get that set in the CellRendererText object.

So...how *do* I set the foreground font color?  I'm obviously not
getting it. :-)
--
R. Douglas Barbieri
doug dooglio net



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