GTK Labels



I have a problem trying to use the code to set label foreground and
background color using the following code.  The code does work for text
boxes and I thought it would be identical for all widgets.  Can you tell me
if I am missing the point somehow?

Thanks,
Mike

void ColorSet (GtkWidget *target,
   GdkColor *newColor,
   int foreground)
{
   GtkStyle *style;
   gint i;

   style = gtk_style_copy (gtk_widget_get_style (target));

   if (foreground)
   {
      // Foreground color.
      for (i = 0; i < 5; i++)
      {
         style->text[i] = *newColor;
      }
   }
   else
   {
      // Background color.
      for (i = 0; i < 5; i++)
      {
         style->base[i] = *newColor;
      }
   }

   gtk_widget_set_style (target, style);
}





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