2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /*******************************************************************************
27 ** $XConsortium: datefield.c /main/3 1995/11/03 10:21:12 rswiston $
29 ** RESTRICTED CONFIDENTIAL INFORMATION:
31 ** The information in this document is subject to special
32 ** restrictions in a confidential disclosure agreement between
33 ** HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
34 ** document outside HP, IBM, Sun, USL, SCO, or Univel without
35 ** Sun's specific written approval. This document and all copies
36 ** and derivative works thereof must be returned or destroyed at
39 ** Copyright 1993 Sun Microsystems, Inc. All rights reserved.
41 *******************************************************************************/
44 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
45 * (c) Copyright 1993, 1994 International Business Machines Corp. *
46 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
47 * (c) Copyright 1993, 1994 Novell, Inc. *
51 static char sccsid[] = "@(#)datefield.c 1.7 94/11/07 Copyr 1993 Sun Microsystems, Inc.";
54 #include <EUSCompat.h>
57 #include <Xm/LabelG.h>
62 #include "datefield.h"
66 ** Returns a date string the parser can handle
69 get_date_from_widget(Tick t, Widget w, OrderingType order,
70 SeparatorType separator) {
75 memset(buf, '\0', 80);
78 format_tick(t, order, separator, buf);
81 if (wc == xmTextWidgetClass)
82 date = XmTextGetString(w);
83 else if (wc == xmTextFieldWidgetClass)
84 date = XmTextFieldGetString(w);
88 if (!date || *date == '\0')
89 format_tick(t, order, separator, buf);
90 else if (!datestr2mdy(date, order, separator, buf)) {
102 set_date_in_widget(Tick t, Widget w, OrderingType order,
103 SeparatorType separator) {
106 WidgetClass wc = XtClass(w);
108 format_tick(t, order, separator, buf);
109 if (wc == xmLabelGadgetClass || wc == xmLabelWidgetClass) {
110 xmstr = XmStringCreateLocalized(buf);
111 XtVaSetValues(w, XmNlabelString, xmstr,
114 } else if (wc == xmTextWidgetClass)
115 XmTextSetString(w, buf);
116 else if (wc == xmTextFieldWidgetClass)
117 XmTextFieldSetString(w, buf);