Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtmail / dtmail / TextFieldUiItem.C
1 /* $TOG: TextFieldUiItem.C /main/7 1997/11/07 15:48:41 mgreess $ */
2 /*
3  *+SNOTICE
4  *
5  *      RESTRICTED CONFIDENTIAL INFORMATION:
6  *      
7  *      The information in this document is subject to special
8  *      restrictions in a confidential disclosure agreement bertween
9  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
10  *      document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
11  *      Sun's specific written approval.  This documment and all copies
12  *      and derivative works thereof must be returned or destroyed at
13  *      Sun's request.
14  *
15  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
16  *
17  *+ENOTICE
18  */
19
20 #include <DtMail/options_util.h>
21 #include <DtMail/PropUi.hh>
22 #include <DtMail/TextFieldUiItem.hh>
23
24 ////////////////////////////////////////////////////////////////////
25 TextFieldUiItem::TextFieldUiItem(
26                                 Widget w,
27                                 int source,
28                                 char *search_key,
29                                 PropUiCallback validator,
30                                 void * validator_data)
31 : PropUiItem(w, source, search_key, validator, validator_data)
32 {
33   options_field_init(w, &(this->dirty_bit));
34 }
35
36 // Takes values in the UI and puts them into the source DB
37 ///////////////////////////////////////////////////////////////////
38 void TextFieldUiItem::writeFromUiToSource()
39 {
40   char  *textfield_value;
41   Widget w = this->getWidget();
42
43   textfield_value = options_field_get_value(w);
44   prop_source->setValue(textfield_value);
45 }
46
47 // Takes values in the UI and puts them into the source DB
48 ///////////////////////////////////////////////////////////////////
49 void TextFieldUiItem::writeFromSourceToUi()
50 {
51   char *value;
52   Widget w = this->getWidget();
53
54   value = (char *)prop_source->getValue();
55   options_field_set_value(w, value, this->dirty_bit);
56   if (NULL != value) free((void*) value);
57 }