Hi, I managed to create my very own CellRenderer for displaying a color box
on a row in a TreeView widget. Now I would like to set that box color with
a color TreeModelColumnRecord I declared earlier of type:
*Gtk::TreeModelColumn< Gdk::Color >* columnColor
I used these lines to add the column for my color box and used the
*add_atribute()
*to relate it to the model like so:
int cols_count = view->append_column("Color", *zoneColorRenderer );
Gtk::TreeViewColumn* pColumn = view->get_column(cols_count - 1);
if(pColumn)
{
pColumn->add_attribute(zoneColorRenderer->property_color(),
zoneModel.columnColor);
}
Gtk::TreeModel::Row row = *( referenceZones->append() );
Gdk::Color color;
double red = 1;
double green = 1;
double blue = 0;
color.set_rgb_p( red, green, blue );
row[zoneModel.columnColor] = color;
In my cell renderer called zoneColorRenderer I have a method called
property_color() that relates to an internal attribute of type *
Glib::PropertyProxy<Gdk::Color>* stored in a Gtk::ColorButton* like so:
Glib::PropertyProxy<Gdk::Color> property_color()
{
return this->button->property_color();
}
This is the attribute:
Gtk::ColorButton* button;
It's initialized in the constructor. When I run my application the
cellRenderer paints splendidly a black box ( no color set ). It appears it
is not relating the model's color with the ColorButton's property_color(),
can anyone help me??
Thanks
--
teratux
------------
http://teratux.blogspot.com
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list