Sylvain Vedrenne wrote: > Hi, > > In my Gtkmm application, I would like the "background" to be black and the > statusbar to be of the standard color (grey, in my configuration). > > I would like to find out how to avoid the statusbar to be the same color as > the > widget behind (except for the resize grip which is Ok). > > It seems to work using Xfc (another C++ port), > but I cannot find out how to make it work using Gtkmm. > > The sample code below (Gtk+ only) shows what the problem is, using red and > green. In this example, the desired color for the statusbar is green. > > Thanks in advance for any help. > Sylvain. > > #include <gtk/gtk.h> > > static void > on_destroy (GtkWidget * widget, gpointer data) > { > gtk_main_quit (); > } > > int > main (int argc, char *argv[]) > { > GtkWidget *window; > GtkWidget *widget; > > gtk_init (&argc, &argv); > window = gtk_window_new (GTK_WINDOW_TOPLEVEL); > gtk_container_set_border_width (GTK_CONTAINER (window), 20); > gtk_window_set_default_size (GTK_WINDOW (window), 200, 100); > g_signal_connect (G_OBJECT (window), "destroy", > G_CALLBACK (on_destroy), NULL); > > widget = gtk_statusbar_new(); /* color problem using gtk_statusbar */ > //widget = gtk_label_new ("Hello, World"); /* problem also using gtk_label */ > //widget = gtk_button_new(); /* no problem using gtk_button */ > > GdkColor my_red; > my_red.red = 0xffff; > my_red.green = 0x0000; > my_red.blue = 0x0f00; > gtk_widget_modify_base( window, 0, &my_red ); > gtk_widget_modify_bg( window, 0, &my_red ); > gtk_widget_modify_fg( window, 0, &my_red ); > > GdkColor my_green; /* I would like the statusbar to be of that color! */ > my_green.red = 0x0000; > my_green.green = 0xffff; > my_green.blue = 0x0f00; > > gtk_widget_modify_base( widget, 0, &my_green ); > gtk_widget_modify_bg( widget, 0, &my_green ); > gtk_widget_modify_fg( widget, 0, &my_green ); > > gtk_container_add (GTK_CONTAINER (window), widget); > gtk_widget_show_all (window); > gtk_main (); > return 0; > } > Finally I found the solution in this old thread: http://mail.gnome.org/archives/gtk-list/2004-October/msg00002.html It says to: "Put your [...in my case: "statusbar"] in an eventbox and then change the background of the eventbox."
My Xfc application that didn't present the problem was using a Gtk EventBox itself. Thanks ;-) Best Regards, -- Sylvain http://sylvain.vedrenne.free.fr _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list