Re: Changing background color of text in statusbar

2004-10-01 Thread Viraj Chatterjee
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 [EMAIL PROTECTED]
To: gtk-list [EMAIL PROTECTED]
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
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list 
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Changing background color of text in statusbar

2004-10-01 Thread John Cupitt
Also, consider setting colours via a grkrc file rather than in your
code. As Viraj says, make an event box, set a name for it with
gtk_widget_set_name()  (maybe status_bar?), then in a gtkrc for your
application have something like:

style red_style = default
{
bg[NORMAL] = #C1665A
bg[PRELIGHT] = #E0B6AF
bg[ACTIVE] = #C1665A
bg[SELECTED] = #C1665A
bg[INSENSITIVE] = #884631
}

widget *status_bar style red_style

Easier to program, and easier for other people to change if they don't like red.

On Fri, 01 Oct 2004 18:05:43 +0530, Viraj Chatterjee [EMAIL PROTECTED] wrote:
 Put your gtk_label in an eventbox and then change the background of the
 eventbox.

  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!
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Changing background color of text in statusbar

2004-10-01 Thread Egon Andersen
Viraj Chatterjee wrote:
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.
Do you mean www.gtk.org FAQ chapter 6.1 ?
I don't see anything called 'Common queries'...
-vc
I can't just put the label in an eventbox. The label is a part of the 
GtkStatusbar.
So I can't see how I can put it in an eventbox - unless I should put the 
entire GtkStatusbar in an eventbox?

Best regards
Egon Andersen
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list