Don't declare GETTIMEOFDAY_ONE_ARGUMENT.
[emacs.git] / oldXMenu / ChgSel.c
blob591fbb7e8860df11b16b720ea6fb29e3d4f85a06
1 #include "copyright.h"
3 /* $Header: /u/src/emacs/19.0/oldXMenu/RCS/ChgSel.c,v 1.1 1992/04/11 22:10:17 jimb Exp $ */
4 /* Copyright Massachusetts Institute of Technology 1985 */
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 "XMenuInt.h"
18 int
19 XMenuChangeSelection(display, menu, p_num, s_num, data, data_sw, label, label_sw)
20 Display *display; /* previously opened display. */
21 register XMenu *menu; /* Menu object to be modified. */
22 register int p_num; /* Pane number to be modified. */
23 register int s_num; /* Selection number to modified. */
24 char *data; /* Data value. */
25 int data_sw; /* Change to new data value? */
26 char *label; /* Selection label. */
27 int label_sw; /* Change to new label? */
29 register XMPane *p_ptr; /* XMPane pointer. */
30 register XMSelect *s_ptr; /* XMSelect pointer. */
32 int label_length; /* Label length in characters. */
33 int label_width; /* Label width in pixels. */
36 * Check for NULL pointers!
38 if (label == NULL) {
39 _XMErrorCode = XME_ARG_BOUNDS;
40 return(XM_FAILURE);
44 * Find the right pane.
46 p_ptr = _XMGetPanePtr(menu, p_num);
47 if (p_ptr == NULL) return(XM_FAILURE);
50 * Find the right selection.
52 s_ptr = _XMGetSelectionPtr(p_ptr, s_num);
53 if (s_ptr == NULL) return(XM_FAILURE);
56 * Reset the label?
58 if (label_sw) {
60 * Determine label size.
62 label_length = strlen(label);
63 label_width = XTextWidth(menu->s_fnt_info, label, label_length);
66 * Change the selection data.
68 s_ptr->label = label;
69 s_ptr->label_width = label_width;
70 s_ptr->label_length = label_length;
73 * Schedule a recompute.
75 menu->recompute = 1;
79 * Reset the data?
81 if (data_sw) s_ptr->data = data;
84 * Return successfully.
86 _XMErrorCode = XME_NO_ERROR;
87 return(s_num);