summaryrefslogtreecommitdiff
path: root/xc/lib/Xt/VarCreate.c
blob: e642a7aebbc0071e6918d2b9963470672389faf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/* $XConsortium: copyright.h,v 1.4 89/07/25 16:12:03 rws Exp $ */
#ifndef lint
static char Xrcsid[] = "$XConsortium: Intrinsic.c,v 1.138 89/10/08 18:23:06 jim Exp $";
#endif

/*

Copyright 1985, 1986, 1987, 1988, 1989 by the
Massachusetts Institute of Technology

Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of M.I.T. not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
M.I.T. makes no representations about the suitability of
this software for any purpose.  It is provided "as is"
without express or implied warranty.

*/

#include "VarargsI.h"
#include "StringDefs.h"

static Widget
_XtVaCreateWidget(name, widget_class, parent, var)
    String      name;
    WidgetClass widget_class;
    Widget      parent;
    va_list     var;
{
    register Widget         widget;
    XtTypedArgList	    typed_args = NULL;
    Cardinal		    num_args;

    XtVaToTypedArgList(var, &typed_args, &num_args);

    widget = _XtCreateWidget(name, widget_class, parent, (ArgList)NULL, 
		    (Cardinal)0, typed_args, num_args);

    if (typed_args != NULL) {
        XtFree((char *)typed_args);
    }    

    return(widget);
}


Widget
XtVaCreateWidget(String name, WidgetClass widget_class, Widget parent, ...)
{
    va_list                 var;
    register Widget         widget;

    va_start(var,parent);
    widget = _XtVaCreateWidget(name, widget_class, parent, var);
    va_end(var);

    return(widget);
}


Widget
XtVaCreateManagedWidget(String name, WidgetClass widget_class, Widget parent, ...)
{
    va_list		var;
    register Widget	widget;

    va_start(var,parent);
    widget = _XtVaCreateWidget(name, widget_class, parent, var);
    XtManageChild(widget);
    va_end(var);

    return (widget);
}


Widget
XtVaAppCreateShell(String name, String class, WidgetClass widget_class, Display* display, ...)
{
    va_list                 var;
    register Widget         widget;
    XtTypedArgList          typed_args = NULL;
    Cardinal                num_args;

    va_start(var,display);

    XtVaToTypedArgList(var, &typed_args, &num_args);
    widget = _XtAppCreateShell(name, class, widget_class, display,
		(ArgList)NULL, (Cardinal)0, typed_args, num_args);
    if (typed_args != NULL) {
	XtFree((char *)typed_args);
    }
 
    va_end(var);
    return(widget);
}


Widget
XtVaCreatePopupShell(String name, WidgetClass widget_class, Widget parent, ...)
{
    va_list                 var;
    register Widget         widget;
    XtTypedArgList          typed_args = NULL;
    Cardinal                num_args;

    va_start(var,parent);

    XtVaToTypedArgList(var, &typed_args, &num_args);
    widget = _XtCreatePopupShell(name, widget_class, parent,
		(ArgList)NULL, (Cardinal)0, typed_args, num_args);
    if (typed_args != NULL) {
	XtFree((char *)typed_args);
    }

    va_end(var);
    return widget;
}

void
XtVaSetValues(Widget widget, ...)
{
    va_list                 var;
    ArgList                 args = NULL;
    Cardinal                num_args;

    va_start(var,widget);

    XtVaToArgList(widget, &args, &num_args, var);
    XtSetValues(widget, args, num_args);
    if (args != NULL) {
	XtFree((char *)args);
    }

    va_end(var);
}


void
XtVaSetSubvalues(caddr_t base, XtResourceList resources, Cardinal num_resources, ...)
{
    va_list	var;
    ArgList    	args;
    Cardinal   	num_args;
    int		total_count, typed_count;		

    va_start(var, num_resources);

    _XtCountVaList(var, &total_count, &typed_count);

    if (typed_count != 0) {
	XtWarning("XtVaTyped is an invalid argument to XtVaSetSubvalues()\n");
    }

    XtVaToArgList((Widget)NULL, &args, &num_args, var);

    XtSetSubvalues(base, resources, num_resources, args, num_args);

    if (num_args != 0) {
        XtFree((char *)args);
    }    

    va_end(var);
}
/*
Widget
XtVaAppInitialize(XtAppContext *app_context_return, String application_class, XrmOptionsDescList options, Cardinal num_options, Cardinal *argc_in_out, String *argv_in_out, String *fallback_resources, ...)
{
	Widget		w;
	ArgList		args = (ArgList)NULL;
	int		num_args;
	va_list		var;
	int		total_count, typed_count;		

	va_start(var, fallback_resources);

	_XtCountVaList(var, &total_count, &typed_count);

	if (typed_count != 0) {
		XtWarning("XtVaTyped is an invalid argument to XtVaAppInitialize()\n");
	}

	XtVaToArgList((Widget)NULL, &args, &num_args, var);
	w = XtAppInitialize(app_context_return, application_class, options,
			    num_options, argc_in_out, argv_in_out,
			    fallback_resources, args, num_args);

	if (args != (ArgList)NULL) {
		XtFree((char *)args);
	}

	va_end(var);

	return	w;
}
*/