3 /***********************************************************
4 Copyright (c) 1993, Oracle and/or its affiliates. All rights reserved.
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
13 The above copyright notice and this permission notice (including the next
14 paragraph) shall be included in all copies or substantial portions of the
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 DEALINGS IN THE SOFTWARE.
25 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
29 Permission to use, copy, modify, and distribute this software and its
30 documentation for any purpose and without fee is hereby granted,
31 provided that the above copyright notice appear in all copies and that
32 both that copyright notice and this permission notice appear in
33 supporting documentation, and that the name of Digital not be
34 used in advertising or publicity pertaining to distribution of the
35 software without specific, written prior permission.
37 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
45 ******************************************************************/
49 Copyright 1987, 1988, 1998 The Open Group
51 Permission to use, copy, modify, distribute, and sell this software and its
52 documentation for any purpose is hereby granted without fee, provided that
53 the above copyright notice appear in all copies and that both that
54 copyright notice and this permission notice appear in supporting
57 The above copyright notice and this permission notice shall be included in
58 all copies or substantial portions of the Software.
60 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
61 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
62 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
63 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
64 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
65 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
67 Except as contained in this notice, the name of The Open Group shall not be
68 used in advertising or otherwise to promote the sale, use or other dealings
69 in this Software without prior written authorization from The Open Group.
76 #include "IntrinsicI.h"
77 #include "StringDefs.h"
80 char* base, /* Base address to fetch values from */
81 XrmResourceList* res, /* The current resource values. */
82 register Cardinal num_resources, /* number of items in resources */
83 ArgList args, /* The resource values requested */
84 Cardinal num_args) /* number of items in arg list */
88 register XrmName argName;
89 register XrmResourceList* xrmres;
90 int translation_arg_num = -1;
91 static XrmQuark QCallback = NULLQUARK;
92 static XrmQuark QTranslationTable = NULLQUARK;
95 if (QCallback == NULLQUARK) {
96 QCallback = XrmPermStringToQuark(XtRCallback);
97 QTranslationTable = XrmPermStringToQuark(XtRTranslationTable);
101 /* Resource lists should be in compiled form already */
103 for (arg = args ; num_args != 0; num_args--, arg++) {
104 argName = StringToName(arg->name);
105 for (xrmres = res, i = 0; i < num_resources; i++, xrmres++) {
106 if (argName == (*xrmres)->xrm_name) {
107 /* hack; do special cases here instead of a get_values_hook
108 * because get_values_hook looses info as to
109 * whether arg->value == NULL for ancient compatibility
110 * mode in _XtCopyToArg. It helps performance, too...
112 if ((*xrmres)->xrm_type == QCallback) {
113 XtCallbackList callback = _XtGetCallbackList(
114 (InternalCallbackList *)
115 (base - (*xrmres)->xrm_offset - 1));
117 (char*)&callback, &arg->value,
118 (*xrmres)->xrm_size);
120 else if ((*xrmres)->xrm_type == QTranslationTable)
121 translation_arg_num = (int) (arg - args);
124 base - (*xrmres)->xrm_offset - 1,
126 (*xrmres)->xrm_size);
132 return translation_arg_num;
135 static void CallGetValuesHook(
136 WidgetClass widget_class,
141 WidgetClass superclass;
142 XtArgsProc get_values_hook;
145 superclass = widget_class->core_class.superclass;
147 if (superclass != NULL)
148 CallGetValuesHook (superclass, w, args, num_args);
151 get_values_hook = widget_class->core_class.get_values_hook;
153 if (get_values_hook != NULL)
154 (*get_values_hook) (w, args, &num_args);
159 static void CallConstraintGetValuesHook(
160 WidgetClass widget_class,
165 ConstraintClassExtension ext;
168 if (widget_class->core_class.superclass
169 ->core_class.class_inited & ConstraintClassFlag) {
170 CallConstraintGetValuesHook
171 (widget_class->core_class.superclass, w, args, num_args);
174 for (ext = (ConstraintClassExtension)((ConstraintWidgetClass)widget_class)
175 ->constraint_class.extension;
176 ext != NULL && ext->record_type != NULLQUARK;
177 ext = (ConstraintClassExtension)ext->next_extension);
180 if ( ext->version == XtConstraintExtensionVersion
181 && ext->record_size == sizeof(ConstraintClassExtensionRec)) {
182 if (ext->get_values_hook != NULL)
183 (*(ext->get_values_hook)) (w, args, &num_args);
186 Cardinal num_params = 1;
187 params[0] = widget_class->core_class.class_name;
188 XtAppWarningMsg(XtWidgetToApplicationContext(w),
189 "invalidExtension", "xtCreateWidget", XtCXtToolkitError,
190 "widget class %s has invalid ConstraintClassExtension record",
191 params, &num_params);
200 register ArgList args,
201 register Cardinal num_args)
205 XtAppContext app = XtWidgetToApplicationContext(w);
207 if (num_args == 0) return;
208 if ((args == NULL) && (num_args != 0)) {
210 "invalidArgCount","xtGetValues",XtCXtToolkitError,
211 "Argument count > 0 on NULL argument list in XtGetValues",
212 (String *)NULL, (Cardinal *)NULL);
218 /* Get widget values */
219 targ = GetValues((char*)w, (XrmResourceList *) wc->core_class.resources,
220 wc->core_class.num_resources, args, num_args);
222 if (targ != -1 && XtIsWidget(w)) {
223 XtTranslations translations = _XtGetTranslationValue(w);
224 _XtCopyToArg((char*)&translations, &args[targ].value,
225 sizeof(XtTranslations));
228 /* Get constraint values if necessary */
229 /* constraints may be NULL if constraint_size==0 */
230 if (XtParent(w) != NULL && !XtIsShell(w) && XtIsConstraint(XtParent(w)) &&
231 w->core.constraints) {
232 ConstraintWidgetClass cwc
233 = (ConstraintWidgetClass) XtClass(XtParent(w));
235 GetValues((char*)w->core.constraints,
236 (XrmResourceList *)(cwc->constraint_class.resources),
237 cwc->constraint_class.num_resources, args, num_args);
240 /* Notify any class procedures that we have performed get_values */
241 CallGetValuesHook(wc, w, args, num_args);
243 /* Notify constraint get_values if necessary */
244 if (XtParent(w) != NULL && !XtIsShell(w) && XtIsConstraint(XtParent(w)))
245 CallConstraintGetValuesHook(XtClass(XtParent(w)), w, args,num_args);
250 XtPointer base, /* Base address to fetch values from */
251 XtResourceList resources, /* The current resource values. */
252 Cardinal num_resources, /* number of items in resources */
253 ArgList args, /* The resource values requested */
254 Cardinal num_args) /* number of items in arg list */
256 XrmResourceList* xrmres;
257 xrmres = _XtCreateIndirectionTable(resources, num_resources);
258 GetValues((char*)base, xrmres, num_resources, args, num_args);
259 XtFree((char *)xrmres);