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



> --------------------------------------------------------
> 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>



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