GtkLabel with GtkRcStyle to set the background colour



Does GTK 1.2 allow this?  I have been able to change the foreground colour with roughly the same code but changing the background colour doesn't work. 

Here is the code I'm using....

 

  GtkRcStyle *rc_style;

  GdkColor colour;

 

  colour.red = 0;

  colour.green = 0xffff;

  colour.blue = 0;

 

  /* create new style */

  rc_style = gtk_rc_style_new();

 

  rc_style->fg[GTK_STATE_NORMAL] = colour;

  rc_style->color_flags[GTK_STATE_NORMAL] = GTK_RC_FG;

 

  gtk_widget_modify_style(GTK_WIDGET(usr->controls.label_usr),rc_style);

  gtk_rc_style_unref(rc_style);

 

 

The above code works fine for the foreground of a label, but when I change

rc_style->fg[GTK_STATE_NORMAL] = colour;

to

rc_style->bg[GTK_STATE_NORMAL] = colour;

 

and

rc_style->color_flags[GTK_STATE_NORMAL] = GTK_RC_FG;

to

rc_style->color_flags[GTK_STATE_NORMAL] = GTK_RC_BG;

 

It does nothing,

 

Anyone been here before?

 

Regards,

 

Martyn



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