Re: Setting background color for the widget of my application



Ignacio Nodal <inodal teleline es> writes:
> Is this function the correct one to change the background color of my
> widgets?
> 
> void gtk_widget_set_style(GtkWidget *widget,GtkStyle *style);
> 
> I mean... modifying the "GdkColor bg[5]" field in the GtkStyle
> structure..
> 

No, should use the gtk_widget_modify_style() function instead:

  rc_style = gtk_rc_style_new ();
  rc_style->bg[GTK_STATE_NORMAL].red = 65535;
  rc_style->bg[GTK_STATE_NORMAL].green = 0;
  rc_style->bg[GTK_STATE_NORMAL].blue = 0;
  rc_style->color_flags[GTK_STATE_NORMAL] = GTK_RC_BG;
  gtk_widget_modify_style (drawing_area, rc_style);
  gtk_rc_style_unref (rc_style);

Havoc




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