Re: Changing window color



On Thu, 30 Jan 2003, Liviu BURCUSEL wrote:

On 30 Jan 2003 10:30:08 +0000
Gustavo J. A. M. wrote:

On Thu, 2003-01-30 at 08:57, Liviu BURCUSEL wrote:
Hello !

I've written a small application using GTK-1.2 and only one problem
still remains open. From time to time I need to change the main
window background from the default gray to red and back to gray but
I don't know how. Please point me the right documentation or give me
a hint in how to do that.

  1. Switch to Gtk+ 2.2 ;)
  2. Use this:
    http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-modify-bg

I can't switch because the computer the program is running on is very
old/slow.  The link does not help me very much because of "undefined
reference to `gtk_widget_modify_bg'". I'll keep on searching :)

Thanks


Hello,

  you could use the style of a widget :


  GtkWidget *w;
  GdkColor col = {0, 0xffff, 0x0000, 0x0000};
  GtkStyle *style;

  w = gtk_window_new(GTK_WINDOW_TOPLEVEL);

  style = gtk_widget_get_style (w); 
  style->bg[GTK_STATE_NORMAL] = col;
  gtk_widget_set_style (w, style);


and the background is red.  

regards

Vincent TORRI

-- 
TORRI Vincent
Mathematiques Appliquees Bordeaux                                                
Institut de Mathematiques                                                       
Universite Bordeaux 1                                                           
351 cours de la liberation                                                      
33 405 Talence cedex - France                                                   
                                                                                
Tel : 33 (0)5 57 96 21 42                                                       
Fax : 33 (0)5 56 84 26 26                                                       
--




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