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 libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $TOG: CheckForMailUiItem.C /main/1 1998/02/17 15:19:56 mgreess $ */
27 * RESTRICTED CONFIDENTIAL INFORMATION:
29 * The information in this document is subject to special
30 * restrictions in a confidential disclosure agreement bertween
31 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
32 * document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
33 * Sun's specific written approval. This documment and all copies
34 * and derivative works thereof must be returned or destroyed at
37 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
42 #include <X11/Intrinsic.h>
44 #include <DtMail/options_util.h>
45 #include <DtMail/PropUi.hh>
46 #include <DtMail/CheckForMailUiItem.hh>
47 #include <DtMail/SpinBoxUiItem.hh>
49 int CheckForMailUiItem::_initialized = 0;
50 DtVirtArray<CheckForMailUiItem*> *CheckForMailUiItem::_checkformail_ui = NULL;
52 CheckForMailUiItem::CheckForMailUiItem(Widget w, int source, char *search_key):
53 SpinBoxUiItem(w, source, search_key)
60 _checkformail_ui = new DtVirtArray<CheckForMailUiItem*> (3);
63 options_spinbox_init(w, &(this->dirty_bit));
64 XtVaGetValues(w, XmNtextField, &textfield, NULL);
67 XmNvalueChangedCallback,
68 CheckForMailUiItem::valueChangedCB,
71 _checkformail_ui->append(this);
75 // Takes values in the UI and puts them into the source DB
76 ///////////////////////////////////////////////////////////////////
77 void CheckForMailUiItem::valueChangedCB(Widget w, XtPointer client, XtPointer)
79 CheckForMailUiItem *cui = (CheckForMailUiItem*) client;
80 cui->_valueChanged = TRUE;
84 // Takes values in the UI and puts them into the source DB
85 ///////////////////////////////////////////////////////////////////
86 void CheckForMailUiItem::writeFromUiToSource()
89 Widget w = this->getWidget();
92 if (!_valueChanged) return;
94 spinbox_value = options_spinbox_get_value(w);
95 sprintf(val_str, "%d", spinbox_value);
96 prop_source->setValue(val_str);
98 for (int i = 0; i < _checkformail_ui->length(); i++)
100 CheckForMailUiItem *cui = (*_checkformail_ui)[i];
101 if (cui != this) cui->writeFromSourceToUi();
103 _valueChanged = FALSE;
107 // Takes values in the UI and puts them into the source DB
108 ///////////////////////////////////////////////////////////////////
109 void CheckForMailUiItem::writeFromSourceToUi()
112 Widget w = this->getWidget();
114 value = prop_source->getValue();
115 options_spinbox_set_value(w, atoi(value), this->dirty_bit);
116 _valueChanged = FALSE;