Setting Entry Fonts and BG's



Hi,

I'm writing a little CD player "capplet" in GTK+ (just to help me learn the 
API...as I know several good ones already exist).  What I want to do is 
have a GtkTextEntry that displays the track number and song length that 
has a black background (as opposed to the default white), with alien 
green numbers (as opposed to the default black) in a really big font 
(which I may make user definable...just for the hell of it :-).  I 
thought that the way to do this would be with the GtkStyle widget, like:

GtkWidget *time;
GtkStyle *style;
.
.
.
time = gtk_entry_new ();
style = gtk_style_new ();
style->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-240-*-*-p-*-iso8859-1");
style->text[GTK_STATE_NORMAL].red = 0;
style->text[GTK_STATE_NORMAL].green = 255;
style->text[GTK_STATE_NORMAL].blue = 0;
style->bg[GTK_STATE_NORMAL] = style->black;
gtk_widget_set_style (time, style);
gtk_entry_set_text (GTK_ENTRY (time), "[0] 00:00.00");
gtk_set_editable (GTK_ENTRY (time), FALSE);
.
.
.

The only thing this seems to word for, though, is the font.  That gets 
set the way I want it.  But the background is still white (the area right 
around the text, that is...although it looks like the bg of the _widget_ 
has a mysterious black border.  But that's not what I was trying to do.  
Also, the text color is still black.  Am I going about this the wrong 
way?  Is gtk_widget_set_style not the method to use for setting things 
like font, bg, and text color in widgets?

Am help would be greatly appreciated.

Gtk Newbie,
shane 



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