Re: Changing background color of text in statusbar



Put your gtk_label in an eventbox and then change the background of the eventbox.
Look at:

3.1.
How do I change the color of a widget?
in the Common queries at the GTK+ web site.
-vc
----- Original Message ----- From: "Egon Andersen" <post talura dk>
To: "gtk-list" <gtk-list gnome org>
Sent: Friday, October 01, 2004 5:54 PM
Subject: Changing background color of text in statusbar


Hi,

I've been trying to change the background colour for the text dispalyed in a statusbar, but I don't get it as I want it!

I simply want the background of the text to be red, but it seems to be quite difficult - or I've just missed something. (Probably the later :-)

I've tried a lot of things including use of 'private' variables in the GtkStatusbar structure!

The following sample code gives me a red frame and a little red square to the right in the statusbar - not quite what I want!



Sample code:
   gtk_widget_modify_bg(active_statusbar, GTK_STATE_NORMAL, &red);
   gtk_widget_modify_bg(active_statusbar, GTK_STATE_ACTIVE, &red);
   gtk_widget_modify_bg(active_statusbar, GTK_STATE_PRELIGHT, &red);
   gtk_widget_modify_bg(active_statusbar, GTK_STATE_SELECTED, &red);
   gtk_widget_modify_bg(active_statusbar, GTK_STATE_INSENSITIVE, &red);
gtk_widget_modify_bg(GTK_STATUSBAR(active_statusbar)->frame, GTK_STATE_NORMAL, &red); gtk_widget_modify_bg(GTK_STATUSBAR(active_statusbar)->frame, GTK_STATE_ACTIVE, &red); gtk_widget_modify_bg(GTK_STATUSBAR(active_statusbar)->frame, GTK_STATE_PRELIGHT, &red); gtk_widget_modify_bg(GTK_STATUSBAR(active_statusbar)->frame, GTK_STATE_SELECTED, &red); gtk_widget_modify_bg(GTK_STATUSBAR(active_statusbar)->frame, GTK_STATE_INSENSITIVE, &red); gtk_widget_modify_bg(GTK_STATUSBAR(active_statusbar)->label, GTK_STATE_NORMAL, &red); gtk_widget_modify_bg(GTK_STATUSBAR(active_statusbar)->label, GTK_STATE_ACTIVE, &red); gtk_widget_modify_bg(GTK_STATUSBAR(active_statusbar)->label, GTK_STATE_PRELIGHT, &red); gtk_widget_modify_bg(GTK_STATUSBAR(active_statusbar)->label, GTK_STATE_SELECTED, &red); gtk_widget_modify_bg(GTK_STATUSBAR(active_statusbar)->label, GTK_STATE_INSENSITIVE, &red);

if(GTK_LABEL(GTK_STATUSBAR(active_statusbar)->label)->mnemonic_widget != NULL)
      {

gtk_widget_modify_bg(GTK_LABEL(GTK_STATUSBAR(active_statusbar)->label)->mnemonic_widget, GTK_STATE_NORMAL, &red);

gtk_widget_modify_bg(GTK_LABEL(GTK_STATUSBAR(active_statusbar)->label)->mnemonic_widget, GTK_STATE_ACTIVE, &red);

gtk_widget_modify_bg(GTK_LABEL(GTK_STATUSBAR(active_statusbar)->label)->mnemonic_widget, GTK_STATE_PRELIGHT, &red);

gtk_widget_modify_bg(GTK_LABEL(GTK_STATUSBAR(active_statusbar)->label)->mnemonic_widget, GTK_STATE_SELECTED, &red);

gtk_widget_modify_bg(GTK_LABEL(GTK_STATUSBAR(active_statusbar)->label)->mnemonic_widget, GTK_STATE_INSENSITIVE, &red);
      }


Best regards
Egon Andersen
_______________________________________________
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]