Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / wwl / src / WObject.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
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)
10  * any later version.
11  *
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
16  * details.
17  *
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
22  */
23 /*
24  * $XConsortium: WObject.cc /main/3 1996/06/11 17:03:32 cde-hal $
25  *
26  * Copyright (c) 1991 HaL Computer Systems, Inc.  All rights reserved.
27  * UNPUBLISHED -- rights reserved under the Copyright Laws of the United
28  * States.  Use of a copyright notice is precautionary only and does not
29  * imply publication or disclosure.
30  * 
31  * This software contains confidential information and trade secrets of HaL
32  * Computer Systems, Inc.  Use, disclosure, or reproduction is prohibited
33  * without the prior express written permission of HaL Computer Systems, Inc.
34  * 
35  *                         RESTRICTED RIGHTS LEGEND
36  * Use, duplication, or disclosure by the Government is subject to
37  * restrictions as set forth in subparagraph (c)(l)(ii) of the Rights in
38  * Technical Data and Computer Software clause at DFARS 252.227-7013.
39  *                        HaL Computer Systems, Inc.
40  *                  1315 Dell Avenue, Campbell, CA  95008
41  * 
42  */
43
44 // This is only for the doc
45 #ifdef DOC
46
47 /*?class WObject
48 Every widget inherits from the class \typ{WObject}.
49 ?*/
50
51 /*?
52 The basic cast constructor for C++ widgets.
53 ?*/
54 WObject :: WObject (Widget w)
55 {
56         widget = w;
57 }
58
59 /*?
60 The copy constructor for C++ widgets.
61 ?*/
62 WObject :: WObject (WObject& w)
63 {
64         widget = w.widget;
65 }
66
67 /*?
68 The basic constructor for C++ widgets. Used by every subclasses.
69 ?*/
70 WObject :: WObject (WComposite& super,  WidgetClass c, const char* name, ArgList args, Cardinal card)
71 {
72         widget = XtCreateWidget (name, c, super.widget, args, card);
73 }
74
75 /*?
76 The cast operator, to get a C widget from a C++ widget.
77 ?*/
78 WObject ::  operator Widget () const
79 {
80         return widget;
81 }
82
83 /*?
84 Return the class of the widget.
85 ?*/
86 WidgetClass
87 WObject :: WidgetClass Class () const
88 {
89         return XtClass (widget);
90 }
91
92 /*?
93 The \fun{XtRealize} function.
94 ?*/
95 void
96 WObject :: Realize () const
97 {
98         XtRealizeWidget (widget);
99 }
100
101 /*?
102 The \fun{XtUnrealizeWidget} function.
103 ?*/
104 void
105 WObject :: Unrealize () const
106 {
107         XtUnrealizeWidget (widget);
108 }
109
110 /*?
111 The \fun{XtIsRealized} function.
112 ?*/
113 Boolean
114 WObject :: IsRealized () const
115 {
116         return XtIsRealized (widget);
117 }
118
119 /*?
120 The \fun{XtDestroyWidget} function.
121 {\em Beware to delete the C++ object after calling this method}.
122 ?*/
123 void
124 WObject :: Destroy () const
125 {
126         XtDestroyWidget (widget);
127 }
128
129 /*?
130 Get one resource value. Equivalent of \fun{XtGetValues} with one
131 \typ{XtArg} record.
132 ?*/
133 Arg&
134 WObject :: Get (Arg& a) const
135 {
136         XtGetValues (widget, &a, 1);
137         return a;
138 }
139
140 /*?nodoc?*/
141 Arg&
142 WObject :: _Get (Arg& a) const
143 {
144         XtGetValues (widget, &a, 1);
145         return a;
146 }
147
148 /*?nextdoc?*/
149 void
150 WObject :: Get (ArgList a, Cardinal c) const
151 {
152         XtGetValues (widget, a, c);
153 }
154
155 /*?
156 The \fun{XtGetValues} function.
157 ?*/
158 void
159 WObject :: Get (WArgList& w) const
160 {
161 }
162
163 /*?
164 Set one resource value. Equivalent of \fun{XtSetValues} with one
165 \typ{XtArg} record.
166 ?*/
167 Arg&
168 WObject :: Set (Arg& a) const
169 {
170         XtSetValues (widget, &a, 1);
171         return a;
172 }
173
174 /*?nodoc?*/
175 Arg&
176 WObject :: _Set (Arg& a) const
177 {
178         XtSetValues (widget, &a, 1);
179         return a;
180 }
181
182 /*?nextdoc?*/
183 void
184 WObject :: Set (ArgList a, Cardinal c) const
185
186         XtSetValues (widget, a, c);
187 }
188
189 /*?
190 The \fun{XtSetValues} function.
191 ?*/
192 void
193 WObject :: Set (WArgList& w) const
194
195 }
196
197 /*?
198 The \fun{XtAddCallback} function.
199 ?*/
200 void
201 WObject :: AddCallback (const char* name, XtCallbackProc proc, caddr_t closure) const
202 {
203         XtAddCallback (widget, name, proc, closure);
204 }
205
206 /*?
207 The \fun{XtRemoveCallback} function.
208 ?*/
209 void
210 WObject :: RemoveCallback (const char* name, XtCallbackProc proc, caddr_t closure) const
211 {
212         XtRemoveCallback (widget, name, proc, closure);
213 }
214
215 /*?
216 The \fun{XtAddCallbacks} function.
217 ?*/
218 void
219 WObject :: AddCallbacks (const char* name, XtCallbackList callbacks) const
220 {
221         XtAddCallbacks (widget, name, callbacks);
222 }
223
224 /*?
225 The \fun{XtRemoveCallbacks} function.
226 ?*/
227 void
228 WObject :: RemoveCallbacks (const char* name, XtCallbackList callbacks) const
229 {
230         XtRemoveCallbacks (widget, name, callbacks);
231 }
232
233 /*?
234 The \fun{XtRemoveAllCallbacks} function.
235 ?*/
236 void
237 WObject :: RemoveAllCallbacks (const char* name) const
238 {
239         XtRemoveAllCallbacks (widget, name);
240 }
241
242 /*?
243 The \fun{XtCallCallbacks} function.
244 ?*/
245 void
246 WObject :: CallCallbacks (const char* name, caddr_t call_data) const
247 {
248         XtCallCallbacks (widget, name, call_data);
249 }
250
251 /*?nodoc?*/
252 WCallback*
253 WObject :: SetCallback (const char* name, WWL* obj, WWL_FUN fun)
254 {
255         return new WCallback (*this, name, obj, fun);
256 }
257 #else // Not for doc
258
259 #include <WWL/WComposite.h>
260 #include <stream.h>
261
262 #define NL << '\n'; cout.flush()
263
264 WObject :: WObject (const WComposite& super,  WidgetClass c, const char* name,
265                     ArgList args, Cardinal card)
266 {
267 //   cout << "Creating widget " << name << " with " << card << " args." NL;
268    widget = XtCreateWidget (name, c, super.widget, args, card);
269 }
270
271 WObject :: WObject (const WComposite& super, int automanage, WidgetClass c,
272                     const char* name, ArgList args, Cardinal card)
273 {
274    automanage = 1;
275    widget = XtCreateManagedWidget (name, c, super.widget, args, card);
276 }
277
278 WObject :: WObject (const WComposite& super,  Boolean popup,  WidgetClass c,
279                     const char* name, ArgList args, Cardinal card)
280 {
281    if (popup)
282       widget = XtCreatePopupShell(name, c, super.widget, args, card);
283    else
284       widget = XtCreateWidget (name, c, super.widget, args, card);
285 }
286
287 #endif