0
|
1 /* Implements an elisp-programmable menubar.
|
|
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
|
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Not in FSF. */
|
|
23
|
|
24 /* #### There ain't much here because menubars have not been
|
|
25 properly abstracted yet. */
|
|
26
|
|
27 #include <config.h>
|
|
28 #include "lisp.h"
|
|
29
|
195
|
30 #include "buffer.h"
|
0
|
31 #include "device.h"
|
|
32 #include "frame.h"
|
251
|
33 #include "gui.h"
|
0
|
34 #include "menubar.h"
|
|
35 #include "redisplay.h"
|
|
36 #include "window.h"
|
|
37
|
|
38 int menubar_show_keybindings;
|
|
39 Lisp_Object Vmenubar_configuration;
|
|
40
|
|
41 Lisp_Object Qcurrent_menubar;
|
|
42
|
|
43 Lisp_Object Qactivate_menubar_hook, Vactivate_menubar_hook;
|
|
44
|
|
45 Lisp_Object Vmenubar_visible_p;
|
|
46
|
|
47 static Lisp_Object Vcurrent_menubar; /* DO NOT ever reference this.
|
|
48 Always go through Qcurrent_menubar.
|
|
49 See below. */
|
175
|
50
|
0
|
51 Lisp_Object Vblank_menubar;
|
|
52
|
|
53 int popup_menu_titles;
|
|
54
|
|
55 Lisp_Object Vmenubar_pointer_glyph;
|
|
56
|
|
57 static int
|
|
58 menubar_variable_changed (Lisp_Object sym, Lisp_Object *val,
|
|
59 Lisp_Object in_object, int flags)
|
|
60 {
|
|
61 MARK_MENUBAR_CHANGED;
|
|
62 return 0;
|
|
63 }
|
|
64
|
|
65 void
|
|
66 update_frame_menubars (struct frame *f)
|
|
67 {
|
|
68 if (f->menubar_changed || f->windows_changed)
|
|
69 MAYBE_FRAMEMETH (f, update_frame_menubars, (f));
|
|
70
|
|
71 f->menubar_changed = 0;
|
|
72 }
|
|
73
|
|
74 void
|
|
75 free_frame_menubars (struct frame *f)
|
|
76 {
|
|
77 /* If we had directly allocated any memory for the menubars instead
|
|
78 of using all Lisp_Objects this is where we would now free it. */
|
|
79
|
|
80 MAYBE_FRAMEMETH (f, free_frame_menubars, (f));
|
|
81 }
|
|
82
|
|
83 static void
|
|
84 menubar_visible_p_changed (Lisp_Object specifier, struct window *w,
|
|
85 Lisp_Object oldval)
|
|
86 {
|
|
87 MARK_MENUBAR_CHANGED;
|
|
88 }
|
|
89
|
|
90 static void
|
|
91 menubar_visible_p_changed_in_frame (Lisp_Object specifier, struct frame *f,
|
|
92 Lisp_Object oldval)
|
|
93 {
|
|
94 update_frame_menubars (f);
|
|
95 }
|
|
96
|
251
|
97 Lisp_Object
|
|
98 current_frame_menubar (CONST struct frame* f)
|
|
99 {
|
|
100 struct window *w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
|
|
101 return symbol_value_in_buffer (Qcurrent_menubar, w->buffer);
|
|
102 }
|
|
103
|
|
104 Lisp_Object
|
|
105 menu_parse_submenu_keywords (Lisp_Object desc, struct gui_item* pgui_item)
|
|
106 {
|
|
107 /* Menu descriptor should be a list */
|
|
108 CHECK_CONS (desc);
|
|
109
|
|
110 /* First element may be menu name, although can be omitted.
|
|
111 Let's think that if stuff begins with anything than a keyword
|
|
112 or a list (submenu), this is a menu name, expected to be a stirng */
|
|
113 if (!KEYWORDP (XCAR (desc)) && !CONSP (XCAR (desc)))
|
|
114 {
|
|
115 CHECK_STRING (XCAR (desc));
|
|
116 pgui_item->name = XCAR (desc);
|
|
117 desc = XCDR (desc);
|
|
118 if (!NILP (desc))
|
|
119 CHECK_CONS (desc);
|
|
120 }
|
|
121
|
|
122 /* Walk along all key-value pairs */
|
|
123 while (!NILP(desc) && KEYWORDP (XCAR (desc)))
|
|
124 {
|
|
125 Lisp_Object key, val;
|
|
126 key = XCAR (desc);
|
|
127 desc = XCDR (desc);
|
|
128 CHECK_CONS (desc);
|
|
129 val = XCAR (desc);
|
|
130 desc = XCDR (desc);
|
|
131 if (!NILP (desc))
|
|
132 CHECK_CONS (desc);
|
|
133 gui_item_add_keyval_pair (pgui_item, key, val);
|
|
134 }
|
|
135
|
|
136 /* Return the rest - supposed to be a list of items */
|
|
137 return desc;
|
|
138 }
|
|
139
|
|
140 DEFUN ("menu-find-real-submenu", Fmenu_find_real_submenu, 2, 2, 0, /*
|
|
141 Find a submenu descriptor within DESC by following PATH.
|
|
142 This function finds a submenu descriptor, either from the description
|
|
143 DESC or generated by a filter within DESC. The function regards :config
|
|
144 and :included keywords in the DESC, and expands submenus along the
|
|
145 PATH using :filter functions. Return value is a descriptor for the
|
|
146 submenu, NOT expanded and NOT checked against :config and :included.
|
|
147 Also, individual menu items are not looked for, only submenus.
|
|
148
|
|
149 See also 'find-menu-item'
|
|
150 */
|
|
151 (desc, path))
|
|
152 {
|
|
153 Lisp_Object path_entry, submenu_desc, submenu;
|
|
154 struct gcpro gcpro1;
|
|
155 struct gui_item gui_item;
|
|
156
|
|
157 gui_item_init (&gui_item);
|
|
158 GCPRO1 (gui_item);
|
|
159 gcpro1.nvars = GUI_ITEM_GCPRO_COUNT;
|
|
160
|
|
161 EXTERNAL_LIST_LOOP (path_entry, path)
|
|
162 {
|
|
163 /* Verify that DESC describes a menu, not single item */
|
|
164 if (!CONSP (desc))
|
|
165 RETURN_UNGCPRO (Qnil);
|
|
166
|
|
167 /* Parse this menu */
|
|
168 desc = menu_parse_submenu_keywords (desc, &gui_item);
|
|
169
|
|
170 /* Check that this (sub)menu is active */
|
|
171 if (!gui_item_active_p (&gui_item))
|
|
172 RETURN_UNGCPRO (Qnil);
|
|
173
|
|
174 /* Apply :filter */
|
|
175 if (!NILP (gui_item.filter))
|
|
176 desc = call1 (gui_item.filter, desc);
|
|
177
|
|
178 /* Find the next menu on the path inside this one */
|
|
179 EXTERNAL_LIST_LOOP (submenu_desc, desc)
|
|
180 {
|
|
181 submenu = XCAR (submenu_desc);
|
|
182 if (CONSP (submenu)
|
|
183 && STRINGP (XCAR (submenu))
|
|
184 && !NILP (Fstring_equal (XCAR (submenu), XCAR (path_entry))))
|
|
185 {
|
|
186 desc = submenu;
|
|
187 goto descend;
|
|
188 }
|
|
189 }
|
|
190 /* Submenu not found */
|
|
191 RETURN_UNGCPRO (Qnil);
|
|
192
|
|
193 descend:
|
|
194 /* Prepare for the next iteration */
|
|
195 gui_item_init (&gui_item);
|
|
196 }
|
|
197
|
|
198 /* We have successfully descended down the end of the path */
|
|
199 UNGCPRO;
|
|
200 return desc;
|
|
201 }
|
|
202
|
20
|
203 DEFUN ("popup-menu", Fpopup_menu, 1, 2, 0, /*
|
0
|
204 Pop up the given menu.
|
|
205 A menu description is a list of menu items, strings, and submenus.
|
|
206
|
|
207 The first element of a menu must be a string, which is the name of the menu.
|
|
208 This is the string that will be displayed in the parent menu, if any. For
|
|
209 toplevel menus, it is ignored. This string is not displayed in the menu
|
|
210 itself.
|
|
211
|
|
212 If an element of a menu is a string, then that string will be presented in
|
|
213 the menu as unselectable text.
|
|
214
|
|
215 If an element of a menu is a string consisting solely of hyphens, then that
|
|
216 item will be presented as a solid horizontal line.
|
|
217
|
|
218 If an element of a menu is a list, it is treated as a submenu. The name of
|
|
219 that submenu (the first element in the list) will be used as the name of the
|
|
220 item representing this menu on the parent.
|
|
221
|
|
222 Otherwise, the element must be a vector, which describes a menu item.
|
|
223 A menu item can have any of the following forms:
|
|
224
|
185
|
225 [ "name" callback <active-p> ]
|
|
226 [ "name" callback <active-p> "suffix" ]
|
|
227 [ "name" callback :<keyword> <value> :<keyword> <value> ... ]
|
0
|
228
|
|
229 The name is the string to display on the menu; it is filtered through the
|
|
230 resource database, so it is possible for resources to override what string
|
|
231 is actually displayed.
|
|
232
|
|
233 If the `callback' of a menu item is a symbol, then it must name a command.
|
|
234 It will be invoked with `call-interactively'. If it is a list, then it is
|
|
235 evaluated with `eval'.
|
|
236
|
|
237 The possible keywords are this:
|
|
238
|
|
239 :active <form> Same as <active-p> in the first two forms: the
|
|
240 expression is evaluated just before the menu is
|
|
241 displayed, and the menu will be selectable only if
|
|
242 the result is non-nil.
|
|
243
|
185
|
244 :suffix "string" Same as "suffix" in the second form: the suffix is
|
0
|
245 appended to the displayed name, providing a convenient
|
|
246 way of adding the name of a command's ``argument'' to
|
|
247 the menu, like ``Kill Buffer NAME''.
|
|
248
|
185
|
249 :keys "string" Normally, the keyboard equivalents of commands in
|
0
|
250 menus are displayed when the `callback' is a symbol.
|
|
251 This can be used to specify keys for more complex menu
|
|
252 items. It is passed through `substitute-command-keys'
|
|
253 first.
|
|
254
|
|
255 :style <style> Specifies what kind of object this menu item is:
|
|
256
|
|
257 nil A normal menu item.
|
|
258 toggle A toggle button.
|
|
259 radio A radio button.
|
|
260
|
|
261 The only difference between toggle and radio buttons is
|
|
262 how they are displayed. But for consistency, a toggle
|
|
263 button should be used when there is one option whose
|
|
264 value can be turned on or off, and radio buttons should
|
|
265 be used when there is a set of mutually exclusive
|
|
266 options. When using a group of radio buttons, you
|
|
267 should arrange for no more than one to be marked as
|
|
268 selected at a time.
|
|
269
|
|
270 :selected <form> Meaningful only when STYLE is `toggle' or `radio'.
|
|
271 This specifies whether the button will be in the
|
|
272 selected or unselected state.
|
|
273
|
|
274 For example:
|
|
275
|
185
|
276 [ "Save As..." write-file t ]
|
|
277 [ "Revert Buffer" revert-buffer (buffer-modified-p) ]
|
|
278 [ "Read Only" toggle-read-only :style toggle :selected buffer-read-only ]
|
0
|
279
|
|
280 See menubar.el for many more examples.
|
20
|
281 */
|
|
282 (menu_desc, event))
|
0
|
283 {
|
|
284 struct frame *f = decode_frame(Qnil);
|
|
285 MAYBE_FRAMEMETH (f, popup_menu, (menu_desc,event));
|
|
286 return Qnil;
|
|
287 }
|
|
288
|
195
|
289 DEFUN ("normalize-menu-item-name", Fnormalize_menu_item_name, 1, 2, 0, /*
|
|
290 Convert a menu item name string into normal form. Returns a new string.
|
|
291 Menu item names should be converted to normal form before being compared.
|
|
292 */
|
|
293 (name, buffer))
|
|
294 {
|
|
295 struct buffer *buf = decode_buffer (buffer, 0);
|
|
296 struct Lisp_String *n;
|
|
297 Charcount end;
|
|
298 int i;
|
|
299 Bufbyte *name_data;
|
|
300 Bufbyte *string_result;
|
|
301 Bufbyte *string_result_ptr;
|
|
302 Emchar elt;
|
|
303 int expecting_underscore = 0;
|
197
|
304
|
195
|
305 CHECK_STRING (name);
|
197
|
306
|
195
|
307 n = XSTRING (name);
|
|
308 end = string_char_length (n);
|
|
309 name_data = string_data (n);
|
197
|
310
|
195
|
311 string_result = (Bufbyte *) alloca (end * MAX_EMCHAR_LEN);
|
|
312 string_result_ptr = string_result;
|
219
|
313 for (i = 0; i < end; i++)
|
195
|
314 {
|
219
|
315 elt = charptr_emchar (name_data);
|
195
|
316 elt = DOWNCASE (buf, elt);
|
219
|
317 if (expecting_underscore)
|
195
|
318 {
|
|
319 expecting_underscore = 0;
|
219
|
320 switch (elt)
|
195
|
321 {
|
219
|
322 case '%':
|
|
323 /* Allow `%%' to mean `%'. */
|
|
324 string_result_ptr += set_charptr_emchar (string_result_ptr, '%');
|
|
325 break;
|
|
326 case '_':
|
|
327 break;
|
|
328 default:
|
195
|
329 string_result_ptr += set_charptr_emchar (string_result_ptr, '%');
|
|
330 string_result_ptr += set_charptr_emchar (string_result_ptr, elt);
|
|
331 }
|
|
332 }
|
219
|
333 else if (elt == '%')
|
|
334 expecting_underscore = 1;
|
195
|
335 else
|
|
336 string_result_ptr += set_charptr_emchar (string_result_ptr, elt);
|
219
|
337 INC_CHARPTR (name_data);
|
195
|
338 }
|
|
339
|
|
340 return make_string (string_result, string_result_ptr - string_result);
|
|
341 }
|
|
342
|
0
|
343 void
|
|
344 syms_of_menubar (void)
|
|
345 {
|
|
346 defsymbol (&Qcurrent_menubar, "current-menubar");
|
20
|
347 DEFSUBR (Fpopup_menu);
|
195
|
348 DEFSUBR (Fnormalize_menu_item_name);
|
251
|
349 DEFSUBR (Fmenu_find_real_submenu);
|
0
|
350 }
|
|
351
|
|
352 void
|
|
353 vars_of_menubar (void)
|
|
354 {
|
|
355 {
|
|
356 /* put in Vblank_menubar a menubar value which has no visible
|
|
357 * items. This is a bit tricky due to various quirks. We
|
|
358 * could use '(["" nil nil]), but this is apparently equivalent
|
|
359 * to '(nil), and a new frame created with this menubar will
|
|
360 * get a vertically-squished menubar. If we use " " as the
|
|
361 * button title instead of "", we get an etched button border.
|
|
362 * So we use
|
|
363 * '(("No active menubar" ["" nil nil]))
|
|
364 * which creates a menu whose title is "No active menubar",
|
|
365 * and this works fine.
|
|
366 */
|
|
367
|
|
368 Lisp_Object menu_item[3];
|
|
369 static CONST char *blank_msg = "No active menubar";
|
|
370
|
|
371 menu_item[0] = build_string ("");
|
|
372 menu_item[1] = Qnil;
|
|
373 menu_item[2] = Qnil;
|
185
|
374 Vblank_menubar = Fcons (Fcons (build_string (blank_msg),
|
|
375 Fcons (Fvector (3, &menu_item[0]),
|
0
|
376 Qnil)),
|
|
377 Qnil);
|
|
378 Vblank_menubar = Fpurecopy (Vblank_menubar);
|
|
379 staticpro (&Vblank_menubar);
|
|
380 }
|
|
381
|
|
382 DEFVAR_BOOL ("popup-menu-titles", &popup_menu_titles /*
|
|
383 If true, popup menus will have title bars at the top.
|
|
384 */ );
|
|
385 popup_menu_titles = 1;
|
|
386
|
|
387 /* #### Replace current menubar with a specifier. */
|
|
388
|
|
389 /* All C code must access the menubar via Qcurrent_menubar
|
|
390 because it can be buffer-local. Note that Vcurrent_menubar
|
|
391 doesn't need to exist at all, except for the magic function. */
|
|
392
|
|
393 DEFVAR_LISP_MAGIC ("current-menubar", &Vcurrent_menubar /*
|
|
394 The current menubar. This may be buffer-local.
|
|
395
|
|
396 When the menubar is changed, the function `set-menubar-dirty-flag' has to
|
|
397 be called for the menubar to be updated on the frame. See `set-menubar'
|
|
398 and `set-buffer-menubar'.
|
|
399
|
|
400 A menubar is a list of menus and menu-items.
|
|
401 A menu is a list of menu items, keyword-value pairs, strings, and submenus.
|
|
402
|
|
403 The first element of a menu must be a string, which is the name of the menu.
|
|
404 This is the string that will be displayed in the parent menu, if any. For
|
|
405 toplevel menus, it is ignored. This string is not displayed in the menu
|
|
406 itself.
|
|
407
|
|
408 Immediately following the name string of the menu, any of three
|
|
409 optional keyword-value pairs is permitted.
|
|
410
|
|
411 If an element of a menu (or menubar) is a string, then that string will be
|
|
412 presented as unselectable text.
|
|
413
|
|
414 If an element of a menu is a string consisting solely of hyphens, then that
|
|
415 item will be presented as a solid horizontal line.
|
|
416
|
|
417 If an element of a menu is a list, it is treated as a submenu. The name of
|
|
418 that submenu (the first element in the list) will be used as the name of the
|
|
419 item representing this menu on the parent.
|
|
420
|
|
421 If an element of a menubar is `nil', then it is used to represent the
|
|
422 division between the set of menubar-items which are flushleft and those
|
|
423 which are flushright.
|
|
424
|
|
425 Otherwise, the element must be a vector, which describes a menu item.
|
|
426 A menu item can have any of the following forms:
|
|
427
|
185
|
428 [ "name" callback <active-p> ]
|
|
429 [ "name" callback <active-p> "suffix" ]
|
|
430 [ "name" callback :<keyword> <value> :<keyword> <value> ... ]
|
0
|
431
|
|
432 The name is the string to display on the menu; it is filtered through the
|
|
433 resource database, so it is possible for resources to override what string
|
|
434 is actually displayed.
|
|
435
|
|
436 If the `callback' of a menu item is a symbol, then it must name a command.
|
|
437 It will be invoked with `call-interactively'. If it is a list, then it is
|
|
438 evaluated with `eval'.
|
|
439
|
|
440 The possible keywords are this:
|
|
441
|
|
442 :active <form> Same as <active-p> in the first two forms: the
|
|
443 expression is evaluated just before the menu is
|
|
444 displayed, and the menu will be selectable only if
|
|
445 the result is non-nil.
|
|
446
|
185
|
447 :suffix "string" Same as "suffix" in the second form: the suffix is
|
0
|
448 appended to the displayed name, providing a convenient
|
|
449 way of adding the name of a command's ``argument'' to
|
|
450 the menu, like ``Kill Buffer NAME''.
|
|
451
|
185
|
452 :keys "string" Normally, the keyboard equivalents of commands in
|
0
|
453 menus are displayed when the `callback' is a symbol.
|
|
454 This can be used to specify keys for more complex menu
|
|
455 items. It is passed through `substitute-command-keys'
|
|
456 first.
|
|
457
|
|
458 :style <style> Specifies what kind of object this menu item is:
|
|
459
|
|
460 nil A normal menu item.
|
|
461 toggle A toggle button.
|
|
462 radio A radio button.
|
|
463 button A menubar button.
|
|
464
|
|
465 The only difference between toggle and radio buttons is
|
|
466 how they are displayed. But for consistency, a toggle
|
|
467 button should be used when there is one option whose
|
|
468 value can be turned on or off, and radio buttons should
|
|
469 be used when there is a set of mutually exclusive
|
|
470 options. When using a group of radio buttons, you
|
|
471 should arrange for no more than one to be marked as
|
|
472 selected at a time.
|
|
473
|
|
474 :selected <form> Meaningful only when STYLE is `toggle', `radio' or
|
|
475 `button'. This specifies whether the button will be in
|
|
476 the selected or unselected state.
|
|
477
|
|
478 :included <form> This can be used to control the visibility of a menu or
|
|
479 menu item. The form is evaluated and the menu or menu
|
|
480 item is only displayed if the result is non-nil.
|
|
481
|
|
482 :config <symbol> This is an efficient shorthand for
|
|
483 :included (memq symbol menubar-configuration)
|
|
484 See the variable `menubar-configuration'.
|
|
485
|
|
486 :filter <function> A menu filter can only be used in a menu item list.
|
|
487 (i.e.: not in a menu item itself). It is used to
|
|
488 sensitize or incrementally create a submenu only when
|
|
489 it is selected by the user and not every time the
|
|
490 menubar is activated. The filter function is passed
|
|
491 the list of menu items in the submenu and must return a
|
|
492 list of menu items to be used for the menu. It is
|
|
493 called only when the menu is about to be displayed, so
|
|
494 other menus may already be displayed. Vile and
|
|
495 terrible things will happen if a menu filter function
|
|
496 changes the current buffer, window, or frame. It
|
|
497 also should not raise, lower, or iconify any frames.
|
|
498 Basically, the filter function should have no
|
|
499 side-effects.
|
|
500
|
|
501 For example:
|
|
502
|
185
|
503 ("File"
|
0
|
504 :filter file-menu-filter ; file-menu-filter is a function that takes
|
|
505 ; one argument (a list of menu items) and
|
|
506 ; returns a list of menu items
|
185
|
507 [ "Save As..." write-file t ]
|
|
508 [ "Revert Buffer" revert-buffer (buffer-modified-p) ]
|
|
509 [ "Read Only" toggle-read-only :style toggle
|
0
|
510 :selected buffer-read-only ]
|
|
511 )
|
|
512
|
|
513 See x-menubar.el for many more examples.
|
|
514
|
|
515 After the menubar is clicked upon, but before any menus are popped up,
|
|
516 the functions on the `activate-menubar-hook' are invoked to make top-level
|
|
517 changes to the menus and menubar. Note, however, that the use of menu
|
|
518 filters (using the :filter keyword) is usually a more efficient way to
|
|
519 dynamically alter or sensitize menus.
|
|
520 */, menubar_variable_changed);
|
|
521
|
|
522 Vcurrent_menubar = Qnil;
|
|
523
|
|
524 DEFVAR_LISP ("activate-menubar-hook", &Vactivate_menubar_hook /*
|
|
525 Function or functions called before a menubar menu is pulled down.
|
|
526 These functions are called with no arguments, and should interrogate and
|
|
527 modify the value of `current-menubar' as desired.
|
|
528
|
|
529 The functions on this hook are invoked after the mouse goes down, but before
|
|
530 the menu is mapped, and may be used to activate, deactivate, add, or delete
|
|
531 items from the menus. However, it is probably the case that using a :filter
|
|
532 keyword in a submenu would be a more efficient way of updating menus. See
|
|
533 the documentation of `current-menubar'.
|
|
534
|
|
535 These functions may return the symbol `t' to assert that they have made
|
|
536 no changes to the menubar. If any other value is returned, the menubar is
|
|
537 recomputed. If `t' is returned but the menubar has been changed, then the
|
|
538 changes may not show up right away. Returning `nil' when the menubar has
|
|
539 not changed is not so bad; more computation will be done, but redisplay of
|
|
540 the menubar will still be performed optimally.
|
|
541 */ );
|
|
542 Vactivate_menubar_hook = Qnil;
|
|
543 defsymbol (&Qactivate_menubar_hook, "activate-menubar-hook");
|
|
544
|
|
545 DEFVAR_BOOL ("menubar-show-keybindings", &menubar_show_keybindings /*
|
|
546 If true, the menubar will display keyboard equivalents.
|
|
547 If false, only the command names will be displayed.
|
|
548 */ );
|
|
549 menubar_show_keybindings = 1;
|
|
550
|
|
551 DEFVAR_LISP_MAGIC ("menubar-configuration", &Vmenubar_configuration /*
|
|
552 A list of symbols, against which the value of the :config tag for each
|
|
553 menubar item will be compared. If a menubar item has a :config tag, then
|
|
554 it is omitted from the menubar if that tag is not a member of the
|
|
555 `menubar-configuration' list.
|
|
556 */ , menubar_variable_changed);
|
|
557 Vmenubar_configuration = Qnil;
|
|
558
|
|
559 DEFVAR_LISP ("menubar-pointer-glyph", &Vmenubar_pointer_glyph /*
|
|
560 *The shape of the mouse-pointer when over the menubar.
|
|
561 This is a glyph; use `set-glyph-image' to change it.
|
|
562 If unspecified in a particular domain, the window-system-provided
|
|
563 default pointer is used.
|
|
564 */ );
|
|
565
|
|
566 Fprovide (intern ("menubar"));
|
|
567 }
|
|
568
|
|
569 void
|
|
570 specifier_vars_of_menubar (void)
|
|
571 {
|
|
572 DEFVAR_SPECIFIER ("menubar-visible-p", &Vmenubar_visible_p /*
|
|
573 *Whether the menubar is visible.
|
|
574 This is a specifier; use `set-specifier' to change it.
|
|
575 */ );
|
|
576 Vmenubar_visible_p = Fmake_specifier (Qboolean);
|
|
577
|
|
578 set_specifier_fallback (Vmenubar_visible_p, list1 (Fcons (Qnil, Qt)));
|
|
579 set_specifier_caching (Vmenubar_visible_p,
|
|
580 slot_offset (struct window,
|
|
581 menubar_visible_p),
|
|
582 menubar_visible_p_changed,
|
|
583 slot_offset (struct frame,
|
|
584 menubar_visible_p),
|
|
585 menubar_visible_p_changed_in_frame);
|
|
586 }
|
|
587
|
|
588 void
|
|
589 complex_vars_of_menubar (void)
|
|
590 {
|
|
591 Vmenubar_pointer_glyph = Fmake_glyph_internal (Qpointer);
|
|
592 }
|