[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

D.6.1 GTK widget names

A GTK widget is specified by its widget class and widget name. The widget class is the type of the widget: for example, GtkMenuBar. The widget name is the name given to a specific widget. A widget always has a class, but need not have a name.

Absolute names are sequences of widget names or widget classes, corresponding to hierarchies of widgets embedded within other widgets. For example, if a GtkWindow named top contains a GtkVBox named box, which in turn contains a GtkMenuBar called menubar, the absolute class name of the menu-bar widget is GtkWindow.GtkVBox.GtkMenuBar, and its absolute widget name is top.box.menubar.

When assigning a style to a widget, you can use the absolute class name or the absolute widget name.

There are two commands to specify changes for widgets:

widget_class

specifies a style for widgets based on the absolute class name.

widget

specifies a style for widgets based on the absolute class name, or just the class.

You must specify the class and the style in double-quotes, and put these commands at the top level in the GTK customization file, like this:

 
style "menufont"
{
  font_name = "helvetica bold 14"
}

widget "top.box.menubar" style "menufont"
widget_class "GtkWindow.GtkVBox.GtkMenuBar" style "menufont"

Matching of absolute names uses shell wildcard syntax: ‘*’ matches zero or more characters and ‘?’ matches one character. This example assigns base_style to all widgets:

 
widget "*" style "base_style"

Given the absolute class name GtkWindow.GtkVBox.GtkMenuBar and the corresponding absolute widget name top.box.menubar, all these examples specify my_style for the menu bar:

 
widget_class "GtkWindow.GtkVBox.GtkMenuBar" style "my_style"
widget_class "GtkWindow.*.GtkMenuBar" style "my_style"
widget_class "*GtkMenuBar" style "my_style"
widget "top.box.menubar" style "my_style"
widget "*box*menubar" style "my_style"
widget "*menubar" style "my_style"
widget "*menu*" style "my_style"

[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 23 Février 2009 en utilisant texi2html 1.78.