comparison src/xmenu.c @ 83301:b151ec53c504

Merged from miles@gnu.org--gnu-2005 (patch 68, 286-291) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-286 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-287 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-288 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-289 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-290 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-291 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-68 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-341
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 06 May 2005 21:06:31 +0000
parents 042f282a2ed7 cd1e4bc8e488
children 6fef25c75847
comparison
equal deleted inserted replaced
83300:6deb860255f3 83301:b151ec53c504
735 DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0, 735 DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0,
736 doc: /* Pop up a deck-of-cards menu and return user's selection. 736 doc: /* Pop up a deck-of-cards menu and return user's selection.
737 POSITION is a position specification. This is either a mouse button event 737 POSITION is a position specification. This is either a mouse button event
738 or a list ((XOFFSET YOFFSET) WINDOW) 738 or a list ((XOFFSET YOFFSET) WINDOW)
739 where XOFFSET and YOFFSET are positions in pixels from the top left 739 where XOFFSET and YOFFSET are positions in pixels from the top left
740 corner of WINDOW's frame. (WINDOW may be a frame object instead of a window.) 740 corner of WINDOW. (WINDOW may be a window or a frame object.)
741 This controls the position of the top left of the menu as a whole. 741 This controls the position of the top left of the menu as a whole.
742 If POSITION is t, it means to use the current mouse position. 742 If POSITION is t, it means to use the current mouse position.
743 743
744 MENU is a specifier for a menu. For the simplest case, MENU is a keymap. 744 MENU is a specifier for a menu. For the simplest case, MENU is a keymap.
745 The menu items come from key bindings that have a menu string as well as 745 The menu items come from key bindings that have a menu string as well as
750 If REAL-DEFINITION is nil, that puts a nonselectable string in the menu. 750 If REAL-DEFINITION is nil, that puts a nonselectable string in the menu.
751 Otherwise, REAL-DEFINITION should be a valid key binding definition. 751 Otherwise, REAL-DEFINITION should be a valid key binding definition.
752 752
753 You can also use a list of keymaps as MENU. 753 You can also use a list of keymaps as MENU.
754 Then each keymap makes a separate pane. 754 Then each keymap makes a separate pane.
755 When MENU is a keymap or a list of keymaps, the return value 755
756 is a list of events. 756 When MENU is a keymap or a list of keymaps, the return value is the
757 list of events corresponding to the user's choice. Note that
758 `x-popup-menu' does not actually execute the command bound to that
759 sequence of events.
757 760
758 Alternatively, you can specify a menu of multiple panes 761 Alternatively, you can specify a menu of multiple panes
759 with a list of the form (TITLE PANE1 PANE2...), 762 with a list of the form (TITLE PANE1 PANE2...),
760 where each pane is a list of form (TITLE ITEM1 ITEM2...). 763 where each pane is a list of form (TITLE ITEM1 ITEM2...).
761 Each ITEM is normally a cons cell (STRING . VALUE); 764 Each ITEM is normally a cons cell (STRING . VALUE);
762 but a string can appear as an item--that makes a nonselectable line 765 but a string can appear as an item--that makes a nonselectable line
763 in the menu. 766 in the menu.
764 With this form of menu, the return value is VALUE from the chosen item. 767 With this form of menu, the return value is VALUE from the chosen item.
765 768
766 If POSITION is nil, don't display the menu at all, just precalculate the 769 If POSITION is nil, don't display the menu at all, just precalculate the
767 cached information about equivalent key sequences. */) 770 cached information about equivalent key sequences.
771
772 If the user gets rid of the menu without making a valid choice, for
773 instance by clicking the mouse away from a valid choice or by typing
774 keyboard input, then this normally results in a quit and
775 `x-popup-menu' does not return. But if POSITION is a mouse button
776 event (indicating that the user invoked the menu with the mouse) then
777 no quit occurs and `x-popup-menu' returns nil. */)
768 (position, menu) 778 (position, menu)
769 Lisp_Object position, menu; 779 Lisp_Object position, menu;
770 { 780 {
771 Lisp_Object keymap, tem; 781 Lisp_Object keymap, tem;
772 int xpos = 0, ypos = 0; 782 int xpos = 0, ypos = 0;
1000 The return value is VALUE from the chosen item. 1010 The return value is VALUE from the chosen item.
1001 1011
1002 An ITEM may also be just a string--that makes a nonselectable item. 1012 An ITEM may also be just a string--that makes a nonselectable item.
1003 An ITEM may also be nil--that means to put all preceding items 1013 An ITEM may also be nil--that means to put all preceding items
1004 on the left of the dialog box and all following items on the right. 1014 on the left of the dialog box and all following items on the right.
1005 \(By default, approximately half appear on each side.) */) 1015 \(By default, approximately half appear on each side.)
1016
1017 If the user gets rid of the dialog box without making a valid choice,
1018 for instance using the window manager, then this produces a quit and
1019 `x-popup-dialog' does not return. */)
1006 (position, contents) 1020 (position, contents)
1007 Lisp_Object position, contents; 1021 Lisp_Object position, contents;
1008 { 1022 {
1009 FRAME_PTR f = NULL; 1023 FRAME_PTR f = NULL;
1010 Lisp_Object window; 1024 Lisp_Object window;
2887 } 2901 }
2888 i += MENU_ITEMS_ITEM_LENGTH; 2902 i += MENU_ITEMS_ITEM_LENGTH;
2889 } 2903 }
2890 } 2904 }
2891 } 2905 }
2906 else if (!for_click)
2907 /* Make "Cancel" equivalent to C-g. */
2908 Fsignal (Qquit, Qnil);
2892 2909
2893 return Qnil; 2910 return Qnil;
2894 } 2911 }
2895 2912
2896 #ifdef USE_GTK 2913 #ifdef USE_GTK
3517 *error = "Can't activate menu"; 3534 *error = "Can't activate menu";
3518 case XM_IA_SELECT: 3535 case XM_IA_SELECT:
3519 entry = Qnil; 3536 entry = Qnil;
3520 break; 3537 break;
3521 case XM_NO_SELECT: 3538 case XM_NO_SELECT:
3522 /* Make "Cancel" equivalent to C-g unless this menu was popped up by 3539 /* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means
3523 a mouse press. */ 3540 the menu was invoked with a mouse event as POSITION). */
3524 if (! for_click) 3541 if (! for_click)
3525 Fsignal (Qquit, Qnil); 3542 Fsignal (Qquit, Qnil);
3526 entry = Qnil; 3543 entry = Qnil;
3527 break; 3544 break;
3528 } 3545 }