Setting foreground color for rows in a TreeView
- From: "Joost Ellerbroek" <j ellerbroek gmail com>
- To: gtkmm-list gnome org
- Subject: Setting foreground color for rows in a TreeView
- Date: Wed, 9 Aug 2006 10:38:20 +0200
I've had a look at the mailinglist archive, but only found an example of setting individual cell background.
This I did get to work, but when I try to adapt it to change foreground color nothing happens: all text stays black.
Could this have something to do with gtk styles?
This is what I do now:
-----------------------------------------------
Gtk::CellRendererText* cell_renderer;
expModelPtr pModel = expModelPtr::cast_dynamic(pView->get_model());
vector<Gtk::TreeViewColumn*> columns = pView->get_columns();
for(vector<Gtk::TreeViewColumn*>::iterator iter = columns.begin(); iter != columns.end(); iter++)
{
cell_renderer = dynamic_cast<Gtk::CellRendererText*>((*iter)->get_first_cell_renderer());
(*iter)->add_attribute(cell_renderer->property_foreground(), pModel->colrecord.m_col_color);
};
-----------------------------------------------
This method works with a Gtk::CellRenderer* and property_cell_background().
The TreeView only contains text columns, so according to the api reference, dynamic_cast<Gtk::CellRendererText*>() should work.
Any ideas?
Joost
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]