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 /* $XConsortium: DtProps.C /main/2 1995/07/17 14:03:51 drk $ */
25 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
26 * (c) Copyright 1993, 1994 International Business Machines Corp. *
27 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
28 * (c) Copyright 1993, 1994 Novell, Inc. *
36 #include "Container.h"
39 #include "dtprintinfomsg.h"
43 DtProps::DtProps(AnyUI *parent,
48 Attribute **attributes)
49 : Dialog(parent, name)
51 mainw = (DtMainW *) parent;
52 _location_id = location_id;
53 _has_been_posted = false;
54 rc = new Container(this, "rc", VERTICAL_ROW_COLUMN);
55 int i, captionWidth = 0, width, columns = 0;
56 for (i = 0; i < n_attributes; i++)
58 if ((width = StringWidth(attributes[i]->DisplayName)) > captionWidth)
60 if ((width = strlen(attributes[i]->DisplayValue)) > columns)
64 for (i = 0; i < n_attributes; i++)
67 if (EditableAfterCreate(attributes[i]))
71 if (attributes[i]->ValueListType == INFORMATION_LINE)
72 new LabelObj(rc, attributes[i]->DisplayName);
74 new Prompt(rc, attributes[i]->DisplayName, _editable, STRING_PROMPT,
75 attributes[i]->DisplayValue, NULL,
76 NULL, true, columns, 1, captionWidth + 8);
79 ok = new Button(this, MESSAGE(OKL), PUSH_BUTTON, OkCB, this);
82 cancel = new Button(this, MESSAGE(CancelL), PUSH_BUTTON, CancelCB, this);
87 help = new Button(this, MESSAGE(HelpL), PUSH_BUTTON, HelpCB, this);
97 boolean DtProps::SetVisiblity(boolean flag)
99 if (_has_been_posted == false)
101 Dialog::SetVisiblity(flag);
103 int width = StringWidth(Name()) + 35;
106 Dialog::SetVisiblity(flag);
109 _has_been_posted = true;
111 Dialog::SetVisiblity(flag);
115 void DtProps::Reset()
119 void DtProps::Apply()
123 void DtProps::CloseCB()
129 void DtProps::OkCB(void *data)
131 DtProps *obj = (DtProps *) data;
137 void DtProps::ApplyCB(void *data)
139 DtProps *obj = (DtProps *) data;
143 void DtProps::CancelCB(void *data)
145 DtProps *obj = (DtProps *) data;
151 void DtProps::ResetCB(void *data)
153 DtProps *obj = (DtProps *) data;
158 void DtProps::HelpCB(void *data)
160 DtProps *obj = (DtProps *) data;
161 obj->HandleHelpRequest();
164 boolean DtProps::HandleHelpRequest()
166 mainw->DisplayHelp(_location_id);