aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-11-14 18:23:05 +0000
committerDave Love2000-11-14 18:23:05 +0000
commit9e445e292ee905691c5a21602b3c059ecb205dd2 (patch)
treefadad7d1dbc4a6ee40d6784b3c5ef7e30284e68b
parent824693e7ddfe7ff36bfcfee62c8011500baf76a2 (diff)
downloademacs-9e445e292ee905691c5a21602b3c059ecb205dd2.tar.gz
emacs-9e445e292ee905691c5a21602b3c059ecb205dd2.zip
Stuff from tool-bar.el.
-rw-r--r--lispref/keymaps.texi66
1 files changed, 66 insertions, 0 deletions
diff --git a/lispref/keymaps.texi b/lispref/keymaps.texi
index 0498dd12fdd..efe89b56f27 100644
--- a/lispref/keymaps.texi
+++ b/lispref/keymaps.texi
@@ -2159,6 +2159,72 @@ If @var{image} is a single image specification, Emacs draws the tool bar
2159button in disabled state by applying an edge-detection algorithm to the 2159button in disabled state by applying an edge-detection algorithm to the
2160image. 2160image.
2161 2161
2162The default tool bar is defined so that items specific to editing do not
2163appear for major modes whose command symbol has a @code{mode-class}
2164property of @code{special} (@pxref{Major Mode Conventions}). Major
2165modes may add items to the global bar by binding @code{[tool-bar
2166@var{foo}]} in their local map. It makes sense for some major modes to
2167replace the default tool bar items completely, since not many can be
2168accommodated conveniently, and the default bindings make this easy by
2169using an indirection through @code{tool-bar-map}.
2170
2171@defvar tool-bar-map
2172@tindex tool-bar-map
2173By default, the global map binds @code{[tool-bar]} as follows:
2174@example
2175(global-set-key [tool-bar]
2176 '(menu-item "tool bar" ignore
2177 :filter (lambda (ignore) tool-bar-map)))
2178@end example
2179@noindent
2180Thus the tool bar map is derived dynamically from the value of variable
2181@code{tool-bar-map} and you should normally adjust the default (global)
2182tool bar by changing that map. Major modes may replace the global bar
2183completely by making @code{tool-bar-map} buffer-local and set to a
2184keymap containing only the desired items. Info mode provides an
2185example.
2186@end defvar
2187
2188There are two convenience functions for defining tool bar items, as
2189follows.
2190
2191@defun tool-bar-add-item icon def key &rest props
2192@tindex tool-bar-add-item
2193This function adds an item to the tool bar by modifying
2194@code{tool-bar-map}. The image to use is defined by @var{icon}, which
2195is the base name of an XPM, XBM or PBM image file to located by
2196@code{find-image}. Given a value @samp{"exit"}, say, @file{exit.xpm},
2197@file{exit.pbm} and @file{exit.xbm} would be searched for in that order
2198on a color display. On a monochrome display, the search order is
2199@samp{.pbm}, @samp{.xbm} and @samp{.xpm}. The binding to use is the
2200command @var{def}, and @var{key} is the fake function key symbol in the
2201prefix keymap. The remaining arguments @var{props} are additional
2202property list elements to add to the menu item specification.
2203
2204To define items in some local map, bind @code{`tool-bar-map} with
2205@code{let} around calls of this function:
2206@example
2207(defvar foo-tool-bar-map
2208 (let ((tool-bar-map (make-sparse-keymap)))
2209 (tool-bar-add-item @dots{})
2210 @dots{}
2211 tool-bar-map))
2212@end example
2213@end defun
2214
2215@defun tool-bar-add-item-from-menu command icon &optional map &rest props
2216@tindex tool-bar-add-item-from-menu
2217This command is a convenience for defining tool bar items which are
2218consistent with existing menu bar bindings. The binding of
2219@var{command} is looked up in the menu bar in @var{map} (default
2220@code{global-map}) and modified to add an image specification for
2221@var{icon}, which is looked for in the same way as by
2222@code{tool-bar-add-item}. The resulting binding is then placed in
2223@code{tool-bar-map}. @var{map} must contain an appropriate keymap bound
2224to @code{[menu-bar]}. The remaining arguments @var{props} are
2225additional property list elements to add to the menu item specification.
2226@end defun
2227
2162@tindex auto-resize-tool-bar 2228@tindex auto-resize-tool-bar
2163@defvar auto-resize-tool-bar 2229@defvar auto-resize-tool-bar
2164If this variable is non-@code{nil}, the tool bar automatically resizes to 2230If this variable is non-@code{nil}, the tool bar automatically resizes to