Re: finding original cell background color in TreeView renderer



On Tue, 2008-04-29 at 08:49 -0500, Joaquim Schmidlap wrote:
> I have a TreeView. Each column has a custom rendering callback  
> function, which I use to change the color and formatting of the text  
> in each cell as the data changes.
> 
> Under certain data conditions, I change the background color of the  
> cell to be red, to get the user's attention. I do this with  
> Gtk::CellRendererText::property_background_gdk() and it works great.
> 
> When the error condition clears, I need to set the color back to the  
> default, since using properties like this seems to be "sticky." In  
> other words, that cell will stay red until I change it. The problem I  
> have now is that when I have set_rules_hint(true) for the TreeView, I  
> need to figure out what color this cell should be based on the  
> alternating row colors.
> 
> Is there a way to query the TreeView for what a given row's  
> background color "should" be based on the hints? Clearly, it must be  
> down in the implementation somewhere, but is this interface exposed  
> to us?
> 
> I know I could query the background of some other cell in the row  
> that didn't change, or maybe stuff the color in the model somewhere,  
> but that feels a little funky to me. Seems like the TreeView must  
> know if a given row is odd or even, and therefore what the color  
> should be.

I guess setting property_background_set() to false in the CellRenderer
should do the trick.

Armin



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