Re: [gtk-list] Re: Problem with ColorContexts
- From: Rob Browning <rlb cs utexas edu>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Problem with ColorContexts
- Date: 12 Mar 1998 15:42:30 -0600
Federico Mena <federico@nuclecu.unam.mx> writes:
> Hmmm. Could you please show me the code where you allocate the colors
> and hand them to the clist?
Here's where I set up the stuff:
static GdkColor split_row_color;
static GdkColorContext *color_context = NULL;
static int
allocate_colors() {
if(!color_context) {
gint n;
color_context =
gdk_color_context_new(gtk_widget_get_visual(main_window),
gtk_widget_get_colormap(main_window));
assert(color_context);
split_row_color.pixel = 0; /* this is important! */
split_row_color.red = 60000; /* Just a test */
split_row_color.green = 0;
split_row_color.blue = 0;
n = 0; /* this is important! */
gdk_color_context_get_pixels (color_context,
&split_row_color.red,
&split_row_color.green,
&split_row_color.blue,
1, &split_row_color.pixel, &n);
assert(n == 1);
}
return(0);
}
Then elsewhere (I know this gets executed because the list gets filled
in):
allocate_colors();
...
gint new_row = gtk_clist_append(GTK_CLIST(clist), rowstrs);
gtk_clist_set_background(GTK_CLIST(clist),
new_row, &split_row_color);
Thanks
--
Rob Browning <rlb@cs.utexas.edu>
PGP fingerprint = E8 0E 0D 04 F5 21 A0 94 53 2B 97 F5 D6 4E 39 30
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]