annotate src/menubar.c @ 177:6075d714658b r20-3b15

Import from CVS: tag r20-3b15
author cvs
date Mon, 13 Aug 2007 09:51:16 +0200
parents 2d532a89d707
children 3d6bfa290dbd
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #include "device.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #include "frame.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include "menubar.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include "redisplay.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #include "window.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 int menubar_show_keybindings;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 Lisp_Object Vmenubar_configuration;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 Lisp_Object Qcurrent_menubar;
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 Qactivate_menubar_hook, Vactivate_menubar_hook;
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 Vmenubar_visible_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 static Lisp_Object Vcurrent_menubar; /* DO NOT ever reference this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 Always go through Qcurrent_menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 See below. */
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 20
diff changeset
48
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 Lisp_Object Vblank_menubar;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 int popup_menu_titles;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 Lisp_Object Vmenubar_pointer_glyph;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 menubar_variable_changed (Lisp_Object sym, Lisp_Object *val,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 Lisp_Object in_object, int flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 MARK_MENUBAR_CHANGED;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 update_frame_menubars (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 if (f->menubar_changed || f->windows_changed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 MAYBE_FRAMEMETH (f, update_frame_menubars, (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 f->menubar_changed = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 free_frame_menubars (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 /* If we had directly allocated any memory for the menubars instead
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 of using all Lisp_Objects this is where we would now free it. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 MAYBE_FRAMEMETH (f, free_frame_menubars, (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 menubar_visible_p_changed (Lisp_Object specifier, struct window *w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 Lisp_Object oldval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 MARK_MENUBAR_CHANGED;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 menubar_visible_p_changed_in_frame (Lisp_Object specifier, struct frame *f,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 Lisp_Object oldval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 update_frame_menubars (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
95 DEFUN ("popup-menu", Fpopup_menu, 1, 2, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 Pop up the given menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 A menu description is a list of menu items, strings, and submenus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 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
100 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
101 toplevel menus, it is ignored. This string is not displayed in the menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 itself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 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
105 the menu as unselectable text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 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
108 item will be presented as a solid horizontal line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 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
111 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
112 item representing this menu on the parent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 Otherwise, the element must be a vector, which describes a menu item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 A menu item can have any of the following forms:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 [ \"name\" callback <active-p> ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 [ \"name\" callback <active-p> \"suffix\" ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 [ \"name\" callback :<keyword> <value> :<keyword> <value> ... ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 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
122 resource database, so it is possible for resources to override what string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 is actually displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 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
126 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
127 evaluated with `eval'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 The possible keywords are this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 :active <form> Same as <active-p> in the first two forms: the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 expression is evaluated just before the menu is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 displayed, and the menu will be selectable only if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 the result is non-nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 :suffix \"string\" Same as \"suffix\" in the second form: the suffix is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 appended to the displayed name, providing a convenient
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 way of adding the name of a command's ``argument'' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 the menu, like ``Kill Buffer NAME''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 :keys \"string\" Normally, the keyboard equivalents of commands in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 menus are displayed when the `callback' is a symbol.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 This can be used to specify keys for more complex menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 items. It is passed through `substitute-command-keys'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 first.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 :style <style> Specifies what kind of object this menu item is:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 nil A normal menu item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 toggle A toggle button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 radio A radio button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 The only difference between toggle and radio buttons is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 how they are displayed. But for consistency, a toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 button should be used when there is one option whose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 value can be turned on or off, and radio buttons should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 be used when there is a set of mutually exclusive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 options. When using a group of radio buttons, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 should arrange for no more than one to be marked as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 selected at a time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 :selected <form> Meaningful only when STYLE is `toggle' or `radio'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 This specifies whether the button will be in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 selected or unselected state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 For example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 [ \"Save As...\" write-file t ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 [ \"Revert Buffer\" revert-buffer (buffer-modified-p) ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 [ \"Read Only\" toggle-read-only :style toggle :selected buffer-read-only ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 See menubar.el for many more examples.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
173 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
174 (menu_desc, event))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 struct frame *f = decode_frame(Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 MAYBE_FRAMEMETH (f, popup_menu, (menu_desc,event));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 syms_of_menubar (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 defsymbol (&Qcurrent_menubar, "current-menubar");
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
185 DEFSUBR (Fpopup_menu);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 vars_of_menubar (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 /* put in Vblank_menubar a menubar value which has no visible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 * items. This is a bit tricky due to various quirks. We
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 * could use '(["" nil nil]), but this is apparently equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 * to '(nil), and a new frame created with this menubar will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 * get a vertically-squished menubar. If we use " " as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 * button title instead of "", we get an etched button border.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 * So we use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 * '(("No active menubar" ["" nil nil]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 * which creates a menu whose title is "No active menubar",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 * and this works fine.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 Lisp_Object menu_item[3];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 static CONST char *blank_msg = "No active menubar";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 menu_item[0] = build_string ("");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 menu_item[1] = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 menu_item[2] = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 Vblank_menubar = Fcons (Fcons (build_string (blank_msg),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 Fcons (Fvector (3, &menu_item[0]),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 Qnil)),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 Vblank_menubar = Fpurecopy (Vblank_menubar);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 staticpro (&Vblank_menubar);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 DEFVAR_BOOL ("popup-menu-titles", &popup_menu_titles /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 If true, popup menus will have title bars at the top.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 popup_menu_titles = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 /* #### Replace current menubar with a specifier. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 /* All C code must access the menubar via Qcurrent_menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 because it can be buffer-local. Note that Vcurrent_menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 doesn't need to exist at all, except for the magic function. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 DEFVAR_LISP_MAGIC ("current-menubar", &Vcurrent_menubar /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 The current menubar. This may be buffer-local.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 When the menubar is changed, the function `set-menubar-dirty-flag' has to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 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
234 and `set-buffer-menubar'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 A menubar is a list of menus and menu-items.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 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
238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 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
240 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
241 toplevel menus, it is ignored. This string is not displayed in the menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 itself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 Immediately following the name string of the menu, any of three
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 optional keyword-value pairs is permitted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 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
248 presented as unselectable text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 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
251 item will be presented as a solid horizontal line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 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
254 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
255 item representing this menu on the parent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 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
258 division between the set of menubar-items which are flushleft and those
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 which are flushright.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 Otherwise, the element must be a vector, which describes a menu item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 A menu item can have any of the following forms:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 [ \"name\" callback <active-p> ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 [ \"name\" callback <active-p> \"suffix\" ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 [ \"name\" callback :<keyword> <value> :<keyword> <value> ... ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 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
269 resource database, so it is possible for resources to override what string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 is actually displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 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
273 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
274 evaluated with `eval'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 The possible keywords are this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 :active <form> Same as <active-p> in the first two forms: the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 expression is evaluated just before the menu is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 displayed, and the menu will be selectable only if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 the result is non-nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 :suffix \"string\" Same as \"suffix\" in the second form: the suffix is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 appended to the displayed name, providing a convenient
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 way of adding the name of a command's ``argument'' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 the menu, like ``Kill Buffer NAME''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 :keys \"string\" Normally, the keyboard equivalents of commands in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 menus are displayed when the `callback' is a symbol.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 This can be used to specify keys for more complex menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 items. It is passed through `substitute-command-keys'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 first.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 :style <style> Specifies what kind of object this menu item is:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 nil A normal menu item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 toggle A toggle button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 radio A radio button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 button A menubar button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 The only difference between toggle and radio buttons is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 how they are displayed. But for consistency, a toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 button should be used when there is one option whose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 value can be turned on or off, and radio buttons should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 be used when there is a set of mutually exclusive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 options. When using a group of radio buttons, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 should arrange for no more than one to be marked as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 selected at a time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 :selected <form> Meaningful only when STYLE is `toggle', `radio' or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 `button'. This specifies whether the button will be in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 the selected or unselected state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 :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
315 menu item. The form is evaluated and the menu or menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 item is only displayed if the result is non-nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 :config <symbol> This is an efficient shorthand for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 :included (memq symbol menubar-configuration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 See the variable `menubar-configuration'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 :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
323 (i.e.: not in a menu item itself). It is used to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 sensitize or incrementally create a submenu only when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 it is selected by the user and not every time the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 menubar is activated. The filter function is passed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 the list of menu items in the submenu and must return a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 list of menu items to be used for the menu. It is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 called only when the menu is about to be displayed, so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 other menus may already be displayed. Vile and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 terrible things will happen if a menu filter function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 changes the current buffer, window, or frame. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 also should not raise, lower, or iconify any frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 Basically, the filter function should have no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 side-effects.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 For example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (\"File\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 :filter file-menu-filter ; file-menu-filter is a function that takes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 ; one argument (a list of menu items) and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 ; returns a list of menu items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 [ \"Save As...\" write-file t ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 [ \"Revert Buffer\" revert-buffer (buffer-modified-p) ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 [ \"Read Only\" toggle-read-only :style toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 :selected buffer-read-only ]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 See x-menubar.el for many more examples.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 After the menubar is clicked upon, but before any menus are popped up,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 the functions on the `activate-menubar-hook' are invoked to make top-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 changes to the menus and menubar. Note, however, that the use of menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 filters (using the :filter keyword) is usually a more efficient way to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 dynamically alter or sensitize menus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 */, menubar_variable_changed);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 Vcurrent_menubar = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 DEFVAR_LISP ("activate-menubar-hook", &Vactivate_menubar_hook /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 Function or functions called before a menubar menu is pulled down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 These functions are called with no arguments, and should interrogate and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 modify the value of `current-menubar' as desired.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 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
366 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
367 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
368 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
369 the documentation of `current-menubar'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 These functions may return the symbol `t' to assert that they have made
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 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
373 recomputed. If `t' is returned but the menubar has been changed, then the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 changes may not show up right away. Returning `nil' when the menubar has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 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
376 the menubar will still be performed optimally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 Vactivate_menubar_hook = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 defsymbol (&Qactivate_menubar_hook, "activate-menubar-hook");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 DEFVAR_BOOL ("menubar-show-keybindings", &menubar_show_keybindings /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 If true, the menubar will display keyboard equivalents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 If false, only the command names will be displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 menubar_show_keybindings = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 DEFVAR_LISP_MAGIC ("menubar-configuration", &Vmenubar_configuration /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 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
389 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
390 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
391 `menubar-configuration' list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 */ , menubar_variable_changed);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 Vmenubar_configuration = Qnil;
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_LISP ("menubar-pointer-glyph", &Vmenubar_pointer_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 *The shape of the mouse-pointer when over the menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 This is a glyph; use `set-glyph-image' to change it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 If unspecified in a particular domain, the window-system-provided
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 default pointer is used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 Fprovide (intern ("menubar"));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 specifier_vars_of_menubar (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 DEFVAR_SPECIFIER ("menubar-visible-p", &Vmenubar_visible_p /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 *Whether the menubar is visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 This is a specifier; use `set-specifier' to change it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 Vmenubar_visible_p = Fmake_specifier (Qboolean);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 set_specifier_fallback (Vmenubar_visible_p, list1 (Fcons (Qnil, Qt)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 set_specifier_caching (Vmenubar_visible_p,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 slot_offset (struct window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 menubar_visible_p),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 menubar_visible_p_changed,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 slot_offset (struct frame,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 menubar_visible_p),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 menubar_visible_p_changed_in_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 complex_vars_of_menubar (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 Vmenubar_pointer_glyph = Fmake_glyph_internal (Qpointer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 }