Re: [gtk-list] Re: Setting Widget Attributes (Half Solution)





On Tue, 2 Jun 1998, Adrian E. Feiguin wrote:

> > --------------------------------------------------------
> > GtkWidget *label = NULL;
> > GtkStyle *LabelStyle = NULL;
> > GdkColor *fg = NULL;
> > GdkColor *bg = NULL;
> > 
> > label = gtk_label_new("Text");
> > LabelStyle = gtk_style_copy(gtk_widget_get_style(label);
> > gtk_widget_set_style(label,LabelStyle);
> > 
> > fg = (GdkColor *) malloc(sizeof(GdkColor));
> > bg = (GdkColor *) malloc(sizeof(GdkColor));
> > 
> > foreGroundColor->red = 0;
> > foreGroundColor->green = 200 * (65535/255);
> > foreGroundColor->blue = 0;
> > 
> > backGroundColor->red = 0;
> > backGroundColor->green = 0;
> > backGroundColor->blue = 0;
> > 
> > LabelStyle->fg[0] = *foreGroundColor;
> > LabelStyle->bg[0] = *backGroundColor;
> 
> 
> Maybe the right way to do it is:
> 
>  gdk_gc_set_foreground(label->fg_gc , foreGroundColor);
>  gdk_gc_set_foreground(label->bg_gc , backGroundColor);
>  
> Please, correct me if I'm wrong (or if it works), thanks,
> 
> <ADRIAN>

No that doesn't do it either.  Labels don't have a gc object.  The style 
object has the fg_gc and bg_gc objects, but they are arrays of 5 gc's, 
just like the colors.  

There has to be somebody here who has done this...

Later,
Ben Boule



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