Mercurial > emacs
annotate oldXMenu/ChgSel.c @ 112447:bcecab2ad22d
* nsterm.m (x_set_offset): Set dont_constrain to 0 so the call to
setFrameTopLeftPoint is constrained.
author | Jan D. <jan.h.d@swipnet.se> |
---|---|
date | Sun, 23 Jan 2011 14:28:14 +0100 |
parents | ef719132ddfa |
children |
rev | line source |
---|---|
76174
fec5e03aaf59
Remove FSF copyright since file does not differ significantly from X11
Glenn Morris <rgm@gnu.org>
parents:
75348
diff
changeset
|
1 /* Copyright Massachusetts Institute of Technology 1985 */ |
fec5e03aaf59
Remove FSF copyright since file does not differ significantly from X11
Glenn Morris <rgm@gnu.org>
parents:
75348
diff
changeset
|
2 |
25858 | 3 #include "copyright.h" |
4 | |
5 | |
6 /* | |
7 * XMenu: MIT Project Athena, X Window system menu package | |
8 * | |
9 * XMenuChangeSelection - Change a menu selection. | |
10 * | |
11 * Author: Tony Della Fera, DEC | |
12 * December 19, 1985 | |
13 * | |
14 */ | |
15 | |
77868
d4f6522bb9d2
Quiet --with-x-toolkit=no compilation warnings: #include <config.h>.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
76174
diff
changeset
|
16 #include <config.h> |
25858 | 17 #include "XMenuInt.h" |
18 | |
19 int | |
109124
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
77868
diff
changeset
|
20 XMenuChangeSelection(Display *display, register XMenu *menu, register int p_num, register int s_num, char *data, int data_sw, char *label, int label_sw) |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
77868
diff
changeset
|
21 /* previously opened display. */ |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
77868
diff
changeset
|
22 /* Menu object to be modified. */ |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
77868
diff
changeset
|
23 /* Pane number to be modified. */ |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
77868
diff
changeset
|
24 /* Selection number to modified. */ |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
77868
diff
changeset
|
25 /* Data value. */ |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
77868
diff
changeset
|
26 /* Change to new data value? */ |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
77868
diff
changeset
|
27 /* Selection label. */ |
5cc91198ffb2
Convert function definitions in oldXMenu to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
77868
diff
changeset
|
28 /* Change to new label? */ |
25858 | 29 { |
30 register XMPane *p_ptr; /* XMPane pointer. */ | |
31 register XMSelect *s_ptr; /* XMSelect pointer. */ | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
25858
diff
changeset
|
32 |
25858 | 33 int label_length; /* Label length in characters. */ |
34 int label_width; /* Label width in pixels. */ | |
35 | |
36 /* | |
37 * Check for NULL pointers! | |
38 */ | |
39 if (label == NULL) { | |
40 _XMErrorCode = XME_ARG_BOUNDS; | |
41 return(XM_FAILURE); | |
42 } | |
43 | |
44 /* | |
45 * Find the right pane. | |
46 */ | |
47 p_ptr = _XMGetPanePtr(menu, p_num); | |
48 if (p_ptr == NULL) return(XM_FAILURE); | |
49 | |
50 /* | |
51 * Find the right selection. | |
52 */ | |
53 s_ptr = _XMGetSelectionPtr(p_ptr, s_num); | |
54 if (s_ptr == NULL) return(XM_FAILURE); | |
55 | |
56 /* | |
57 * Reset the label? | |
58 */ | |
59 if (label_sw) { | |
60 /* | |
61 * Determine label size. | |
62 */ | |
63 label_length = strlen(label); | |
64 label_width = XTextWidth(menu->s_fnt_info, label, label_length); | |
65 | |
66 /* | |
67 * Change the selection data. | |
68 */ | |
69 s_ptr->label = label; | |
70 s_ptr->label_width = label_width; | |
71 s_ptr->label_length = label_length; | |
72 | |
73 /* | |
74 * Schedule a recompute. | |
75 */ | |
76 menu->recompute = 1; | |
77 } | |
78 | |
79 /* | |
80 * Reset the data? | |
81 */ | |
82 if (data_sw) s_ptr->data = data; | |
83 | |
84 /* | |
85 * Return successfully. | |
86 */ | |
87 _XMErrorCode = XME_NO_ERROR; | |
88 return(s_num); | |
89 } | |
52401 | 90 |