RE: TreeView and setting row colors
- From: "Aaron Geier" <ageier catalystmicro com>
- To: "Jonathon Jongsma" <jonathon jongsma gmail com>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: RE: TreeView and setting row colors
- Date: Thu, 30 Aug 2007 13:29:49 -0600
Hello,
I've been able to use the CellRenderer properties to set the background
and foreground colors, thanks for the tips.
I am having some difficulties creating a custom cell_data_func. I did a
google search to see if I could find any examples where this was done,
but am not having any luck there.
Does anyone have an example of a custom cell_data_func?
Thanks
Aaron Geier
-----Original Message-----
From: Jonathon Jongsma [mailto:jonathon jongsma gmail com]
Sent: Wednesday, August 29, 2007 7:24 PM
To: Aaron Geier
Subject: Re: TreeView and setting row colors
On 8/29/07, Aaron Geier <ageier catalystmicro com> wrote:
> Hello all,
>
> I've been using the Gtk::Widget::modify_base and
> Gtk::Widget::modify_text to modify the background colors and
foreground
> colors of things like Gtk::Entry objects.
>
> I'm looking for a way to modify the base and text of a row in a
TreeView
> using the TreeStore model.
>
> The reason I want to do this, is to bring attention to certain rows in
> the TreeView using colors.
>
> I have been looking through the documentation, and I can't seem to
find
> a good way of doing this, or if it is even possible.
>
> Thanks,
> Aaron Geier
There are a couple methods for doing this. One is to use a custom
cell_data_func (see set_cell_data_func()) which determines what color
the cell should be. Once you've determined which color the cell
should be, you can set property_foreground_gdk() to change the color
that the cell is rendered in.
Another option is to add a new column of type Gdk::Color to your model
and relate that to the property_foreground_gdk() by using
Gtk::TreeViewColumn::add_attribute().
If you need further guidance, you can probably find several usage
examples by searching for property_foreground_gdk() or related
functions on google code search.
Hope that helps.
--
jonner
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]