D.6.2 GTK Widget Names in Emacs
In Emacs, the top level widget for a frame is a GtkWindow
that contains a GtkVBox
. The GtkVBox
contains the
GtkMenuBar
and a GtkFixed
widget. The vertical scroll
bars, GtkVScrollbar
, are contained in the GtkFixed
widget. The text you write in Emacs is drawn in the GtkFixed
widget.
Dialogs in Emacs are GtkDialog
widgets. The file dialog is a
GtkFileSelection
widget.
To set a style for the menu bar using the absolute class name, use:
widget_class "GtkWindow.GtkVBox.GtkMenuBar" style "my_style"
For the scroll bar, the absolute class name is:
widget_class
"GtkWindow.GtkVBox.GtkFixed.GtkVScrollbar"
style "my_style"
The names for the emacs widgets, and their classes, are:
emacs-filedialog
| GtkFileSelection
|
emacs-dialog
| GtkDialog
|
Emacs
| GtkWindow
|
pane
| GtkVHbox
|
emacs
| GtkFixed
|
verticalScrollBar
| GtkVScrollbar
|
emacs-toolbar
| GtkToolbar
|
menubar
| GtkMenuBar
|
emacs-menuitem
| anything in menus
|
Thus, for Emacs you can write the two examples above as:
widget "Emacs.pane.menubar" style "my_style"
widget "Emacs.pane.emacs.verticalScrollBar" style "my_style"
GTK absolute names are quite strange when it comes to menus
and dialogs. The names do not start with ‘Emacs’, as they are
free-standing windows and not contained (in the GTK sense) by the
Emacs GtkWindow. To customize the dialogs and menus, use wildcards like this:
widget "*emacs-dialog*" style "my_dialog_style"
widget "*emacs-filedialog* style "my_file_style"
widget "*emacs-menuitem* style "my_menu_style"
If you specify a customization in ~/.emacs.d/gtkrc, then it
automatically applies only to Emacs, since other programs don't read
that file. For example, the drop down menu in the file dialog can not
be customized by any absolute widget name, only by an absolute class
name. This is because the widgets in the drop down menu do not
have names and the menu is not contained in the Emacs GtkWindow. To
have all menus in Emacs look the same, use this in
~/.emacs.d/gtkrc:
widget_class "*Menu*" style "my_menu_style"