Fix the MS-Windows build due to import of md5 from gnulib.
[emacs.git] / oldXMenu / ChgSel.c
blobdcefb6c3a5d026e479e3c2d6a308ba7d6c73d6ce
1 /* Copyright Massachusetts Institute of Technology 1985 */
3 #include "copyright.h"
6 /*
7 * XMenu: MIT Project Athena, X Window system menu package
9 * XMenuChangeSelection - Change a menu selection.
11 * Author: Tony Della Fera, DEC
12 * December 19, 1985
16 #include <config.h>
17 #include "XMenuInt.h"
19 int
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)
21 /* previously opened display. */
22 /* Menu object to be modified. */
23 /* Pane number to be modified. */
24 /* Selection number to modified. */
25 /* Data value. */
26 /* Change to new data value? */
27 /* Selection label. */
28 /* Change to new label? */
30 register XMPane *p_ptr; /* XMPane pointer. */
31 register XMSelect *s_ptr; /* XMSelect pointer. */
33 int label_length; /* Label length in characters. */
34 int label_width; /* Label width in pixels. */
37 * Check for NULL pointers!
39 if (label == NULL) {
40 _XMErrorCode = XME_ARG_BOUNDS;
41 return(XM_FAILURE);
45 * Find the right pane.
47 p_ptr = _XMGetPanePtr(menu, p_num);
48 if (p_ptr == NULL) return(XM_FAILURE);
51 * Find the right selection.
53 s_ptr = _XMGetSelectionPtr(p_ptr, s_num);
54 if (s_ptr == NULL) return(XM_FAILURE);
57 * Reset the label?
59 if (label_sw) {
61 * Determine label size.
63 label_length = strlen(label);
64 label_width = XTextWidth(menu->s_fnt_info, label, label_length);
67 * Change the selection data.
69 s_ptr->label = label;
70 s_ptr->label_width = label_width;
71 s_ptr->label_length = label_length;
74 * Schedule a recompute.
76 menu->recompute = 1;
80 * Reset the data?
82 if (data_sw) s_ptr->data = data;
85 * Return successfully.
87 _XMErrorCode = XME_NO_ERROR;
88 return(s_num);