(tooltip-mode): Doc fix.
[emacs.git] / oldXMenu / Post.c
blob3b39d796823e0320411d91458b596ac8f7ca45b5
1 #include "copyright.h"
3 /* Copyright Massachusetts Institute of Technology 1985 */
5 /*
6 * XMenu: MIT Project Athena, X Window system menu package
8 * XMenuPost - Maps a given menu to the display and activates
9 * the menu for user selection. The user is allowed to
10 * specify the mouse button event mask that will be used
11 * to identify a selection request. When a selection
12 * request is received (i.e., when the specified mouse
13 * event occurs) the data returned will be either the
14 * data associated with the particular selection active
15 * at the time of the selection request or NULL if no
16 * selection was active. A menu selection is shown to
17 * be active by placing a highlight box around the
18 * selection as the mouse cursor enters its active
19 * region. Inactive selections will not be highlighted.
20 * As the mouse cursor moved from one menu pane
21 * to another menu pane the pane being entered is raised
22 * and activated and the pane being left is deactivated.
23 * If an error occurs NULL will be returned with the
24 * p_num set to POST_ERROR, s_num set to
25 * NO_SELECTION and _XMErrorCode set to an
26 * appropriate value.
27 * Every time the routine returns successfully the
28 * p_num and s_num indices will be set to indicate
29 * the currently active pane and/or selection. If the
30 * mouse was not in a selection window at the time
31 * s_num will be set to NO_SELECTION.
33 * Author: Tony Della Fera, DEC
34 * August, 1984
38 #include "XMenuInt.h"
40 char *
41 XMenuPost(display, menu, p_num, s_num, x_pos, y_pos, event_mask)
42 register Display *display; /* Previously opened display. */
43 register XMenu *menu; /* Menu to post. */
44 register int *p_num; /* Pane number selected. */
45 register int *s_num; /* Selection number selected. */
46 register int x_pos; /* X coordinate of menu position. */
47 register int y_pos; /* Y coordinate of menu position. */
48 int event_mask; /* Mouse button event mask. */
50 register int stat; /* Routine call return status. */
51 char *data; /* Return data. */
54 * Set up initial pane and selection assumptions.
58 * Make the procedure call.
60 stat = XMenuActivate(
61 display,
62 menu,
63 p_num, s_num,
64 x_pos, y_pos,
65 event_mask,
66 &data, 0);
69 * Check the return value and return accordingly.
71 switch (stat) {
72 case XM_FAILURE:
73 *p_num = POST_ERROR;
74 *s_num = NO_SELECTION;
75 return(NULL);
76 case XM_NO_SELECT:
77 case XM_IA_SELECT:
78 *s_num = NO_SELECTION;
79 return(NULL);
80 case XM_SUCCESS:
81 default:
82 return(data);
86 /* arch-tag: 7b6104e5-fa32-4342-aa17-05296a30dd70
87 (do not change this comment) */