Mercurial > emacs
annotate oldXMenu/ChgSel.c @ 70895:226e865bc288
(dired-mode-map): Fix breakage.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Wed, 24 May 2006 21:42:14 +0000 |
parents | e8a3fb527b77 |
children | ce127a46b1ca d04d8ccb3c41 c5406394f567 |
rev | line source |
---|---|
25858 | 1 #include "copyright.h" |
2 | |
3 /* Copyright Massachusetts Institute of Technology 1985 */ | |
68640
e8a3fb527b77
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
65000
diff
changeset
|
4 /* Copyright (C) 2002, 2003, 2004, 2005, |
e8a3fb527b77
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
65000
diff
changeset
|
5 2006 Free Software Foundation, Inc. */ |
25858 | 6 |
7 /* | |
8 * XMenu: MIT Project Athena, X Window system menu package | |
9 * | |
10 * XMenuChangeSelection - Change a menu selection. | |
11 * | |
12 * Author: Tony Della Fera, DEC | |
13 * December 19, 1985 | |
14 * | |
15 */ | |
16 | |
17 #include "XMenuInt.h" | |
18 | |
19 int | |
20 XMenuChangeSelection(display, menu, p_num, s_num, data, data_sw, label, label_sw) | |
21 Display *display; /* previously opened display. */ | |
22 register XMenu *menu; /* Menu object to be modified. */ | |
23 register int p_num; /* Pane number to be modified. */ | |
24 register int s_num; /* Selection number to modified. */ | |
25 char *data; /* Data value. */ | |
26 int data_sw; /* Change to new data value? */ | |
27 char *label; /* Selection label. */ | |
28 int label_sw; /* Change to new label? */ | |
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 |
91 /* arch-tag: 229732a6-46bf-4a3a-ad90-3d8ed65c0841 | |
92 (do not change this comment) */ |