1
/* $Xorg: VarCreate.c,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */
5
Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA.
7
Permission to use, copy, modify, and distribute this
8
software and its documentation for any purpose and without
9
fee is hereby granted, provided that the above copyright
10
notice appear in all copies and that both that copyright
11
notice and this permission notice appear in supporting
12
documentation, and that the name Sun not be used in
13
advertising or publicity pertaining to distribution of the
14
software without specific, written prior permission.
15
Sun makes no representations about the suitability of
16
this software for any purpose. It is provided "as is"
17
without express or implied warranty.
19
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
20
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
21
NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
22
ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
23
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
24
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
25
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
26
THE USE OR PERFORMANCE OF THIS SOFTWARE.
32
Copyright 1885, 1986, 1987, 1988, 1989, 1994, 1998 The Open Group
34
Permission to use, copy, modify, distribute, and sell this software and its
35
documentation for any purpose is hereby granted without fee, provided that
36
the above copyright notice appear in all copies and that both that
37
copyright notice and this permission notice appear in supporting
40
The above copyright notice and this permission notice shall be included in
41
all copies or substantial portions of the Software.
43
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
47
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
48
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
50
Except as contained in this notice, the name of The Open Group shall not be
51
used in advertising or otherwise to promote the sale, use or other dealings
52
in this Software without prior written authorization from The Open Group.
55
/* $XFree86: xc/lib/Xt/VarCreate.c,v 3.7 2001/12/14 19:56:32 dawes Exp $ */
57
#include "IntrinsicI.h"
58
#include "StringDefs.h"
63
#if (defined(SUNSHLIB) || defined(AIXSHLIB)) && defined(SHAREDCODE)
64
#define XtToolkitInitialize _XtToolkitInitialize
65
#endif /* (SUNSHLIB || AIXSHLIB) && SHAREDCODE */
70
WidgetClass widget_class,
75
register Widget widget;
76
XtTypedArgList typed_args = NULL;
79
_XtVaToTypedArgList(var, count, &typed_args, &num_args);
81
widget = _XtCreateWidget(name, widget_class, parent, (ArgList)NULL,
82
(Cardinal)0, typed_args, num_args);
84
if (typed_args != NULL) {
85
XtFree((XtPointer)typed_args);
95
WidgetClass widget_class,
100
register Widget widget;
101
int total_count, typed_count;
102
WIDGET_TO_APPCON(parent);
105
va_start(var,parent);
106
_XtCountVaList(var, &total_count, &typed_count);
109
va_start(var,parent);
110
widget = _XtVaCreateWidget((String)name, widget_class, parent, var,
119
XtVaCreateManagedWidget(
121
WidgetClass widget_class,
126
register Widget widget;
127
int total_count, typed_count;
128
WIDGET_TO_APPCON(parent);
131
va_start(var,parent);
132
_XtCountVaList(var, &total_count, &typed_count);
135
va_start(var,parent);
136
widget = _XtVaCreateWidget((String)name, widget_class, parent, var,
138
XtManageChild(widget);
149
WidgetClass widget_class,
154
register Widget widget;
155
XtTypedArgList typed_args = NULL;
157
int total_count, typed_count;
158
DPY_TO_APPCON(display);
161
va_start(var,display);
162
_XtCountVaList(var, &total_count, &typed_count);
165
va_start(var,display);
167
_XtVaToTypedArgList(var, total_count, &typed_args, &num_args);
168
widget = _XtAppCreateShell((String)name, (String)class, widget_class,
169
display, (ArgList)NULL, (Cardinal)0, typed_args, num_args);
170
if (typed_args != NULL) {
171
XtFree((XtPointer)typed_args);
181
XtVaCreatePopupShell(
183
WidgetClass widget_class,
188
register Widget widget;
189
XtTypedArgList typed_args = NULL;
191
int total_count, typed_count;
192
WIDGET_TO_APPCON(parent);
195
va_start(var,parent);
196
_XtCountVaList(var, &total_count, &typed_count);
199
va_start(var,parent);
201
_XtVaToTypedArgList(var, total_count, &typed_args, &num_args);
202
widget = _XtCreatePopupShell((String)name, widget_class, parent,
203
(ArgList)NULL, (Cardinal)0, typed_args, num_args);
204
if (typed_args != NULL) {
205
XtFree((XtPointer)typed_args);
214
XtVaSetValues(Widget widget, ...)
219
int total_count, typed_count;
220
WIDGET_TO_APPCON(widget);
223
va_start(var,widget);
224
_XtCountVaList(var, &total_count, &typed_count);
227
va_start(var,widget);
229
_XtVaToArgList(widget, var, total_count, &args, &num_args);
230
XtSetValues(widget, args, num_args);
231
_XtFreeArgList(args, total_count, typed_count);
239
XtVaSetSubvalues(XtPointer base, XtResourceList resources, Cardinal num_resources, ...)
244
int total_count, typed_count;
246
va_start(var, num_resources);
247
_XtCountVaList(var, &total_count, &typed_count);
250
if (typed_count != 0) {
251
XtWarning("XtVaTypedArg is not valid in XtVaSetSubvalues()\n");
254
va_start(var, num_resources);
255
_XtVaToArgList((Widget)NULL, var, total_count, &args, &num_args);
257
XtSetSubvalues(base, resources, num_resources, args, num_args);
260
XtFree((XtPointer)args);
267
_XtVaOpenApplication(
268
XtAppContext *app_context_return,
269
_Xconst char* application_class,
270
XrmOptionDescList options,
271
Cardinal num_options,
274
String *fallback_resources,
275
WidgetClass widget_class,
278
XtAppContext app_con;
280
register int saved_argc = *argc_in_out;
284
XtTypedArgList typed_args;
286
XtToolkitInitialize(); /* cannot be moved into _XtAppInit */
288
dpy = _XtAppInit(&app_con, (String)application_class, options, num_options,
289
argc_in_out, &argv_in_out, fallback_resources);
291
typed_args = (XtTypedArgList) __XtMalloc((unsigned) sizeof(XtTypedArg));
292
attr = va_arg (var_args, String);
293
for(; attr != NULL; attr = va_arg (var_args, String)) {
294
if (strcmp(attr, XtVaTypedArg) == 0) {
295
typed_args[count].name = va_arg(var_args, String);
296
typed_args[count].type = va_arg(var_args, String);
297
typed_args[count].value = va_arg(var_args, XtArgVal);
298
typed_args[count].size = va_arg(var_args, int);
300
typed_args[count].name = attr;
301
typed_args[count].type = NULL;
302
typed_args[count].value = va_arg(var_args, XtArgVal);
303
typed_args[count].size = 0;
306
typed_args = (XtTypedArgList)
307
XtRealloc((char *) typed_args,
308
(unsigned) (count + 1) * sizeof(XtTypedArg));
310
typed_args[count].name = NULL;
315
XtVaAppCreateShell( NULL, application_class,
317
XtNscreen, (XtArgVal)DefaultScreenOfDisplay(dpy),
318
XtNargc, (XtArgVal)saved_argc,
319
XtNargv, (XtArgVal)argv_in_out,
320
XtVaNestedList, (XtVarArgsList)typed_args,
323
if (app_context_return != NULL)
324
*app_context_return = app_con;
326
XtFree((XtPointer)typed_args);
327
XtFree((XtPointer)argv_in_out);
333
XtAppContext *app_context_return,
334
_Xconst char* application_class,
335
XrmOptionDescList options,
336
Cardinal num_options,
339
String *fallback_resources,
342
return _XtVaOpenApplication(app_context_return, application_class,
343
options, num_options,
344
argc_in_out, argv_in_out, fallback_resources,
345
applicationShellWidgetClass, var_args);
348
#if !((defined(SUNSHLIB) || defined(AIXSHLIB)) && defined(SHAREDCODE))
351
* If not used as a shared library, we still need a front end to
352
* _XtVaOpenApplication and to _XtVaAppInitialize.
357
XtAppContext *app_context_return,
358
_Xconst char* application_class,
359
XrmOptionDescList options,
360
Cardinal num_options,
363
String *fallback_resources,
364
WidgetClass widget_class,
369
va_start(var, widget_class);
370
return _XtVaOpenApplication(app_context_return, (String)application_class,
371
options, num_options, argc_in_out, argv_in_out,
372
fallback_resources, widget_class, var);
377
XtAppContext *app_context_return,
378
_Xconst char* application_class,
379
XrmOptionDescList options,
380
Cardinal num_options,
383
String *fallback_resources,
388
va_start(var, fallback_resources);
389
return _XtVaOpenApplication(app_context_return, (String)application_class,
390
options, num_options, argc_in_out, argv_in_out,
392
applicationShellWidgetClass, var);
395
#endif /* !((SUNSHLIB || AIXSHLIB) && SHAREDCODE) */