1 /* $TOG: CheckBoxUiItem.C /main/5 1997/04/29 15:58:33 mgreess $ */
5 * RESTRICTED CONFIDENTIAL INFORMATION:
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
15 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
20 #include <DtMail/options_util.h>
21 #include <DtMail/PropUi.hh>
22 #include <DtMail/CheckBoxUiItem.hh>
24 // CheckBoxUiItem::CheckBoxUiItem
25 // CheckBoxUiItem ctor
26 ////////////////////////////////////////////////////////////////////
28 CheckBoxUiItem::CheckBoxUiItem(Widget w, int source, char *search_key):PropUiItem(w, source, search_key)
32 #endif /* DEAD_WOOD */
34 options_checkbox_init(w, &(this->dirty_bit));
38 // CheckBoxUiItem::writeFromUiToSource()
39 // Takes values in the UI and puts them into the source DB
40 ///////////////////////////////////////////////////////////////////
41 void CheckBoxUiItem::writeFromUiToSource()
43 Boolean checkbox_value;
44 Widget w = this->getWidget();
46 checkbox_value = options_checkbox_get_value(w);
48 if(checkbox_value == TRUE) // make sure the value is in the table
50 prop_source->setValue("");
54 prop_source->setValue("f");
58 // CheckBoxUiItem::writeFromSourceToUi()
59 // Takes values in the UI and puts them into the source DB
60 ///////////////////////////////////////////////////////////////////
61 void CheckBoxUiItem::writeFromSourceToUi()
64 Widget w = this->getWidget();
66 value = (char *)prop_source->getValue();
69 // this will have to be made more robust...
71 // This assumes that a non-null value means that the
72 // value is set and that a non-null means turn on the CB
73 if (strcmp(value, "") == 0)
74 options_checkbox_set_value(w, TRUE, this->dirty_bit);
75 else if (NULL == value || strcmp(value, "f") == 0)
76 options_checkbox_set_value(w, FALSE, this->dirty_bit);