Re: [gtk-list] Re: Howto set colour?



Thanks for the reply Iain,
I got it working by following your advice:

This is the corrections I made if anybody else has the same problem.

  GtkStyle *style = gtk_style_copy (_ColorButtonFrame->style);

  GdkColor C;
  C.red   = (gushort)( 65535 * color[0] );
  C.green = (gushort)( 65535 * color[1] );
  C.blue  = (gushort)( 65535 * color[2] );

  style->bg[GTK_STATE_NORMAL] = C;
  gtk_widget_set_style( _ColorButtonDA, style );



Iain wrote:

> > Hi all,
> > I have a small problem:
> >
> > I would like to set the colour of a DrawingArea (or any other widget for
> > that matter).
>
> try changing the style of the widget...
>
> style = gtk_style_copy (drawingarea->style);
> style.bg[GTK_STATE_NORMAL] = colour;
> drawingarea->style = style;
>
> (NB: I haven't tried this and some names of things are almost 100% certain
> to be wrong, but I think the theory is right, if not the implementation)
>
> Iain
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null



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