annotate man/lispref/menus.texi @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 @c -*-texinfo-*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 @c This is part of the XEmacs Lisp Reference Manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 @c Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 @c Copyright (C) 1995 Sun Microsystems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 @c See the file lispref.texi for copying conditions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 @setfilename ../../info/menu.info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 @node Menus, Dialog Boxes, Keymaps, Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 @chapter Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 @cindex menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 * Menu Format:: Format of a menu description.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 * Menubar Format:: How to specify a menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 * Menubar:: Functions for controlling the menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 * Modifying Menus:: Modifying a menu description.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 * Pop-Up Menus:: Functions for specifying pop-up menus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 * Menu Filters:: Filter functions for the default menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 * Buffers Menu:: The menu that displays the list of buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 @node Menu Format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 @section Format of Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 @cindex menu format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 @cindex format of menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 A menu is described using a @dfn{menu description}, which is a list of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 menu items, keyword-value pairs, strings, and submenus. The menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 description specifies which items are present in the menu, what function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 each item invokes, and whether the item is selectable or not. Pop-up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 menus are directly described with a menu description, while menubars are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 described slightly differently (see below).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 The first element of a menu must be a string, which is the name of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 menu. This is the string that will be displayed in the parent menu or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 menubar, if any. This string is not displayed in the menu itself,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 except in the case of the top level pop-up menu, where there is no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 parent. In this case, the string will be displayed at the top of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 menu if @code{popup-menu-titles} is non-@code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 Immediately following the first element there may optionally be up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 to three keyword-value pairs, as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 @item :included @var{form}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 This can be used to control the visibility of a menu. The form is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 evaluated and the menu will be omitted if the result is @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 @item :config @var{symbol}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 This is an efficient shorthand for @code{:included (memq @var{symbol}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 menubar-configuration)}. See the variable @code{menubar-configuration}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 @item :filter @var{function}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 A menu filter is used to sensitize or incrementally create a submenu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 only when it is selected by the user and not every time the menubar is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 activated. The filter function is passed the list of menu items in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 submenu and must return a list of menu items to be used for the menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 It is called only when the menu is about to be displayed, so other menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 may already be displayed. Vile and terrible things will happen if a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 menu filter function changes the current buffer, window, or frame. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 also should not raise, lower, or iconify any frames. Basically, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 filter function should have no side-effects.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 The rest of the menu consists of elements as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 A @dfn{menu item}, which is a vector in the following form:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 @code{[ @var{name} @var{callback} @var{:keyword} @var{value} @var{:keyword} @var{value} ... ]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 @var{name} is a string, the name of the menu item; it is the string to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 display on the menu. It is filtered through the resource database, so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 it is possible for resources to override what string is actually
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 @var{callback} is a form that will be invoked when the menu item is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 selected. If the callback of a menu item is a symbol, then it must name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 a command. It will be invoked with @code{call-interactively}. If it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 a list, then it is evaluated with @code{eval}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 The valid keywords and their meanings are described below.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 Note that for compatibility purposes, the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 @code{[ @var{name} @var{callback} @var{active-p} ]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 is also accepted and is equivalent to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 @code{[ @var{name} @var{callback} :active @var{active-p} ]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 and the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 @code{[ @var{name} @var{callback} @var{active-p} @var{suffix}]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 is accepted and is equivalent to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 @code{[ @var{name} @var{callback} :active @var{active-p} :suffix @var{suffix}]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 However, these older forms are deprecated and should generally not be used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 If an element of a menu is a string, then that string will be presented
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 in the menu as unselectable text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 If an element of a menu is a string consisting solely of hyphens, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 that item will be presented as a solid horizontal line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 If an element of a menu is a string beginning with @samp{--:}, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 a particular sort of horizontal line will be displayed, as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 @item "--:singleLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 A solid horizontal line. This is equivalent to a string consisting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 solely of hyphens.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 @item "--:doubleLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 A solid double horizontal line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 @item "--:singleDashedLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 A dashed horizontal line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 @item "--:doubleDashedLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 A dashed double horizontal line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 @item "--:noLine"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 No line (but a small space is left).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 @item "--:shadowEtchedIn"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 A solid horizontal line with a 3-d recessed appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 @item "--:shadowEtchedOut"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 A solid horizontal line with a 3-d pushed-out appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 @item "--:shadowDoubleEtchedIn"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 A solid double horizontal line with a 3-d recessed appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 @item "--:shadowDoubleEtchedOut"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 A solid double horizontal line with a 3-d pushed-out appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 @item "--:shadowEtchedInDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 A dashed horizontal line with a 3-d recessed appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 @item "--:shadowEtchedOutDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 A dashed horizontal line with a 3-d pushed-out appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 @item "--:shadowDoubleEtchedInDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 A dashed double horizontal line with a 3-d recessed appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 @item "--:shadowDoubleEtchedOutDash"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 A dashed double horizontal line with a 3-d pushed-out appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 If an element of a menu is a list, it is treated as a submenu. The name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 of that submenu (the first element in the list) will be used as the name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 of the item representing this menu on the parent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 The possible keywords are as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 @item :active @var{form}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 @var{form} will be evaluated when the menu that this item is a part of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 is about to be displayed, and the item will be selectable only if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 result is non-@code{nil}. If the item is unselectable, it will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 usually be displayed grayed-out to indicate this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 @item :suffix @var{string}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 The string is appended to the displayed name. This provides a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 convenient way of adding the name of a command's ``argument'' to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 menu, like like @samp{Kill Buffer NAME}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 @item :keys @var{string}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 Normally, the keyboard equivalents of commands in menus are displayed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 when the ``callback'' is a symbol. This can be used to specify keys for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 more complex menu items. It is passed through
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 @code{substitute-command-keys} first.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 @item :style @var{style}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 Specifies what kind of object this menu item is. @var{style} be one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 of the symbols
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 @item nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 A normal menu item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 @item toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 A toggle button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 @item radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 A radio button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 @item button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 A menubar button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 The only difference between toggle and radio buttons is how they are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 displayed. But for consistency, a toggle button should be used when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 there is one option whose value can be turned on or off, and radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 buttons should be used when there is a set of mutually exclusive options.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 When using a group of radio buttons, you should arrange for no more than
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 one to be marked as selected at a time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 @item :selected @var{form}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 Meaningful only when @var{style} is @code{toggle}, @code{radio} or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 @code{button}. This specifies whether the button will be in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 selected or unselected state. @var{form} is evaluated, as for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 @code{:active}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 @item :included @var{form}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 This can be used to control the visibility of a menu item. The form is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 evaluated and the menu item is only displayed if the result is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 non-@code{nil}. Note that this is different from @code{:active}: If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 @code{:active} evaluates to @code{nil}, the item will be displayed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 grayed out, while if @code{:included} evaluates to @code{nil}, the item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 will be omitted entirely.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 @item :config @var{symbol}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 This is an efficient shorthand for @code{:included (memq @var{symbol}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 menubar-configuration)}. See the variable @code{menubar-configuration}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 @defvar menubar-configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 This variable holds a list of symbols, against which the value of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 @code{:config} tag for each menubar item will be compared. If a menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 item has a @code{:config} tag, then it is omitted from the menubar if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 that tag is not a member of the @code{menubar-configuration} list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 For example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 ("File"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 :filter file-menu-filter ; file-menu-filter is a function that takes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 ; one argument (a list of menu items) and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ; returns a list of menu items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 [ "Save As..." write-file t ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 [ "Revert Buffer" revert-buffer (buffer-modified-p) ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 [ "Read Only" toggle-read-only :style toggle :selected buffer-read-only ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 @node Menubar Format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 @section Format of the Menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 @cindex menubar format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 @cindex format of the menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 A menubar is a list of menus, menu items, and strings. The format is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 similar to that of a menu, except:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 The first item need not be a string, and is not treated specially.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 A string consisting solely of hyphens is not treated specially.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 If an element of a menubar is @code{nil}, then it is used to represent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 the division between the set of menubar items which are flush-left and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 those which are flush-right. (Note: this isn't completely implemented
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 yet.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 @node Menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 @section Menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 @cindex menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 @defvar current-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 This variable holds the description of the current menubar. This may be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 buffer-local. When the menubar is changed, the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 @code{set-menubar-dirty-flag} has to be called in order for the menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 to be updated on the screen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 @defvr Constant default-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 This variable holds the menubar description of the menubar that is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 visible at startup. This is the value that @code{current-menubar}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 has at startup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 @end defvr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 @defun set-menubar-dirty-flag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 This function tells XEmacs that the menubar widget has to be updated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 Changes to the menubar will generally not be visible until this function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 is called.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 The following convenience functions are provided for setting the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 menubar. They are equivalent to doing the appropriate action to change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 @code{current-menubar}, and then calling @code{set-menubar-dirty-flag}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 Note that these functions copy their argument using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 @code{copy-sequence}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 @defun set-menubar menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 This function sets the default menubar to be @var{menubar} (@pxref{Menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 Format}). This is the menubar that will be visible in buffers that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 have not defined their own, buffer-local menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 @defun set-buffer-menubar menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 This function sets the buffer-local menubar to be @var{menubar}. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 does not change the menubar in any buffers other than the current one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 Miscellaneous:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 @defvar menubar-show-keybindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 If true, the menubar will display keyboard equivalents. If false, only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 the command names will be displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 @defvar activate-menubar-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 Function or functions called before a menubar menu is pulled down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 These functions are called with no arguments, and should interrogate and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 modify the value of @code{current-menubar} as desired.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 The functions on this hook are invoked after the mouse goes down, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 before the menu is mapped, and may be used to activate, deactivate, add,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 or delete items from the menus. However, using a filter (with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 @code{:filter} keyword in a menu description) is generally a more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 efficient way of accomplishing the same thing, because the filter is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 invoked only when the actual menu goes down. With a complex menu,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 there can be a quite noticeable and sometimes aggravating delay if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 all menu modification is implemented using the @code{activate-menubar-hook}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 See above.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 These functions may return the symbol @code{t} to assert that they have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 made no changes to the menubar. If any other value is returned, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 menubar is recomputed. If @code{t} is returned but the menubar has been
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 changed, then the changes may not show up right away. Returning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 @code{nil} when the menubar has not changed is not so bad; more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 computation will be done, but redisplay of the menubar will still be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 performed optimally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 @defvar menu-no-selection-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 Function or functions to call when a menu or dialog box is dismissed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 without a selection having been made.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 @node Modifying Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 @section Modifying Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 The following functions are provided to modify the menubar of one of its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 submenus. Note that these functions modify the menu in-place, rather
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 than copying it and making a new menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 Some of these functions take a @dfn{menu path}, which is a list of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 strings identifying the menu to be modified. For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 @code{("File")} names the top-level ``File'' menu. @code{("File"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 "Foo")} names a hypothetical submenu of ``File''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 Others take a @dfn{menu item path}, which is similar to a menu path but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 also specifies a particular item to be modified. For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 @code{("File" "Save")} means the menu item called ``Save'' under the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 top-level ``File'' menu. @code{("Menu" "Foo" "Item")} means the menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 item called ``Item'' under the ``Foo'' submenu of ``Menu''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 @defun add-submenu menu-path submenu &optional before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 This function adds a menu to the menubar or one of its submenus. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 named menu exists already, it is changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 @var{menu-path} identifies the menu under which the new menu should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 inserted. If @var{menu-path} is @code{nil}, then the menu will be added
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 to the menubar itself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 @var{submenu} is the new menu to add (@pxref{Menu Format}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 @var{before}, if provided, is the name of a menu before which this menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 should be added, if this menu is not on its parent already. If the menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 is already present, it will not be moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 @defun add-menu-button menu-path menu-leaf &optional before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 This function adds a menu item to some menu, creating the menu first if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 necessary. If the named item exists already, it is changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 @var{menu-path} identifies the menu under which the new menu item should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 be inserted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 @var{menu-leaf} is a menubar leaf node (@pxref{Menu Format}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 @var{before}, if provided, is the name of a menu before which this item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 should be added, if this item is not on the menu already. If the item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 is already present, it will not be moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 @defun delete-menu-item menu-item-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 This function removes the menu item specified by @var{menu-item-path}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 from the menu hierarchy.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 @defun enable-menu-item menu-item-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 This function makes the menu item specified by @var{menu-item-path} be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 selectable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 @defun disable-menu-item menu-item-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 This function makes the menu item specified by @var{menu-item-path} be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 unselectable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 @defun relabel-menu-item menu-item-path new-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 This function changes the string of the menu item specified by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 @var{menu-item-path}. @var{new-name} is the string that the menu item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 will be printed as from now on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 The following function can be used to search for a particular item in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 a menubar specification, given a path to the item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 @defun find-menu-item menubar menu-item-path &optional parent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 This function searches @var{menubar} for the item given by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 @var{menu-item-path} starting from @var{parent} (@code{nil} means start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 at the top of @var{menubar}). This function returns @code{(@var{item}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 . @var{parent})}, where @var{parent} is the immediate parent of the item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 found (a menu description), and @var{item} is either a vector, list, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 string, depending on the nature of the menu item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 This function signals an error if the item is not found.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 The following deprecated functions are also documented, so that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 existing code can be understood. You should not use these functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 in new code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 @defun add-menu menu-path menu-name menu-items &optional before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 This function adds a menu to the menubar or one of its submenus. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 named menu exists already, it is changed. This is obsolete; use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 @code{add-submenu} instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 @var{menu-path} identifies the menu under which the new menu should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 inserted. If @var{menu-path} is @code{nil}, then the menu will be added
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 to the menubar itself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 @var{menu-name} is the string naming the menu to be added;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 @var{menu-items} is a list of menu items, strings, and submenus. These
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 two arguments are the same as the first and following elements of a menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 description (@pxref{Menu Format}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 @var{before}, if provided, is the name of a menu before which this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 menu should be added, if this menu is not on its parent already. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 menu is already present, it will not be moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 @defun add-menu-item menu-path item-name function enabled-p &optional before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 This function adds a menu item to some menu, creating the menu first if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 necessary. If the named item exists already, it is changed. This is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 obsolete; use @code{add-menu-button} instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 @var{menu-path} identifies the menu under which the new menu item should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 be inserted. @var{item-name}, @var{function}, and @var{enabled-p} are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 the first, second, and third elements of a menu item vector (@pxref{Menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 Format}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 @var{before}, if provided, is the name of a menu item before which this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 item should be added, if this item is not on the menu already. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 item is already present, it will not be moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 @node Menu Filters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 @section Menu Filters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 @cindex menu filters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 The following filter functions are provided for use in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 @code{default-menubar}. You may want to use them in your own menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 description.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 @defun file-menu-filter menu-items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 This function changes the arguments and sensitivity of these File menu items:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 @item Delete Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 Has the name of the current buffer appended to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 @item Print Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 Has the name of the current buffer appended to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 @item Pretty-Print Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 Has the name of the current buffer appended to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 @item Save Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 Has the name of the current buffer appended to it, and is sensitive only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 when the current buffer is modified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 @item Revert Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 Has the name of the current buffer appended to it, and is sensitive only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 when the current buffer has a file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 @item Delete Frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 Sensitive only when there is more than one visible frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 @defun edit-menu-filter menu-items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 This function changes the arguments and sensitivity of these Edit menu items:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 @item Cut
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 Sensitive only when XEmacs owns the primary X Selection (if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 @code{zmacs-regions} is @code{t}, this is equivalent to saying that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 there is a region selected).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 @item Copy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 Sensitive only when XEmacs owns the primary X Selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 @item Clear
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 Sensitive only when XEmacs owns the primary X Selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 @item Paste
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 Sensitive only when there is an owner for the X Clipboard Selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 @item Undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 Sensitive only when there is undo information. While in the midst of an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 undo, this is changed to @samp{Undo More}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 @defun buffers-menu-filter menu-items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 This function sets up the Buffers menu. @xref{Buffers Menu} for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 more information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 @node Pop-Up Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 @section Pop-Up Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 @cindex pop-up menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 @defun popup-menu menu-desc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 This function pops up a menu specified by @var{menu-desc}, which is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 menu description (@pxref{Menu Format}). The menu is displayed at the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 current mouse position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 @defun popup-menu-up-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 This function returns @code{t} if a pop-up menu is up, @code{nil}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 otherwise.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 @defvar popup-menu-titles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 If true (the default), pop-up menus will have title bars at the top.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 Some machinery is provided that attempts to provide a higher-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 mechanism onto pop-up menus. This only works if you do not redefine
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 the binding for button3.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 @deffn Command popup-mode-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 This function pops up a menu of global and mode-specific commands. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 menu is computed by combining @code{global-popup-menu} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 @code{mode-popup-menu}. This is the default binding for button3.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 You should generally not change this binding.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 @defvar global-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 This holds the global popup menu. This is present in all modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (This is @code{nil} by default.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 @defvar mode-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 The mode-specific popup menu. Automatically buffer local.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 This is appended to the default items in @code{global-popup-menu}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 @defvr Constant default-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 This holds the default value of @code{mode-popup-menu}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 @end defvr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 @defvar activate-popup-menu-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 Function or functions run before a mode-specific popup menu is made
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 visible. These functions are called with no arguments, and should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 interrogate and modify the value of @code{global-popup-menu} or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 @code{mode-popup-menu} as desired. Note: this hook is only run if you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 use @code{popup-mode-menu} for activating the global and mode-specific
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 commands; if you have your own binding for button3, this hook won't be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 run.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 The following convenience functions are provided for displaying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 pop-up menus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 @defun popup-buffer-menu event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 This function pops up a copy of the @samp{Buffers} menu (from the menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 where the mouse is clicked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 @defun popup-menubar-menu event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 This function pops up a copy of menu that also appears in the menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 @node Buffers Menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 @section Buffers Menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 @cindex buffers menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 The following options control how the @samp{Buffers} menu is displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 This is a list of all (or a subset of) the buffers currently in existence,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 and is updated dynamically.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 @defopt buffers-menu-max-size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 This user option holds the maximum number of entries which may appear on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 the @samp{Buffers} menu. If this is 10, then only the ten
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 most-recently-selected buffers will be shown. If this is @code{nil},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 then all buffers will be shown. Setting this to a large number or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 @code{nil} will slow down menu responsiveness.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 @defun format-buffers-menu-line buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 This function returns a string to represent @var{buffer} in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 @samp{Buffers} menu. @code{nil} means the buffer shouldn't be listed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 You can redefine this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 @defopt complex-buffers-menu-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 If true, the @samp{Buffers} menu will contain several commands, as submenus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 of each buffer line. If this is false, then there will be only one command:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 select that buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 @defopt buffers-menu-switch-to-buffer-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 This user option holds the function to call to select a buffer from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 @samp{Buffers} menu. @code{switch-to-buffer} is a good choice, as is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 @code{pop-to-buffer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612