Re: [gtk-list] Colours (colors)



On Fri, 9 Apr 1999, Steve Waterworth wrote:

> Hi there,
> 
> Gtk 1.0.6 Linux
> Gtk 1.2.0 Solaris 2.6
> 
> I am trying to use the resource file along with a named widget to set the
> colour (color for americans) and font of a GtkLabel. Alas without much success
> so far :-)
> 
> The C source
> 
> gtk_set_locale ();
> gtk_init (&argc, &argv);
> gtk_rc_parse("color.rc");
> 
> ....
> 
> label = gtk_label_new("Some Text");
> gtk_widget_set_name(label, "mylabel");
> gtk_widget_show(label);
> 
> <------------->
> 
> The resource file
> 
> style "title"
> {
> 	fg[NORMAL] = {1.0, 0.0, 0.0}
> 	font = "-adobe-helvetica-bold-r-normal--*-140-*-*-*-*-*-*"
> }
> 
> style "postit"
> {
> 	bg[NORMAL] = {1.0, 1.0, 0.0}
> }
> 
> widget "mylabel" style "title"

use: widget "*mylabel" style "title"

the widget name path constructed for the label consists of the widget names
of all its toplevels as well, e.g. for

window (name: humphrey)
  hbox
    label (name: mylabel)

the widget path your pattern needs to match would be:
"humphrey.GtkHBox.mylabel"

(the widget_class path would be "GtkWindow.GtkHBox.GtkLabel").

> widget_class "*GtkTooltips*" style "postit"
use: widget "gtk-tooltips*" style "postit"

the tooltip's window is named "gtk-tooltips", GtkTooltips in itself is not
a GtkWidget (though a GtkObject) and as such is not attempted to match any
widget styles.

> I just can't figure out the correct syntax here. I want only the named label to
> have this style not any other widgets at all. Also I can't get a yellow tooltip
> either :-((
> 
> Any help greatly appreciated this is driving me crazy!
> 

[trog: this tends to become an FAQ, especially the "gtk-tooltips*"
 pattern, is this covered yet?]

>    --
> 
> Regards,
> 
> Steve Waterworth
> stevew@bigeric.force9.co.uk
> 

---
ciaoTJ



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