statusbar foreground color: solved
- From: carlos pehoe civil ist utl pt (Carlos Pereira)
- To: gtk-app-devel-list gnome org
- Subject: statusbar foreground color: solved
- Date: Mon, 8 Sep 2003 22:55:50 +0100 (WEST)
I solved my problem with the statusbar foreground color!
After looking into the code I have found that a GtkStatusbar
is essentially a label mounted on top of a frame packed into
a hbox... Therefore everything that is usually applied to a
label (for example on a button) can equally be applied to a
statusbar. Not only changing the foreground color is easy,
but changing the message alignment is also easy as well
(see examples below).
I believe even the usual pop/push mechanisms could be completely
circumvented, just by using gtk_label_set_text, though this
is probably not recommended, particularly in multi-threaded,
multi-process code (because of the contexts).
Carlos
----------------------Gtk 1.2-----------------
GdkColor color;
GtkStyle *style;
GtkWidget *label = GTK_STATUSBAR (statusbar)->label;
/* change statusbar foreground color to red */
gdk_color_parse ("red", &color);
style = gtk_style_copy (gtk_widget_get_style (label));
style->fg[GTK_STATE_NORMAL] = color;
style->fg[GTK_STATE_ACTIVE] = color;
style->fg[GTK_STATE_PRELIGHT] = color;
style->fg[GTK_STATE_SELECTED] = color;
style->fg[GTK_STATE_INSENSITIVE] = color;
gtk_widget_set_style (label, style);
gtk_style_unref (style);
/* align statusbar message in the center */
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]