Re: [gtk-list] gtk_clist & individual item colors




Ray Clouse <ray.clouse@boeing.com> writes:

> I've gone through a few months of the archives, looked in the Harlow
> book, and the docs for clists, but have found nothing on how to change
> an individual item's color.
> 
> What I want to do is set text colors in gnomePM (portfolio manager) so
> the positives are green and the negatives are red.  But leave everything
> else alone.  And, of course, I do not want to change an entire row's
> color.

The function you are looking for is gtk_clist_set_cell_style().
There are some examples of using it in testgtk.c.

[ The way to "leave everything else alone" is to copy the clist's
  style with:

 gtk_widget_ensure_style (clist);
 my_style = gtk_style_copy (gtk_widget_get_style (clist));
 my_style->fg_gc[GTK_STATE_NORMAL] = ...
 
 If you want to make that the colors react properly to theme changes,
 then instead of calling ensure_style, you should do this in 
 a "style_set" handler. ] 

Regards,
                                        Owen



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