611 |
|
|
612 |
DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0, |
DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0, |
613 |
doc: /* Pop up a deck-of-cards menu and return user's selection. |
doc: /* Pop up a deck-of-cards menu and return user's selection. |
614 |
POSITION is a position specification. This is either a mouse button |
POSITION is a position specification. This is either a mouse button event |
615 |
event or a list ((XOFFSET YOFFSET) WINDOW) where XOFFSET and YOFFSET |
or a list ((XOFFSET YOFFSET) WINDOW) |
616 |
are positions in pixels from the top left corner of WINDOW's frame |
where XOFFSET and YOFFSET are positions in pixels from the top left |
617 |
\(WINDOW may be a frame object instead of a window). This controls the |
corner of WINDOW. (WINDOW may be a window or a frame object.) |
618 |
position of the center of the first line in the first pane of the |
This controls the position of the top left of the menu as a whole. |
619 |
menu, not the top left of the menu as a whole. If POSITION is t, it |
If POSITION is t, it means to use the current mouse position. |
|
means to use the current mouse position. |
|
620 |
|
|
621 |
MENU is a specifier for a menu. For the simplest case, MENU is a keymap. |
MENU is a specifier for a menu. For the simplest case, MENU is a keymap. |
622 |
The menu items come from key bindings that have a menu string as well as |
The menu items come from key bindings that have a menu string as well as |
623 |
a definition; actually, the \"definition\" in such a key binding looks like |
a definition; actually, the "definition" in such a key binding looks like |
624 |
\(STRING . REAL-DEFINITION). To give the menu a title, put a string into |
\(STRING . REAL-DEFINITION). To give the menu a title, put a string into |
625 |
the keymap as a top-level element. |
the keymap as a top-level element. |
626 |
|
|
627 |
If REAL-DEFINITION is nil, that puts a nonselectable string in the menu. |
If REAL-DEFINITION is nil, that puts a nonselectable string in the menu. |
628 |
Otherwise, REAL-DEFINITION should be a valid key binding definition. |
Otherwise, REAL-DEFINITION should be a valid key binding definition. |
629 |
|
|
630 |
You can also use a list of keymaps as MENU. Then each keymap makes a |
You can also use a list of keymaps as MENU. |
631 |
separate pane. When MENU is a keymap or a list of keymaps, the return |
Then each keymap makes a separate pane. |
632 |
value is a list of events. |
|
633 |
|
When MENU is a keymap or a list of keymaps, the return value is the |
634 |
Alternatively, you can specify a menu of multiple panes with a list of |
list of events corresponding to the user's choice. Note that |
635 |
the form (TITLE PANE1 PANE2...), where each pane is a list of |
`x-popup-menu' does not actually execute the command bound to that |
636 |
form (TITLE ITEM1 ITEM2...). |
sequence of events. |
637 |
Each ITEM is normally a cons cell (STRING . VALUE); but a string can |
|
638 |
appear as an item--that makes a nonselectable line in the menu. |
Alternatively, you can specify a menu of multiple panes |
639 |
|
with a list of the form (TITLE PANE1 PANE2...), |
640 |
|
where each pane is a list of form (TITLE ITEM1 ITEM2...). |
641 |
|
Each ITEM is normally a cons cell (STRING . VALUE); |
642 |
|
but a string can appear as an item--that makes a nonselectable line |
643 |
|
in the menu. |
644 |
With this form of menu, the return value is VALUE from the chosen item. |
With this form of menu, the return value is VALUE from the chosen item. |
645 |
|
|
646 |
If POSITION is nil, don't display the menu at all, just precalculate the |
If POSITION is nil, don't display the menu at all, just precalculate the |
647 |
cached information about equivalent key sequences. */) |
cached information about equivalent key sequences. |
648 |
(position, menu) |
|
649 |
|
If the user gets rid of the menu without making a valid choice, for |
650 |
|
instance by clicking the mouse away from a valid choice or by typing |
651 |
|
keyboard input, then this normally results in a quit and |
652 |
|
`x-popup-menu' does not return. But if POSITION is a mouse button |
653 |
|
event (indicating that the user invoked the menu with the mouse) then |
654 |
|
no quit occurs and `x-popup-menu' returns nil. */) |
655 |
|
(position, menu) |
656 |
Lisp_Object position, menu; |
Lisp_Object position, menu; |
657 |
{ |
{ |
658 |
Lisp_Object keymap, tem; |
Lisp_Object keymap, tem; |
851 |
The dialog box appears in the middle of the specified frame. |
The dialog box appears in the middle of the specified frame. |
852 |
|
|
853 |
CONTENTS specifies the alternatives to display in the dialog box. |
CONTENTS specifies the alternatives to display in the dialog box. |
854 |
It is a list of the form (TITLE ITEM1 ITEM2...). |
It is a list of the form (DIALOG ITEM1 ITEM2...). |
855 |
Each ITEM is a cons cell (STRING . VALUE). |
Each ITEM is a cons cell (STRING . VALUE). |
856 |
The return value is VALUE from the chosen item. |
The return value is VALUE from the chosen item. |
857 |
|
|
861 |
\(By default, approximately half appear on each side.) |
\(By default, approximately half appear on each side.) |
862 |
|
|
863 |
If HEADER is non-nil, the frame title for the box is "Information", |
If HEADER is non-nil, the frame title for the box is "Information", |
864 |
otherwise it is "Question". */) |
otherwise it is "Question". |
865 |
(position, contents, header) |
|
866 |
|
If the user gets rid of the dialog box without making a valid choice, |
867 |
|
for instance using the window manager, then this produces a quit and |
868 |
|
`x-popup-dialog' does not return. */) |
869 |
|
(position, contents, header) |
870 |
Lisp_Object position, contents, header; |
Lisp_Object position, contents, header; |
871 |
{ |
{ |
872 |
FRAME_PTR f = NULL; |
FRAME_PTR f = NULL; |