Re: Change the color of GtkButton



Set the 'style' of the widget.. it's not very well documented.  Here's a function that'll change the color a widget.  Just use something like:

show_color_pref (button, color);

... you'll probably want to check out the style structure for details of what color you're changing.

-Paul


/* partially stolen from Gaim's prefs.c */
static GtkWidget *show_color_pref (GtkWidget *widget, gint *color)
{
  GdkColor c;
  GtkStyle *style;

  c.pixel = 0;
  c.red   = color[0] << 8;
  c.green = color[1] << 8;
  c.blue  = color[2] << 8;

  style = gtk_style_new ();
  style->bg[0] = c;
  style->bg[1] = c;

  gtk_widget_set_style (widget, style);
  return widget;
}

On Thu, 18 Apr 2002 13:20:22 +0800
"Shark" <leonheart 263 net> wrote:

> How could I change the color of GtkButton? I want to change it to white color? 				
> 
> ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Shark
> ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2002-04-18
> 
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list



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