Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtmail / dtmail / SpinBoxUiItem.C
1 /* $TOG: SpinBoxUiItem.C /main/5 1997/04/29 16:38:00 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/SpinBoxUiItem.hh>
23
24 // SpinBoxUiItem::SpinBoxUiItem
25 // SpinBoxUiItem ctor
26 ////////////////////////////////////////////////////////////////////
27
28 SpinBoxUiItem::SpinBoxUiItem(Widget w, int source, char *search_key):PropUiItem(w, source, search_key)
29 {
30 #ifdef DEAD_WOOD
31   data_source = source;
32 #endif /* DEAD_WOOD */
33
34   options_spinbox_init(w, &(this->dirty_bit));
35
36 }
37
38 // SpinBoxUiItem::writeFromUiToSource()
39 // Takes values in the UI and puts them into the source DB
40 ///////////////////////////////////////////////////////////////////
41 void SpinBoxUiItem::writeFromUiToSource()
42 {
43   int   spinbox_value;
44   Widget w = this->getWidget();
45   char val_str[64];
46
47   spinbox_value = options_spinbox_get_value(w);
48
49   sprintf(val_str, "%d", spinbox_value);
50
51   prop_source->setValue(val_str);
52
53 }
54
55 // SpinBoxUiItem::writeFromSourceToUi()
56 // Takes values in the UI and puts them into the source DB
57 ///////////////////////////////////////////////////////////////////
58 void SpinBoxUiItem::writeFromSourceToUi()
59 {
60   const char *value;
61   Widget w = this->getWidget();
62
63   value = prop_source->getValue();
64
65   options_spinbox_set_value(w, atoi(value), this->dirty_bit);
66
67   if (NULL != value)
68     free((void*) value);
69 }
70
71
72