Mercurial > emacs
annotate oldXMenu/Post.c @ 55512:0358ae672b40
*** empty log message ***
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 10 May 2004 18:36:09 +0000 |
parents | e8824c4f5f7e |
children | 3861ff8f4bf1 8e5779acd195 |
rev | line source |
---|---|
25858 | 1 #include "copyright.h" |
2 | |
3 /* Copyright Massachusetts Institute of Technology 1985 */ | |
4 | |
5 /* | |
6 * XMenu: MIT Project Athena, X Window system menu package | |
7 * | |
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 | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
27456
diff
changeset
|
11 * to identify a selection request. When a selection |
25858 | 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. | |
32 * | |
33 * Author: Tony Della Fera, DEC | |
34 * August, 1984 | |
35 * | |
36 */ | |
37 | |
38 #include "XMenuInt.h" | |
39 | |
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. */ | |
49 { | |
50 register int stat; /* Routine call return status. */ | |
51 char *data; /* Return data. */ | |
52 | |
53 /* | |
54 * Set up initial pane and selection assumptions. | |
55 */ | |
56 | |
57 /* | |
58 * Make the procedure call. | |
59 */ | |
60 stat = XMenuActivate( | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
27456
diff
changeset
|
61 display, |
25858 | 62 menu, |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
27456
diff
changeset
|
63 p_num, s_num, |
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
27456
diff
changeset
|
64 x_pos, y_pos, |
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
27456
diff
changeset
|
65 event_mask, |
27456
4a9ea0d1735b
(XMenuPost): Pass null help callback to XMenuActivate.
Gerd Moellmann <gerd@gnu.org>
parents:
25858
diff
changeset
|
66 &data, 0); |
25858 | 67 |
68 /* | |
69 * Check the return value and return accordingly. | |
70 */ | |
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); | |
83 } | |
84 } | |
52401 | 85 |
86 /* arch-tag: 7b6104e5-fa32-4342-aa17-05296a30dd70 | |
87 (do not change this comment) */ |