setting clist row backgrounds



Hi,

I'm sure this must be an FAQ, or that I'm just being dumb, but I can't
figure this one out so was hoping someone could help.

I'm trying to set the background colour of a GtkCList row to an alternate
colour, and then later revert it back to the original CList row colour (ie.
respecting the relevant theme colour).
At the moment, to set a background colour I'm doing:

   GdkColor *col = malloc(sizeof(GdkColor));

   gdk_color_parse ("0022ff", col);
   gdk_colormap_alloc_color
(gdk_window_get_colormap(GDMconfigurator->window),
        col, TRUE, TRUE);
   gtk_clist_set_background (GTK_CLIST (get_widget("sessions_clist")),
        selected_session_row,
        col);

But this always gives me a really dubious coloured row background (red/pink
usually), and definitely not what I specified to gdk_color_parse().

I'm guessing this is me really missing something about the way GDK
handles/allocates colours, rather than my use of the set_background() calls,
but if anyone has any insight/examples to help with this, and retrieving a
CList's desired row background GdkColor, I'd be grateful.

Cheers,

Lee.







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