#include <X11/IntrinsicP.h>#include <X11/StringDefs.h>#include <X11/ObjectP.h>#include <X11/Xmu/Converters.h>Include dependency graph for StrToWidg.c:

Go to the source code of this file.
Defines | |
| #define | done(address, type) |
| #define | newDone(type, value) |
Functions | |
| void | XmuCvtStringToWidget (XrmValuePtr args, Cardinal *num_args, XrmValuePtr fromVal, XrmValuePtr toVal) |
| Boolean | XmuNewCvtStringToWidget (Display *dpy, XrmValue *args, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, XtPointer *converter_data) |
| Boolean | XmuCvtWidgetToString (Display *dpy, XrmValuePtr args, Cardinal *num_args, XrmValuePtr fromVal, XrmValuePtr toVal, XtPointer *data) |
Value:
Definition at line 46 of file StrToWidg.c.
Value:
{ \
if (toVal->addr != NULL) { \
if (toVal->size < sizeof(type)) { \
toVal->size = sizeof(type); \
return False; \
} \
*(type*)(toVal->addr) = (value); \
} \
else { \
static type static_val; \
static_val = (value); \
toVal->addr = (XtPointer)&static_val; \
} \
toVal->size = sizeof(type); \
return True; \
}
Definition at line 118 of file StrToWidg.c.
Referenced by XmuNewCvtStringToWidget().
| void XmuCvtStringToWidget | ( | XrmValuePtr | args, | |
| Cardinal * | num_args, | |||
| XrmValuePtr | fromVal, | |||
| XrmValuePtr | toVal | |||
| ) |
Definition at line 55 of file StrToWidg.c.
References addr, done, i, name, NULL, and XtRWidget.
00057 { 00058 static Widget widget, *widgetP, parent; 00059 XrmName name = XrmStringToName(fromVal->addr); 00060 int i; 00061 00062 if (*num_args != 1) 00063 XtErrorMsg("wrongParameters", "cvtStringToWidget", "xtToolkitError", 00064 "StringToWidget conversion needs parent arg", NULL, 0); 00065 00066 parent = *(Widget*)args[0].addr; 00067 /* try to match names of normal children */ 00068 if (XtIsComposite(parent)) 00069 { 00070 i = ((CompositeWidget)parent)->composite.num_children; 00071 for (widgetP = ((CompositeWidget)parent)->composite.children; 00072 i; i--, widgetP++) 00073 if ((*widgetP)->core.xrm_name == name) 00074 { 00075 widget = *widgetP; 00076 done(&widget, Widget); 00077 } 00078 } 00079 00080 /* try to match names of popup children */ 00081 i = parent->core.num_popups; 00082 for (widgetP = parent->core.popup_list; i; i--, widgetP++) 00083 if ((*widgetP)->core.xrm_name == name) 00084 { 00085 widget = *widgetP; 00086 done(&widget, Widget); 00087 } 00088 00089 /* try to match classes of normal children */ 00090 if (XtIsComposite(parent)) 00091 { 00092 i = ((CompositeWidget)parent)->composite.num_children; 00093 for (widgetP = ((CompositeWidget)parent)->composite.children; 00094 i; i--, widgetP++) 00095 if ((*widgetP)->core.widget_class->core_class.xrm_class == name) 00096 { 00097 widget = *widgetP; 00098 done(&widget, Widget); 00099 } 00100 } 00101 00102 /* try to match classes of popup children */ 00103 i = parent->core.num_popups; 00104 for (widgetP = parent->core.popup_list; i; i--, widgetP++) 00105 if ((*widgetP)->core.widget_class->core_class.xrm_class == name) 00106 { 00107 widget = *widgetP; 00108 done(&widget, Widget); 00109 } 00110 00111 XtStringConversionWarning(fromVal->addr, XtRWidget); 00112 toVal->addr = NULL; 00113 toVal->size = 0; 00114 }
| Boolean XmuCvtWidgetToString | ( | Display * | dpy, | |
| XrmValuePtr | args, | |||
| Cardinal * | num_args, | |||
| XrmValuePtr | fromVal, | |||
| XrmValuePtr | toVal, | |||
| XtPointer * | data | |||
| ) |
Definition at line 192 of file StrToWidg.c.
References buffer, NULL, and size.
00195 { 00196 static String buffer; 00197 Cardinal size; 00198 Widget widget; 00199 00200 widget = *(Widget *)fromVal->addr; 00201 00202 if (widget) 00203 buffer = XrmQuarkToString(widget->core.xrm_name); 00204 else 00205 buffer = "(null)"; 00206 00207 size = strlen(buffer) + 1; 00208 if (toVal->addr != NULL) 00209 { 00210 if (toVal->size < size) 00211 { 00212 toVal->size = size; 00213 return (False); 00214 } 00215 strcpy((char *)toVal->addr, buffer); 00216 } 00217 else 00218 toVal->addr = (XPointer)buffer; 00219 toVal->size = sizeof(String); 00220 00221 return (True); 00222 }
| Boolean XmuNewCvtStringToWidget | ( | Display * | dpy, | |
| XrmValue * | args, | |||
| Cardinal * | num_args, | |||
| XrmValue * | fromVal, | |||
| XrmValue * | toVal, | |||
| XtPointer * | converter_data | |||
| ) |
Definition at line 139 of file StrToWidg.c.
References addr, i, name, newDone, NULL, and XtRWidget.
Referenced by ClassInit(), and ClassInitialize().
00142 { 00143 Widget *widgetP, parent; 00144 XrmName name = XrmStringToName(fromVal->addr); 00145 int i; 00146 00147 if (*num_args != 1) 00148 XtAppWarningMsg(XtDisplayToApplicationContext(dpy), 00149 "wrongParameters","cvtStringToWidget","xtToolkitError", 00150 "String To Widget conversion needs parent argument", 00151 (String *)NULL, (Cardinal *)NULL); 00152 00153 parent = *(Widget*)args[0].addr; 00154 /* try to match names of normal children */ 00155 if (XtIsComposite(parent)) 00156 { 00157 i = ((CompositeWidget)parent)->composite.num_children; 00158 for (widgetP = ((CompositeWidget)parent)->composite.children; 00159 i; i--, widgetP++) 00160 if ((*widgetP)->core.xrm_name == name) 00161 newDone(Widget, *widgetP); 00162 } 00163 00164 /* try to match names of popup children */ 00165 i = parent->core.num_popups; 00166 for (widgetP = parent->core.popup_list; i; i--, widgetP++) 00167 if ((*widgetP)->core.xrm_name == name) 00168 newDone(Widget, *widgetP); 00169 00170 /* try to match classes of normal children */ 00171 if (XtIsComposite(parent)) 00172 { 00173 i = ((CompositeWidget)parent)->composite.num_children; 00174 for (widgetP = ((CompositeWidget)parent)->composite.children; 00175 i; i--, widgetP++) 00176 if ((*widgetP)->core.widget_class->core_class.xrm_class == name) 00177 newDone(Widget, *widgetP); 00178 } 00179 00180 /* try to match classes of popup children */ 00181 i = parent->core.num_popups; 00182 for (widgetP = parent->core.popup_list; i; i--, widgetP++) 00183 if ((*widgetP)->core.widget_class->core_class.xrm_class == name) 00184 newDone(Widget, *widgetP); 00185 00186 XtDisplayStringConversionWarning(dpy, (String)fromVal->addr, XtRWidget); 00187 return (False); 00188 }
Here is the caller graph for this function:

1.5.1