Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Next: , Previous: GTK widget names, Up: GTK resources


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"

 
 
  Published under the terms of the GNU General Public License Design by Interspire