annotate src/menubar.c @ 261:405dd6d1825b r20-5b29

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