diff options
| author | Dave Love | 2000-11-14 18:23:05 +0000 |
|---|---|---|
| committer | Dave Love | 2000-11-14 18:23:05 +0000 |
| commit | 9e445e292ee905691c5a21602b3c059ecb205dd2 (patch) | |
| tree | fadad7d1dbc4a6ee40d6784b3c5ef7e30284e68b | |
| parent | 824693e7ddfe7ff36bfcfee62c8011500baf76a2 (diff) | |
| download | emacs-9e445e292ee905691c5a21602b3c059ecb205dd2.tar.gz emacs-9e445e292ee905691c5a21602b3c059ecb205dd2.zip | |
Stuff from tool-bar.el.
| -rw-r--r-- | lispref/keymaps.texi | 66 |
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 | |||
| 2159 | button in disabled state by applying an edge-detection algorithm to the | 2159 | button in disabled state by applying an edge-detection algorithm to the |
| 2160 | image. | 2160 | image. |
| 2161 | 2161 | ||
| 2162 | The default tool bar is defined so that items specific to editing do not | ||
| 2163 | appear for major modes whose command symbol has a @code{mode-class} | ||
| 2164 | property of @code{special} (@pxref{Major Mode Conventions}). Major | ||
| 2165 | modes 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 | ||
| 2167 | replace the default tool bar items completely, since not many can be | ||
| 2168 | accommodated conveniently, and the default bindings make this easy by | ||
| 2169 | using an indirection through @code{tool-bar-map}. | ||
| 2170 | |||
| 2171 | @defvar tool-bar-map | ||
| 2172 | @tindex tool-bar-map | ||
| 2173 | By 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 | ||
| 2180 | Thus 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) | ||
| 2182 | tool bar by changing that map. Major modes may replace the global bar | ||
| 2183 | completely by making @code{tool-bar-map} buffer-local and set to a | ||
| 2184 | keymap containing only the desired items. Info mode provides an | ||
| 2185 | example. | ||
| 2186 | @end defvar | ||
| 2187 | |||
| 2188 | There are two convenience functions for defining tool bar items, as | ||
| 2189 | follows. | ||
| 2190 | |||
| 2191 | @defun tool-bar-add-item icon def key &rest props | ||
| 2192 | @tindex tool-bar-add-item | ||
| 2193 | This 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 | ||
| 2195 | is 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 | ||
| 2198 | on 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 | ||
| 2200 | command @var{def}, and @var{key} is the fake function key symbol in the | ||
| 2201 | prefix keymap. The remaining arguments @var{props} are additional | ||
| 2202 | property list elements to add to the menu item specification. | ||
| 2203 | |||
| 2204 | To 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 | ||
| 2217 | This command is a convenience for defining tool bar items which are | ||
| 2218 | consistent 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 | ||
| 2224 | to @code{[menu-bar]}. The remaining arguments @var{props} are | ||
| 2225 | additional 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 |
| 2164 | If this variable is non-@code{nil}, the tool bar automatically resizes to | 2230 | If this variable is non-@code{nil}, the tool bar automatically resizes to |