aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Djärv2006-05-07 19:38:49 +0000
committerJan Djärv2006-05-07 19:38:49 +0000
commitce64e507a69e9ca4b0a9d74fdbd734967f6de0c4 (patch)
tree960c910264f3e53bd9c695341183b4324534e676
parent987678e31b8a90a80bead3337093d8ad2266dffb (diff)
downloademacs-ce64e507a69e9ca4b0a9d74fdbd734967f6de0c4.tar.gz
emacs-ce64e507a69e9ca4b0a9d74fdbd734967f6de0c4.zip
Added GTK part
-rw-r--r--man/xresmini.texi131
1 files changed, 130 insertions, 1 deletions
diff --git a/man/xresmini.texi b/man/xresmini.texi
index 3c299d5b6ce..7445028e0be 100644
--- a/man/xresmini.texi
+++ b/man/xresmini.texi
@@ -296,7 +296,136 @@ The margin of the menu bar, in characters. Default is 1.
296@node GTK resources 296@node GTK resources
297@appendixsec GTK resources 297@appendixsec GTK resources
298 298
299@c Waiting for contents 299 The most common way to customize the GTK widgets Emacs uses (menus, dialogs
300tool bars and scroll bars) is by choosing an appropriate theme, for example
301with the GNOME theme selector. You can also do Emacs specific customization
302by inserting GTK style directives in the file @file{~/.emacs.d/gtkrc}. Some GTK
303themes ignore customizations in @file{~/.emacs.d/gtkrc} so not everything
304works with all themes. To customize Emacs font, background, faces, etc., use
305the normal X resources (@pxref{Resources}). We will present some examples of
306customizations here, but for a more detailed description, see the online manual.
307
308 The first example is just one line. It changes the font on all GTK widgets
309to courier with size 12:
310
311@smallexample
312gtk-font-name = "courier 12"
313@end smallexample
314
315 The thing to note is that the font name is not an X font name, like
316-*-helvetica-medium-r-*--*-120-*-*-*-*-*-*, but a Pango font name. A Pango
317font name is basically of the format "family style size", where the style
318is optional as in the case above. A name with a style could be for example:
319
320@smallexample
321gtk-font-name = "helvetica bold 10"
322@end smallexample
323
324 To customize widgets you first define a style and then apply the style to
325the widgets. Here is an example that sets the font for menus, but not
326for other widgets:
327
328@smallexample
329# @r{Define the style @samp{menufont}.}
330style "menufont"
331@{
332 font_name = "helvetica bold 14" # This is a Pango font name
333@}
334
335# @r{Specify that widget type @samp{*emacs-menuitem*} uses @samp{menufont}.}
336widget "*emacs-menuitem*" style "menufont"
337@end smallexample
338
339The widget name in this example contains wildcards, so the style will be
340applied to all widgets that match "*emacs-menuitem*". The widgets are
341named by the way they are contained, from the outer widget to the inner widget.
342So to apply the style "my_style" (not shown) with the full, absolute name, for
343the menubar and the scroll bar in Emacs we use:
344
345@smallexample
346widget "Emacs.pane.menubar" style "my_style"
347widget "Emacs.pane.emacs.verticalScrollBar" style "my_style"
348@end smallexample
349
350But to aoid having to type it all, wildcards are often used. @samp{*}
351matches zero or more characters and @samp{?} matches one character. So "*"
352matches all widgets.
353
354 Each widget has a class (for example GtkMenuItem) and a name (emacs-menuitem).
355You can assign styles by name or by class. In this example we have used the
356class:
357
358@smallexample
359style "menufont"
360@{
361 font_name = "helvetica bold 14"
362@}
363
364widget_class "*GtkMenuBar" style "menufont"
365@end smallexample
366
367@noindent
368The names and classes for the GTK widgets Emacs uses are:
369
370@multitable {@code{verticalScrollbar plus}} {@code{GtkFileSelection} and some}
371@item @code{emacs-filedialog}
372@tab @code{GtkFileSelection}
373@item @code{emacs-dialog}
374@tab @code{GtkDialog}
375@item @code{Emacs}
376@tab @code{GtkWindow}
377@item @code{pane}
378@tab @code{GtkVHbox}
379@item @code{emacs}
380@tab @code{GtkFixed}
381@item @code{verticalScrollBar}
382@tab @code{GtkVScrollbar}
383@item @code{emacs-toolbar}
384@tab @code{GtkToolbar}
385@item @code{menubar}
386@tab @code{GtkMenuBar}
387@item @code{emacs-menuitem}
388@tab anything in menus
389@end multitable
390
391 GTK absolute names are quite strange when it comes to menus
392and dialogs. The names do not start with @samp{Emacs}, as they are
393free-standing windows and not contained (in the GTK sense) by the
394Emacs GtkWindow. To customize the dialogs and menus, use wildcards like this:
395
396@smallexample
397widget "*emacs-dialog*" style "my_dialog_style"
398widget "*emacs-filedialog* style "my_file_style"
399widget "*emacs-menuitem* style "my_menu_style"
400@end smallexample
401
402 If you specify a customization in @file{~/.emacs.d/gtkrc}, then it
403automatically applies only to Emacs, since other programs don't read
404that file. For example, the drop down menu in the file dialog can not
405be customized by any absolute widget name, only by an absolute class
406name. This is because the widgets in the drop down menu do not
407have names and the menu is not contained in the Emacs GtkWindow. To
408have all menus in Emacs look the same, use this in
409@file{~/.emacs.d/gtkrc}:
410
411@smallexample
412widget_class "*Menu*" style "my_menu_style"
413@end smallexample
414
415 Here is a more elaborate example, showing how to change the parts of
416the scroll bar:
417
418@smallexample
419style "scroll"
420@{
421 fg[NORMAL] = "red"@ @ @ @ @ # @r{The arrow color.}
422 bg[NORMAL] = "yellow"@ @ # @r{The thumb and background around the arrow.}
423 bg[ACTIVE] = "blue"@ @ @ @ # @r{The trough color.}
424 bg[PRELIGHT] = "white"@ # @r{The thumb color when the mouse is over it.}
425@}
426
427widget "*verticalScrollBar*" style "scroll"
428@end smallexample
300 429
301@ignore 430@ignore
302 arch-tag: e1856f29-2482-42c0-a990-233cdccd1f21 431 arch-tag: e1856f29-2482-42c0-a990-233cdccd1f21