1 /*******************************************************************************
5 ** $XConsortium: datefield.c /main/3 1995/11/03 10:21:12 rswiston $
7 ** RESTRICTED CONFIDENTIAL INFORMATION:
9 ** The information in this document is subject to special
10 ** restrictions in a confidential disclosure agreement between
11 ** HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
12 ** document outside HP, IBM, Sun, USL, SCO, or Univel without
13 ** Sun's specific written approval. This document and all copies
14 ** and derivative works thereof must be returned or destroyed at
17 ** Copyright 1993 Sun Microsystems, Inc. All rights reserved.
19 *******************************************************************************/
22 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
23 * (c) Copyright 1993, 1994 International Business Machines Corp. *
24 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
25 * (c) Copyright 1993, 1994 Novell, Inc. *
29 static char sccsid[] = "@(#)datefield.c 1.7 94/11/07 Copyr 1993 Sun Microsystems, Inc.";
32 #include <EUSCompat.h>
35 #include <Xm/LabelG.h>
40 #include "datefield.h"
44 ** Returns a date string the parser can handle
47 get_date_from_widget(Tick t, Widget w, OrderingType order,
48 SeparatorType separator) {
53 memset(buf, '\0', 80);
56 format_tick(t, order, separator, buf);
59 if (wc == xmTextWidgetClass)
60 date = XmTextGetString(w);
61 else if (wc == xmTextFieldWidgetClass)
62 date = XmTextFieldGetString(w);
66 if (!date || *date == '\0')
67 format_tick(t, order, separator, buf);
68 else if (!datestr2mdy(date, order, separator, buf)) {
80 set_date_in_widget(Tick t, Widget w, OrderingType order,
81 SeparatorType separator) {
84 WidgetClass wc = XtClass(w);
86 format_tick(t, order, separator, buf);
87 if (wc == xmLabelGadgetClass || wc == xmLabelWidgetClass) {
88 xmstr = XmStringCreateLocalized(buf);
89 XtVaSetValues(w, XmNlabelString, xmstr,
92 } else if (wc == xmTextWidgetClass)
93 XmTextSetString(w, buf);
94 else if (wc == xmTextFieldWidgetClass)
95 XmTextFieldSetString(w, buf);