231
|
1 /* Implements an elisp-programmable menubar -- Win32
|
|
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
|
|
4 Copyright (C) 1997 Kirill M. Katsnelson <kkm@kis.ru>
|
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Not in FSF. */
|
|
24
|
|
25 /* Autorship:
|
|
26 Initially written by kkm 12/24/97,
|
|
27 peeking into and copying stuff from menubar-x.c
|
|
28 */
|
|
29
|
|
30 /* Algotirhm for handling menus is as follows. When window's menubar
|
|
31 * is created, current-menubar is not traversed in depth. Rather, only
|
|
32 * top level items, both items and pulldowns, are added to the
|
|
33 * menubar. Each pulldown is initially empty. When a pulldown is
|
|
34 * selected and about to open, corresponding element of
|
|
35 * current-menubar is found, and the newly open pulldown is
|
|
36 * populated. This is made again in the same non-recursive manner.
|
|
37 *
|
|
38 * This algorithm uses hash tables to find out element of the menu
|
|
39 * descriptor list given menu handle. The key is an opaque ptr data
|
|
40 * type, keeping menu handle, and the value is a list of strings
|
|
41 * representing the path from the root of the menu to the item
|
|
42 * descriptor. Each frame has an associated hashtable.
|
|
43 *
|
|
44 * Leaf items are assigned a unique id based on item's hash. When an
|
|
45 * item is selected, Windows sends back the id. Unfortunately, only
|
|
46 * low 16 bit of the ID are sent, and there's no way to get the 32-bit
|
|
47 * value. Yes, Win32 is just a different set of bugs than X! Aside
|
|
48 * from this blame, another hasing mechanism is required to map menu
|
|
49 * ids to commands (which are actually Lisp_Object's). This mapping is
|
|
50 * performed in the same hashtable, as the lifetime of both maps is
|
|
51 * exactly the same. This is unabmigous, as menu handles are
|
|
52 * represented by lisp opaques, while command ids are by lisp
|
|
53 * integers. The additional advantage for this is that command forms
|
|
54 * are automatically GC-protected, which is important because these
|
|
55 * may be transient forms generated by :filter functions.
|
|
56 *
|
|
57 * The hashtable is not allowed to grow too much; it is pruned
|
|
58 * whenever this is safe to do. This is done by re-creating the menu
|
|
59 * bar, and clearing and refilling the hash table from scratch.
|
|
60 *
|
|
61 * Popup menus are handled identially to pulldowns. A static hash
|
|
62 * table is used for popup menus, and lookup is made not in
|
|
63 * current-menubar but in a lisp form supplied to the `popup'
|
|
64 * function.
|
|
65 *
|
|
66 * Another Windows weirdness is that there's no way to tell that a
|
|
67 * popup has been dismissed without making selection. We need to know
|
|
68 * that to cleanup the popup menu hashtable, but this is not honestly
|
|
69 * doable using *documented* sequence of messages. Sticking to
|
|
70 * particular knowledge is bad because this may break in Windows NT
|
|
71 * 5.0, or Windows 98, or other future version. Instead, I allow the
|
|
72 * hashtables to hang around, and not clear them, unless WM_COMMAND is
|
|
73 * received. This is worthy some memory but more safe. Hacks welcome,
|
|
74 * anyways!
|
|
75 *
|
|
76 */
|
|
77
|
|
78 #include <config.h>
|
|
79 #include "lisp.h"
|
|
80
|
|
81 #include "buffer.h"
|
|
82 #include "commands.h"
|
|
83 #include "console-msw.h"
|
|
84 #include "emacsfns.h"
|
|
85 #include "elhash.h"
|
|
86 #include "event-msw.h"
|
|
87 #include "events.h"
|
|
88 #include "frame.h"
|
|
89 #include "gui.h"
|
|
90 #include "lisp.h"
|
|
91 #include "menubar.h"
|
|
92 #include "menubar-msw.h"
|
|
93 #include "opaque.h"
|
|
94 #include "window.h"
|
|
95
|
|
96 #define EMPTY_ITEM_ID ((UINT)LISP_TO_VOID (Qunbound))
|
|
97 #define EMPTY_ITEM_NAME "(empty)"
|
|
98
|
233
|
99 /* Current menu (bar or popup) descriptor. gcpro'ed */
|
|
100 static Lisp_Object current_menudesc;
|
231
|
101
|
233
|
102 /* Current menubar or popup hashtable. gcpro'ed */
|
|
103 static Lisp_Object current_hashtable;
|
231
|
104
|
|
105 /* Bound by menubar.el */
|
|
106 static Lisp_Object Qfind_menu_item;
|
|
107
|
|
108 /* This is used to allocate unique ids to menu items.
|
|
109 Items ids are in MENU_ITEM_ID_MIN to MENU_ITEM_ID_MAX.
|
|
110 Allocation checks that the item is not already in
|
|
111 the TOP_LEVEL_MENU */
|
|
112 /* #### defines go to gui-msw.h */
|
|
113 #define MENU_ITEM_ID_MIN 0x8000
|
|
114 #define MENU_ITEM_ID_MAX 0xFFFF
|
|
115 #define MENU_ITEM_ID_BITS(x) ((x) & 0x7FFF | 0x8000)
|
|
116 static HMENU top_level_menu;
|
|
117
|
|
118 /* ============= THIS STUFF MIGHT GO SOMEWHERE ELSE ================= */
|
|
119
|
|
120 /* All these functions are windows sys independent, and are candidates
|
|
121 to go to lisp code instead */
|
|
122
|
|
123 /*
|
|
124 * DESCRIPTOR is a list in the form ({:keyword value}+ rest...).
|
|
125 * This function extracts all the key-value pairs into the newly
|
|
126 * created plist, and returns pointer to REST. Original list is not
|
|
127 * modified (heaven save!)
|
|
128 */
|
|
129 Lisp_Object
|
|
130 gui_parse_menu_keywords (Lisp_Object descriptor, Lisp_Object *plist)
|
|
131 {
|
|
132 Lisp_Object pair, key, val;
|
|
133 *plist = Qnil;
|
|
134 LIST_LOOP (pair, descriptor)
|
|
135 {
|
|
136 if (!CONSP(pair))
|
|
137 signal_simple_error ("Mailformed gui entity descriptor", descriptor);
|
|
138 key = XCAR(pair);
|
|
139 if (!KEYWORDP (key))
|
|
140 return pair;
|
|
141 pair = XCDR (pair);
|
|
142 if (!CONSP(pair))
|
|
143 signal_simple_error ("Mailformed gui entity descriptor", descriptor);
|
|
144 val = XCAR (pair);
|
|
145 internal_plist_put (plist, key, val);
|
|
146 }
|
|
147 return pair;
|
|
148 }
|
|
149
|
|
150 /*
|
|
151 * DESC is a vector describing a menu item. The function returns menu
|
|
152 * item name in NAME, callback form in CALLBACK, and all key-values
|
|
153 * pairs in PLIST. For old-style vectors, the plist is faked.
|
|
154 */
|
|
155 void
|
|
156 gui_parse_button_descriptor (Lisp_Object desc, Lisp_Object *name,
|
|
157 Lisp_Object *callback, Lisp_Object *plist)
|
|
158 {
|
|
159 int length = XVECTOR_LENGTH (desc);
|
|
160 Lisp_Object *contents = XVECTOR_DATA (desc);
|
|
161 int plist_p;
|
|
162
|
|
163 *name = Qnil;
|
|
164 *callback = Qnil;
|
|
165 *plist = Qnil;
|
|
166
|
|
167 if (length < 3)
|
233
|
168 signal_simple_error ("Button descriptors must be at least 3 long", desc);
|
231
|
169
|
|
170 /* length 3: [ "name" callback active-p ]
|
|
171 length 4: [ "name" callback active-p suffix ]
|
|
172 or [ "name" callback keyword value ]
|
|
173 length 5+: [ "name" callback [ keyword value ]+ ]
|
|
174 */
|
|
175 plist_p = (length >= 5 || KEYWORDP (contents [2]));
|
|
176
|
|
177 *name = contents [0];
|
|
178 *callback = contents [1];
|
|
179
|
|
180 if (!plist_p)
|
|
181 /* the old way */
|
|
182 {
|
|
183 internal_plist_put (plist, Q_active, contents [2]);
|
|
184 if (length == 4)
|
|
185 internal_plist_put (plist, Q_suffix, contents [3]);
|
|
186 }
|
|
187 else
|
|
188 /* the new way */
|
|
189 {
|
|
190 int i;
|
|
191 if (length & 1)
|
|
192 signal_simple_error (
|
233
|
193 "Button descriptor has an odd number of keywords and values",
|
231
|
194 desc);
|
|
195
|
|
196 for (i = 2; i < length;)
|
|
197 {
|
|
198 Lisp_Object key = contents [i++];
|
|
199 Lisp_Object val = contents [i++];
|
|
200 if (!KEYWORDP (key))
|
233
|
201 signal_simple_error_2 ("Not a keyword", key, desc);
|
231
|
202 internal_plist_put (plist, key, val);
|
|
203 }
|
|
204 }
|
|
205 }
|
|
206
|
|
207 /*
|
|
208 * Given PLIST of key-value pairs for a menu item or button, consult
|
|
209 * :included and :config properties (the latter against
|
|
210 * CONFLIST). Return value is non-zero when item should *not* appear.
|
|
211 */
|
|
212 int
|
|
213 gui_plist_says_item_excluded (Lisp_Object plist, Lisp_Object conflist)
|
|
214 {
|
|
215 Lisp_Object tem;
|
|
216 /* This function can call lisp */
|
|
217
|
|
218 /* Evaluate :included first */
|
|
219 tem = internal_plist_get (plist, Q_included);
|
|
220 if (!UNBOUNDP (tem))
|
|
221 {
|
|
222 tem = Feval (tem);
|
|
223 if (NILP (tem))
|
|
224 return 1;
|
|
225 }
|
|
226
|
|
227 /* Do :config if conflist is given */
|
|
228 if (!NILP (conflist))
|
|
229 {
|
|
230 tem = internal_plist_get (plist, Q_config);
|
|
231 if (!UNBOUNDP (tem))
|
|
232 {
|
|
233 tem = Fmemq (tem, conflist);
|
|
234 if (NILP (tem))
|
|
235 return 1;
|
|
236 }
|
|
237 }
|
|
238
|
|
239 return 0;
|
|
240 }
|
|
241
|
|
242 /*
|
|
243 * Given PLIST of key-value pairs for a menu item or button, consult
|
|
244 * :active property. Return non-zero if the item is *inactive*
|
|
245 */
|
|
246 int
|
|
247 gui_plist_says_item_inactive (Lisp_Object plist)
|
|
248 {
|
|
249 Lisp_Object tem;
|
|
250 /* This function can call lisp */
|
|
251
|
|
252 tem = internal_plist_get (plist, Q_active);
|
|
253 if (!UNBOUNDP (tem))
|
|
254 {
|
|
255 tem = Feval (tem);
|
|
256 if (NILP (tem))
|
|
257 return 1;
|
|
258 }
|
|
259
|
|
260 return 0;
|
|
261 }
|
|
262
|
|
263 /*
|
|
264 * Given PLIST of key-value pairs for a menu item or button, evaluate
|
|
265 * the form which is the value of :filter property. Filter function
|
|
266 * given DESC as argument. If there's no :filter property, DESC is
|
|
267 * returned, otherwise the value returned by the filter function is
|
|
268 * returned.
|
|
269 */
|
|
270 Lisp_Object
|
|
271 gui_plist_apply_filter (Lisp_Object plist, Lisp_Object desc)
|
|
272 {
|
|
273 Lisp_Object tem;
|
|
274 /* This function can call lisp */
|
|
275
|
|
276 tem = internal_plist_get (plist, Q_filter);
|
|
277 if (UNBOUNDP (tem))
|
|
278 return desc;
|
|
279 else
|
|
280 return call1 (tem, desc);
|
|
281 }
|
|
282
|
|
283 /*
|
|
284 * This is tricky because there's no menu item styles in Windows, only
|
|
285 * states: Each item may be given no checkmark, radio or check
|
|
286 * mark. This function returns required mark style as determined by
|
|
287 * PLIST. Return value is the value of :style property if the item is
|
|
288 * :seleted, or nil otherwise
|
|
289 */
|
|
290 Lisp_Object
|
|
291 gui_plist_get_current_style (Lisp_Object plist)
|
|
292 {
|
|
293 Lisp_Object style, selected;
|
|
294 style = internal_plist_get (plist, Q_style);
|
|
295 if (UNBOUNDP (style) || NILP(style))
|
|
296 return Qnil;
|
|
297
|
|
298 selected = internal_plist_get (plist, Q_selected);
|
|
299 if (UNBOUNDP (selected) || NILP(Feval(selected)))
|
|
300 return Qnil;
|
|
301
|
|
302 return style;
|
|
303 }
|
|
304
|
|
305 Lisp_Object
|
|
306 current_frame_menubar (CONST struct frame* f)
|
|
307 {
|
|
308 struct window *w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
|
|
309 return symbol_value_in_buffer (Qcurrent_menubar, w->buffer);
|
|
310 }
|
|
311
|
|
312 /* ============ END IF STUFF THAT MIGHT GO SOMEWHERE ELSE =============== */
|
|
313
|
|
314 /* Change these together */
|
|
315 #define MAX_MENUITEM_LENGTH 128
|
|
316 #define DISPLAYABLE_MAX_MENUITEM_LENGTH "128"
|
|
317
|
|
318 static void
|
|
319 signal_item_too_long (Lisp_Object name)
|
|
320 {
|
|
321 signal_simple_error ("Menu item is longer than "
|
|
322 DISPLAYABLE_MAX_MENUITEM_LENGTH
|
|
323 " characters", name);
|
|
324 }
|
|
325
|
|
326 /* #### If this function returned (FLUSHLEFT . FLUSHRIGHT) it also
|
|
327 could be moved above that line - it becomes window system
|
|
328 independant */
|
|
329 /*
|
|
330 * This returns Windows-style menu item string:
|
|
331 * "Left Flush\tRight Flush"
|
|
332 */
|
|
333 static CONST char*
|
|
334 plist_get_menu_item_name (Lisp_Object name, Lisp_Object callback, Lisp_Object plist)
|
|
335 {
|
|
336 /* We construct the name in a static buffer. That's fine, beause
|
|
337 menu items longer than 128 chars are probably programming errors,
|
|
338 and better be caught than displayed! */
|
|
339
|
|
340 static char buf[MAX_MENUITEM_LENGTH];
|
|
341 char* p = buf;
|
|
342 int buf_left = MAX_MENUITEM_LENGTH - 1;
|
|
343 Lisp_Object tem;
|
|
344
|
|
345 /* Get name first */
|
|
346 buf_left -= XSTRING_LENGTH (name);
|
|
347 if (buf_left < 0)
|
|
348 signal_item_too_long (name);
|
|
349 strcpy (p, XSTRING_DATA (name));
|
|
350 p += XSTRING_LENGTH (name);
|
|
351
|
|
352 /* Have suffix? */
|
|
353 tem = internal_plist_get (plist, Q_suffix);
|
|
354 if (!UNBOUNDP (tem))
|
|
355 {
|
|
356 if (!STRINGP (tem))
|
|
357 signal_simple_error (":suffix must be a string", tem);
|
|
358 buf_left -= XSTRING_LENGTH (tem) + 1;
|
|
359 if (buf_left < 0)
|
|
360 signal_item_too_long (name);
|
|
361 *p++ = ' ';
|
|
362 strcpy (p, XSTRING_DATA (tem));
|
|
363 p += XSTRING_LENGTH (tem);
|
|
364 }
|
|
365
|
|
366 /* Have keys? */
|
|
367 if (menubar_show_keybindings)
|
|
368 {
|
|
369 static char buf2 [1024];
|
|
370 buf2[0] = 0;
|
|
371
|
|
372 tem = internal_plist_get (plist, Q_keys);
|
|
373 if (!UNBOUNDP (tem))
|
|
374 {
|
|
375 if (!STRINGP (tem))
|
|
376 signal_simple_error (":keys must be a string", tem);
|
|
377 if (XSTRING_LENGTH (tem) > sizeof (buf2) - 1)
|
|
378 signal_item_too_long (name);
|
|
379 strcpy (buf2, XSTRING_DATA (tem));
|
|
380 }
|
|
381 else if (SYMBOLP (callback))
|
|
382 {
|
|
383 /* #### Warning, dependency here on current_buffer and point */
|
|
384 /* #### I've borrowed this warning along with this code from
|
|
385 menubar-x.c. What does that mean? -- kkm */
|
|
386 where_is_to_char (callback, buf2);
|
|
387 }
|
|
388
|
|
389 if (buf2 [0])
|
|
390 {
|
|
391 int n = strlen (buf2) + 1;
|
|
392 buf_left -= n;
|
|
393 if (buf_left < 0)
|
|
394 signal_item_too_long (name);
|
|
395 *p++ = '\t';
|
|
396 strcpy (p, buf2);
|
|
397 p += n-1;
|
|
398 }
|
|
399 }
|
|
400
|
|
401 *p = 0;
|
|
402 return buf;
|
|
403 }
|
|
404
|
|
405 /*
|
|
406 * hmenu_to_lisp_object() returns an opaque ptr given menu handle.
|
|
407 */
|
|
408 static Lisp_Object
|
|
409 hmenu_to_lisp_object (HMENU hmenu)
|
|
410 {
|
|
411 return make_opaque_ptr (hmenu);
|
|
412 }
|
|
413
|
|
414 /*
|
|
415 * Allocation tries a hash based on item's path and name first. This
|
|
416 * almost guarantees that the same item will override its old value in
|
|
417 * the hashtable rather than abandon it.
|
|
418 */
|
|
419 static Lisp_Object
|
|
420 allocate_menu_item_id (Lisp_Object path, Lisp_Object name)
|
|
421 {
|
|
422 UINT id = MENU_ITEM_ID_BITS (HASH2 (internal_hash (path, 0),
|
|
423 internal_hash (name, 0)));
|
|
424 do {
|
|
425 id = MENU_ITEM_ID_BITS (id + 1);
|
|
426 } while (GetMenuState (top_level_menu, id, MF_BYCOMMAND) != 0xFFFFFFFF);
|
|
427 return make_int (id);
|
|
428 }
|
|
429
|
|
430 static HMENU
|
|
431 create_empty_popup_menu (void)
|
|
432 {
|
|
433 HMENU submenu = CreatePopupMenu ();
|
|
434 /* #### It seems that really we do not need "(empty)" at this stage */
|
|
435 #if 0
|
|
436 AppendMenu (submenu, MF_STRING | MF_GRAYED, EMPTY_ITEM_ID, EMPTY_ITEM_NAME);
|
|
437 #endif
|
|
438 return submenu;
|
|
439 }
|
|
440
|
|
441 static void
|
|
442 empty_menu (HMENU menu, int add_empty_p)
|
|
443 {
|
|
444 while (DeleteMenu (menu, 0, MF_BYPOSITION));
|
|
445 if (add_empty_p)
|
|
446 AppendMenu (menu, MF_STRING | MF_GRAYED, EMPTY_ITEM_ID, EMPTY_ITEM_NAME);
|
|
447 }
|
|
448
|
233
|
449 /*
|
|
450 * The idea of checksumming is that we must hash minimal object
|
|
451 * which is neccessarily changes when the item changes. For separator
|
|
452 * this is a constant, for grey strings and submenus these are hashes
|
|
453 * of names, since sumbenus are unpopulated until opened so always
|
|
454 * equal otherwise. For items, this is a full hash value of a callback,
|
|
455 * because a callback may me a form which can be changed only somewhere
|
|
456 * in depth.
|
|
457 */
|
|
458 static unsigned long
|
|
459 checksum_menu_item (Lisp_Object item)
|
|
460 {
|
|
461 if (STRINGP (item))
|
|
462 {
|
|
463 /* Separator or unselectable text - hash as a string + 13 */
|
|
464 if (separator_string_p (XSTRING_DATA (item)))
|
|
465 return 13;
|
|
466 else
|
|
467 return internal_hash (item, 0) + 13;
|
|
468 }
|
|
469 else if (CONSP (item))
|
|
470 {
|
|
471 /* Submenu - hash by its string name + 0 */
|
|
472 return internal_hash (XCAR(item), 0);
|
|
473 }
|
|
474 else if (VECTORP (item))
|
|
475 {
|
|
476 /* An ordinary item - hash its name and callback form. */
|
|
477 Lisp_Object plist, name, callback;
|
|
478 gui_parse_button_descriptor (item, &name, &callback, &plist);
|
|
479 return HASH2 (internal_hash (name, 0),
|
|
480 internal_hash (callback, 0));
|
|
481 }
|
|
482
|
|
483 /* An error - will be caught later */
|
|
484 return 0;
|
|
485 }
|
|
486
|
231
|
487 static void
|
|
488 populate_menu_add_item (HMENU menu, Lisp_Object path,
|
|
489 Lisp_Object hash_tab, Lisp_Object item, int flush_right)
|
|
490 {
|
|
491 MENUITEMINFO item_info;
|
|
492 struct gcpro gcpro1, gcpro2;
|
|
493
|
|
494 item_info.cbSize = sizeof (item_info);
|
|
495 item_info.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID;
|
|
496 item_info.fState = 0;
|
|
497 item_info.wID = 0;
|
|
498 item_info.fType = 0;
|
|
499
|
|
500 if (STRINGP (item))
|
|
501 {
|
|
502 /* Separator or unselectable text */
|
|
503 if (separator_string_p (XSTRING_DATA (item)))
|
|
504 item_info.fType = MFT_SEPARATOR;
|
|
505 else
|
|
506 {
|
|
507 item_info.fType = MFT_STRING;
|
|
508 item_info.fState = MFS_DISABLED;
|
|
509 item_info.dwTypeData = XSTRING_DATA (item);
|
|
510 }
|
|
511 }
|
|
512 else if (CONSP (item))
|
|
513 {
|
|
514 /* Submenu */
|
|
515 Lisp_Object subname = XCAR (item);
|
|
516 Lisp_Object plist;
|
|
517 HMENU submenu;
|
|
518
|
|
519 if (!STRINGP (subname))
|
233
|
520 signal_simple_error ("Menu name (first element) must be a string", item);
|
231
|
521
|
|
522 item = gui_parse_menu_keywords (XCDR (item), &plist);
|
|
523 GCPRO1 (plist);
|
|
524
|
|
525 if (gui_plist_says_item_excluded (plist, Vmenubar_configuration))
|
|
526 return;
|
|
527
|
|
528 if (gui_plist_says_item_inactive (plist))
|
|
529 item_info.fState = MFS_GRAYED;
|
|
530 /* Temptation is to put 'else' right here. Although, the
|
|
531 displayed item won't have an arrow indicating that it is a
|
|
532 popup. So we go ahead a little bit more and create a popup */
|
|
533 submenu = create_empty_popup_menu();
|
|
534
|
|
535 item_info.fMask |= MIIM_SUBMENU;
|
|
536 item_info.dwTypeData = plist_get_menu_item_name (subname, Qnil, plist);
|
|
537 item_info.hSubMenu = submenu;
|
|
538
|
|
539 UNGCPRO; /* plist */
|
|
540
|
|
541 if (!(item_info.fState & MFS_GRAYED))
|
|
542 {
|
|
543 /* Now add the full submenu path as a value to the hash table,
|
|
544 keyed by menu handle */
|
|
545 if (NILP(path))
|
|
546 path = list1 (subname);
|
|
547 else {
|
|
548 Lisp_Object arg[2];
|
|
549 arg[0] = path;
|
|
550 arg[1] = list1 (subname);
|
|
551 GCPRO1 (arg[1]);
|
|
552 path = Fappend (2, arg);
|
|
553 UNGCPRO; /* arg[1] */
|
|
554 }
|
|
555
|
|
556 GCPRO1 (path);
|
|
557 Fputhash (hmenu_to_lisp_object (submenu), path, hash_tab);
|
|
558 UNGCPRO; /* path */
|
|
559 }
|
|
560 }
|
|
561 else if (VECTORP (item))
|
|
562 {
|
|
563 /* An ordinary item */
|
|
564 Lisp_Object plist, name, callback, style, id;
|
|
565
|
|
566 gui_parse_button_descriptor (item, &name, &callback, &plist);
|
|
567 GCPRO2 (plist, callback);
|
|
568
|
|
569 if (gui_plist_says_item_excluded (plist, Vmenubar_configuration))
|
|
570 return;
|
|
571
|
|
572 if (gui_plist_says_item_inactive (plist))
|
|
573 item_info.fState |= MFS_GRAYED;
|
|
574
|
|
575 style = gui_plist_get_current_style (plist);
|
|
576 if (EQ (style, Qradio))
|
|
577 {
|
|
578 item_info.fType |= MFT_RADIOCHECK;
|
|
579 item_info.fState |= MFS_CHECKED;
|
|
580 }
|
|
581 else if (EQ (style, Qtoggle))
|
|
582 {
|
|
583 item_info.fState |= MFS_CHECKED;
|
|
584 }
|
|
585
|
|
586 id = allocate_menu_item_id (path, name);
|
|
587 Fputhash (id, callback, hash_tab);
|
|
588
|
|
589 UNGCPRO; /* plist, callback */
|
|
590
|
|
591 item_info.wID = (UINT) XINT(id);
|
|
592 item_info.fType |= MFT_STRING;
|
|
593 item_info.dwTypeData = plist_get_menu_item_name (name, callback, plist);
|
|
594 }
|
|
595 else
|
|
596 {
|
233
|
597 signal_simple_error ("Ill-constructed menu descriptor", item);
|
231
|
598 }
|
|
599
|
|
600 if (flush_right)
|
|
601 item_info.fType |= MFT_RIGHTJUSTIFY;
|
|
602
|
|
603 InsertMenuItem (menu, UINT_MAX, TRUE, &item_info);
|
|
604 }
|
|
605
|
233
|
606 /*
|
|
607 * This function is called from populate_menu and checksum_menu.
|
|
608 * When called to populate, MENU is a menu handle, PATH is a
|
|
609 * list of strings representing menu path from root to this submenu,
|
|
610 * DESCRIPTOR is a menu descriptor, HASH_TAB is a hashtable associated
|
|
611 * with root menu, BAR_P indicates whether this called for a menubar or
|
|
612 * a popup, and POPULATE_P is non-zero. Return value must be ignored.
|
|
613 * When called to checksum, DESCRIPTOR has the same meaning, POPULATE_P
|
|
614 * is zero, PATH must be Qnil, and the rest of parameters is ignored.
|
|
615 * Return value is the menu checksum.
|
|
616 */
|
|
617 static unsigned long
|
|
618 populate_or_checksum_helper (HMENU menu, Lisp_Object path, Lisp_Object descriptor,
|
|
619 Lisp_Object hash_tab, int bar_p, int populate_p)
|
231
|
620 {
|
|
621 Lisp_Object menu_name, plist, item_desc;
|
|
622 int deep_p, flush_right;
|
|
623 struct gcpro gcpro1;
|
233
|
624 unsigned long checksum = 0;
|
231
|
625
|
|
626 /* Will initially contain only "(empty)" */
|
233
|
627 if (populate_p)
|
|
628 empty_menu (menu, 1);
|
231
|
629
|
|
630 /* PATH set to nil indicates top-level popup or menubar */
|
|
631 deep_p = !NILP (path);
|
|
632
|
|
633 if (!deep_p)
|
|
634 top_level_menu = menu;
|
|
635
|
|
636 if (!CONSP(descriptor))
|
233
|
637 signal_simple_error ("Menu descriptor must be a list", descriptor);
|
231
|
638
|
|
639 if (STRINGP (XCAR (descriptor)))
|
|
640 {
|
|
641 menu_name = XCAR (descriptor);
|
|
642 descriptor = XCDR (descriptor);
|
|
643 }
|
|
644 else
|
|
645 {
|
|
646 menu_name = Qnil;
|
|
647 if (deep_p) /* Not a popup or bar */
|
233
|
648 signal_simple_error ("Menu must have a name", descriptor);
|
231
|
649 }
|
|
650
|
|
651 /* Fetch keywords prepending the item list */
|
|
652 descriptor = gui_parse_menu_keywords (descriptor, &plist);
|
|
653 GCPRO1 (plist);
|
|
654 descriptor = gui_plist_apply_filter (plist, descriptor);
|
|
655 UNGCPRO; /* plist */
|
|
656
|
|
657 /* Loop thru the descriptor's CDR and add items for each entry */
|
|
658 flush_right = 0;
|
|
659 EXTERNAL_LIST_LOOP (item_desc, descriptor)
|
|
660 {
|
|
661 if (NILP (XCAR (item_desc)))
|
|
662 {
|
|
663 if (bar_p)
|
|
664 flush_right = 1;
|
233
|
665 if (!populate_p)
|
|
666 checksum = HASH2 (checksum, Qnil);
|
231
|
667 }
|
233
|
668 else if (populate_p)
|
231
|
669 populate_menu_add_item (menu, path, hash_tab,
|
|
670 XCAR (item_desc), flush_right);
|
233
|
671 else
|
|
672 checksum = HASH2 (checksum,
|
|
673 checksum_menu_item (XCAR (item_desc)));
|
231
|
674 }
|
|
675
|
233
|
676 if (populate_p)
|
|
677 {
|
|
678 /* Remove the "(empty)" item, if there are other ones */
|
|
679 if (GetMenuItemCount (menu) > 1)
|
|
680 RemoveMenu (menu, EMPTY_ITEM_ID, MF_BYCOMMAND);
|
231
|
681
|
233
|
682 /* Add the header to the popup, if told so. The same as in X - an
|
|
683 insensitive item, and a separator (Seems to me, there were
|
|
684 two separators in X... In Windows this looks ugly, anywats. */
|
|
685 if (!bar_p && !deep_p && popup_menu_titles && !NILP(menu_name))
|
|
686 {
|
|
687 InsertMenu (menu, 0, MF_BYPOSITION | MF_STRING | MF_DISABLED,
|
|
688 0, XSTRING_DATA(menu_name));
|
|
689 InsertMenu (menu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
|
690 SetMenuDefaultItem (menu, 0, MF_BYPOSITION);
|
|
691 }
|
231
|
692 }
|
233
|
693 return checksum;
|
|
694 }
|
|
695
|
|
696 static void
|
|
697 populate_menu (HMENU menu, Lisp_Object path, Lisp_Object descriptor,
|
|
698 Lisp_Object hash_tab, int bar_p)
|
|
699 {
|
|
700 populate_or_checksum_helper (menu, path, descriptor, hash_tab, bar_p, 1);
|
|
701 }
|
|
702
|
|
703 static unsigned long
|
|
704 checksum_menu (Lisp_Object descriptor)
|
|
705 {
|
|
706 return populate_or_checksum_helper (NULL, Qnil, descriptor, Qunbound, 0, 0);
|
231
|
707 }
|
|
708
|
|
709 static Lisp_Object
|
|
710 find_menu (Lisp_Object desc, Lisp_Object path)
|
|
711 {
|
|
712 /* #### find-menu-item is not what's required here.
|
|
713 Need to write this in C, or improve lisp */
|
|
714 if (!NILP (path))
|
|
715 {
|
|
716 desc = call2 (Qfind_menu_item, desc, path);
|
|
717 /* desc is (supposed to be) (ITEM . PARENT). Supposed
|
|
718 to signal but sometimes manages to return nil */
|
|
719 if (!NILP(desc))
|
|
720 {
|
|
721 CHECK_CONS (desc);
|
|
722 desc = XCAR (desc);
|
|
723 }
|
|
724 }
|
|
725 return desc;
|
|
726 }
|
|
727
|
|
728 static void
|
|
729 update_frame_menubar_maybe (struct frame* f)
|
|
730 {
|
|
731 HMENU menubar = GetMenu (FRAME_MSWINDOWS_HANDLE (f));
|
|
732 struct window *w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
|
|
733 Lisp_Object desc = (!NILP (w->menubar_visible_p)
|
|
734 ? symbol_value_in_buffer (Qcurrent_menubar, w->buffer)
|
|
735 : Qnil);
|
|
736
|
|
737 if (NILP (desc) && menubar != NULL)
|
|
738 {
|
|
739 /* Menubar has gone */
|
|
740 FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Qnil;
|
233
|
741 SetMenu (FRAME_MSWINDOWS_HANDLE (f), NULL);
|
231
|
742 DestroyMenu (menubar);
|
|
743 DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f));
|
|
744 return;
|
|
745 }
|
|
746
|
|
747 if (!NILP (desc) && menubar == NULL)
|
|
748 {
|
|
749 /* Menubar has appeared */
|
|
750 menubar = CreateMenu ();
|
|
751 goto populate;
|
|
752 }
|
|
753
|
|
754 if (NILP (desc))
|
|
755 {
|
|
756 /* We did not have the bar and are not going to */
|
|
757 return;
|
|
758 }
|
|
759
|
233
|
760 /* Now we bail out if the menubar has not changed */
|
|
761 if (FRAME_MSWINDOWS_MENU_CHECKSUM(f) == checksum_menu (desc))
|
|
762 return;
|
231
|
763
|
|
764 populate:
|
|
765 /* Come with empty hash table */
|
|
766 if (NILP (FRAME_MSWINDOWS_MENU_HASHTABLE(f)))
|
|
767 FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Fmake_hashtable (make_int (50), Qequal);
|
|
768 else
|
|
769 Fclrhash (FRAME_MSWINDOWS_MENU_HASHTABLE(f));
|
|
770
|
|
771 Fputhash (hmenu_to_lisp_object (menubar), Qnil,
|
|
772 FRAME_MSWINDOWS_MENU_HASHTABLE(f));
|
|
773 populate_menu (menubar, Qnil, desc,
|
|
774 FRAME_MSWINDOWS_MENU_HASHTABLE(f), 1);
|
|
775 SetMenu (FRAME_MSWINDOWS_HANDLE (f), menubar);
|
|
776 DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f));
|
233
|
777
|
|
778 FRAME_MSWINDOWS_MENU_CHECKSUM(f) = checksum_menu (desc);
|
231
|
779 }
|
|
780
|
|
781 static void
|
|
782 prune_menubar (struct frame *f)
|
|
783 {
|
|
784 HMENU menubar = GetMenu (FRAME_MSWINDOWS_HANDLE (f));
|
|
785 Lisp_Object desc = current_frame_menubar (f);
|
|
786 if (menubar == NULL)
|
|
787 return;
|
|
788
|
|
789 /* #### If a filter function has set desc to Qnil, this abort()
|
233
|
790 triggers. To resolve, we must prevent filters explicitely from
|
|
791 mangling with the active menu. In apply_filter probably?
|
231
|
792 Is copy-tree on the whole menu too expensive? */
|
|
793 if (NILP(desc))
|
|
794 /* abort(); */
|
|
795 return;
|
|
796
|
|
797 /* We do the trick by removing all items and re-populating top level */
|
|
798 empty_menu (menubar, 0);
|
|
799
|
|
800 assert (HASHTABLEP (FRAME_MSWINDOWS_MENU_HASHTABLE(f)));
|
|
801 Fclrhash (FRAME_MSWINDOWS_MENU_HASHTABLE(f));
|
|
802
|
|
803 Fputhash (hmenu_to_lisp_object (menubar), Qnil,
|
|
804 FRAME_MSWINDOWS_MENU_HASHTABLE(f));
|
|
805 populate_menu (menubar, Qnil, desc,
|
|
806 FRAME_MSWINDOWS_MENU_HASHTABLE(f), 1);
|
|
807 }
|
|
808
|
|
809 /*
|
|
810 * This is called when cleanup is possible. It is better not to
|
|
811 * clean things up at all than do it too earaly!
|
|
812 */
|
|
813 static void
|
|
814 menu_cleanup (struct frame *f)
|
|
815 {
|
|
816 /* This function can GC */
|
233
|
817 current_menudesc = Qnil;
|
|
818 current_hashtable = Qnil;
|
|
819 prune_menubar (f);
|
231
|
820 }
|
|
821
|
|
822
|
|
823 /*------------------------------------------------------------------------*/
|
|
824 /* Message handlers */
|
|
825 /*------------------------------------------------------------------------*/
|
|
826 static Lisp_Object
|
|
827 unsafe_handle_wm_initmenupopup_1 (HMENU menu, struct frame* f)
|
|
828 {
|
|
829 /* This function can call lisp, beat dogs and stick chewing gum to
|
|
830 everything! */
|
|
831
|
233
|
832 Lisp_Object path, desc;
|
231
|
833 struct gcpro gcpro1;
|
|
834
|
|
835 /* Find which guy is going to explode */
|
233
|
836 path = Fgethash (hmenu_to_lisp_object (menu), current_hashtable, Qunbound);
|
231
|
837 assert (!UNBOUNDP (path));
|
233
|
838 #ifdef DEBUG_XEMACS
|
|
839 /* Allow to continue in a debugger after assert - not so fatal */
|
|
840 if (UNBOUNDP (path))
|
|
841 error ("internal menu error");
|
|
842 #endif
|
231
|
843
|
|
844 /* Now find a desc chunk for it. If none, then probably menu open
|
|
845 hook has played too much games around stuff */
|
233
|
846 desc = current_menudesc;
|
231
|
847 if (!NILP (path))
|
|
848 {
|
|
849 desc = find_menu (desc, path);
|
|
850 if (NILP (desc))
|
233
|
851 signal_simple_error ("This menu does not exist any more", path);
|
231
|
852 }
|
|
853
|
|
854 /* Now, stuff it */
|
|
855 /* DESC may be generated by filter, so we have to gcpro it */
|
|
856 GCPRO1 (desc);
|
233
|
857 populate_menu (menu, path, desc, current_hashtable, 0);
|
231
|
858 UNGCPRO;
|
|
859 return Qt;
|
|
860 }
|
|
861
|
|
862 static Lisp_Object
|
|
863 unsafe_handle_wm_initmenu_1 (struct frame* f)
|
|
864 {
|
|
865 /* This function can call lisp */
|
|
866 /* #### - this menubar update mechanism is expensively anti-social and
|
|
867 the activate-menubar-hook is now mostly obsolete. */
|
|
868
|
|
869 /* We simply ignore return value. In any case, we construct the bar
|
|
870 on the fly */
|
|
871 run_hook (Vactivate_menubar_hook);
|
233
|
872
|
231
|
873 update_frame_menubar_maybe (f);
|
233
|
874
|
|
875 current_menudesc = current_frame_menubar (f);
|
|
876 current_hashtable = FRAME_MSWINDOWS_MENU_HASHTABLE(f);
|
|
877 assert (HASHTABLEP (current_hashtable));
|
|
878
|
231
|
879 return Qt;
|
|
880 }
|
|
881
|
|
882 #ifdef KKM_DOES_NOT_LIKE_UNDOCS_SOMETIMES
|
|
883
|
|
884 /* #### This may become wrong in future Windows */
|
|
885
|
|
886 static Lisp_Object
|
|
887 unsafe_handle_wm_exitmenuloop_1 (struct frame* f)
|
|
888 {
|
|
889 if (!NILP (current_tracking_popup))
|
|
890 prune_menubar (f);
|
|
891 return Qt;
|
|
892 }
|
|
893
|
|
894 #endif
|
|
895
|
|
896 /*
|
|
897 * Return value is Qt if we have dispatched the command,
|
|
898 * or Qnil if id has not been mapped to a callback.
|
|
899 * Window procedure may try other targets to route the
|
|
900 * command if we return nil
|
|
901 */
|
|
902 Lisp_Object
|
|
903 mswindows_handle_wm_command (struct frame* f, WORD id)
|
|
904 {
|
|
905 /* Try to map the command id through the proper hash table */
|
233
|
906 Lisp_Object command, funcsym, frame;
|
231
|
907 struct gcpro gcpro1;
|
|
908
|
233
|
909 command = Fgethash (make_int (id), current_hashtable, Qunbound);
|
231
|
910 if (UNBOUNDP (command))
|
|
911 {
|
|
912 menu_cleanup (f);
|
|
913 return Qnil;
|
|
914 }
|
|
915
|
|
916 /* Need to gcpro because the hashtable may get destroyed
|
|
917 by menu_cleanup(), and will not gcpro the command
|
|
918 any more */
|
|
919 GCPRO1 (command);
|
|
920 menu_cleanup (f);
|
|
921
|
|
922 /* Ok, this is our one. Enqueue it. */
|
|
923 if (SYMBOLP (command))
|
|
924 funcsym = Qcall_interactively;
|
|
925 else if (CONSP (command))
|
|
926 funcsym = Qeval;
|
|
927 else
|
233
|
928 signal_simple_error ("Illegal callback", command);
|
231
|
929
|
|
930 XSETFRAME (frame, f);
|
|
931 enqueue_misc_user_event (frame, funcsym, command);
|
233
|
932
|
|
933 /* Needs good bump also, for WM_COMMAND may have been dispatched from
|
|
934 mswindows_need_event, which will block again despite new command
|
|
935 event has arrived */
|
|
936 mswindows_enqueue_magic_event (FRAME_MSWINDOWS_HANDLE(f),
|
|
937 XM_BUMPQUEUE);
|
231
|
938
|
|
939 UNGCPRO; /* command */
|
|
940 return Qt;
|
|
941 }
|
|
942
|
|
943
|
|
944 /*------------------------------------------------------------------------*/
|
|
945 /* Message handling proxies */
|
|
946 /*------------------------------------------------------------------------*/
|
|
947
|
|
948 static HMENU wm_initmenu_menu;
|
|
949 static struct frame* wm_initmenu_frame;
|
|
950
|
|
951 static Lisp_Object
|
|
952 unsafe_handle_wm_initmenupopup (Lisp_Object u_n_u_s_e_d)
|
|
953 {
|
|
954 return unsafe_handle_wm_initmenupopup_1 (wm_initmenu_menu, wm_initmenu_frame);
|
|
955 }
|
|
956
|
|
957 static Lisp_Object
|
|
958 unsafe_handle_wm_initmenu (Lisp_Object u_n_u_s_e_d)
|
|
959 {
|
|
960 return unsafe_handle_wm_initmenu_1 (wm_initmenu_frame);
|
|
961 }
|
|
962
|
|
963 #ifdef KKM_DOES_NOT_LIKE_UNDOCS_SOMETIMES
|
|
964 static Lisp_Object
|
|
965 unsafe_handle_wm_exitmenuloop (Lisp_Object u_n_u_s_e_d)
|
|
966 {
|
|
967 return unsafe_handle_wm_exitmenuloop_1 (wm_initmenu_frame);
|
|
968 }
|
|
969 #endif
|
|
970
|
|
971 Lisp_Object
|
|
972 mswindows_handle_wm_initmenupopup (HMENU hmenu, struct frame* frm)
|
|
973 {
|
|
974 /* We cannot pass hmenu as a lisp object. Use static var */
|
|
975 wm_initmenu_menu = hmenu;
|
|
976 wm_initmenu_frame = frm;
|
|
977 return mswindows_protect_modal_loop (unsafe_handle_wm_initmenupopup, Qnil);
|
|
978 }
|
|
979
|
|
980 Lisp_Object
|
233
|
981 mswindows_handle_wm_initmenu (HMENU hmenu, struct frame* f)
|
231
|
982 {
|
233
|
983 /* Handle only frame menubar, ignore if from popup or system menu */
|
|
984 if (GetMenu (FRAME_MSWINDOWS_HANDLE(f)) == hmenu)
|
|
985 {
|
|
986 wm_initmenu_frame = f;
|
|
987 return mswindows_protect_modal_loop (unsafe_handle_wm_initmenu, Qnil);
|
|
988 }
|
|
989 return Qt;
|
231
|
990 }
|
|
991
|
|
992 Lisp_Object
|
|
993 mswindows_handle_wm_exitmenuloop (struct frame* f)
|
|
994 {
|
|
995 #ifdef KKM_DOES_NOT_LIKE_UNDOCS_SOMETIMES
|
|
996 wm_initmenu_frame = f;
|
|
997 return mswindows_protect_modal_loop (unsafe_handle_wm_exitmenuloop, Qnil);
|
|
998 #else
|
|
999 return Qt;
|
|
1000 #endif
|
|
1001 }
|
|
1002
|
|
1003
|
|
1004 /*------------------------------------------------------------------------*/
|
|
1005 /* Methods */
|
|
1006 /*------------------------------------------------------------------------*/
|
|
1007
|
|
1008 static void
|
|
1009 mswindows_update_frame_menubars (struct frame* f)
|
|
1010 {
|
|
1011 update_frame_menubar_maybe (f);
|
|
1012 }
|
|
1013
|
|
1014 static void
|
|
1015 mswindows_free_frame_menubars (struct frame* f)
|
|
1016 {
|
|
1017 FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Qnil;
|
|
1018 }
|
|
1019
|
|
1020 static void
|
|
1021 mswindows_popup_menu (Lisp_Object menu_desc, Lisp_Object event)
|
|
1022 {
|
|
1023 struct frame *f = selected_frame ();
|
|
1024 struct Lisp_Event *eev = NULL;
|
|
1025 HMENU menu;
|
|
1026 POINT pt;
|
|
1027 int ok;
|
|
1028
|
|
1029 if (!NILP (event))
|
|
1030 {
|
|
1031 CHECK_LIVE_EVENT (event);
|
|
1032 eev = XEVENT (event);
|
|
1033 if (eev->event_type != button_press_event
|
|
1034 && eev->event_type != button_release_event)
|
|
1035 wrong_type_argument (Qmouse_event_p, event);
|
|
1036 }
|
|
1037 else if (!NILP (Vthis_command_keys))
|
|
1038 {
|
|
1039 /* if an event wasn't passed, use the last event of the event sequence
|
|
1040 currently being executed, if that event is a mouse event */
|
|
1041 eev = XEVENT (Vthis_command_keys); /* last event first */
|
|
1042 if (eev->event_type != button_press_event
|
|
1043 && eev->event_type != button_release_event)
|
|
1044 eev = NULL;
|
|
1045 }
|
|
1046
|
|
1047 /* Default is to put the menu at the point (10, 10) in frame */
|
|
1048 if (eev)
|
|
1049 {
|
|
1050 pt.x = eev->event.button.x;
|
|
1051 pt.y = eev->event.button.y;
|
|
1052 ClientToScreen (FRAME_MSWINDOWS_HANDLE (f), &pt);
|
|
1053 }
|
|
1054 else
|
|
1055 pt.x = pt.y = 10;
|
|
1056
|
|
1057 if (SYMBOLP (menu_desc))
|
|
1058 menu_desc = Fsymbol_value (menu_desc);
|
|
1059
|
233
|
1060 current_menudesc = menu_desc;
|
|
1061 current_hashtable = Fmake_hashtable (make_int(10), Qequal);
|
231
|
1062 menu = create_empty_popup_menu();
|
233
|
1063 Fputhash (hmenu_to_lisp_object (menu), Qnil, current_hashtable);
|
231
|
1064
|
233
|
1065 ok = TrackPopupMenu (menu,
|
|
1066 TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
|
231
|
1067 pt.x, pt.y, 0,
|
|
1068 FRAME_MSWINDOWS_HANDLE (f), NULL);
|
|
1069
|
|
1070 DestroyMenu (menu);
|
|
1071
|
|
1072 /* Signal a signal if caught by Track...() modal loop */
|
|
1073 mswindows_unmodalize_signal_maybe ();
|
|
1074
|
|
1075 /* This is probably the only real reason for failure */
|
|
1076 if (!ok) {
|
|
1077 menu_cleanup (f);
|
233
|
1078 signal_simple_error ("Cannot track popup menu while in menu",
|
231
|
1079 menu_desc);
|
|
1080 }
|
|
1081 }
|
|
1082
|
|
1083
|
|
1084 /*------------------------------------------------------------------------*/
|
|
1085 /* Initialization */
|
|
1086 /*------------------------------------------------------------------------*/
|
|
1087 void
|
|
1088 syms_of_menubar_mswindows (void)
|
|
1089 {
|
|
1090 defsymbol (&Qfind_menu_item, "find-menu-item");
|
|
1091 }
|
|
1092
|
|
1093 void
|
|
1094 console_type_create_menubar_mswindows (void)
|
|
1095 {
|
|
1096 CONSOLE_HAS_METHOD (mswindows, update_frame_menubars);
|
|
1097 CONSOLE_HAS_METHOD (mswindows, free_frame_menubars);
|
|
1098 CONSOLE_HAS_METHOD (mswindows, popup_menu);
|
|
1099 }
|
|
1100
|
|
1101 void
|
|
1102 vars_of_menubar_mswindows (void)
|
|
1103 {
|
233
|
1104 current_menudesc = Qnil;
|
|
1105 current_hashtable = Qnil;
|
231
|
1106
|
233
|
1107 staticpro (¤t_menudesc);
|
|
1108 staticpro (¤t_hashtable);
|
231
|
1109
|
|
1110 Fprovide (intern ("mswindows-menubars"));
|
|
1111 }
|