CH09.xml revision 9e7bcd65
19e7bcd65Smrg<chapter id='Resource_Management'> 29e7bcd65Smrg<title>Resource Management</title> 39e7bcd65Smrg<para> 49e7bcd65SmrgA resource is a field in the widget record with a corresponding 59e7bcd65Smrgresource entry in the <emphasis remap='I'>resources</emphasis> list of the widget or any of its 69e7bcd65Smrgsuperclasses. 79e7bcd65SmrgThis means that the field is 89e7bcd65Smrgsettable by 99e7bcd65Smrg<xref linkend='XtCreateWidget' xrefstyle='select: title'/> 109e7bcd65Smrg(by naming the field in the argument list), by an 119e7bcd65Smrgentry in a resource file (by using either the name or class), and by 129e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/>. 139e7bcd65SmrgIn addition, it is readable by 149e7bcd65Smrg<xref linkend='XtGetValues' xrefstyle='select: title'/>. 159e7bcd65SmrgNot all fields in a widget record are resources. 169e7bcd65SmrgSome are for bookkeeping use by the 179e7bcd65Smrggeneric routines (like <emphasis remap='I'>managed</emphasis> and <emphasis remap='I'>being_destroyed</emphasis>). 189e7bcd65SmrgOthers can be for local bookkeeping, 199e7bcd65Smrgand still others are derived from resources 209e7bcd65Smrg(many graphics contexts and pixmaps). 219e7bcd65Smrg</para> 229e7bcd65Smrg 239e7bcd65Smrg<para> 249e7bcd65SmrgWidgets typically need to obtain a large set of resources at widget 259e7bcd65Smrgcreation time. 269e7bcd65SmrgSome of the resources come from the argument list supplied in the call to 279e7bcd65Smrg<xref linkend='XtCreateWidget' xrefstyle='select: title'/>, 289e7bcd65Smrgsome from the resource database, 299e7bcd65Smrgand some from the internal defaults specified by the widget. 309e7bcd65SmrgResources are obtained first from the argument list, 319e7bcd65Smrgthen from the resource database for all resources not specified 329e7bcd65Smrgin the argument list, 339e7bcd65Smrgand last, from the internal default, if needed. 349e7bcd65Smrg</para> 359e7bcd65Smrg<sect1 id="Resource_Lists"> 369e7bcd65Smrg<title>Resource Lists</title> 379e7bcd65Smrg<para> 389e7bcd65SmrgA resource entry specifies a field in the widget, 399e7bcd65Smrgthe textual name and class of the field that argument lists 409e7bcd65Smrgand external resource files use to refer to the field, 419e7bcd65Smrgand a default value that the field should get if no value is specified. 429e7bcd65SmrgThe declaration for the 439e7bcd65Smrg<function>XtResource</function> 449e7bcd65Smrgstructure is 459e7bcd65Smrg</para> 469e7bcd65Smrg<literallayout > 479e7bcd65Smrgtypedef struct { 489e7bcd65Smrg String resource_name; 499e7bcd65Smrg String resource_class; 509e7bcd65Smrg String resource_type; 519e7bcd65Smrg Cardinal resource_size; 529e7bcd65Smrg Cardinal resource_offset; 539e7bcd65Smrg String default_type; 549e7bcd65Smrg XtPointer default_addr; 559e7bcd65Smrg} XtResource, *XtResourceList; 569e7bcd65Smrg</literallayout> 579e7bcd65Smrg<para> 589e7bcd65SmrgWhen the resource list is specified as the 599e7bcd65Smrg<function>CoreClassPart</function>, 609e7bcd65Smrg<function>ObjectClassPart</function>, 619e7bcd65Smrg<function>RectObjClassPart</function>, 629e7bcd65Smrgor 639e7bcd65Smrg<function>ConstraintClassPart</function> 649e7bcd65Smrg<emphasis remap='I'>resources</emphasis> field, the strings pointed to by <emphasis remap='I'>resource_name</emphasis>, 659e7bcd65Smrg<emphasis remap='I'>resource_class</emphasis>, <emphasis remap='I'>resource_type</emphasis>, and <emphasis remap='I'>default_type</emphasis> must 669e7bcd65Smrgbe permanently allocated prior to or during the execution of the class 679e7bcd65Smrginitialization procedure and must not be subsequently deallocated. 689e7bcd65Smrg</para> 699e7bcd65Smrg 709e7bcd65Smrg<para> 719e7bcd65SmrgThe <emphasis remap='I'>resource_name</emphasis> field contains the name used by clients to access the field 729e7bcd65Smrgin the widget. 739e7bcd65SmrgBy convention, it starts with a lowercase letter 749e7bcd65Smrgand is spelled exactly like the field name, 759e7bcd65Smrgexcept all underscores (_) are deleted and the next letter is replaced by its 769e7bcd65Smrguppercase counterpart. 779e7bcd65SmrgFor example, the resource name for background_pixel becomes backgroundPixel. 789e7bcd65SmrgResource names beginning with the two-character 799e7bcd65Smrgsequence ``xt'', and resource classes beginning with the two-character 809e7bcd65Smrgsequence ``Xt'' are reserved to the Intrinsics for future standard and 819e7bcd65Smrgimplementation-dependent uses. 829e7bcd65SmrgWidget header files typically contain a symbolic name for each resource name. 839e7bcd65SmrgAll resource names, classes, and types used by the Intrinsics are named in 849e7bcd65Smrg<function><X11/StringDefs.h></function>. 859e7bcd65SmrgThe Intrinsics's symbolic resource names begin with 869e7bcd65Smrg``XtN'' 879e7bcd65Smrgand are followed by the string name (for example, XtNbackgroundPixel 889e7bcd65Smrgfor backgroundPixel). 899e7bcd65Smrg</para> 909e7bcd65Smrg 919e7bcd65Smrg<para> 929e7bcd65SmrgThe <emphasis remap='I'>resource_class</emphasis> field contains the class string used in resource 939e7bcd65Smrgspecification files to identify the field. 949e7bcd65SmrgA resource class provides two functions: 959e7bcd65Smrg</para> 969e7bcd65Smrg<itemizedlist spacing='compact'> 979e7bcd65Smrg <listitem> 989e7bcd65Smrg <para> 999e7bcd65SmrgIt isolates an application from different representations that widgets 1009e7bcd65Smrgcan use for a similar resource. 1019e7bcd65Smrg </para> 1029e7bcd65Smrg </listitem> 1039e7bcd65Smrg <listitem> 1049e7bcd65Smrg <para> 1059e7bcd65SmrgIt lets you specify values for several actual resources with a single name. 1069e7bcd65SmrgA resource class should be chosen to span a group of closely related fields. 1079e7bcd65Smrg </para> 1089e7bcd65Smrg </listitem> 1099e7bcd65Smrg</itemizedlist> 1109e7bcd65Smrg<para> 1119e7bcd65SmrgFor example, 1129e7bcd65Smrga widget can have several pixel resources: background, foreground, 1139e7bcd65Smrgborder, block cursor, pointer cursor, and so on. 1149e7bcd65SmrgTypically, the background defaults to white 1159e7bcd65Smrgand everything else to black. 1169e7bcd65SmrgThe resource class for each of these resources in the resource list 1179e7bcd65Smrgshould be chosen so that it takes the minimal number of entries 1189e7bcd65Smrgin the resource database to make the background ivory 1199e7bcd65Smrgand everything else darkblue. 1209e7bcd65Smrg</para> 1219e7bcd65Smrg 1229e7bcd65Smrg<para> 1239e7bcd65SmrgIn this case, the background pixel should have a resource class of 1249e7bcd65Smrg``Background'' 1259e7bcd65Smrgand all the other pixel entries a resource class of 1269e7bcd65Smrg``Foreground''. 1279e7bcd65SmrgThen, the resource file needs only two lines to 1289e7bcd65Smrgchange all pixels to ivory or darkblue: 1299e7bcd65Smrg</para> 1309e7bcd65Smrg<literallayout > 1319e7bcd65Smrg*Background: ivory 1329e7bcd65Smrg*Foreground: darkblue 1339e7bcd65Smrg</literallayout> 1349e7bcd65Smrg<para> 1359e7bcd65SmrgSimilarly, a widget may have several font resources (such as normal and bold), 1369e7bcd65Smrgbut all fonts should have the class Font. 1379e7bcd65SmrgThus, changing all fonts simply requires only a single line in the 1389e7bcd65Smrgdefault resource file: 1399e7bcd65Smrg</para> 1409e7bcd65Smrg<literallayout > 1419e7bcd65Smrg*Font: 6x13 1429e7bcd65Smrg</literallayout> 1439e7bcd65Smrg<para> 1449e7bcd65SmrgBy convention, 1459e7bcd65Smrgresource classes are always spelled starting with a capital letter 1469e7bcd65Smrgto distinguish them from resource names. 1479e7bcd65SmrgTheir symbolic names are preceded with 1489e7bcd65Smrg``XtC'' 1499e7bcd65Smrg(for example, XtCBackground). 1509e7bcd65Smrg</para> 1519e7bcd65Smrg 1529e7bcd65Smrg<para> 1539e7bcd65SmrgThe <emphasis remap='I'>resource_type</emphasis> field gives the physical representation type of the resource 1549e7bcd65Smrgand also encodes information about the specific usage of the field. 1559e7bcd65SmrgBy convention, it starts with an uppercase letter and is 1569e7bcd65Smrgspelled identically to the type name of the field. 1579e7bcd65SmrgThe resource type is used when resources are fetched to 1589e7bcd65Smrgconvert from the resource database format (usually 1599e7bcd65Smrg<function>String</function>) 1609e7bcd65Smrgor the format of the resource default value 1619e7bcd65Smrg(almost anything, but often 1629e7bcd65Smrg<function>String</function>) 1639e7bcd65Smrgto the desired 1649e7bcd65Smrgphysical representation (see <xref linkend='Resource_Conversions' />). 1659e7bcd65SmrgThe Intrinsics define the following resource types: 1669e7bcd65Smrg</para> 1679e7bcd65Smrg 1689e7bcd65Smrg<informaltable frame='topbot'> 1699e7bcd65Smrg <?dbfo keep-together="auto" ?> 1709e7bcd65Smrg <tgroup cols='2' align='left' colsep='0' rowsep='0'> 1719e7bcd65Smrg <colspec colwidth='1.0*' colname='c1'/> 1729e7bcd65Smrg <colspec colwidth='1.0*' colname='c2'/> 1739e7bcd65Smrg <thead> 1749e7bcd65Smrg <row rowsep='1'> 1759e7bcd65Smrg <entry>Resource Type</entry> 1769e7bcd65Smrg <entry>Structure or Field Type</entry> 1779e7bcd65Smrg </row> 1789e7bcd65Smrg </thead> 1799e7bcd65Smrg <tbody> 1809e7bcd65Smrg <row> 1819e7bcd65Smrg <entry><function>XtRAcceleratorTable</function></entry> 1829e7bcd65Smrg <entry>XtAccelerators</entry> 1839e7bcd65Smrg </row> 1849e7bcd65Smrg <row> 1859e7bcd65Smrg <entry><function>XtRAtom</function></entry> 1869e7bcd65Smrg <entry>Atom</entry> 1879e7bcd65Smrg </row> 1889e7bcd65Smrg <row> 1899e7bcd65Smrg <entry><function>XtRBitmap</function></entry> 1909e7bcd65Smrg <entry>Pixmap, depth=1</entry> 1919e7bcd65Smrg </row> 1929e7bcd65Smrg <row> 1939e7bcd65Smrg <entry><function>XtRBoolean</function></entry> 1949e7bcd65Smrg <entry>Boolean</entry> 1959e7bcd65Smrg </row> 1969e7bcd65Smrg <row> 1979e7bcd65Smrg <entry><function>XtRBool</function></entry> 1989e7bcd65Smrg <entry>Bool</entry> 1999e7bcd65Smrg </row> 2009e7bcd65Smrg <row> 2019e7bcd65Smrg <entry><function>XtRCallback</function></entry> 2029e7bcd65Smrg <entry>XtCallbackList</entry> 2039e7bcd65Smrg </row> 2049e7bcd65Smrg <row> 2059e7bcd65Smrg <entry><function>XtRCardinal</function></entry> 2069e7bcd65Smrg <entry>Cardinal</entry> 2079e7bcd65Smrg </row> 2089e7bcd65Smrg <row> 2099e7bcd65Smrg <entry><function>XtRColor</function></entry> 2109e7bcd65Smrg <entry>XColor</entry> 2119e7bcd65Smrg </row> 2129e7bcd65Smrg <row> 2139e7bcd65Smrg <entry><function>XtRColormap</function></entry> 2149e7bcd65Smrg <entry>Colormap</entry> 2159e7bcd65Smrg </row> 2169e7bcd65Smrg <row> 2179e7bcd65Smrg <entry><function>XtRCommandArgArray</function></entry> 2189e7bcd65Smrg <entry>String*</entry> 2199e7bcd65Smrg </row> 2209e7bcd65Smrg <row> 2219e7bcd65Smrg <entry><function>XtRCursor</function></entry> 2229e7bcd65Smrg <entry>Cursor</entry> 2239e7bcd65Smrg </row> 2249e7bcd65Smrg <row> 2259e7bcd65Smrg <entry><function>XtRDimension</function></entry> 2269e7bcd65Smrg <entry>Dimension</entry> 2279e7bcd65Smrg </row> 2289e7bcd65Smrg <row> 2299e7bcd65Smrg <entry><function>XtRDirectoryString</function></entry> 2309e7bcd65Smrg <entry>String</entry> 2319e7bcd65Smrg </row> 2329e7bcd65Smrg <row> 2339e7bcd65Smrg <entry><function>XtRDisplay</function></entry> 2349e7bcd65Smrg <entry>Display*</entry> 2359e7bcd65Smrg </row> 2369e7bcd65Smrg <row> 2379e7bcd65Smrg <entry><function>XtREnum</function></entry> 2389e7bcd65Smrg <entry>XtEnum</entry> 2399e7bcd65Smrg </row> 2409e7bcd65Smrg <row> 2419e7bcd65Smrg <entry><function>XtREnvironmentArray</function></entry> 2429e7bcd65Smrg <entry>String*</entry> 2439e7bcd65Smrg </row> 2449e7bcd65Smrg <row> 2459e7bcd65Smrg <entry><function>XtRFile</function></entry> 2469e7bcd65Smrg <entry>FILE*</entry> 2479e7bcd65Smrg </row> 2489e7bcd65Smrg <row> 2499e7bcd65Smrg <entry><function>XtRFloat</function></entry> 2509e7bcd65Smrg <entry>float</entry> 2519e7bcd65Smrg </row> 2529e7bcd65Smrg <row> 2539e7bcd65Smrg <entry><function>XtRFont</function></entry> 2549e7bcd65Smrg <entry>Font</entry> 2559e7bcd65Smrg </row> 2569e7bcd65Smrg <row> 2579e7bcd65Smrg <entry><function>XtRFontSet</function></entry> 2589e7bcd65Smrg <entry>XFontSet</entry> 2599e7bcd65Smrg </row> 2609e7bcd65Smrg <row> 2619e7bcd65Smrg <entry><function>XtRFontStruct</function></entry> 2629e7bcd65Smrg <entry>XFontStruct*</entry> 2639e7bcd65Smrg </row> 2649e7bcd65Smrg <row> 2659e7bcd65Smrg <entry><function>XtRFunction</function></entry> 2669e7bcd65Smrg <entry>(*)()</entry> 2679e7bcd65Smrg </row> 2689e7bcd65Smrg <row> 2699e7bcd65Smrg <entry><function>XtRGeometry</function></entry> 2709e7bcd65Smrg <entry>char*, format as defined by 2719e7bcd65Smrg <function>XParseGeometry</function></entry> 2729e7bcd65Smrg </row> 2739e7bcd65Smrg <row> 2749e7bcd65Smrg <entry><function>XtRGravity</function></entry> 2759e7bcd65Smrg <entry>int</entry> 2769e7bcd65Smrg </row> 2779e7bcd65Smrg <row> 2789e7bcd65Smrg <entry><function>XtRInitialState</function></entry> 2799e7bcd65Smrg <entry>int</entry> 2809e7bcd65Smrg </row> 2819e7bcd65Smrg <row> 2829e7bcd65Smrg <entry><function>XtRInt</function></entry> 2839e7bcd65Smrg <entry>int</entry> 2849e7bcd65Smrg </row> 2859e7bcd65Smrg <row> 2869e7bcd65Smrg <entry><function>XtRLongBoolean</function></entry> 2879e7bcd65Smrg <entry>long</entry> 2889e7bcd65Smrg </row> 2899e7bcd65Smrg <row> 2909e7bcd65Smrg <entry><function>XtRObject</function></entry> 2919e7bcd65Smrg <entry>Object</entry> 2929e7bcd65Smrg </row> 2939e7bcd65Smrg <row> 2949e7bcd65Smrg <entry><function>XtRPixel</function></entry> 2959e7bcd65Smrg <entry>Pixel</entry> 2969e7bcd65Smrg </row> 2979e7bcd65Smrg <row> 2989e7bcd65Smrg <entry><function>XtRPixmap</function></entry> 2999e7bcd65Smrg <entry>Pixmap</entry> 3009e7bcd65Smrg </row> 3019e7bcd65Smrg <row> 3029e7bcd65Smrg <entry><function>XtRPointer</function></entry> 3039e7bcd65Smrg <entry>XtPointer</entry> 3049e7bcd65Smrg </row> 3059e7bcd65Smrg <row> 3069e7bcd65Smrg <entry><function>XtRPosition</function></entry> 3079e7bcd65Smrg <entry>Position</entry> 3089e7bcd65Smrg </row> 3099e7bcd65Smrg <row> 3109e7bcd65Smrg <entry><function>XtRRestartStyle</function></entry> 3119e7bcd65Smrg <entry>unsigned char</entry> 3129e7bcd65Smrg </row> 3139e7bcd65Smrg <row> 3149e7bcd65Smrg <entry><function>XtRScreen</function></entry> 3159e7bcd65Smrg <entry>Screen*</entry> 3169e7bcd65Smrg </row> 3179e7bcd65Smrg <row> 3189e7bcd65Smrg <entry><function>XtRShort</function></entry> 3199e7bcd65Smrg <entry>short</entry> 3209e7bcd65Smrg </row> 3219e7bcd65Smrg <row> 3229e7bcd65Smrg <entry><function>XtRSmcConn</function></entry> 3239e7bcd65Smrg <entry>XtPointer</entry> 3249e7bcd65Smrg </row> 3259e7bcd65Smrg <row> 3269e7bcd65Smrg <entry><function>XtRString</function></entry> 3279e7bcd65Smrg <entry>String</entry> 3289e7bcd65Smrg </row> 3299e7bcd65Smrg <row> 3309e7bcd65Smrg <entry><function>XtRStringArray</function></entry> 3319e7bcd65Smrg <entry>String*</entry> 3329e7bcd65Smrg </row> 3339e7bcd65Smrg <row> 3349e7bcd65Smrg <entry><function>XtRStringTable</function></entry> 3359e7bcd65Smrg <entry>String*</entry> 3369e7bcd65Smrg </row> 3379e7bcd65Smrg <row> 3389e7bcd65Smrg <entry><function>XtRTranslationTable</function></entry> 3399e7bcd65Smrg <entry>XtTranslations</entry> 3409e7bcd65Smrg </row> 3419e7bcd65Smrg <row> 3429e7bcd65Smrg <entry><function>XtRUnsignedChar</function></entry> 3439e7bcd65Smrg <entry>unsigned char</entry> 3449e7bcd65Smrg </row> 3459e7bcd65Smrg <row> 3469e7bcd65Smrg <entry><function>XtRVisual</function></entry> 3479e7bcd65Smrg <entry>Visual*</entry> 3489e7bcd65Smrg </row> 3499e7bcd65Smrg <row> 3509e7bcd65Smrg <entry><function>XtRWidget</function></entry> 3519e7bcd65Smrg <entry>Widget</entry> 3529e7bcd65Smrg </row> 3539e7bcd65Smrg <row> 3549e7bcd65Smrg <entry><function>XtRWidgetClass</function></entry> 3559e7bcd65Smrg <entry>WidgetClass</entry> 3569e7bcd65Smrg </row> 3579e7bcd65Smrg <row> 3589e7bcd65Smrg <entry><function>XtRWidgetList</function></entry> 3599e7bcd65Smrg <entry>WidgetList</entry> 3609e7bcd65Smrg </row> 3619e7bcd65Smrg <row> 3629e7bcd65Smrg <entry><function>XtRWindow</function></entry> 3639e7bcd65Smrg <entry>Window</entry> 3649e7bcd65Smrg </row> 3659e7bcd65Smrg </tbody> 3669e7bcd65Smrg </tgroup> 3679e7bcd65Smrg</informaltable> 3689e7bcd65Smrg 3699e7bcd65Smrg<para> 3709e7bcd65Smrg<function><X11/StringDefs.h></function> 3719e7bcd65Smrgalso defines the following resource types as a 3729e7bcd65Smrgconvenience for widgets, although they do not have any corresponding 3739e7bcd65Smrgdata type assigned: 3749e7bcd65Smrg<function>XtREditMode</function>, 3759e7bcd65Smrg<function>XtRJustify</function>, 3769e7bcd65Smrgand 3779e7bcd65Smrg<function>XtROrientation</function>. 3789e7bcd65Smrg</para> 3799e7bcd65Smrg 3809e7bcd65Smrg<para> 3819e7bcd65SmrgThe <emphasis remap='I'>resource_size</emphasis> field is the size of the physical representation in bytes; 3829e7bcd65Smrgyou should specify it as 3839e7bcd65Smrg<function>sizeof</function>(type) so that the 3849e7bcd65Smrgcompiler fills in the value. 3859e7bcd65SmrgThe <emphasis remap='I'>resource_offset</emphasis> field is the offset in bytes of the field 3869e7bcd65Smrgwithin the widget. 3879e7bcd65SmrgYou should use the 3889e7bcd65Smrg<xref linkend='XtOffsetOf' xrefstyle='select: title'/> 3899e7bcd65Smrgmacro to retrieve this value. 3909e7bcd65SmrgThe <emphasis remap='I'>default_type</emphasis> field is the representation type of the default 3919e7bcd65Smrgresource value. 3929e7bcd65SmrgIf <emphasis remap='I'>default_type</emphasis> is different from <emphasis remap='I'>resource_type</emphasis> and the default value 3939e7bcd65Smrgis needed, 3949e7bcd65Smrgthe resource manager invokes a conversion procedure from <emphasis remap='I'>default_type</emphasis> 3959e7bcd65Smrgto <emphasis remap='I'>resource_type</emphasis>. 3969e7bcd65SmrgWhenever possible, 3979e7bcd65Smrgthe default type should be identical to the resource type in order 3989e7bcd65Smrgto minimize widget creation time. 3999e7bcd65SmrgHowever, there are sometimes no values of the type that the program 4009e7bcd65Smrgcan easily specify. 4019e7bcd65SmrgIn this case, 4029e7bcd65Smrgit should be a value for which the converter is guaranteed to work (for example, 4039e7bcd65Smrg<function>XtDefaultForeground</function> 4049e7bcd65Smrgfor a pixel resource). 4059e7bcd65SmrgThe <emphasis remap='I'>default_addr</emphasis> field specifies the address of the default resource value. 4069e7bcd65SmrgAs a special case, if <emphasis remap='I'>default_type</emphasis> is 4079e7bcd65Smrg<function>XtRString</function>, 4089e7bcd65Smrgthen the value in the <emphasis remap='I'>default_addr</emphasis> field is the pointer to 4099e7bcd65Smrgthe string rather than a pointer to the pointer. 4109e7bcd65SmrgThe default is used if a resource is not specified in the argument list 4119e7bcd65Smrgor in the resource database or if the conversion from the representation 4129e7bcd65Smrgtype stored in the resource database fails, 4139e7bcd65Smrgwhich can happen for various reasons (for example, a misspelled entry in a 4149e7bcd65Smrgresource file). 4159e7bcd65Smrg</para> 4169e7bcd65Smrg 4179e7bcd65Smrg<para> 4189e7bcd65SmrgTwo special representation types 4199e7bcd65Smrg(XtRImmediate 4209e7bcd65Smrgand 4219e7bcd65SmrgXtRCallProc) 4229e7bcd65Smrgare usable only as default resource types. 4239e7bcd65SmrgXtRImmediate 4249e7bcd65Smrgindicates that the value in the <emphasis remap='I'>default_addr</emphasis> field is the actual value of 4259e7bcd65Smrgthe resource rather than the address of the value. 4269e7bcd65SmrgThe value must be in the correct representation type for the resource, 4279e7bcd65Smrgcoerced to an 4289e7bcd65Smrg<function>XtPointer</function>. 4299e7bcd65SmrgNo conversion is possible, since there is no source representation type. 4309e7bcd65SmrgXtRCallProc 4319e7bcd65Smrgindicates that the value in the <emphasis remap='I'>default_addr</emphasis> field is a procedure 4329e7bcd65Smrgpointer. 4339e7bcd65SmrgThis procedure is automatically invoked with the widget, 4349e7bcd65Smrg<emphasis remap='I'>resource_offset</emphasis>, and a pointer to an 4359e7bcd65Smrg<function>XrmValue</function> 4369e7bcd65Smrgin which to store the result. 4379e7bcd65SmrgXtRCallProc 4389e7bcd65Smrgprocedure pointers are of type 4399e7bcd65Smrg<xref linkend='XtResourceDefaultProc' xrefstyle='select: title'/>. 4409e7bcd65Smrg</para> 4419e7bcd65Smrg 4429e7bcd65Smrg<funcsynopsis id='XtResourceDefaultProc'> 4439e7bcd65Smrg<funcprototype> 4449e7bcd65Smrg<funcdef>typedef void <function>(*XtResourceDefaultProc)</function></funcdef> 4459e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 4469e7bcd65Smrg <paramdef>int <parameter>offset</parameter></paramdef> 4479e7bcd65Smrg <paramdef>XrmValue *<parameter>value</parameter></paramdef> 4489e7bcd65Smrg</funcprototype> 4499e7bcd65Smrg</funcsynopsis> 4509e7bcd65Smrg 4519e7bcd65Smrg<variablelist> 4529e7bcd65Smrg <varlistentry> 4539e7bcd65Smrg <term> 4549e7bcd65Smrg <emphasis remap='I'>w</emphasis> 4559e7bcd65Smrg </term> 4569e7bcd65Smrg <listitem> 4579e7bcd65Smrg <para> 4589e7bcd65SmrgSpecifies the widget whose resource value is to be obtained. 4599e7bcd65Smrg </para> 4609e7bcd65Smrg </listitem> 4619e7bcd65Smrg </varlistentry> 4629e7bcd65Smrg <varlistentry> 4639e7bcd65Smrg <term> 4649e7bcd65Smrg <emphasis remap='I'>offset</emphasis> 4659e7bcd65Smrg </term> 4669e7bcd65Smrg <listitem> 4679e7bcd65Smrg <para> 4689e7bcd65SmrgSpecifies the offset of the field in the widget record. 4699e7bcd65Smrg </para> 4709e7bcd65Smrg </listitem> 4719e7bcd65Smrg </varlistentry> 4729e7bcd65Smrg <varlistentry> 4739e7bcd65Smrg <term> 4749e7bcd65Smrg <emphasis remap='I'>value</emphasis> 4759e7bcd65Smrg </term> 4769e7bcd65Smrg <listitem> 4779e7bcd65Smrg <para> 4789e7bcd65SmrgSpecifies the resource value descriptor to return. 4799e7bcd65Smrg </para> 4809e7bcd65Smrg </listitem> 4819e7bcd65Smrg </varlistentry> 4829e7bcd65Smrg</variablelist> 4839e7bcd65Smrg 4849e7bcd65Smrg<para> 4859e7bcd65SmrgThe 4869e7bcd65Smrg<xref linkend='XtResourceDefaultProc' xrefstyle='select: title'/> 4879e7bcd65Smrgprocedure should fill in the <emphasis remap='I'>value->addr</emphasis> field with a pointer 4889e7bcd65Smrgto the resource value in its correct representation type. 4899e7bcd65Smrg</para> 4909e7bcd65Smrg 4919e7bcd65Smrg<para> 4929e7bcd65SmrgTo get the resource list structure for a particular class, use 4939e7bcd65Smrg<xref linkend='XtGetResourceList' xrefstyle='select: title'/>. 4949e7bcd65Smrg</para> 4959e7bcd65Smrg 4969e7bcd65Smrg<funcsynopsis id='XtGetResourceList'> 4979e7bcd65Smrg<funcprototype> 4989e7bcd65Smrg<funcdef>void <function>XtGetResourceList</function></funcdef> 4999e7bcd65Smrg 5009e7bcd65Smrg <paramdef>WidgetClass <parameter>class</parameter></paramdef> 5019e7bcd65Smrg <paramdef>XtResourceList *<parameter>resources_return</parameter></paramdef> 5029e7bcd65Smrg <paramdef>Cardinal *<parameter>num_resources_return</parameter></paramdef> 5039e7bcd65Smrg</funcprototype> 5049e7bcd65Smrg</funcsynopsis> 5059e7bcd65Smrg 5069e7bcd65Smrg<variablelist> 5079e7bcd65Smrg <varlistentry> 5089e7bcd65Smrg <term> 5099e7bcd65Smrg <emphasis remap='I'>class</emphasis> 5109e7bcd65Smrg </term> 5119e7bcd65Smrg <listitem> 5129e7bcd65Smrg <para> 5139e7bcd65SmrgSpecifies the object class to be queried. It must be 5149e7bcd65Smrg<function>objectClass</function> 5159e7bcd65Smrgor any subclass thereof. 5169e7bcd65Smrg </para> 5179e7bcd65Smrg </listitem> 5189e7bcd65Smrg </varlistentry> 5199e7bcd65Smrg <varlistentry> 5209e7bcd65Smrg <term> 5219e7bcd65Smrg <emphasis remap='I'>resources_return</emphasis> 5229e7bcd65Smrg </term> 5239e7bcd65Smrg <listitem> 5249e7bcd65Smrg <para> 5259e7bcd65SmrgReturns the resource list. 5269e7bcd65Smrg </para> 5279e7bcd65Smrg </listitem> 5289e7bcd65Smrg </varlistentry> 5299e7bcd65Smrg <varlistentry> 5309e7bcd65Smrg <term> 5319e7bcd65Smrg <emphasis remap='I'>num_resources_return</emphasis> 5329e7bcd65Smrg </term> 5339e7bcd65Smrg <listitem> 5349e7bcd65Smrg <para> 5359e7bcd65SmrgReturns the number of entries in the resource list. 5369e7bcd65Smrg </para> 5379e7bcd65Smrg </listitem> 5389e7bcd65Smrg </varlistentry> 5399e7bcd65Smrg</variablelist> 5409e7bcd65Smrg 5419e7bcd65Smrg<para> 5429e7bcd65SmrgIf 5439e7bcd65Smrg<xref linkend='XtGetResourceList' xrefstyle='select: title'/> 5449e7bcd65Smrgis called before the class is initialized, 5459e7bcd65Smrgit returns the resource list as specified in the class record. 5469e7bcd65SmrgIf it is called after the class has been initialized, 5479e7bcd65Smrg<xref linkend='XtGetResourceList' xrefstyle='select: title'/> 5489e7bcd65Smrgreturns a merged resource list that includes the resources 5499e7bcd65Smrgfor all superclasses. 5509e7bcd65SmrgThe list returned by 5519e7bcd65Smrg<xref linkend='XtGetResourceList' xrefstyle='select: title'/> 5529e7bcd65Smrgshould be freed using 5539e7bcd65Smrg<xref linkend='XtFree' xrefstyle='select: title'/> 5549e7bcd65Smrgwhen it is no longer needed. 5559e7bcd65Smrg</para> 5569e7bcd65Smrg 5579e7bcd65Smrg<para> 5589e7bcd65SmrgTo get the constraint resource list structure for a particular widget 5599e7bcd65Smrgclass, use 5609e7bcd65Smrg<xref linkend='XtGetConstraintResourceList' xrefstyle='select: title'/>. 5619e7bcd65Smrg</para> 5629e7bcd65Smrg 5639e7bcd65Smrg<funcsynopsis id='XtGetConstraintResourceList'> 5649e7bcd65Smrg<funcprototype> 5659e7bcd65Smrg<funcdef>void <function>XtGetConstraintResourceList</function></funcdef> 5669e7bcd65Smrg <paramdef>WidgetClass <parameter>class</parameter></paramdef> 5679e7bcd65Smrg <paramdef>XtResourceList *<parameter>resources_return</parameter></paramdef> 5689e7bcd65Smrg <paramdef>Cardinal *<parameter>num_resources_return</parameter></paramdef> 5699e7bcd65Smrg</funcprototype> 5709e7bcd65Smrg</funcsynopsis> 5719e7bcd65Smrg 5729e7bcd65Smrg<variablelist> 5739e7bcd65Smrg <varlistentry> 5749e7bcd65Smrg <term> 5759e7bcd65Smrg <emphasis remap='I'>class</emphasis> 5769e7bcd65Smrg </term> 5779e7bcd65Smrg <listitem> 5789e7bcd65Smrg <para> 5799e7bcd65SmrgSpecifies the object class to be queried. It must be 5809e7bcd65Smrg<function>objectClass</function> 5819e7bcd65Smrgor any subclass thereof. 5829e7bcd65Smrg </para> 5839e7bcd65Smrg </listitem> 5849e7bcd65Smrg </varlistentry> 5859e7bcd65Smrg <varlistentry> 5869e7bcd65Smrg <term> 5879e7bcd65Smrg <emphasis remap='I'>resources_return</emphasis> 5889e7bcd65Smrg </term> 5899e7bcd65Smrg <listitem> 5909e7bcd65Smrg <para> 5919e7bcd65SmrgReturns the constraint resource list. 5929e7bcd65Smrg </para> 5939e7bcd65Smrg </listitem> 5949e7bcd65Smrg </varlistentry> 5959e7bcd65Smrg <varlistentry> 5969e7bcd65Smrg <term> 5979e7bcd65Smrg <emphasis remap='I'>num_resources_return</emphasis> 5989e7bcd65Smrg </term> 5999e7bcd65Smrg <listitem> 6009e7bcd65Smrg <para> 6019e7bcd65SmrgReturns the number of entries in the constraint resource list. 6029e7bcd65Smrg </para> 6039e7bcd65Smrg </listitem> 6049e7bcd65Smrg </varlistentry> 6059e7bcd65Smrg</variablelist> 6069e7bcd65Smrg 6079e7bcd65Smrg<para> 6089e7bcd65SmrgIf 6099e7bcd65Smrg<xref linkend='XtGetConstraintResourceList' xrefstyle='select: title'/> 6109e7bcd65Smrgis called before the widget class is 6119e7bcd65Smrginitialized, the resource list as specified in the widget 6129e7bcd65Smrgclass Constraint part is returned. If 6139e7bcd65Smrg<xref linkend='XtGetConstraintResourceList' xrefstyle='select: title'/> 6149e7bcd65Smrgis called after the widget class has been initialized, the merged 6159e7bcd65Smrgresource list for the class and all Constraint superclasses is 6169e7bcd65Smrgreturned. If the 6179e7bcd65Smrgspecified class is not a subclass of 6189e7bcd65Smrg<function>constraintWidgetClass</function>, 6199e7bcd65Smrg*<emphasis remap='I'>resources_return</emphasis> is set to NULL 6209e7bcd65Smrgand *<emphasis remap='I'>num_resources_return</emphasis> is set to zero. 6219e7bcd65SmrgThe list returned by 6229e7bcd65Smrg<xref linkend='XtGetConstraintResourceList' xrefstyle='select: title'/> 6239e7bcd65Smrgshould be freed using 6249e7bcd65Smrg<xref linkend='XtFree' xrefstyle='select: title'/> 6259e7bcd65Smrgwhen it is no longer needed. 6269e7bcd65Smrg</para> 6279e7bcd65Smrg 6289e7bcd65Smrg<para> 6299e7bcd65SmrgThe routines 6309e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 6319e7bcd65Smrgand 6329e7bcd65Smrg<xref linkend='XtGetValues' xrefstyle='select: title'/> 6339e7bcd65Smrgalso use the resource list to set and get widget state; 6349e7bcd65Smrgsee <xref linkend='Obtaining_Widget_State' /> and 6359e7bcd65Smrg<xref linkend='Setting_Widget_State' />. 6369e7bcd65Smrg</para> 6379e7bcd65Smrg 6389e7bcd65Smrg<para> 6399e7bcd65SmrgHere is an abbreviated version of a possible resource list for a Label widget: 6409e7bcd65Smrg</para> 6419e7bcd65Smrg<literallayout > 6429e7bcd65Smrg/* Resources specific to Label */ 6439e7bcd65Smrgstatic XtResource resources[] = { 6449e7bcd65Smrg{XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), 6459e7bcd65Smrg XtOffsetOf(LabelRec, label.foreground), XtRString, XtDefaultForeground}, 6469e7bcd65Smrg{XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct*), 6479e7bcd65Smrg XtOffsetOf(LabelRec, label.font), XtRString, XtDefaultFont}, 6489e7bcd65Smrg{XtNlabel, XtCLabel, XtRString, sizeof(String), 6499e7bcd65Smrg XtOffsetOf(LabelRec, label.label), XtRString, NULL}, 6509e7bcd65Smrg . 6519e7bcd65Smrg . 6529e7bcd65Smrg . 6539e7bcd65Smrg} 6549e7bcd65Smrg</literallayout> 6559e7bcd65Smrg<para> 6569e7bcd65SmrgThe complete resource name for a field of a widget instance is the 6579e7bcd65Smrgconcatenation of the application shell name (from 6589e7bcd65Smrg<function>XtAppCreateShell ),</function> 6599e7bcd65Smrgthe instance names of all the widget's parents up to the 6609e7bcd65Smrgtop of the widget tree, 6619e7bcd65Smrgthe instance name of the widget itself, 6629e7bcd65Smrgand the resource name of the specified field of the widget. 6639e7bcd65SmrgSimilarly, 6649e7bcd65Smrgthe full resource class of a field of a widget instance is the 6659e7bcd65Smrgconcatenation of the application class (from 6669e7bcd65Smrg<function>XtAppCreateShell ),</function> 6679e7bcd65Smrgthe widget class names of all the widget's parents up to the 6689e7bcd65Smrgtop of the widget tree, 6699e7bcd65Smrgthe widget class name of the widget itself, 6709e7bcd65Smrgand the resource class of the specified field of the widget. 6719e7bcd65Smrg</para> 6729e7bcd65Smrg</sect1> 6739e7bcd65Smrg 6749e7bcd65Smrg<sect1 id="Byte_Offset_Calculations"> 6759e7bcd65Smrg<title>Byte Offset Calculations</title> 6769e7bcd65Smrg<para> 6779e7bcd65SmrgTo determine the byte offset of a field within a structure type, use 6789e7bcd65Smrg<xref linkend='XtOffsetOf' xrefstyle='select: title'/>. 6799e7bcd65Smrg</para> 6809e7bcd65Smrg 6819e7bcd65Smrg<funcsynopsis id='XtOffsetOf'> 6829e7bcd65Smrg<funcprototype> 6839e7bcd65Smrg<funcdef>Cardinal <function>XtOffsetOf</function></funcdef> 6849e7bcd65Smrg <paramdef>Type <parameter>structure_type</parameter></paramdef> 6859e7bcd65Smrg <paramdef>Field <parameter>field_name</parameter></paramdef> 6869e7bcd65Smrg</funcprototype> 6879e7bcd65Smrg</funcsynopsis> 6889e7bcd65Smrg 6899e7bcd65Smrg 6909e7bcd65Smrg 6919e7bcd65Smrg<variablelist> 6929e7bcd65Smrg <varlistentry> 6939e7bcd65Smrg <term> 6949e7bcd65Smrg <emphasis remap='I'>structure_type</emphasis> 6959e7bcd65Smrg </term> 6969e7bcd65Smrg <listitem> 6979e7bcd65Smrg <para> 6989e7bcd65SmrgSpecifies a type that is declared as a structure. 6999e7bcd65Smrg </para> 7009e7bcd65Smrg </listitem> 7019e7bcd65Smrg </varlistentry> 7029e7bcd65Smrg <varlistentry> 7039e7bcd65Smrg <term> 7049e7bcd65Smrg <emphasis remap='I'>field_name</emphasis> 7059e7bcd65Smrg </term> 7069e7bcd65Smrg <listitem> 7079e7bcd65Smrg <para> 7089e7bcd65SmrgSpecifies the name of a member within the structure. 7099e7bcd65Smrg </para> 7109e7bcd65Smrg </listitem> 7119e7bcd65Smrg </varlistentry> 7129e7bcd65Smrg</variablelist> 7139e7bcd65Smrg 7149e7bcd65Smrg<para> 7159e7bcd65SmrgThe 7169e7bcd65Smrg<xref linkend='XtOffsetOf' xrefstyle='select: title'/> 7179e7bcd65Smrgmacro expands to a constant expression that gives the 7189e7bcd65Smrgoffset in bytes to the specified structure member from the beginning 7199e7bcd65Smrgof the structure. It is normally used to statically initialize 7209e7bcd65Smrgresource lists and is more portable than 7219e7bcd65Smrg<xref linkend='XtOffset' xrefstyle='select: title'/>, 7229e7bcd65Smrgwhich serves the same function. 7239e7bcd65Smrg</para> 7249e7bcd65Smrg 7259e7bcd65Smrg<para> 7269e7bcd65SmrgTo determine the byte offset of a field within a structure pointer type, use 7279e7bcd65Smrg<xref linkend='XtOffset' xrefstyle='select: title'/>. 7289e7bcd65Smrg</para> 7299e7bcd65Smrg 7309e7bcd65Smrg<funcsynopsis id='XtOffset'> 7319e7bcd65Smrg<funcprototype> 7329e7bcd65Smrg<funcdef>Cardinal <function>XtOffset</function></funcdef> 7339e7bcd65Smrg <paramdef>Type <parameter> pointer_type</parameter></paramdef> 7349e7bcd65Smrg <paramdef>Field <parameter> field_name</parameter></paramdef> 7359e7bcd65Smrg</funcprototype> 7369e7bcd65Smrg</funcsynopsis> 7379e7bcd65Smrg 7389e7bcd65Smrg<variablelist> 7399e7bcd65Smrg <varlistentry> 7409e7bcd65Smrg <term> 7419e7bcd65Smrg <emphasis remap='I'>pointer_type</emphasis> 7429e7bcd65Smrg </term> 7439e7bcd65Smrg <listitem> 7449e7bcd65Smrg <para> 7459e7bcd65SmrgSpecifies a type that is declared as a pointer to a structure. 7469e7bcd65Smrg </para> 7479e7bcd65Smrg </listitem> 7489e7bcd65Smrg </varlistentry> 7499e7bcd65Smrg <varlistentry> 7509e7bcd65Smrg <term> 7519e7bcd65Smrg <emphasis remap='I'>field_name</emphasis> 7529e7bcd65Smrg </term> 7539e7bcd65Smrg <listitem> 7549e7bcd65Smrg <para> 7559e7bcd65SmrgSpecifies the name of a member within the structure. 7569e7bcd65Smrg </para> 7579e7bcd65Smrg </listitem> 7589e7bcd65Smrg </varlistentry> 7599e7bcd65Smrg</variablelist> 7609e7bcd65Smrg 7619e7bcd65Smrg<para> 7629e7bcd65SmrgThe 7639e7bcd65Smrg<xref linkend='XtOffset' xrefstyle='select: title'/> 7649e7bcd65Smrgmacro expands to a constant expression that gives the 7659e7bcd65Smrgoffset in bytes to the specified structure member from the beginning 7669e7bcd65Smrgof the structure. It may be used to statically initialize 7679e7bcd65Smrgresource lists. 7689e7bcd65Smrg<xref linkend='XtOffset' xrefstyle='select: title'/> 7699e7bcd65Smrgis less portable than 7709e7bcd65Smrg<xref linkend='XtOffsetOf' xrefstyle='select: title'/>. 7719e7bcd65Smrg</para> 7729e7bcd65Smrg</sect1> 7739e7bcd65Smrg 7749e7bcd65Smrg<sect1 id="Superclass_to_Subclass_Chaining_of_Resource_Lists"> 7759e7bcd65Smrg<title>Superclass-to-Subclass Chaining of Resource Lists</title> 7769e7bcd65Smrg<para> 7779e7bcd65SmrgThe 7789e7bcd65Smrg<xref linkend='XtCreateWidget' xrefstyle='select: title'/> 7799e7bcd65Smrgfunction gets resources as a superclass-to-subclass chained operation. 7809e7bcd65SmrgThat is, the resources specified in the 7819e7bcd65Smrg<function>objectClass</function> 7829e7bcd65Smrgresource list are fetched, 7839e7bcd65Smrgthen those in 7849e7bcd65Smrg<function>rectObjClass</function>, 7859e7bcd65Smrgand so on down to the resources specified 7869e7bcd65Smrgfor this widget's class. Within a class, resources are fetched in the order 7879e7bcd65Smrgthey are declared. 7889e7bcd65Smrg</para> 7899e7bcd65Smrg 7909e7bcd65Smrg<para> 7919e7bcd65SmrgIn general, if a widget resource field is declared in a superclass, 7929e7bcd65Smrgthat field is included in the superclass's resource list and need not be 7939e7bcd65Smrgincluded in the subclass's resource list. 7949e7bcd65SmrgFor example, the 7959e7bcd65SmrgCore 7969e7bcd65Smrgclass contains a resource entry for <emphasis remap='I'>background_pixel</emphasis>. 7979e7bcd65SmrgConsequently, 7989e7bcd65Smrgthe implementation of Label need not also have a resource entry 7999e7bcd65Smrgfor <emphasis remap='I'>background_pixel</emphasis>. 8009e7bcd65SmrgHowever, a subclass, 8019e7bcd65Smrgby specifying a resource entry for that field in its own resource list, 8029e7bcd65Smrgcan override the resource entry for any field declared in a superclass. 8039e7bcd65SmrgThis is most often done to override the defaults provided in the 8049e7bcd65Smrgsuperclass with new ones. 8059e7bcd65SmrgAt class initialization time, 8069e7bcd65Smrgresource lists for that class are scanned from the superclass down 8079e7bcd65Smrgto the class to look for resources with the same offset. 8089e7bcd65SmrgA matching resource in a subclass will be reordered to override 8099e7bcd65Smrgthe superclass entry. 8109e7bcd65SmrgIf reordering is necessary, a copy of the superclass resource list is made to 8119e7bcd65Smrgavoid affecting other subclasses of the superclass. 8129e7bcd65Smrg</para> 8139e7bcd65Smrg 8149e7bcd65Smrg<para> 8159e7bcd65SmrgAlso at class initialization time, the Intrinsics produce an 8169e7bcd65Smrginternal representation of the resource list to optimize access time 8179e7bcd65Smrgwhen creating widgets. In order to save memory, the Intrinsics may 8189e7bcd65Smrgoverwrite the storage allocated for the resource list in the class 8199e7bcd65Smrgrecord; therefore, widgets must allocate resource lists in writable 8209e7bcd65Smrgstorage and must not access the list contents directly after the 8219e7bcd65Smrgclass_initialize procedure has returned. 8229e7bcd65Smrg</para> 8239e7bcd65Smrg</sect1> 8249e7bcd65Smrg 8259e7bcd65Smrg<sect1 id="Subresources"> 8269e7bcd65Smrg<title>Subresources</title> 8279e7bcd65Smrg<para> 8289e7bcd65SmrgA widget does not do anything to retrieve its own resources; 8299e7bcd65Smrginstead, 8309e7bcd65Smrg<xref linkend='XtCreateWidget' xrefstyle='select: title'/> 8319e7bcd65Smrgdoes this automatically before calling the class initialize procedure. 8329e7bcd65Smrg</para> 8339e7bcd65Smrg 8349e7bcd65Smrg<para> 8359e7bcd65SmrgSome widgets have subparts that are not widgets but for which the widget 8369e7bcd65Smrgwould like to fetch resources. 8379e7bcd65SmrgSuch widgets call 8389e7bcd65Smrg<xref linkend='XtGetSubresources' xrefstyle='select: title'/> 8399e7bcd65Smrgto accomplish this. 8409e7bcd65Smrg</para> 8419e7bcd65Smrg 8429e7bcd65Smrg<funcsynopsis id='XtGetSubresources'> 8439e7bcd65Smrg<funcprototype> 8449e7bcd65Smrg<funcdef>void <function>XtGetSubresources</function></funcdef> 8459e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 8469e7bcd65Smrg <paramdef>XtPointer <parameter>base</parameter></paramdef> 8479e7bcd65Smrg <paramdef>String <parameter>name</parameter></paramdef> 8489e7bcd65Smrg <paramdef>String <parameter>class</parameter></paramdef> 8499e7bcd65Smrg <paramdef>XtResourceList <parameter>resources</parameter></paramdef> 8509e7bcd65Smrg <paramdef>Cardinal <parameter>num_resources</parameter></paramdef> 8519e7bcd65Smrg <paramdef>ArgList <parameter>args</parameter></paramdef> 8529e7bcd65Smrg <paramdef>Cardinal <parameter>num_args</parameter></paramdef> 8539e7bcd65Smrg</funcprototype> 8549e7bcd65Smrg</funcsynopsis> 8559e7bcd65Smrg 8569e7bcd65Smrg<variablelist> 8579e7bcd65Smrg <varlistentry> 8589e7bcd65Smrg <term> 8599e7bcd65Smrg <emphasis remap='I'>w</emphasis> 8609e7bcd65Smrg </term> 8619e7bcd65Smrg <listitem> 8629e7bcd65Smrg <para> 8639e7bcd65SmrgSpecifies the object used to qualify the subpart resource name and 8649e7bcd65Smrgclass. Must be of class Object or any subclass thereof. 8659e7bcd65Smrg </para> 8669e7bcd65Smrg </listitem> 8679e7bcd65Smrg </varlistentry> 8689e7bcd65Smrg <varlistentry> 8699e7bcd65Smrg <term> 8709e7bcd65Smrg <emphasis remap='I'>base</emphasis> 8719e7bcd65Smrg </term> 8729e7bcd65Smrg <listitem> 8739e7bcd65Smrg <para> 8749e7bcd65SmrgSpecifies the base address of the subpart data structure into which the 8759e7bcd65Smrgresources will be written. 8769e7bcd65Smrg </para> 8779e7bcd65Smrg </listitem> 8789e7bcd65Smrg </varlistentry> 8799e7bcd65Smrg <varlistentry> 8809e7bcd65Smrg <term> 8819e7bcd65Smrg <emphasis remap='I'>name</emphasis> 8829e7bcd65Smrg </term> 8839e7bcd65Smrg <listitem> 8849e7bcd65Smrg <para> 8859e7bcd65SmrgSpecifies the name of the subpart. 8869e7bcd65Smrg </para> 8879e7bcd65Smrg </listitem> 8889e7bcd65Smrg </varlistentry> 8899e7bcd65Smrg <varlistentry> 8909e7bcd65Smrg <term> 8919e7bcd65Smrg <emphasis remap='I'>class</emphasis> 8929e7bcd65Smrg </term> 8939e7bcd65Smrg <listitem> 8949e7bcd65Smrg <para> 8959e7bcd65SmrgSpecifies the class of the subpart. 8969e7bcd65Smrg </para> 8979e7bcd65Smrg </listitem> 8989e7bcd65Smrg </varlistentry> 8999e7bcd65Smrg <varlistentry> 9009e7bcd65Smrg <term> 9019e7bcd65Smrg <emphasis remap='I'>resources</emphasis> 9029e7bcd65Smrg </term> 9039e7bcd65Smrg <listitem> 9049e7bcd65Smrg <para> 9059e7bcd65SmrgSpecifies the resource list for the subpart. 9069e7bcd65Smrg </para> 9079e7bcd65Smrg </listitem> 9089e7bcd65Smrg </varlistentry> 9099e7bcd65Smrg <varlistentry> 9109e7bcd65Smrg <term> 9119e7bcd65Smrg <emphasis remap='I'>num_resources</emphasis> 9129e7bcd65Smrg </term> 9139e7bcd65Smrg <listitem> 9149e7bcd65Smrg <para> 9159e7bcd65SmrgSpecifies the number of entries in the resource list. 9169e7bcd65Smrg </para> 9179e7bcd65Smrg </listitem> 9189e7bcd65Smrg </varlistentry> 9199e7bcd65Smrg <varlistentry> 9209e7bcd65Smrg <term> 9219e7bcd65Smrg <emphasis remap='I'>args</emphasis> 9229e7bcd65Smrg </term> 9239e7bcd65Smrg <listitem> 9249e7bcd65Smrg <para> 9259e7bcd65SmrgSpecifies the argument list to override any other resource specifications. 9269e7bcd65Smrg </para> 9279e7bcd65Smrg </listitem> 9289e7bcd65Smrg </varlistentry> 9299e7bcd65Smrg <varlistentry> 9309e7bcd65Smrg <term> 9319e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 9329e7bcd65Smrg </term> 9339e7bcd65Smrg <listitem> 9349e7bcd65Smrg <para> 9359e7bcd65SmrgSpecifies the number of entries in the argument list. 9369e7bcd65Smrg </para> 9379e7bcd65Smrg </listitem> 9389e7bcd65Smrg </varlistentry> 9399e7bcd65Smrg</variablelist> 9409e7bcd65Smrg 9419e7bcd65Smrg<para> 9429e7bcd65SmrgThe 9439e7bcd65Smrg<xref linkend='XtGetSubresources' xrefstyle='select: title'/> 9449e7bcd65Smrgfunction constructs a name and class list from the application name and class, 9459e7bcd65Smrgthe names and classes of all the object's ancestors, and the object itself. 9469e7bcd65SmrgThen it appends to this list the <emphasis remap='I'>name</emphasis> and <emphasis remap='I'>class</emphasis> pair passed in. 9479e7bcd65SmrgThe resources are fetched from the argument list, the resource database, 9489e7bcd65Smrgor the default values in the resource list. 9499e7bcd65SmrgThen they are copied into the subpart record. 9509e7bcd65SmrgIf <emphasis remap='I'>args</emphasis> is NULL, 9519e7bcd65Smrg<emphasis remap='I'>num_args</emphasis> must be zero. 9529e7bcd65SmrgHowever, if <emphasis remap='I'>num_args</emphasis> is zero, 9539e7bcd65Smrgthe argument list is not referenced. 9549e7bcd65Smrg</para> 9559e7bcd65Smrg 9569e7bcd65Smrg<para> 9579e7bcd65Smrg<xref linkend='XtGetSubresources' xrefstyle='select: title'/> 9589e7bcd65Smrgmay overwrite the specified resource list with an 9599e7bcd65Smrgequivalent representation in an internal format, which optimizes access 9609e7bcd65Smrgtime if the list is used repeatedly. The resource list must be 9619e7bcd65Smrgallocated in writable storage, and the caller must not modify the list 9629e7bcd65Smrgcontents after the call if the same list is to be used again. 9639e7bcd65SmrgResources fetched by 9649e7bcd65Smrg<xref linkend='XtGetSubresources' xrefstyle='select: title'/> 9659e7bcd65Smrgare reference-counted as 9669e7bcd65Smrgif they were referenced by the specified object. Subresources might 9679e7bcd65Smrgtherefore be freed from the conversion cache and destroyed 9689e7bcd65Smrgwhen the object is destroyed, but not before then. 9699e7bcd65Smrg</para> 9709e7bcd65Smrg 9719e7bcd65Smrg<para> 9729e7bcd65SmrgTo fetch resources for widget subparts using varargs lists, use 9739e7bcd65Smrg<xref linkend='XtVaGetSubresources' xrefstyle='select: title'/>. 9749e7bcd65Smrg</para> 9759e7bcd65Smrg 9769e7bcd65Smrg<funcsynopsis id='XtVaGetSubresources'> 9779e7bcd65Smrg<funcprototype> 9789e7bcd65Smrg<funcdef>void <function>XtVaGetSubresources</function></funcdef> 9799e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 9809e7bcd65Smrg <paramdef>XtPointer <parameter>base</parameter></paramdef> 9819e7bcd65Smrg <paramdef>String <parameter>name</parameter></paramdef> 9829e7bcd65Smrg <paramdef>String <parameter>class</parameter></paramdef> 9839e7bcd65Smrg <paramdef>XtResourceList <parameter>resources</parameter></paramdef> 9849e7bcd65Smrg <paramdef>Cardinal <parameter>num_resources</parameter></paramdef> 9859e7bcd65Smrg</funcprototype> 9869e7bcd65Smrg</funcsynopsis> 9879e7bcd65Smrg 9889e7bcd65Smrg<variablelist> 9899e7bcd65Smrg <varlistentry> 9909e7bcd65Smrg <term> 9919e7bcd65Smrg <emphasis remap='I'>w</emphasis> 9929e7bcd65Smrg </term> 9939e7bcd65Smrg <listitem> 9949e7bcd65Smrg <para> 9959e7bcd65SmrgSpecifies the object used to qualify the subpart resource name and 9969e7bcd65Smrgclass. Must be of class Object or any subclass thereof. 9979e7bcd65Smrg </para> 9989e7bcd65Smrg </listitem> 9999e7bcd65Smrg </varlistentry> 10009e7bcd65Smrg <varlistentry> 10019e7bcd65Smrg <term> 10029e7bcd65Smrg <emphasis remap='I'>base</emphasis> 10039e7bcd65Smrg </term> 10049e7bcd65Smrg <listitem> 10059e7bcd65Smrg <para> 10069e7bcd65SmrgSpecifies the base address of the subpart data structure into which the 10079e7bcd65Smrgresources will be written. 10089e7bcd65Smrg </para> 10099e7bcd65Smrg </listitem> 10109e7bcd65Smrg </varlistentry> 10119e7bcd65Smrg <varlistentry> 10129e7bcd65Smrg <term> 10139e7bcd65Smrg <emphasis remap='I'>name</emphasis> 10149e7bcd65Smrg </term> 10159e7bcd65Smrg <listitem> 10169e7bcd65Smrg <para> 10179e7bcd65SmrgSpecifies the name of the subpart. 10189e7bcd65Smrg </para> 10199e7bcd65Smrg </listitem> 10209e7bcd65Smrg </varlistentry> 10219e7bcd65Smrg <varlistentry> 10229e7bcd65Smrg <term> 10239e7bcd65Smrg <emphasis remap='I'>class</emphasis> 10249e7bcd65Smrg </term> 10259e7bcd65Smrg <listitem> 10269e7bcd65Smrg <para> 10279e7bcd65SmrgSpecifies the class of the subpart. 10289e7bcd65Smrg </para> 10299e7bcd65Smrg </listitem> 10309e7bcd65Smrg </varlistentry> 10319e7bcd65Smrg <varlistentry> 10329e7bcd65Smrg <term> 10339e7bcd65Smrg <emphasis remap='I'>resources</emphasis> 10349e7bcd65Smrg </term> 10359e7bcd65Smrg <listitem> 10369e7bcd65Smrg <para> 10379e7bcd65SmrgSpecifies the resource list for the subpart. 10389e7bcd65Smrg </para> 10399e7bcd65Smrg </listitem> 10409e7bcd65Smrg </varlistentry> 10419e7bcd65Smrg <varlistentry> 10429e7bcd65Smrg <term> 10439e7bcd65Smrg <emphasis remap='I'>num_resources</emphasis> 10449e7bcd65Smrg </term> 10459e7bcd65Smrg <listitem> 10469e7bcd65Smrg <para> 10479e7bcd65SmrgSpecifies the number of entries in the resource list. 10489e7bcd65Smrg </para> 10499e7bcd65Smrg </listitem> 10509e7bcd65Smrg </varlistentry> 10519e7bcd65Smrg <varlistentry> 10529e7bcd65Smrg <term> 10539e7bcd65Smrg ... 10549e7bcd65Smrg </term> 10559e7bcd65Smrg <listitem> 10569e7bcd65Smrg <para> 10579e7bcd65SmrgSpecifies the variable argument list to override any other 10589e7bcd65Smrgresource specifications. 10599e7bcd65Smrg </para> 10609e7bcd65Smrg </listitem> 10619e7bcd65Smrg </varlistentry> 10629e7bcd65Smrg</variablelist> 10639e7bcd65Smrg 10649e7bcd65Smrg<para> 10659e7bcd65Smrg<xref linkend='XtVaGetSubresources' xrefstyle='select: title'/> 10669e7bcd65Smrgis identical in function to 10679e7bcd65Smrg<xref linkend='XtGetSubresources' xrefstyle='select: title'/> 10689e7bcd65Smrgwith the <emphasis remap='I'>args</emphasis> and <emphasis remap='I'>num_args</emphasis> parameters replaced by a varargs list, as 10699e7bcd65Smrgdescribed in Section 2.5.1. 10709e7bcd65Smrg</para> 10719e7bcd65Smrg</sect1> 10729e7bcd65Smrg 10739e7bcd65Smrg<sect1 id="Obtaining_Application_Resources"> 10749e7bcd65Smrg<title>Obtaining Application Resources</title> 10759e7bcd65Smrg<para> 10769e7bcd65SmrgTo retrieve resources that are not specific to a widget 10779e7bcd65Smrgbut apply to the overall application, use 10789e7bcd65Smrg<xref linkend='XtGetApplicationResources' xrefstyle='select: title'/>. 10799e7bcd65Smrg</para> 10809e7bcd65Smrg 10819e7bcd65Smrg<funcsynopsis id='XtGetApplicationResources'> 10829e7bcd65Smrg<funcprototype> 10839e7bcd65Smrg<funcdef>void <function>XtGetApplicationResources</function></funcdef> 10849e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 10859e7bcd65Smrg <paramdef>XtPointer <parameter>base</parameter></paramdef> 10869e7bcd65Smrg <paramdef>XtResourceList <parameter>resources</parameter></paramdef> 10879e7bcd65Smrg <paramdef>Cardinal <parameter>num_resources</parameter></paramdef> 10889e7bcd65Smrg <paramdef>ArgList <parameter>args</parameter></paramdef> 10899e7bcd65Smrg <paramdef>Cardinal <parameter>num_args</parameter></paramdef> 10909e7bcd65Smrg</funcprototype> 10919e7bcd65Smrg</funcsynopsis> 10929e7bcd65Smrg 10939e7bcd65Smrg<variablelist> 10949e7bcd65Smrg <varlistentry> 10959e7bcd65Smrg <term> 10969e7bcd65Smrg <emphasis remap='I'>w</emphasis> 10979e7bcd65Smrg </term> 10989e7bcd65Smrg <listitem> 10999e7bcd65Smrg <para> 11009e7bcd65SmrgSpecifies the object that identifies the resource database to search 11019e7bcd65Smrg(the database is that associated with the display for this object). Must be of class Object or any subclass thereof. 11029e7bcd65Smrg </para> 11039e7bcd65Smrg </listitem> 11049e7bcd65Smrg </varlistentry> 11059e7bcd65Smrg <varlistentry> 11069e7bcd65Smrg <term> 11079e7bcd65Smrg <emphasis remap='I'>base</emphasis> 11089e7bcd65Smrg </term> 11099e7bcd65Smrg <listitem> 11109e7bcd65Smrg <para> 11119e7bcd65SmrgSpecifies the base address into which 11129e7bcd65Smrgthe resource values will be written. 11139e7bcd65Smrg </para> 11149e7bcd65Smrg </listitem> 11159e7bcd65Smrg </varlistentry> 11169e7bcd65Smrg <varlistentry> 11179e7bcd65Smrg <term> 11189e7bcd65Smrg <emphasis remap='I'>resources</emphasis> 11199e7bcd65Smrg </term> 11209e7bcd65Smrg <listitem> 11219e7bcd65Smrg <para> 11229e7bcd65SmrgSpecifies the resource list. 11239e7bcd65Smrg </para> 11249e7bcd65Smrg </listitem> 11259e7bcd65Smrg </varlistentry> 11269e7bcd65Smrg <varlistentry> 11279e7bcd65Smrg <term> 11289e7bcd65Smrg <emphasis remap='I'>num_resources</emphasis> 11299e7bcd65Smrg </term> 11309e7bcd65Smrg <listitem> 11319e7bcd65Smrg <para> 11329e7bcd65SmrgSpecifies the number of entries in the resource list. 11339e7bcd65Smrg </para> 11349e7bcd65Smrg </listitem> 11359e7bcd65Smrg </varlistentry> 11369e7bcd65Smrg <varlistentry> 11379e7bcd65Smrg <term> 11389e7bcd65Smrg <emphasis remap='I'>args</emphasis> 11399e7bcd65Smrg </term> 11409e7bcd65Smrg <listitem> 11419e7bcd65Smrg <para> 11429e7bcd65SmrgSpecifies the argument list to override any other resource specifications. 11439e7bcd65Smrg </para> 11449e7bcd65Smrg </listitem> 11459e7bcd65Smrg </varlistentry> 11469e7bcd65Smrg <varlistentry> 11479e7bcd65Smrg <term> 11489e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 11499e7bcd65Smrg </term> 11509e7bcd65Smrg <listitem> 11519e7bcd65Smrg <para> 11529e7bcd65SmrgSpecifies the number of entries in the argument list. 11539e7bcd65Smrg </para> 11549e7bcd65Smrg </listitem> 11559e7bcd65Smrg </varlistentry> 11569e7bcd65Smrg</variablelist> 11579e7bcd65Smrg 11589e7bcd65Smrg<para> 11599e7bcd65SmrgThe 11609e7bcd65Smrg<xref linkend='XtGetApplicationResources' xrefstyle='select: title'/> 11619e7bcd65Smrgfunction first uses the passed object, 11629e7bcd65Smrgwhich is usually an application shell widget, 11639e7bcd65Smrgto construct a resource name and class list. 11649e7bcd65SmrgThe full name and class of the specified object (that is, including its 11659e7bcd65Smrgancestors, if any) is logically added to the 11669e7bcd65Smrgfront of each resource name and class. 11679e7bcd65SmrgThen it retrieves the resources from the argument list, 11689e7bcd65Smrgthe resource database, or the resource list default values. 11699e7bcd65SmrgAfter adding base to each address, 11709e7bcd65Smrg<xref linkend='XtGetApplicationResources' xrefstyle='select: title'/> 11719e7bcd65Smrgcopies the resources into the addresses 11729e7bcd65Smrgobtained by adding <emphasis remap='I'>base</emphasis> to each <emphasis remap='I'>offset</emphasis> in the resource list. 11739e7bcd65SmrgIf <emphasis remap='I'>args</emphasis> is NULL, 11749e7bcd65Smrg<emphasis remap='I'>num_args</emphasis> must be zero. 11759e7bcd65SmrgHowever, if <emphasis remap='I'>num_args</emphasis> is zero, 11769e7bcd65Smrgthe argument list is not referenced. 11779e7bcd65SmrgThe portable way to specify application resources is to declare them 11789e7bcd65Smrgas members of a structure and pass the address of the structure 11799e7bcd65Smrgas the <emphasis remap='I'>base</emphasis> argument. 11809e7bcd65Smrg</para> 11819e7bcd65Smrg 11829e7bcd65Smrg<para> 11839e7bcd65Smrg<xref linkend='XtGetApplicationResources' xrefstyle='select: title'/> 11849e7bcd65Smrgmay overwrite the specified resource list 11859e7bcd65Smrgwith an equivalent representation in an internal format, which 11869e7bcd65Smrgoptimizes access time if the list is used repeatedly. The resource 11879e7bcd65Smrglist must be allocated in writable storage, and the caller must not 11889e7bcd65Smrgmodify the list contents after the call if the same list is to be 11899e7bcd65Smrgused again. Any per-display resources fetched by 11909e7bcd65Smrg<xref linkend='XtGetApplicationResources' xrefstyle='select: title'/> 11919e7bcd65Smrgwill not be freed from the resource cache until the display is closed. 11929e7bcd65Smrg</para> 11939e7bcd65Smrg 11949e7bcd65Smrg<para> 11959e7bcd65SmrgTo retrieve resources for the overall application using varargs lists, use 11969e7bcd65Smrg<xref linkend='XtVaGetApplicationResources' xrefstyle='select: title'/>. 11979e7bcd65Smrg</para> 11989e7bcd65Smrg 11999e7bcd65Smrg<funcsynopsis id='XtVaGetApplicationResources'> 12009e7bcd65Smrg<funcprototype> 12019e7bcd65Smrg<funcdef>void <function>XtVaGetApplicationResources</function></funcdef> 12029e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 12039e7bcd65Smrg <paramdef>XtPointer <parameter>base</parameter></paramdef> 12049e7bcd65Smrg <paramdef>XtResourceList <parameter>resources</parameter></paramdef> 12059e7bcd65Smrg <paramdef>Cardinal <parameter>num_resources</parameter></paramdef> 12069e7bcd65Smrg</funcprototype> 12079e7bcd65Smrg</funcsynopsis> 12089e7bcd65Smrg 12099e7bcd65Smrg<variablelist> 12109e7bcd65Smrg <varlistentry> 12119e7bcd65Smrg <term> 12129e7bcd65Smrg <emphasis remap='I'>w</emphasis> 12139e7bcd65Smrg </term> 12149e7bcd65Smrg <listitem> 12159e7bcd65Smrg <para> 12169e7bcd65SmrgSpecifies the object that identifies the resource database to search 12179e7bcd65Smrg(the database is that associated with the display for this object). Must be of class Object or any subclass thereof. 12189e7bcd65Smrg </para> 12199e7bcd65Smrg </listitem> 12209e7bcd65Smrg </varlistentry> 12219e7bcd65Smrg <varlistentry> 12229e7bcd65Smrg <term> 12239e7bcd65Smrg <emphasis remap='I'>base</emphasis> 12249e7bcd65Smrg </term> 12259e7bcd65Smrg <listitem> 12269e7bcd65Smrg <para> 12279e7bcd65SmrgSpecifies the base address into which 12289e7bcd65Smrgthe resource values will be written. 12299e7bcd65Smrg </para> 12309e7bcd65Smrg </listitem> 12319e7bcd65Smrg </varlistentry> 12329e7bcd65Smrg <varlistentry> 12339e7bcd65Smrg <term> 12349e7bcd65Smrg <emphasis remap='I'>resources</emphasis> 12359e7bcd65Smrg </term> 12369e7bcd65Smrg <listitem> 12379e7bcd65Smrg <para> 12389e7bcd65SmrgSpecifies the resource list for the subpart. 12399e7bcd65Smrg </para> 12409e7bcd65Smrg </listitem> 12419e7bcd65Smrg </varlistentry> 12429e7bcd65Smrg <varlistentry> 12439e7bcd65Smrg <term> 12449e7bcd65Smrg <emphasis remap='I'>num_resources</emphasis> 12459e7bcd65Smrg </term> 12469e7bcd65Smrg <listitem> 12479e7bcd65Smrg <para> 12489e7bcd65SmrgSpecifies the number of entries in the resource list. 12499e7bcd65Smrg </para> 12509e7bcd65Smrg </listitem> 12519e7bcd65Smrg </varlistentry> 12529e7bcd65Smrg <varlistentry> 12539e7bcd65Smrg <term> 12549e7bcd65Smrg ... 12559e7bcd65Smrg </term> 12569e7bcd65Smrg <listitem> 12579e7bcd65Smrg <para> 12589e7bcd65SmrgSpecifies the variable argument list to override any other 12599e7bcd65Smrgresource specifications. 12609e7bcd65Smrg </para> 12619e7bcd65Smrg </listitem> 12629e7bcd65Smrg </varlistentry> 12639e7bcd65Smrg</variablelist> 12649e7bcd65Smrg 12659e7bcd65Smrg<para> 12669e7bcd65Smrg<xref linkend='XtVaGetApplicationResources' xrefstyle='select: title'/> 12679e7bcd65Smrgis identical in function to 12689e7bcd65Smrg<xref linkend='XtGetApplicationResources' xrefstyle='select: title'/> 12699e7bcd65Smrgwith the <emphasis remap='I'>args</emphasis> and <emphasis remap='I'>num_args</emphasis> parameters 12709e7bcd65Smrgreplaced by a varargs list, as described in Section 2.5.1. 12719e7bcd65Smrg</para> 12729e7bcd65Smrg</sect1> 12739e7bcd65Smrg 12749e7bcd65Smrg<sect1 id="Resource_Conversions"> 12759e7bcd65Smrg<title>Resource Conversions</title> 12769e7bcd65Smrg<para> 12779e7bcd65SmrgThe Intrinsics provide a mechanism for registering representation converters that 12789e7bcd65Smrgare automatically invoked by the resource-fetching routines. 12799e7bcd65SmrgThe Intrinsics additionally provide and register several commonly used converters. 12809e7bcd65SmrgThis resource conversion mechanism serves several purposes: 12819e7bcd65Smrg</para> 12829e7bcd65Smrg<itemizedlist spacing='compact'> 12839e7bcd65Smrg <listitem> 12849e7bcd65Smrg <para> 12859e7bcd65SmrgIt permits user and application resource files to contain textual 12869e7bcd65Smrgrepresentations of nontextual values. 12879e7bcd65Smrg </para> 12889e7bcd65Smrg </listitem> 12899e7bcd65Smrg <listitem> 12909e7bcd65Smrg <para> 12919e7bcd65SmrgIt allows textual or other representations of default resource values that 12929e7bcd65Smrgare dependent on the display, screen, or colormap, and thus must be 12939e7bcd65Smrgcomputed at runtime. 12949e7bcd65Smrg </para> 12959e7bcd65Smrg </listitem> 12969e7bcd65Smrg <listitem> 12979e7bcd65Smrg <para> 12989e7bcd65SmrgIt caches conversion source and result data. 12999e7bcd65SmrgConversions that require much computation or space 13009e7bcd65Smrg(for example, string-to-translation-table) 13019e7bcd65Smrgor that require round-trips to the server 13029e7bcd65Smrg(for example, string-to-font or string-to-color) are performed only once. 13039e7bcd65Smrg </para> 13049e7bcd65Smrg </listitem> 13059e7bcd65Smrg</itemizedlist> 13069e7bcd65Smrg<sect2 id="Predefined_Resource_Converters"> 13079e7bcd65Smrg<title>Predefined Resource Converters</title> 13089e7bcd65Smrg<para> 13099e7bcd65SmrgThe Intrinsics define all the representations used in the 13109e7bcd65SmrgObject, 13119e7bcd65SmrgRectObj, 13129e7bcd65SmrgCore, 13139e7bcd65SmrgComposite, 13149e7bcd65SmrgConstraint, 13159e7bcd65Smrgand 13169e7bcd65SmrgShell 13179e7bcd65Smrgwidget classes. 13189e7bcd65SmrgThe Intrinsics register the following resource converters that accept 13199e7bcd65Smrginput values of representation type 13209e7bcd65Smrg<function>XtRString</function>. 13219e7bcd65Smrg</para> 13229e7bcd65Smrg 13239e7bcd65Smrg<informaltable frame='topbot'> 13249e7bcd65Smrg <?dbfo keep-together="auto" ?> 13259e7bcd65Smrg <tgroup cols='3' align='left' rowsep='0' colsep='0'> 13269e7bcd65Smrg <colspec colwidth='0.7*' colname='c1'/> 13279e7bcd65Smrg <colspec colwidth='1.0*' colname='c2'/> 13289e7bcd65Smrg <colspec colwidth='0.6*' colname='c3'/> 13299e7bcd65Smrg <thead> 13309e7bcd65Smrg <row rowsep='1'> 13319e7bcd65Smrg <entry>Target Representation</entry> 13329e7bcd65Smrg <entry>Converter Name</entry> 13339e7bcd65Smrg <entry>Additional Args</entry> 13349e7bcd65Smrg </row> 13359e7bcd65Smrg </thead> 13369e7bcd65Smrg <tbody> 13379e7bcd65Smrg <row> 13389e7bcd65Smrg <entry><function>XtRAcceleratorTable</function></entry> 13399e7bcd65Smrg <entry><function>XtCvtStringToAcceleratorTable</function></entry> 13409e7bcd65Smrg </row> 13419e7bcd65Smrg <row> 13429e7bcd65Smrg <entry><function>XtRAtom</function></entry> 13439e7bcd65Smrg <entry><function>XtCvtStringToAtom</function></entry> 13449e7bcd65Smrg <entry>Display*</entry> 13459e7bcd65Smrg </row> 13469e7bcd65Smrg <row> 13479e7bcd65Smrg <entry><function>XtRBoolean</function></entry> 13489e7bcd65Smrg <entry><function>XtCvtStringToBoolean</function></entry> 13499e7bcd65Smrg </row> 13509e7bcd65Smrg <row> 13519e7bcd65Smrg <entry><function>XtRBool</function></entry> 13529e7bcd65Smrg <entry><function>XtCvtStringToBool</function></entry> 13539e7bcd65Smrg </row> 13549e7bcd65Smrg <row> 13559e7bcd65Smrg <entry><function>XtRCommandArgArray</function></entry> 13569e7bcd65Smrg <entry><function>XtCvtStringToCommandArgArray</function></entry> 13579e7bcd65Smrg </row> 13589e7bcd65Smrg <row> 13599e7bcd65Smrg <entry><function>XtRCursor</function></entry> 13609e7bcd65Smrg <entry><function>XtCvtStringToCursor</function></entry> 13619e7bcd65Smrg <entry>Display*</entry> 13629e7bcd65Smrg </row> 13639e7bcd65Smrg <row> 13649e7bcd65Smrg <entry><function>XtRDimension</function></entry> 13659e7bcd65Smrg <entry><function>XtCvtStringToDimension</function></entry> 13669e7bcd65Smrg </row> 13679e7bcd65Smrg <row> 13689e7bcd65Smrg <entry><function>XtRDirectoryString</function></entry> 13699e7bcd65Smrg <entry><function>XtCvtStringToDirectoryString</function></entry> 13709e7bcd65Smrg </row> 13719e7bcd65Smrg <row> 13729e7bcd65Smrg <entry><function>XtRDisplay</function></entry> 13739e7bcd65Smrg <entry><function>XtCvtStringToDisplay</function></entry> 13749e7bcd65Smrg </row> 13759e7bcd65Smrg <row> 13769e7bcd65Smrg <entry><function>XtRFile</function></entry> 13779e7bcd65Smrg <entry><function>XtCvtStringToFile</function></entry> 13789e7bcd65Smrg </row> 13799e7bcd65Smrg <row> 13809e7bcd65Smrg <entry><function>XtRFloat</function></entry> 13819e7bcd65Smrg <entry><function>XtCvtStringToFloat</function></entry> 13829e7bcd65Smrg </row> 13839e7bcd65Smrg <row> 13849e7bcd65Smrg <entry><function>XtRFont</function></entry> 13859e7bcd65Smrg <entry><function>XtCvtStringToFont</function></entry> 13869e7bcd65Smrg <entry>Display*</entry> 13879e7bcd65Smrg </row> 13889e7bcd65Smrg <row> 13899e7bcd65Smrg <entry><function>XtRFontSet</function></entry> 13909e7bcd65Smrg <entry><function>XtCvtStringToFontSet</function></entry> 13919e7bcd65Smrg <entry>Display*, String <emphasis remap='I'>locale</emphasis></entry> 13929e7bcd65Smrg </row> 13939e7bcd65Smrg <row> 13949e7bcd65Smrg <entry><function>XtRFontStruct</function></entry> 13959e7bcd65Smrg <entry><function>XtCvtStringToFontStruct</function></entry> 13969e7bcd65Smrg <entry>Display*</entry> 13979e7bcd65Smrg </row> 13989e7bcd65Smrg <row> 13999e7bcd65Smrg <entry><function>XtRGravity</function></entry> 14009e7bcd65Smrg <entry><function>XtCvtStringToGravity</function></entry> 14019e7bcd65Smrg </row> 14029e7bcd65Smrg <row> 14039e7bcd65Smrg <entry><function>XtRInitialState</function></entry> 14049e7bcd65Smrg <entry><function>XtCvtStringToInitialState</function></entry> 14059e7bcd65Smrg </row> 14069e7bcd65Smrg <row> 14079e7bcd65Smrg <entry><function>XtRInt</function></entry> 14089e7bcd65Smrg <entry><function>XtCvtStringToInt</function></entry> 14099e7bcd65Smrg </row> 14109e7bcd65Smrg <row> 14119e7bcd65Smrg <entry><function>XtRPixel</function></entry> 14129e7bcd65Smrg <entry><function>XtCvtStringToPixel</function></entry> 14139e7bcd65Smrg <entry><function>colorConvertArgs</function></entry> 14149e7bcd65Smrg </row> 14159e7bcd65Smrg <row> 14169e7bcd65Smrg <entry><function>XtRPosition</function></entry> 14179e7bcd65Smrg <entry><function>XtCvtStringToPosition</function></entry> 14189e7bcd65Smrg </row> 14199e7bcd65Smrg <row> 14209e7bcd65Smrg <entry><function>XtRRestartStyle</function></entry> 14219e7bcd65Smrg <entry><function>XtCvtStringToRestartStyle</function></entry> 14229e7bcd65Smrg </row> 14239e7bcd65Smrg <row> 14249e7bcd65Smrg <entry><function>XtRShort</function></entry> 14259e7bcd65Smrg <entry><function>XtCvtStringToShort</function></entry> 14269e7bcd65Smrg </row> 14279e7bcd65Smrg <row> 14289e7bcd65Smrg <entry><function>XtRTranslationTable</function></entry> 14299e7bcd65Smrg <entry><function>XtCvtStringToTranslationTable</function></entry> 14309e7bcd65Smrg </row> 14319e7bcd65Smrg <row> 14329e7bcd65Smrg <entry><function>XtRUnsignedChar</function></entry> 14339e7bcd65Smrg <entry><function>XtCvtStringToUnsignedChar</function></entry> 14349e7bcd65Smrg </row> 14359e7bcd65Smrg <row> 14369e7bcd65Smrg <entry><function>XtRVisual</function></entry> 14379e7bcd65Smrg <entry><function>XtCvtStringToVisual</function></entry> 14389e7bcd65Smrg <entry>Screen*, Cardinal <emphasis remap='I'>depth</emphasis></entry> 14399e7bcd65Smrg </row> 14409e7bcd65Smrg </tbody> 14419e7bcd65Smrg </tgroup> 14429e7bcd65Smrg</informaltable> 14439e7bcd65Smrg 14449e7bcd65Smrg<para> 14459e7bcd65SmrgThe String-to-Pixel conversion has two predefined constants that are 14469e7bcd65Smrgguaranteed to work and contrast with each other: 14479e7bcd65Smrg<function>XtDefaultForeground</function> 14489e7bcd65Smrgand 14499e7bcd65Smrg<function>XtDefaultBackground</function>. 14509e7bcd65SmrgThey evaluate to the black and white pixel values of the widget's screen, 14519e7bcd65Smrgrespectively. 14529e7bcd65SmrgIf the application resource reverseVideo is 14539e7bcd65Smrg<function>True</function>, 14549e7bcd65Smrgthey evaluate to the white and black pixel values of the widget's screen, 14559e7bcd65Smrgrespectively. 14569e7bcd65SmrgSimilarly, the String-to-Font and String-to-FontStruct converters recognize 14579e7bcd65Smrgthe constant 14589e7bcd65Smrg<function>XtDefaultFont</function> 14599e7bcd65Smrgand evaluate this in the following manner: 14609e7bcd65Smrg</para> 14619e7bcd65Smrg<itemizedlist spacing='compact'> 14629e7bcd65Smrg <listitem> 14639e7bcd65Smrg <para> 14649e7bcd65SmrgQuery the resource database for the resource whose full name 14659e7bcd65Smrgis ``xtDefaultFont'', class ``XtDefaultFont'' (that is, no widget 14669e7bcd65Smrgname/class prefixes), and use a type 14679e7bcd65Smrg<function>XtRString</function> 14689e7bcd65Smrgvalue returned as the font name or a type 14699e7bcd65Smrg<function>XtRFont</function> 14709e7bcd65Smrgor 14719e7bcd65Smrg<function>XtRFontStruct</function> 14729e7bcd65Smrgvalue directly as the resource value. 14739e7bcd65Smrg </para> 14749e7bcd65Smrg </listitem> 14759e7bcd65Smrg <listitem> 14769e7bcd65Smrg <para> 14779e7bcd65SmrgIf the resource database does not contain a value for xtDefaultFont, 14789e7bcd65Smrgclass XtDefaultFont, or if the returned font name cannot be 14799e7bcd65Smrgsuccessfully opened, an implementation-defined font in ISO8859-1 14809e7bcd65Smrgcharacter set encoding is opened. (One possible algorithm is to 14819e7bcd65Smrgperform an 14829e7bcd65Smrg<function>XListFonts</function> 14839e7bcd65Smrgusing a wildcard font name and use the first 14849e7bcd65Smrgfont in the list. This wildcard font name should be as broad as 14859e7bcd65Smrgpossible to maximize the probability of locating a useable font; 14869e7bcd65Smrgfor example, "-*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-1".) 14879e7bcd65Smrg </para> 14889e7bcd65Smrg </listitem> 14899e7bcd65Smrg <listitem> 14909e7bcd65Smrg <para> 14919e7bcd65SmrgIf no suitable ISO8859-1 font can be found, issue a warning message 14929e7bcd65Smrgand return 14939e7bcd65Smrg<function>False</function>. 14949e7bcd65Smrg </para> 14959e7bcd65Smrg </listitem> 14969e7bcd65Smrg</itemizedlist> 14979e7bcd65Smrg<para> 14989e7bcd65SmrgThe String-to-FontSet converter recognizes the constant 14999e7bcd65Smrg<function>XtDefaultFontSet</function> 15009e7bcd65Smrgand evaluate this in the following manner: 15019e7bcd65Smrg</para> 15029e7bcd65Smrg<itemizedlist spacing='compact'> 15039e7bcd65Smrg <listitem> 15049e7bcd65Smrg <para> 15059e7bcd65SmrgQuery the resource database for the resource whose full name 15069e7bcd65Smrgis ``xtDefaultFontSet'', class ``XtDefaultFontSet'' (that is, no widget 15079e7bcd65Smrgname/class prefixes), and use a type 15089e7bcd65Smrg<function>XtRString</function> 15099e7bcd65Smrgvalue returned as the base font name list or a type 15109e7bcd65Smrg<function>XtRFontSet</function> 15119e7bcd65Smrgvalue directly as the resource value. 15129e7bcd65Smrg </para> 15139e7bcd65Smrg </listitem> 15149e7bcd65Smrg <listitem> 15159e7bcd65Smrg <para> 15169e7bcd65SmrgIf the resource database does not contain a value for xtDefaultFontSet, 15179e7bcd65Smrgclass XtDefaultFontSet, or if a font set cannot be 15189e7bcd65Smrgsuccessfully created from this resource, 15199e7bcd65Smrgan implementation-defined font set is created. 15209e7bcd65Smrg(One possible algorithm is to 15219e7bcd65Smrgperform an 15229e7bcd65Smrg<function>XCreateFontSet</function> 15239e7bcd65Smrgusing a wildcard base font name. 15249e7bcd65SmrgThis wildcard base font name should be as broad as 15259e7bcd65Smrgpossible to maximize the probability of locating a useable font; 15269e7bcd65Smrgfor example, "-*-*-*-R-*-*-*-120-*-*-*-*".) 15279e7bcd65Smrg </para> 15289e7bcd65Smrg </listitem> 15299e7bcd65Smrg <listitem> 15309e7bcd65Smrg <para> 15319e7bcd65SmrgIf no suitable font set can be created, issue a warning message 15329e7bcd65Smrgand return 15339e7bcd65Smrg<function>False</function>. 15349e7bcd65Smrg </para> 15359e7bcd65Smrg </listitem> 15369e7bcd65Smrg</itemizedlist> 15379e7bcd65Smrg<para> 15389e7bcd65SmrgIf a font set is created but <emphasis remap='I'>missing_charset_list</emphasis> is not 15399e7bcd65Smrgempty, a warning is issued and the partial font set is returned. 15409e7bcd65SmrgThe Intrinsics register the String-to-FontSet converter with 15419e7bcd65Smrga conversion argument list that extracts the current process 15429e7bcd65Smrglocale at the time the converter is invoked. This ensures 15439e7bcd65Smrgthat the converter is invoked again if the same conversion 15449e7bcd65Smrgis required in a different locale. 15459e7bcd65Smrg</para> 15469e7bcd65Smrg 15479e7bcd65Smrg<para> 15489e7bcd65SmrgThe String-to-Gravity conversion accepts string values that are the 15499e7bcd65Smrgnames of window and bit gravities and their numerical equivalents, 15509e7bcd65Smrgas defined in <emphasis remap='I'>Xlib — C Language X Interface.</emphasis>: 15519e7bcd65Smrg<function>ForgetGravity</function>, 15529e7bcd65Smrg<function>UnmapGravity</function>, 15539e7bcd65Smrg<function>NorthWestGravity</function>, 15549e7bcd65Smrg<function>NorthGravity</function>, 15559e7bcd65Smrg<function>NorthEastGravity</function>, 15569e7bcd65Smrg<function>WestGravity</function>, 15579e7bcd65Smrg<function>CenterGravity</function>, 15589e7bcd65Smrg<function>EastGravity</function>, 15599e7bcd65Smrg<function>SouthWestGravity</function>, 15609e7bcd65Smrg<function>SouthGravity</function>, 15619e7bcd65Smrg<function>SouthEastGravity</function>, 15629e7bcd65Smrgand 15639e7bcd65Smrg<function>StaticGravity</function>. 15649e7bcd65SmrgAlphabetic case is not significant in the conversion. 15659e7bcd65Smrg</para> 15669e7bcd65Smrg 15679e7bcd65Smrg<para> 15689e7bcd65SmrgThe String-to-CommandArgArray conversion parses a String into an 15699e7bcd65Smrgarray of strings. 15709e7bcd65SmrgWhite space characters separate elements of the command line. 15719e7bcd65SmrgThe converter recognizes the backslash character ``\\'' as an escape 15729e7bcd65Smrgcharacter to allow the following white space character to be part of the 15739e7bcd65Smrgarray element. 15749e7bcd65Smrg</para> 15759e7bcd65Smrg 15769e7bcd65Smrg<para> 15779e7bcd65SmrgThe String-to-DirectoryString conversion recognizes the 15789e7bcd65Smrgstring ``XtCurrentDirectory'' and returns the result of a call 15799e7bcd65Smrgto the operating system to get the current directory. 15809e7bcd65Smrg</para> 15819e7bcd65Smrg 15829e7bcd65Smrg<para> 15839e7bcd65SmrgThe String-to-RestartStyle conversion accepts the values 15849e7bcd65Smrg<function>RestartIfRunning</function>, 15859e7bcd65Smrg<function>RestartAnyway</function>, 15869e7bcd65Smrg<function>RestartImmediately</function>, 15879e7bcd65Smrgand 15889e7bcd65Smrg<function>RestartNever</function> 15899e7bcd65Smrgas defined by the <emphasis remap='I'>X Session Management Protocol</emphasis>. 15909e7bcd65Smrg</para> 15919e7bcd65Smrg 15929e7bcd65Smrg<para> 15939e7bcd65SmrgThe String-to-InitialState conversion accepts the values 15949e7bcd65Smrg<function>NormalState</function> 15959e7bcd65Smrgor 15969e7bcd65Smrg<function>IconicState</function> 15979e7bcd65Smrgas defined by the <emphasis remap='I'>Inter-Client Communication Conventions Manual.</emphasis>. 15989e7bcd65Smrg</para> 15999e7bcd65Smrg 16009e7bcd65Smrg<para> 16019e7bcd65SmrgThe String-to-Visual conversion calls 16029e7bcd65Smrg<function>XMatchVisualInfo</function> 16039e7bcd65Smrgusing the 16049e7bcd65Smrg<emphasis remap='I'>screen</emphasis> and <emphasis remap='I'>depth</emphasis> fields from the core part and returns the first 16059e7bcd65Smrgmatching Visual on the list. The widget resource list must be certain 16069e7bcd65Smrgto specify any resource of type 16079e7bcd65Smrg<function>XtRVisual</function> 16089e7bcd65Smrgafter the depth resource. 16099e7bcd65SmrgThe allowed string values are the visual class names defined in <emphasis remap='I'>X Window System Protocol</emphasis>, 16109e7bcd65SmrgSection 8; 16119e7bcd65Smrg<function>StaticGray</function>, 16129e7bcd65Smrg<function>StaticColor</function>, 16139e7bcd65Smrg<function>TrueColor</function>, 16149e7bcd65Smrg<function>GrayScale</function>, 16159e7bcd65Smrg<function>PseudoColor</function>, 16169e7bcd65Smrgand 16179e7bcd65Smrg<function>DirectColor</function>. 16189e7bcd65Smrg</para> 16199e7bcd65Smrg 16209e7bcd65Smrg<para> 16219e7bcd65SmrgThe Intrinsics register the following resource converter that accepts 16229e7bcd65Smrgan input value of representation type 16239e7bcd65Smrg<function>XtRColor</function>. 16249e7bcd65Smrg</para> 16259e7bcd65Smrg 16269e7bcd65Smrg<informaltable frame='topbot'> 16279e7bcd65Smrg <?dbfo keep-together="auto" ?> 16289e7bcd65Smrg <tgroup cols='3' align='left' rowsep='0' colsep='0'> 16299e7bcd65Smrg <colspec colwidth='1.0*' colname='c1'/> 16309e7bcd65Smrg <colspec colwidth='1.0*' colname='c2'/> 16319e7bcd65Smrg <colspec colwidth='1.0*' colname='c3'/> 16329e7bcd65Smrg <thead> 16339e7bcd65Smrg <row rowsep='1'> 16349e7bcd65Smrg <entry>Target Representation</entry> 16359e7bcd65Smrg <entry>Converter Name</entry> 16369e7bcd65Smrg <entry>Additional Args</entry> 16379e7bcd65Smrg </row> 16389e7bcd65Smrg </thead> 16399e7bcd65Smrg <tbody> 16409e7bcd65Smrg <row> 16419e7bcd65Smrg <entry><function>XtRPixel</function></entry> 16429e7bcd65Smrg <entry><function>XtCvtColorToPixel</function></entry> 16439e7bcd65Smrg </row> 16449e7bcd65Smrg </tbody> 16459e7bcd65Smrg </tgroup> 16469e7bcd65Smrg</informaltable> 16479e7bcd65Smrg 16489e7bcd65Smrg<para> 16499e7bcd65SmrgThe Intrinsics register the following resource converters that accept 16509e7bcd65Smrginput values of representation type 16519e7bcd65Smrg<function>XtRInt</function>. 16529e7bcd65Smrg</para> 16539e7bcd65Smrg 16549e7bcd65Smrg<informaltable frame='topbot'> 16559e7bcd65Smrg <?dbfo keep-together="auto" ?> 16569e7bcd65Smrg <tgroup cols='3' align='left' rowsep='0' colsep='0'> 16579e7bcd65Smrg <colspec colwidth='1.0*' colname='c1'/> 16589e7bcd65Smrg <colspec colwidth='1.0*' colname='c2'/> 16599e7bcd65Smrg <colspec colwidth='1.0*' colname='c3'/> 16609e7bcd65Smrg <thead> 16619e7bcd65Smrg <row rowsep='1'> 16629e7bcd65Smrg <entry>Target Representation</entry> 16639e7bcd65Smrg <entry>Converter Name</entry> 16649e7bcd65Smrg <entry>Additional Args</entry> 16659e7bcd65Smrg </row> 16669e7bcd65Smrg </thead> 16679e7bcd65Smrg <tbody> 16689e7bcd65Smrg <row> 16699e7bcd65Smrg <entry><function>XtRBoolean</function></entry> 16709e7bcd65Smrg <entry><function>XtCvtIntToBoolean</function></entry> 16719e7bcd65Smrg </row> 16729e7bcd65Smrg <row> 16739e7bcd65Smrg <entry><function>XtRBool</function></entry> 16749e7bcd65Smrg <entry><function>XtCvtIntToBool</function></entry> 16759e7bcd65Smrg </row> 16769e7bcd65Smrg <row> 16779e7bcd65Smrg <entry><function>XtRColor</function></entry> 16789e7bcd65Smrg <entry><function>XtCvtIntToColor</function></entry> 16799e7bcd65Smrg <entry><function>colorConvertArgs</function></entry> 16809e7bcd65Smrg </row> 16819e7bcd65Smrg <row> 16829e7bcd65Smrg <entry><function>XtRDimension</function></entry> 16839e7bcd65Smrg <entry><function>XtCvtIntToDimension</function></entry> 16849e7bcd65Smrg </row> 16859e7bcd65Smrg <row> 16869e7bcd65Smrg <entry><function>XtRFloat</function></entry> 16879e7bcd65Smrg <entry><function>XtCvtIntToFloat</function></entry> 16889e7bcd65Smrg </row> 16899e7bcd65Smrg <row> 16909e7bcd65Smrg <entry><function>XtRFont</function></entry> 16919e7bcd65Smrg <entry><function>XtCvtIntToFont</function></entry> 16929e7bcd65Smrg </row> 16939e7bcd65Smrg <row> 16949e7bcd65Smrg <entry><function>XtRPixel</function></entry> 16959e7bcd65Smrg <entry><function>XtCvtIntToPixel</function></entry> 16969e7bcd65Smrg </row> 16979e7bcd65Smrg <row> 16989e7bcd65Smrg <entry><function>XtRPixmap</function></entry> 16999e7bcd65Smrg <entry><function>XtCvtIntToPixmap</function></entry> 17009e7bcd65Smrg </row> 17019e7bcd65Smrg <row> 17029e7bcd65Smrg <entry><function>XtRPosition</function></entry> 17039e7bcd65Smrg <entry><function>XtCvtIntToPosition</function></entry> 17049e7bcd65Smrg </row> 17059e7bcd65Smrg <row> 17069e7bcd65Smrg <entry><function>XtRShort</function></entry> 17079e7bcd65Smrg <entry><function>XtCvtIntToShort</function></entry> 17089e7bcd65Smrg </row> 17099e7bcd65Smrg <row> 17109e7bcd65Smrg <entry><function>XtRUnsignedChar</function></entry> 17119e7bcd65Smrg <entry><function>XtCvtIntToUnsignedChar</function></entry> 17129e7bcd65Smrg </row> 17139e7bcd65Smrg </tbody> 17149e7bcd65Smrg </tgroup> 17159e7bcd65Smrg</informaltable> 17169e7bcd65Smrg 17179e7bcd65Smrg<para> 17189e7bcd65SmrgThe Intrinsics register the following resource converter that accepts 17199e7bcd65Smrgan input value of representation type 17209e7bcd65Smrg<function>XtRPixel</function>. 17219e7bcd65Smrg</para> 17229e7bcd65Smrg 17239e7bcd65Smrg<informaltable frame='topbot'> 17249e7bcd65Smrg <?dbfo keep-together="auto" ?> 17259e7bcd65Smrg <tgroup cols='3' align='left' rowsep='0' colsep='0'> 17269e7bcd65Smrg <colspec colwidth='1.0*' colname='c1'/> 17279e7bcd65Smrg <colspec colwidth='1.0*' colname='c2'/> 17289e7bcd65Smrg <colspec colwidth='1.0*' colname='c3'/> 17299e7bcd65Smrg <thead> 17309e7bcd65Smrg <row rowsep='1'> 17319e7bcd65Smrg <entry>Target Representation</entry> 17329e7bcd65Smrg <entry>Converter Name</entry> 17339e7bcd65Smrg <entry>Additional Args</entry> 17349e7bcd65Smrg </row> 17359e7bcd65Smrg </thead> 17369e7bcd65Smrg <tbody> 17379e7bcd65Smrg <row> 17389e7bcd65Smrg <entry><function>XtRColor</function></entry> 17399e7bcd65Smrg <entry><function>XtCvtPixelToColor</function></entry> 17409e7bcd65Smrg </row> 17419e7bcd65Smrg </tbody> 17429e7bcd65Smrg </tgroup> 17439e7bcd65Smrg</informaltable> 17449e7bcd65Smrg</sect2> 17459e7bcd65Smrg 17469e7bcd65Smrg<sect2 id="New_Resource_Converters"> 17479e7bcd65Smrg<title>New Resource Converters</title> 17489e7bcd65Smrg<para> 17499e7bcd65SmrgType converters use pointers to 17509e7bcd65Smrg<function>XrmValue</function> 17519e7bcd65Smrgstructures (defined in 17529e7bcd65Smrg<function><X11/Xresource.h>;</function> 17539e7bcd65Smrgsee <olink targetdoc='libX11' targetptr='Creating_and_Storing_Databases'>Section 15.4</olink> in 17549e7bcd65Smrg<olink targetdoc='libX11' targetptr='libX11'>Xlib — C Language X Interface.</olink>) 17559e7bcd65Smrgfor input and output values. 17569e7bcd65Smrg</para> 17579e7bcd65Smrg<literallayout > 17589e7bcd65Smrgtypedef struct { 17599e7bcd65Smrg unsigned int size; 17609e7bcd65Smrg XPointer addr; 17619e7bcd65Smrg} XrmValue, *XrmValuePtr; 17629e7bcd65Smrg</literallayout> 17639e7bcd65Smrg<para> 17649e7bcd65SmrgThe <emphasis remap='I'>addr</emphasis> field specifies the address of the data, and the <emphasis remap='I'>size</emphasis> 17659e7bcd65Smrgfield gives the total number of significant bytes in the data. 17669e7bcd65SmrgFor values of type 17679e7bcd65Smrg<function>String</function>, 17689e7bcd65Smrg<emphasis remap='I'>addr</emphasis> is the address of the first character and <emphasis remap='I'>size</emphasis> 17699e7bcd65Smrgincludes the NULL-terminating byte. 17709e7bcd65Smrg</para> 17719e7bcd65Smrg 17729e7bcd65Smrg<para> 17739e7bcd65SmrgA resource converter procedure pointer is of type 17749e7bcd65Smrg<xref linkend='XtTypeConverter' xrefstyle='select: title'/>. 17759e7bcd65Smrg</para> 17769e7bcd65Smrg 17779e7bcd65Smrg<funcsynopsis id='XtTypeConverter'> 17789e7bcd65Smrg<funcprototype> 17799e7bcd65Smrg<funcdef>typedef Boolean <function>(*XtTypeConverter)</function></funcdef> 17809e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 17819e7bcd65Smrg <paramdef>XrmValue *<parameter>args</parameter></paramdef> 17829e7bcd65Smrg <paramdef>Cardinal *<parameter>num_args</parameter></paramdef> 17839e7bcd65Smrg <paramdef>XrmValue *<parameter>from</parameter></paramdef> 17849e7bcd65Smrg <paramdef>XrmValue *<parameter>to</parameter></paramdef> 17859e7bcd65Smrg <paramdef>XtPointer *<parameter>converter_data</parameter></paramdef> 17869e7bcd65Smrg</funcprototype> 17879e7bcd65Smrg</funcsynopsis> 17889e7bcd65Smrg 17899e7bcd65Smrg<variablelist> 17909e7bcd65Smrg <varlistentry> 17919e7bcd65Smrg <term> 17929e7bcd65Smrg <emphasis remap='I'>display</emphasis> 17939e7bcd65Smrg </term> 17949e7bcd65Smrg <listitem> 17959e7bcd65Smrg <para> 17969e7bcd65SmrgSpecifies the display connection with which this conversion is associated. 17979e7bcd65Smrg </para> 17989e7bcd65Smrg </listitem> 17999e7bcd65Smrg </varlistentry> 18009e7bcd65Smrg <varlistentry> 18019e7bcd65Smrg <term> 18029e7bcd65Smrg <emphasis remap='I'>args</emphasis> 18039e7bcd65Smrg </term> 18049e7bcd65Smrg <listitem> 18059e7bcd65Smrg <para> 18069e7bcd65SmrgSpecifies a list of additional 18079e7bcd65Smrg<function>XrmValue</function> 18089e7bcd65Smrgarguments to the converter if additional context is needed 18099e7bcd65Smrgto perform the conversion, or NULL. 18109e7bcd65SmrgFor example, the String-to-Font converter needs the widget's <emphasis remap='I'>display</emphasis>, 18119e7bcd65Smrgand the String-to-Pixel converter needs the widget's <emphasis remap='I'>screen</emphasis> and <emphasis remap='I'>colormap</emphasis>. 18129e7bcd65Smrg </para> 18139e7bcd65Smrg </listitem> 18149e7bcd65Smrg </varlistentry> 18159e7bcd65Smrg <varlistentry> 18169e7bcd65Smrg <term> 18179e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 18189e7bcd65Smrg </term> 18199e7bcd65Smrg <listitem> 18209e7bcd65Smrg <para> 18219e7bcd65SmrgSpecifies the number of entries in <emphasis remap='I'>args</emphasis>. 18229e7bcd65Smrg </para> 18239e7bcd65Smrg </listitem> 18249e7bcd65Smrg </varlistentry> 18259e7bcd65Smrg <varlistentry> 18269e7bcd65Smrg <term> 18279e7bcd65Smrg <emphasis remap='I'>from</emphasis> 18289e7bcd65Smrg </term> 18299e7bcd65Smrg <listitem> 18309e7bcd65Smrg <para> 18319e7bcd65SmrgSpecifies the value to convert. 18329e7bcd65Smrg </para> 18339e7bcd65Smrg </listitem> 18349e7bcd65Smrg </varlistentry> 18359e7bcd65Smrg <varlistentry> 18369e7bcd65Smrg <term> 18379e7bcd65Smrg <emphasis remap='I'>to</emphasis> 18389e7bcd65Smrg </term> 18399e7bcd65Smrg <listitem> 18409e7bcd65Smrg <para> 18419e7bcd65SmrgSpecifies a descriptor for a location into which to store the converted value. 18429e7bcd65Smrg </para> 18439e7bcd65Smrg </listitem> 18449e7bcd65Smrg </varlistentry> 18459e7bcd65Smrg <varlistentry> 18469e7bcd65Smrg <term> 18479e7bcd65Smrg <emphasis remap='I'>converter_data</emphasis> 18489e7bcd65Smrg </term> 18499e7bcd65Smrg <listitem> 18509e7bcd65Smrg <para> 18519e7bcd65SmrgSpecifies a location into which the converter may 18529e7bcd65Smrgstore converter-specific data associated 18539e7bcd65Smrgwith this conversion. 18549e7bcd65Smrg </para> 18559e7bcd65Smrg </listitem> 18569e7bcd65Smrg </varlistentry> 18579e7bcd65Smrg</variablelist> 18589e7bcd65Smrg 18599e7bcd65Smrg<para> 18609e7bcd65SmrgThe <emphasis remap='I'>display</emphasis> argument is normally used only when generating error 18619e7bcd65Smrgmessages, to identify the application context (with the function 18629e7bcd65Smrg<function>XtDisplayToApplicationContext ).</function> 18639e7bcd65Smrg</para> 18649e7bcd65Smrg 18659e7bcd65Smrg<para> 18669e7bcd65SmrgThe <emphasis remap='I'>to</emphasis> argument specifies the size and location into which the 18679e7bcd65Smrgconverter should store the converted value. If the <emphasis remap='I'>addr</emphasis> field is NULL, 18689e7bcd65Smrgthe converter should allocate appropriate storage and store the size 18699e7bcd65Smrgand location into the <emphasis remap='I'>to</emphasis> descriptor. If the type converter allocates 18709e7bcd65Smrgthe storage, it remains under the ownership of the converter and must 18719e7bcd65Smrgnot be modified by the caller. The type converter is permitted to use 18729e7bcd65Smrgstatic storage for this purpose, and therefore the caller must 18739e7bcd65Smrgimmediately copy the data upon return from the converter. If the 18749e7bcd65Smrg<emphasis remap='I'>addr</emphasis> field is not NULL, the converter must check the <emphasis remap='I'>size</emphasis> field to 18759e7bcd65Smrgensure that sufficient space has been allocated before storing the 18769e7bcd65Smrgconverted value. If insufficient space is specified, the converter 18779e7bcd65Smrgshould update the <emphasis remap='I'>size</emphasis> field with the number of bytes required and 18789e7bcd65Smrgreturn 18799e7bcd65Smrg<function>False</function> 18809e7bcd65Smrgwithout modifying the data at the specified location. 18819e7bcd65SmrgIf sufficient space was allocated by the caller, the converter should 18829e7bcd65Smrgupdate the <emphasis remap='I'>size</emphasis> field with the number of bytes actually occupied by the 18839e7bcd65Smrgconverted value. For converted values of type 18849e7bcd65Smrg<function>XtRString</function>, 18859e7bcd65Smrgthe size should 18869e7bcd65Smrginclude the NULL-terminating byte, if any. 18879e7bcd65SmrgThe converter may store any value in the location specified 18889e7bcd65Smrgin <emphasis remap='I'>converter_data</emphasis>; this value will be passed to the destructor, if any, 18899e7bcd65Smrgwhen the resource is freed by the Intrinsics. 18909e7bcd65Smrg</para> 18919e7bcd65Smrg 18929e7bcd65Smrg<para> 18939e7bcd65SmrgThe converter must return 18949e7bcd65Smrg<function>True</function> 18959e7bcd65Smrgif the conversion was successful and 18969e7bcd65Smrg<function>False</function> 18979e7bcd65Smrgotherwise. If the conversion cannot be performed because of an 18989e7bcd65Smrgimproper source value, a warning message should also be issued with 18999e7bcd65Smrg<xref linkend='XtAppWarningMsg' xrefstyle='select: title'/>. 19009e7bcd65Smrg</para> 19019e7bcd65Smrg 19029e7bcd65Smrg<para> 19039e7bcd65SmrgMost type converters just take the data described by the specified <emphasis remap='I'>from</emphasis> 19049e7bcd65Smrgargument and return data by writing into the location specified in 19059e7bcd65Smrgthe <emphasis remap='I'>to</emphasis> argument. 19069e7bcd65SmrgA few need other information, which is available in <emphasis remap='I'>args</emphasis>. 19079e7bcd65SmrgA type converter can invoke another type converter, 19089e7bcd65Smrgwhich allows differing sources that may convert into a common intermediate 19099e7bcd65Smrgresult to make maximum use of the type converter cache. 19109e7bcd65Smrg</para> 19119e7bcd65Smrg 19129e7bcd65Smrg<para> 19139e7bcd65SmrgNote that if an address is written into <emphasis remap='I'>to->addr</emphasis>, it cannot be that 19149e7bcd65Smrgof a local variable of the converter because the data will not be 19159e7bcd65Smrgvalid after the converter returns. Static variables may be used, 19169e7bcd65Smrgas in the following example. 19179e7bcd65SmrgIf the converter modifies the resource database, 19189e7bcd65Smrgthe changes affect any in-progress widget creation, 19199e7bcd65Smrg<xref linkend='XtGetApplicationResources' xrefstyle='select: title'/>, 19209e7bcd65Smrgor 19219e7bcd65Smrg<xref linkend='XtGetSubresources' xrefstyle='select: title'/> 19229e7bcd65Smrgin an implementation-defined manner; however, insertion of new entries 19239e7bcd65Smrgor changes to existing entries is allowed and will not directly cause 19249e7bcd65Smrgan error. 19259e7bcd65Smrg</para> 19269e7bcd65Smrg 19279e7bcd65Smrg<para> 19289e7bcd65SmrgThe following is an example of a converter that takes a 19299e7bcd65Smrg<function>string</function> 19309e7bcd65Smrgand converts it to a 19319e7bcd65Smrg<function>Pixel</function>. 19329e7bcd65SmrgNote that the <emphasis remap='I'>display</emphasis> parameter is 19339e7bcd65Smrgused only to generate error messages; the 19349e7bcd65Smrg<function>Screen</function> 19359e7bcd65Smrgconversion argument is 19369e7bcd65Smrgstill required to inform the Intrinsics that the converted value is 19379e7bcd65Smrga function of the particular display (and colormap). 19389e7bcd65Smrg</para> 19399e7bcd65Smrg 19409e7bcd65Smrg<literallayout > 19419e7bcd65Smrg#define done(type, value) \\ 19429e7bcd65Smrg { \\ 19439e7bcd65Smrg if (toVal->addr != NULL) { \\ 19449e7bcd65Smrg if (toVal->size < sizeof(type)) { \\ 19459e7bcd65Smrg toVal->size = sizeof(type); \\ 19469e7bcd65Smrg return False; \\ 19479e7bcd65Smrg } \\ 19489e7bcd65Smrg *(type*)(toVal->addr) = (value); \\ 19499e7bcd65Smrg } \\ 19509e7bcd65Smrg else { \\ 19519e7bcd65Smrg static type static_val; \\ 19529e7bcd65Smrg static_val = (value); \\ 19539e7bcd65Smrg toVal->addr = (XPointer)&static_val; \\ 19549e7bcd65Smrg } \\ 19559e7bcd65Smrg toVal->size = sizeof(type); \\ 19569e7bcd65Smrg return True; \\ 19579e7bcd65Smrg } 19589e7bcd65Smrgstatic Boolean CvtStringToPixel(dpy, args, num_args, fromVal, toVal, converter_data) 19599e7bcd65Smrg Display *dpy; 19609e7bcd65Smrg XrmValue *args; 19619e7bcd65Smrg Cardinal *num_args; 19629e7bcd65Smrg XrmValue *fromVal; 19639e7bcd65Smrg XrmValue *toVal; 19649e7bcd65Smrg XtPointer *converter_data; 19659e7bcd65Smrg{ 19669e7bcd65Smrg static XColor screenColor; 19679e7bcd65Smrg XColor exactColor; 19689e7bcd65Smrg Screen *screen; 19699e7bcd65Smrg Colormap colormap; 19709e7bcd65Smrg Status status; 19719e7bcd65Smrg if (*num_args != 2) 19729e7bcd65Smrg XtAppWarningMsg(XtDisplayToApplicationContext(dpy), 19739e7bcd65Smrg "wrongParameters", "cvtStringToPixel", "XtToolkitError", 19749e7bcd65Smrg "String to pixel conversion needs screen and colormap arguments", 19759e7bcd65Smrg (String *)NULL, (Cardinal *)NULL); 19769e7bcd65Smrg screen = *((Screen**) args[0].addr); 19779e7bcd65Smrg colormap = *((Colormap *) args[1].addr); 19789e7bcd65Smrg if (CompareISOLatin1(str, XtDefaultBackground) == 0) { 19799e7bcd65Smrg *closure_ret = False; 19809e7bcd65Smrg done(Pixel, WhitePixelOfScreen(screen)); 19819e7bcd65Smrg } 19829e7bcd65Smrg if (CompareISOLatin1(str, XtDefaultForeground) == 0) { 19839e7bcd65Smrg *closure_ret = False; 19849e7bcd65Smrg done(Pixel, BlackPixelOfScreen(screen)); 19859e7bcd65Smrg } 19869e7bcd65Smrg status = XAllocNamedColor(DisplayOfScreen(screen), colormap, (char*)fromVal->addr, 19879e7bcd65Smrg &screenColor, &exactColor); 19889e7bcd65Smrg if (status == 0) { 19899e7bcd65Smrg String params[1]; 19909e7bcd65Smrg Cardinal num_params = 1; 19919e7bcd65Smrg params[0] = (String)fromVal->addr; 19929e7bcd65Smrg XtAppWarningMsg(XtDisplayToApplicationContext(dpy), 19939e7bcd65Smrg "noColormap", "cvtStringToPixel", "XtToolkitError", 19949e7bcd65Smrg "Cannot allocate colormap entry for \\"%s\\"", params,\ 19959e7bcd65Smrg &num_params); 19969e7bcd65Smrg *converter_data = (char *) False; 19979e7bcd65Smrg return False; 19989e7bcd65Smrg } else { 19999e7bcd65Smrg *converter_data = (char *) True; 20009e7bcd65Smrg done(Pixel, &screenColor.pixel); 20019e7bcd65Smrg } 20029e7bcd65Smrg} 20039e7bcd65Smrg</literallayout> 20049e7bcd65Smrg 20059e7bcd65Smrg<para> 20069e7bcd65SmrgAll type converters should define some set of conversion values for which they 20079e7bcd65Smrgare guaranteed to succeed so these can be used in the resource defaults. 20089e7bcd65SmrgThis issue arises only with conversions, such as fonts and colors, 20099e7bcd65Smrgwhere there is no string representation that all server implementations 20109e7bcd65Smrgwill necessarily recognize. 20119e7bcd65SmrgFor resources like these, 20129e7bcd65Smrgthe converter should define a symbolic constant 20139e7bcd65Smrgin the same manner as 20149e7bcd65Smrg<function>XtDefaultForeground</function>, 20159e7bcd65Smrg<function>XtDefaultBackground</function>, 20169e7bcd65Smrgand 20179e7bcd65Smrg<function>XtDefaultFont</function>. 20189e7bcd65Smrg</para> 20199e7bcd65Smrg 20209e7bcd65Smrg<para> 20219e7bcd65SmrgTo allow the Intrinsics to deallocate resources produced by type 20229e7bcd65Smrgconverters, a resource destructor procedure may also be provided. 20239e7bcd65Smrg</para> 20249e7bcd65Smrg 20259e7bcd65Smrg<para> 20269e7bcd65SmrgA resource destructor procedure pointer is of type 20279e7bcd65Smrg<xref linkend='XtDestructor' xrefstyle='select: title'/>. 20289e7bcd65Smrg</para> 20299e7bcd65Smrg 20309e7bcd65Smrg<funcsynopsis id='XtDestructor'> 20319e7bcd65Smrg<funcprototype> 20329e7bcd65Smrg <funcdef>typedef void <function>(*XtDestructor)</function></funcdef> 20339e7bcd65Smrg <paramdef>XtAppContext <parameter>app</parameter></paramdef> 20349e7bcd65Smrg <paramdef>XrmValue *<parameter>to</parameter></paramdef> 20359e7bcd65Smrg <paramdef>XtPointer <parameter>converter_data</parameter></paramdef> 20369e7bcd65Smrg <paramdef>XrmValue *<parameter>args</parameter></paramdef> 20379e7bcd65Smrg <paramdef>Cardinal *<parameter>num_args</parameter></paramdef> 20389e7bcd65Smrg</funcprototype> 20399e7bcd65Smrg</funcsynopsis> 20409e7bcd65Smrg 20419e7bcd65Smrg<variablelist> 20429e7bcd65Smrg <varlistentry> 20439e7bcd65Smrg <term> 20449e7bcd65Smrg <emphasis remap='I'>app</emphasis> 20459e7bcd65Smrg </term> 20469e7bcd65Smrg <listitem> 20479e7bcd65Smrg <para> 20489e7bcd65SmrgSpecifies an application context in which the resource is being freed. 20499e7bcd65Smrg </para> 20509e7bcd65Smrg </listitem> 20519e7bcd65Smrg </varlistentry> 20529e7bcd65Smrg <varlistentry> 20539e7bcd65Smrg <term> 20549e7bcd65Smrg <emphasis remap='I'>to</emphasis> 20559e7bcd65Smrg </term> 20569e7bcd65Smrg <listitem> 20579e7bcd65Smrg <para> 20589e7bcd65SmrgSpecifies a descriptor for the resource produced by the type converter. 20599e7bcd65Smrg </para> 20609e7bcd65Smrg </listitem> 20619e7bcd65Smrg </varlistentry> 20629e7bcd65Smrg <varlistentry> 20639e7bcd65Smrg <term> 20649e7bcd65Smrg <emphasis remap='I'>converter_data</emphasis> 20659e7bcd65Smrg </term> 20669e7bcd65Smrg <listitem> 20679e7bcd65Smrg <para> 20689e7bcd65SmrgSpecifies the converter-specific data returned by the type converter. 20699e7bcd65Smrg </para> 20709e7bcd65Smrg </listitem> 20719e7bcd65Smrg </varlistentry> 20729e7bcd65Smrg <varlistentry> 20739e7bcd65Smrg <term> 20749e7bcd65Smrg <emphasis remap='I'>args</emphasis> 20759e7bcd65Smrg </term> 20769e7bcd65Smrg <listitem> 20779e7bcd65Smrg <para> 20789e7bcd65SmrgSpecifies the additional converter arguments as passed 20799e7bcd65Smrgto the type converter when the conversion was performed. 20809e7bcd65Smrg </para> 20819e7bcd65Smrg </listitem> 20829e7bcd65Smrg </varlistentry> 20839e7bcd65Smrg <varlistentry> 20849e7bcd65Smrg <term> 20859e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 20869e7bcd65Smrg </term> 20879e7bcd65Smrg <listitem> 20889e7bcd65Smrg <para> 20899e7bcd65SmrgSpecifies the number of entries in <emphasis remap='I'>args</emphasis>. 20909e7bcd65Smrg </para> 20919e7bcd65Smrg </listitem> 20929e7bcd65Smrg </varlistentry> 20939e7bcd65Smrg</variablelist> 20949e7bcd65Smrg 20959e7bcd65Smrg<para> 20969e7bcd65SmrgThe destructor procedure is responsible for freeing the resource 20979e7bcd65Smrgspecified by the <emphasis remap='I'>to</emphasis> argument, including any auxiliary storage 20989e7bcd65Smrgassociated with that resource, but not the memory directly addressed 20999e7bcd65Smrgby the size and location in the <emphasis remap='I'>to</emphasis> argument or the memory specified 21009e7bcd65Smrgby <emphasis remap='I'>args</emphasis>. 21019e7bcd65Smrg</para> 21029e7bcd65Smrg</sect2> 21039e7bcd65Smrg 21049e7bcd65Smrg<sect2 id="Issuing_Conversion_Warnings"> 21059e7bcd65Smrg<title>Issuing Conversion Warnings</title> 21069e7bcd65Smrg<para> 21079e7bcd65SmrgThe 21089e7bcd65Smrg<xref linkend='XtDisplayStringConversionWarning' xrefstyle='select: title'/> 21099e7bcd65Smrgprocedure is a convenience routine for resource type converters 21109e7bcd65Smrgthat convert from string values. 21119e7bcd65Smrg</para> 21129e7bcd65Smrg 21139e7bcd65Smrg<funcsynopsis id='XtDisplayStringConversionWarning'> 21149e7bcd65Smrg<funcprototype> 21159e7bcd65Smrg<funcdef>void <function>XtDisplayStringConversionWarning</function></funcdef> 21169e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 21179e7bcd65Smrg <paramdef>String <parameter>from_value</parameter></paramdef> 21189e7bcd65Smrg</funcprototype> 21199e7bcd65Smrg</funcsynopsis> 21209e7bcd65Smrg 21219e7bcd65Smrg<variablelist> 21229e7bcd65Smrg <varlistentry> 21239e7bcd65Smrg <term> 21249e7bcd65Smrg <emphasis remap='I'>display</emphasis> 21259e7bcd65Smrg </term> 21269e7bcd65Smrg <listitem> 21279e7bcd65Smrg <para> 21289e7bcd65SmrgSpecifies the display connection with which the conversion is associated. 21299e7bcd65Smrg </para> 21309e7bcd65Smrg </listitem> 21319e7bcd65Smrg </varlistentry> 21329e7bcd65Smrg <varlistentry> 21339e7bcd65Smrg <term> 21349e7bcd65Smrg <emphasis remap='I'>from_value</emphasis> 21359e7bcd65Smrg </term> 21369e7bcd65Smrg <listitem> 21379e7bcd65Smrg <para> 21389e7bcd65SmrgSpecifies the string that could not be converted. 21399e7bcd65Smrg </para> 21409e7bcd65Smrg </listitem> 21419e7bcd65Smrg </varlistentry> 21429e7bcd65Smrg <varlistentry> 21439e7bcd65Smrg <term> 21449e7bcd65Smrg <emphasis remap='I'>to_type</emphasis> 21459e7bcd65Smrg </term> 21469e7bcd65Smrg <listitem> 21479e7bcd65Smrg <para> 21489e7bcd65SmrgSpecifies the target representation type requested. 21499e7bcd65Smrg </para> 21509e7bcd65Smrg </listitem> 21519e7bcd65Smrg </varlistentry> 21529e7bcd65Smrg</variablelist> 21539e7bcd65Smrg 21549e7bcd65Smrg<para> 21559e7bcd65SmrgThe 21569e7bcd65Smrg<xref linkend='XtDisplayStringConversionWarning' xrefstyle='select: title'/> 21579e7bcd65Smrgprocedure issues a warning message using 21589e7bcd65Smrg<xref linkend='XtAppWarningMsg' xrefstyle='select: title'/> 21599e7bcd65Smrgwith <emphasis remap='I'>name</emphasis> ``conversionError'', 21609e7bcd65Smrg<emphasis remap='I'>type</emphasis> ``string'', <emphasis remap='I'>class</emphasis> ``XtToolkitError'', and the default message 21619e7bcd65Smrg``Cannot convert "<emphasis remap='I'>from_value</emphasis>" to type <emphasis remap='I'>to_type</emphasis>''. 21629e7bcd65Smrg</para> 21639e7bcd65Smrg 21649e7bcd65Smrg<para> 21659e7bcd65SmrgTo issue other types of warning or error messages, the type converter 21669e7bcd65Smrgshould use 21679e7bcd65Smrg<xref linkend='XtAppWarningMsg' xrefstyle='select: title'/> 21689e7bcd65Smrgor 21699e7bcd65Smrg<xref linkend='XtAppErrorMsg' xrefstyle='select: title'/>. 21709e7bcd65Smrg</para> 21719e7bcd65Smrg 21729e7bcd65Smrg<para> 21739e7bcd65SmrgTo retrieve the application context associated with a given 21749e7bcd65Smrgdisplay connection, use 21759e7bcd65Smrg<xref linkend='XtDisplayToApplicationContext' xrefstyle='select: title'/>. 21769e7bcd65Smrg</para> 21779e7bcd65Smrg 21789e7bcd65Smrg<funcsynopsis id='XtDisplayToApplicationContext'> 21799e7bcd65Smrg<funcprototype> 21809e7bcd65Smrg<funcdef>XtAppContext <function>XtDisplayToApplicationContext</function></funcdef> 21819e7bcd65Smrg <paramdef>Display *<parameter>display</parameter></paramdef> 21829e7bcd65Smrg</funcprototype> 21839e7bcd65Smrg</funcsynopsis> 21849e7bcd65Smrg 21859e7bcd65Smrg<variablelist> 21869e7bcd65Smrg <varlistentry> 21879e7bcd65Smrg <term> 21889e7bcd65Smrg <emphasis remap='I'>display</emphasis> 21899e7bcd65Smrg </term> 21909e7bcd65Smrg <listitem> 21919e7bcd65Smrg <para> 21929e7bcd65SmrgSpecifies an open and initialized display connection. 21939e7bcd65Smrg </para> 21949e7bcd65Smrg </listitem> 21959e7bcd65Smrg </varlistentry> 21969e7bcd65Smrg</variablelist> 21979e7bcd65Smrg 21989e7bcd65Smrg<para> 21999e7bcd65SmrgThe 22009e7bcd65Smrg<xref linkend='XtDisplayToApplicationContext' xrefstyle='select: title'/> 22019e7bcd65Smrgfunction returns the application 22029e7bcd65Smrgcontext in which the specified <emphasis remap='I'>display</emphasis> was initialized. If the 22039e7bcd65Smrgdisplay is not known to the Intrinsics, an error message is issued. 22049e7bcd65Smrg</para> 22059e7bcd65Smrg</sect2> 22069e7bcd65Smrg 22079e7bcd65Smrg<sect2 id="Registering_a_New_Resource_Converter"> 22089e7bcd65Smrg<title>Registering a New Resource Converter</title> 22099e7bcd65Smrg<para> 22109e7bcd65SmrgWhen registering a resource converter, the client must specify the 22119e7bcd65Smrgmanner in which the conversion cache is to be used when there are multiple 22129e7bcd65Smrgcalls to the converter. Conversion cache control is specified 22139e7bcd65Smrgvia an <function>XtCacheType</function> 22149e7bcd65Smrgargument. </para> 22159e7bcd65Smrg 22169e7bcd65Smrg<literallayout > 22179e7bcd65Smrgtypedef int XtCacheType; 22189e7bcd65Smrg</literallayout> 22199e7bcd65Smrg 22209e7bcd65Smrg<para> 22219e7bcd65SmrgAn <function>XtCacheType</function> 22229e7bcd65Smrgfield may contain one of the following values: 22239e7bcd65Smrg</para> 22249e7bcd65Smrg 22259e7bcd65Smrg<para> 22269e7bcd65Smrg<function>XtCacheNone</function> 22279e7bcd65Smrg</para> 22289e7bcd65Smrg<itemizedlist spacing='compact'> 22299e7bcd65Smrg <listitem> 22309e7bcd65Smrg <para> 22319e7bcd65SmrgSpecifies that the results of a previous conversion 22329e7bcd65Smrgmay not be reused to satisfy any other resource 22339e7bcd65Smrgrequests; the specified converter will be called 22349e7bcd65Smrgeach time the converted value is required. 22359e7bcd65Smrg </para> 22369e7bcd65Smrg </listitem> 22379e7bcd65Smrg</itemizedlist> 22389e7bcd65Smrg<para> 22399e7bcd65Smrg<function>XtCacheAll</function> 22409e7bcd65Smrg</para> 22419e7bcd65Smrg<itemizedlist spacing='compact'> 22429e7bcd65Smrg <listitem> 22439e7bcd65Smrg <para> 22449e7bcd65SmrgSpecifies that the results of a previous conversion 22459e7bcd65Smrgshould be reused for any resource request that depends 22469e7bcd65Smrgupon the same source value and conversion arguments. 22479e7bcd65Smrg </para> 22489e7bcd65Smrg </listitem> 22499e7bcd65Smrg</itemizedlist> 22509e7bcd65Smrg<para> 22519e7bcd65Smrg<function>XtCacheByDisplay</function> 22529e7bcd65Smrg</para> 22539e7bcd65Smrg<itemizedlist spacing='compact'> 22549e7bcd65Smrg <listitem> 22559e7bcd65Smrg <para> 22569e7bcd65SmrgSpecifies that the results of a previous conversion 22579e7bcd65Smrgshould be used as for 22589e7bcd65Smrg<function>XtCacheAll</function> 22599e7bcd65Smrgbut the destructor will be called, if specified, if 22609e7bcd65Smrg<xref linkend='XtCloseDisplay' xrefstyle='select: title'/> 22619e7bcd65Smrgis called 22629e7bcd65Smrgfor the display connection associated with the converted value, and 22639e7bcd65Smrgthe value will be removed from the conversion cache. 22649e7bcd65Smrg </para> 22659e7bcd65Smrg </listitem> 22669e7bcd65Smrg</itemizedlist> 22679e7bcd65Smrg<para> 22689e7bcd65SmrgThe qualifier 22699e7bcd65Smrg<function>XtCacheRefCount</function> 22709e7bcd65Smrgmay be ORed with any of the above values. If 22719e7bcd65Smrg<function>XtCacheRefCount</function> 22729e7bcd65Smrgis specified, calls to 22739e7bcd65Smrg<xref linkend='XtCreateWidget' xrefstyle='select: title'/>, 22749e7bcd65Smrg<xref linkend='XtCreateManagedWidget' xrefstyle='select: title'/>, 22759e7bcd65Smrg<xref linkend='XtGetApplicationResources' xrefstyle='select: title'/>, 22769e7bcd65Smrgand 22779e7bcd65Smrg<xref linkend='XtGetSubresources' xrefstyle='select: title'/> 22789e7bcd65Smrgthat use the converted value will be counted. When a widget using the 22799e7bcd65Smrgconverted value is destroyed, the count is decremented, and, if the 22809e7bcd65Smrgcount reaches zero, the destructor procedure will be called and the 22819e7bcd65Smrgconverted value will be removed from the conversion cache. 22829e7bcd65Smrg</para> 22839e7bcd65Smrg 22849e7bcd65Smrg<para> 22859e7bcd65SmrgTo register a type converter for all application contexts in a 22869e7bcd65Smrgprocess, use 22879e7bcd65Smrg<xref linkend='XtSetTypeConverter' xrefstyle='select: title'/>, 22889e7bcd65Smrgand to register a type converter in a single application context, use 22899e7bcd65Smrg<xref linkend='XtAppSetTypeConverter' xrefstyle='select: title'/>. 22909e7bcd65Smrg</para> 22919e7bcd65Smrg 22929e7bcd65Smrg<funcsynopsis id='XtSetTypeConverter'> 22939e7bcd65Smrg<funcprototype> 22949e7bcd65Smrg<funcdef>void <function>XtSetTypeConverter</function></funcdef> 22959e7bcd65Smrg <paramdef>String <parameter>from_type</parameter></paramdef> 22969e7bcd65Smrg <paramdef>String <parameter>to_type</parameter></paramdef> 22979e7bcd65Smrg <paramdef>XtTypeConverter <parameter>converter</parameter></paramdef> 22989e7bcd65Smrg <paramdef>XtConvertArgList <parameter>convert_args</parameter></paramdef> 22999e7bcd65Smrg <paramdef>Cardinal <parameter>num_args</parameter></paramdef> 23009e7bcd65Smrg <paramdef>XtCacheType <parameter>cache_type</parameter></paramdef> 23019e7bcd65Smrg <paramdef>XtDestructor <parameter>destructor</parameter></paramdef> 23029e7bcd65Smrg</funcprototype> 23039e7bcd65Smrg</funcsynopsis> 23049e7bcd65Smrg 23059e7bcd65Smrg<variablelist> 23069e7bcd65Smrg <varlistentry> 23079e7bcd65Smrg <term> 23089e7bcd65Smrg <emphasis remap='I'>from_type</emphasis> 23099e7bcd65Smrg </term> 23109e7bcd65Smrg <listitem> 23119e7bcd65Smrg <para> 23129e7bcd65SmrgSpecifies the source type. 23139e7bcd65Smrg </para> 23149e7bcd65Smrg </listitem> 23159e7bcd65Smrg </varlistentry> 23169e7bcd65Smrg <varlistentry> 23179e7bcd65Smrg <term> 23189e7bcd65Smrg <emphasis remap='I'>to_type</emphasis> 23199e7bcd65Smrg </term> 23209e7bcd65Smrg <listitem> 23219e7bcd65Smrg <para> 23229e7bcd65SmrgSpecifies the destination type. 23239e7bcd65Smrg </para> 23249e7bcd65Smrg </listitem> 23259e7bcd65Smrg </varlistentry> 23269e7bcd65Smrg <varlistentry> 23279e7bcd65Smrg <term> 23289e7bcd65Smrg <emphasis remap='I'>converter</emphasis> 23299e7bcd65Smrg </term> 23309e7bcd65Smrg <listitem> 23319e7bcd65Smrg <para> 23329e7bcd65SmrgSpecifies the resource type converter procedure. 23339e7bcd65Smrg </para> 23349e7bcd65Smrg </listitem> 23359e7bcd65Smrg </varlistentry> 23369e7bcd65Smrg <varlistentry> 23379e7bcd65Smrg <term> 23389e7bcd65Smrg <emphasis remap='I'>convert_args</emphasis> 23399e7bcd65Smrg </term> 23409e7bcd65Smrg <listitem> 23419e7bcd65Smrg <para> 23429e7bcd65SmrgSpecifies additional conversion arguments, or NULL. 23439e7bcd65Smrg </para> 23449e7bcd65Smrg </listitem> 23459e7bcd65Smrg </varlistentry> 23469e7bcd65Smrg <varlistentry> 23479e7bcd65Smrg <term> 23489e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 23499e7bcd65Smrg </term> 23509e7bcd65Smrg <listitem> 23519e7bcd65Smrg <para> 23529e7bcd65SmrgSpecifies the number of entries in <emphasis remap='I'>convert_args</emphasis>. 23539e7bcd65Smrg </para> 23549e7bcd65Smrg </listitem> 23559e7bcd65Smrg </varlistentry> 23569e7bcd65Smrg <varlistentry> 23579e7bcd65Smrg <term> 23589e7bcd65Smrg <emphasis remap='I'>cache_type</emphasis> 23599e7bcd65Smrg </term> 23609e7bcd65Smrg <listitem> 23619e7bcd65Smrg <para> 23629e7bcd65SmrgSpecifies whether or not resources produced by this 23639e7bcd65Smrgconverter are sharable or display-specific and when 23649e7bcd65Smrgthey should be freed. 23659e7bcd65Smrg </para> 23669e7bcd65Smrg </listitem> 23679e7bcd65Smrg </varlistentry> 23689e7bcd65Smrg <varlistentry> 23699e7bcd65Smrg <term> 23709e7bcd65Smrg <emphasis remap='I'>destructor</emphasis> 23719e7bcd65Smrg </term> 23729e7bcd65Smrg <listitem> 23739e7bcd65Smrg <para> 23749e7bcd65SmrgSpecifies a destroy procedure for resources produced by 23759e7bcd65Smrgthis conversion, or NULL if no additional action is 23769e7bcd65Smrgrequired to deallocate resources produced by the converter. 23779e7bcd65Smrg </para> 23789e7bcd65Smrg </listitem> 23799e7bcd65Smrg </varlistentry> 23809e7bcd65Smrg</variablelist> 23819e7bcd65Smrg 23829e7bcd65Smrg 23839e7bcd65Smrg<funcsynopsis id='XtAppSetTypeConverter'> 23849e7bcd65Smrg<funcprototype> 23859e7bcd65Smrg<funcdef> <function>XtAppSetTypeConverter</function></funcdef> 23869e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 23879e7bcd65Smrg <paramdef>String <parameter>from_type</parameter></paramdef> 23889e7bcd65Smrg <paramdef>String <parameter>to_type</parameter></paramdef> 23899e7bcd65Smrg <paramdef>XtTypeConverter <parameter>converter</parameter></paramdef> 23909e7bcd65Smrg <paramdef>XtConvertArgList <parameter>convert_args</parameter></paramdef> 23919e7bcd65Smrg <paramdef>Cardinal <parameter>num_args</parameter></paramdef> 23929e7bcd65Smrg <paramdef>XtCacheType <parameter>cache_type</parameter></paramdef> 23939e7bcd65Smrg <paramdef>XtDestructor <parameter>destructor</parameter></paramdef> 23949e7bcd65Smrg</funcprototype> 23959e7bcd65Smrg</funcsynopsis> 23969e7bcd65Smrg 23979e7bcd65Smrg<variablelist> 23989e7bcd65Smrg <varlistentry> 23999e7bcd65Smrg <term> 24009e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 24019e7bcd65Smrg </term> 24029e7bcd65Smrg <listitem> 24039e7bcd65Smrg <para> 24049e7bcd65SmrgSpecifies the application context. 24059e7bcd65Smrg </para> 24069e7bcd65Smrg </listitem> 24079e7bcd65Smrg </varlistentry> 24089e7bcd65Smrg <varlistentry> 24099e7bcd65Smrg <term> 24109e7bcd65Smrg <emphasis remap='I'>from_type</emphasis> 24119e7bcd65Smrg </term> 24129e7bcd65Smrg <listitem> 24139e7bcd65Smrg <para> 24149e7bcd65SmrgSpecifies the source type. 24159e7bcd65Smrg </para> 24169e7bcd65Smrg </listitem> 24179e7bcd65Smrg </varlistentry> 24189e7bcd65Smrg <varlistentry> 24199e7bcd65Smrg <term> 24209e7bcd65Smrg <emphasis remap='I'>to_type</emphasis> 24219e7bcd65Smrg </term> 24229e7bcd65Smrg <listitem> 24239e7bcd65Smrg <para> 24249e7bcd65SmrgSpecifies the destination type. 24259e7bcd65Smrg </para> 24269e7bcd65Smrg </listitem> 24279e7bcd65Smrg </varlistentry> 24289e7bcd65Smrg <varlistentry> 24299e7bcd65Smrg <term> 24309e7bcd65Smrg <emphasis remap='I'>converter</emphasis> 24319e7bcd65Smrg </term> 24329e7bcd65Smrg <listitem> 24339e7bcd65Smrg <para> 24349e7bcd65SmrgSpecifies the resource type converter procedure. 24359e7bcd65Smrg </para> 24369e7bcd65Smrg </listitem> 24379e7bcd65Smrg </varlistentry> 24389e7bcd65Smrg <varlistentry> 24399e7bcd65Smrg <term> 24409e7bcd65Smrg <emphasis remap='I'>convert_args</emphasis> 24419e7bcd65Smrg </term> 24429e7bcd65Smrg <listitem> 24439e7bcd65Smrg <para> 24449e7bcd65SmrgSpecifies additional conversion arguments, or NULL. 24459e7bcd65Smrg </para> 24469e7bcd65Smrg </listitem> 24479e7bcd65Smrg </varlistentry> 24489e7bcd65Smrg <varlistentry> 24499e7bcd65Smrg <term> 24509e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 24519e7bcd65Smrg </term> 24529e7bcd65Smrg <listitem> 24539e7bcd65Smrg <para> 24549e7bcd65SmrgSpecifies the number of entries in <emphasis remap='I'>convert_args</emphasis>. 24559e7bcd65Smrg </para> 24569e7bcd65Smrg </listitem> 24579e7bcd65Smrg </varlistentry> 24589e7bcd65Smrg <varlistentry> 24599e7bcd65Smrg <term> 24609e7bcd65Smrg <emphasis remap='I'>cache_type</emphasis> 24619e7bcd65Smrg </term> 24629e7bcd65Smrg <listitem> 24639e7bcd65Smrg <para> 24649e7bcd65SmrgSpecifies whether or not resources produced by this 24659e7bcd65Smrgconverter are sharable or display-specific and when 24669e7bcd65Smrgthey should be freed. 24679e7bcd65Smrg </para> 24689e7bcd65Smrg </listitem> 24699e7bcd65Smrg </varlistentry> 24709e7bcd65Smrg <varlistentry> 24719e7bcd65Smrg <term> 24729e7bcd65Smrg <emphasis remap='I'>destructor</emphasis> 24739e7bcd65Smrg </term> 24749e7bcd65Smrg <listitem> 24759e7bcd65Smrg <para> 24769e7bcd65SmrgSpecifies a destroy procedure for resources produced by 24779e7bcd65Smrgthis conversion, or NULL if no additional action is 24789e7bcd65Smrgrequired to deallocate resources produced by the converter. 24799e7bcd65Smrg </para> 24809e7bcd65Smrg </listitem> 24819e7bcd65Smrg </varlistentry> 24829e7bcd65Smrg</variablelist> 24839e7bcd65Smrg 24849e7bcd65Smrg<para> 24859e7bcd65Smrg<xref linkend='XtSetTypeConverter' xrefstyle='select: title'/> 24869e7bcd65Smrgregisters the specified type converter and 24879e7bcd65Smrgdestructor in all application contexts created by the calling process, 24889e7bcd65Smrgincluding any future application contexts that may be created. 24899e7bcd65Smrg<xref linkend='XtAppSetTypeConverter' xrefstyle='select: title'/> 24909e7bcd65Smrgregisters the specified type converter in the 24919e7bcd65Smrgsingle application context specified. If the same <emphasis remap='I'>from_type</emphasis> and 24929e7bcd65Smrg<emphasis remap='I'>to_type</emphasis> are specified in multiple calls to either function, the most 24939e7bcd65Smrgrecent overrides the previous ones. 24949e7bcd65Smrg</para> 24959e7bcd65Smrg 24969e7bcd65Smrg<para> 24979e7bcd65SmrgFor the few type converters that need additional arguments, 24989e7bcd65Smrgthe Intrinsics conversion mechanism provides a method of specifying 24999e7bcd65Smrghow these arguments should be computed. 25009e7bcd65SmrgThe enumerated type 25019e7bcd65Smrg<function>XtAddressMode</function> 25029e7bcd65Smrgand the structure 25039e7bcd65Smrg<function>XtConvertArgRec</function> 25049e7bcd65Smrgspecify how each argument is derived. 25059e7bcd65SmrgThese are defined in 25069e7bcd65Smrg<function><X11/Intrinsic.h></function>. 25079e7bcd65Smrg</para> 25089e7bcd65Smrg<literallayout > 25099e7bcd65Smrgtypedef enum { 25109e7bcd65Smrg /* address mode parameter representation */ 25119e7bcd65Smrg XtAddress, /* address */ 25129e7bcd65Smrg XtBaseOffset, /* offset */ 25139e7bcd65Smrg XtImmediate, /* constant */ 25149e7bcd65Smrg XtResourceString, /* resource name string */ 25159e7bcd65Smrg XtResourceQuark, /* resource name quark */ 25169e7bcd65Smrg XtWidgetBaseOffset, /* offset */ 25179e7bcd65Smrg XtProcedureArg /* procedure to call */ 25189e7bcd65Smrg} XtAddressMode; 25199e7bcd65Smrg 25209e7bcd65Smrgtypedef struct { 25219e7bcd65Smrg XtAddressMode address_mode; 25229e7bcd65Smrg XtPointer address_id; 25239e7bcd65Smrg Cardinal size; 25249e7bcd65Smrg} XtConvertArgRec, *XtConvertArgList; 25259e7bcd65Smrg</literallayout> 25269e7bcd65Smrg<para> 25279e7bcd65SmrgThe <emphasis remap='I'>size</emphasis> field specifies the length of the data in bytes. 25289e7bcd65SmrgThe <emphasis remap='I'>address_mode</emphasis> field specifies how the <emphasis remap='I'>address_id</emphasis> field should be 25299e7bcd65Smrginterpreted. 25309e7bcd65Smrg<function>XtAddress</function> 25319e7bcd65Smrgcauses <emphasis remap='I'>address_id</emphasis> to be interpreted as the address of the data. 25329e7bcd65Smrg<function>XtBaseOffset</function> 25339e7bcd65Smrgcauses <emphasis remap='I'>address_id</emphasis> to be interpreted as the offset from the widget base. 25349e7bcd65Smrg<function>XtImmediate</function> 25359e7bcd65Smrgcauses <emphasis remap='I'>address_id</emphasis> to be interpreted as a constant. 25369e7bcd65Smrg<function>XtResourceString</function> 25379e7bcd65Smrgcauses <emphasis remap='I'>address_id</emphasis> to be interpreted as the name of a resource 25389e7bcd65Smrgthat is to be converted into an offset from the widget base. 25399e7bcd65Smrg<function>XtResourceQuark</function> 25409e7bcd65Smrgcauses <emphasis remap='I'>address_id</emphasis> to be interpreted as the result of an 25419e7bcd65Smrg<function>XrmStringToQuark</function> 25429e7bcd65Smrgconversion on the name of a resource, 25439e7bcd65Smrgwhich is to be converted into an offset from the widget base. 25449e7bcd65Smrg<function>XtWidgetBaseOffset</function> 25459e7bcd65Smrgis similar to 25469e7bcd65Smrg<function>XtBaseOffset</function> 25479e7bcd65Smrgexcept that it 25489e7bcd65Smrgsearches for the closest windowed ancestor if the object is not 25499e7bcd65Smrgof a subclass of 25509e7bcd65SmrgCore 25519e7bcd65Smrg(see <xref linkend='Nonwidget_Objects' />). 25529e7bcd65Smrg<function>XtProcedureArg</function> 25539e7bcd65Smrgspecifies that <emphasis remap='I'>address_id</emphasis> is a pointer to a procedure to 25549e7bcd65Smrgbe invoked to return the conversion argument. If 25559e7bcd65Smrg<function>XtProcedureArg</function> 25569e7bcd65Smrgis specified, <emphasis remap='I'>address_id</emphasis> must contain 25579e7bcd65Smrgthe address of a function of type 25589e7bcd65Smrg<xref linkend='XtConvertArgProc' xrefstyle='select: title'/>. 25599e7bcd65Smrg</para> 25609e7bcd65Smrg 25619e7bcd65Smrg<funcsynopsis id='XtConvertArgProc'> 25629e7bcd65Smrg<funcprototype> 25639e7bcd65Smrg<funcdef>typedef void <function>(*XtConvertArgProc)</function></funcdef> 25649e7bcd65Smrg <paramdef>XtAppContext <parameter>app</parameter></paramdef> 25659e7bcd65Smrg <paramdef>XrmValue *<parameter>to</parameter></paramdef> 25669e7bcd65Smrg <paramdef>XtPointer <parameter>converter_data</parameter></paramdef> 25679e7bcd65Smrg <paramdef>XrmValue *<parameter>args</parameter></paramdef> 25689e7bcd65Smrg <paramdef>Cardinal *<parameter>num_args</parameter></paramdef> 25699e7bcd65Smrg</funcprototype> 25709e7bcd65Smrg</funcsynopsis> 25719e7bcd65Smrg 25729e7bcd65Smrg<variablelist> 25739e7bcd65Smrg <varlistentry> 25749e7bcd65Smrg <term> 25759e7bcd65Smrg <emphasis remap='I'>app</emphasis> 25769e7bcd65Smrg </term> 25779e7bcd65Smrg <listitem> 25789e7bcd65Smrg <para> 25799e7bcd65SmrgSpecifies an application context in which the resource is being freed. 25809e7bcd65Smrg </para> 25819e7bcd65Smrg </listitem> 25829e7bcd65Smrg </varlistentry> 25839e7bcd65Smrg <varlistentry> 25849e7bcd65Smrg <term> 25859e7bcd65Smrg <emphasis remap='I'>to</emphasis> 25869e7bcd65Smrg </term> 25879e7bcd65Smrg <listitem> 25889e7bcd65Smrg <para> 25899e7bcd65SmrgSpecifies a descriptor for the resource produced by the type converter. 25909e7bcd65Smrg </para> 25919e7bcd65Smrg </listitem> 25929e7bcd65Smrg </varlistentry> 25939e7bcd65Smrg <varlistentry> 25949e7bcd65Smrg <term> 25959e7bcd65Smrg <emphasis remap='I'>converter_data</emphasis> 25969e7bcd65Smrg </term> 25979e7bcd65Smrg <listitem> 25989e7bcd65Smrg <para> 25999e7bcd65SmrgSpecifies the converter-specific data returned by the type converter. 26009e7bcd65Smrg </para> 26019e7bcd65Smrg </listitem> 26029e7bcd65Smrg </varlistentry> 26039e7bcd65Smrg <varlistentry> 26049e7bcd65Smrg <term> 26059e7bcd65Smrg <emphasis remap='I'>args</emphasis> 26069e7bcd65Smrg </term> 26079e7bcd65Smrg <listitem> 26089e7bcd65Smrg <para> 26099e7bcd65SmrgSpecifies the additional converter arguments as passed 26109e7bcd65Smrgto the type converter when the conversion was performed. 26119e7bcd65Smrg </para> 26129e7bcd65Smrg </listitem> 26139e7bcd65Smrg </varlistentry> 26149e7bcd65Smrg <varlistentry> 26159e7bcd65Smrg <term> 26169e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 26179e7bcd65Smrg </term> 26189e7bcd65Smrg <listitem> 26199e7bcd65Smrg <para> 26209e7bcd65SmrgSpecifies the number of entries in <emphasis remap='I'>args</emphasis>. 26219e7bcd65Smrg </para> 26229e7bcd65Smrg </listitem> 26239e7bcd65Smrg </varlistentry> 26249e7bcd65Smrg</variablelist> 26259e7bcd65Smrg 26269e7bcd65Smrg<para> 26279e7bcd65SmrgThe destructor procedure is responsible for freeing the resource 26289e7bcd65Smrgspecified by the <emphasis remap='I'>to</emphasis> argument, including any auxiliary storage 26299e7bcd65Smrgassociated with that resource, but not the memory directly addressed 26309e7bcd65Smrgby the size and location in the <emphasis remap='I'>to</emphasis> argument or the memory specified 26319e7bcd65Smrgby <emphasis remap='I'>args</emphasis>. 26329e7bcd65Smrg</para> 26339e7bcd65Smrg</sect2> 26349e7bcd65Smrg 26359e7bcd65Smrg<sect2 id="Resource_Converter_Invocation"> 26369e7bcd65Smrg<title>Resource Converter Invocation</title> 26379e7bcd65Smrg<para> 26389e7bcd65SmrgAll resource-fetching routines (for example, 26399e7bcd65Smrg<xref linkend='XtGetSubresources' xrefstyle='select: title'/>, 26409e7bcd65Smrg<xref linkend='XtGetApplicationResources' xrefstyle='select: title'/>, 26419e7bcd65Smrgand so on) call resource converters if the resource database or 26429e7bcd65Smrgvarargs list specifies a value 26439e7bcd65Smrgthat has a different representation from the desired representation or if the 26449e7bcd65Smrgwidget's default resource value representation is different from the desired 26459e7bcd65Smrgrepresentation. 26469e7bcd65Smrg</para> 26479e7bcd65Smrg 26489e7bcd65Smrg<para> 26499e7bcd65SmrgTo invoke explicit resource conversions, use 26509e7bcd65Smrg<xref linkend='XtConvertAndStore' xrefstyle='select: title'/> 26519e7bcd65Smrgor 26529e7bcd65Smrg<xref linkend='XtCallConverter' xrefstyle='select: title'/>. 26539e7bcd65Smrg</para> 26549e7bcd65Smrg<literallayout > 26559e7bcd65Smrgtypedef XtPointer XtCacheRef; 26569e7bcd65Smrg</literallayout> 26579e7bcd65Smrg 26589e7bcd65Smrg<funcsynopsis id='XtCallConverter'> 26599e7bcd65Smrg<funcprototype> 26609e7bcd65Smrg<funcdef>Boolean <function>XtCallConverter</function></funcdef> 26619e7bcd65Smrg <paramdef>Display* <parameter>display</parameter></paramdef> 26629e7bcd65Smrg <paramdef>XtTypeConverter <parameter>converter</parameter></paramdef> 26639e7bcd65Smrg <paramdef>XrmValuePtr <parameter>conversion_args</parameter></paramdef> 26649e7bcd65Smrg <paramdef>Cardinal <parameter>num_args</parameter></paramdef> 26659e7bcd65Smrg <paramdef>XrmValuePtr <parameter>from</parameter></paramdef> 26669e7bcd65Smrg <paramdef>XrmValuePtr <parameter>to_in_out</parameter></paramdef> 26679e7bcd65Smrg <paramdef>XtCacheRef *<parameter>cache_ref_return</parameter></paramdef> 26689e7bcd65Smrg</funcprototype> 26699e7bcd65Smrg</funcsynopsis> 26709e7bcd65Smrg 26719e7bcd65Smrg<variablelist> 26729e7bcd65Smrg <varlistentry> 26739e7bcd65Smrg <term> 26749e7bcd65Smrg <emphasis remap='I'>display</emphasis> 26759e7bcd65Smrg </term> 26769e7bcd65Smrg <listitem> 26779e7bcd65Smrg <para> 26789e7bcd65SmrgSpecifies the display with which the conversion is to be associated. 26799e7bcd65Smrg </para> 26809e7bcd65Smrg </listitem> 26819e7bcd65Smrg </varlistentry> 26829e7bcd65Smrg <varlistentry> 26839e7bcd65Smrg <term> 26849e7bcd65Smrg <emphasis remap='I'>converter</emphasis> 26859e7bcd65Smrg </term> 26869e7bcd65Smrg <listitem> 26879e7bcd65Smrg <para> 26889e7bcd65SmrgSpecifies the conversion procedure to be called. 26899e7bcd65Smrg </para> 26909e7bcd65Smrg </listitem> 26919e7bcd65Smrg </varlistentry> 26929e7bcd65Smrg <varlistentry> 26939e7bcd65Smrg <term> 26949e7bcd65Smrg <emphasis remap='I'>conversion_args</emphasis> 26959e7bcd65Smrg </term> 26969e7bcd65Smrg <listitem> 26979e7bcd65Smrg <para> 26989e7bcd65SmrgSpecifies the additional conversion arguments needed 26999e7bcd65Smrgto perform the conversion, or NULL. 27009e7bcd65Smrg </para> 27019e7bcd65Smrg </listitem> 27029e7bcd65Smrg </varlistentry> 27039e7bcd65Smrg <varlistentry> 27049e7bcd65Smrg <term> 27059e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 27069e7bcd65Smrg </term> 27079e7bcd65Smrg <listitem> 27089e7bcd65Smrg <para> 27099e7bcd65SmrgSpecifies the number of entries in <emphasis remap='I'>conversion_args</emphasis>. 27109e7bcd65Smrg </para> 27119e7bcd65Smrg </listitem> 27129e7bcd65Smrg </varlistentry> 27139e7bcd65Smrg <varlistentry> 27149e7bcd65Smrg <term> 27159e7bcd65Smrg <emphasis remap='I'>from</emphasis> 27169e7bcd65Smrg </term> 27179e7bcd65Smrg <listitem> 27189e7bcd65Smrg <para> 27199e7bcd65SmrgSpecifies a descriptor for the source value. 27209e7bcd65Smrg </para> 27219e7bcd65Smrg </listitem> 27229e7bcd65Smrg </varlistentry> 27239e7bcd65Smrg <varlistentry> 27249e7bcd65Smrg <term> 27259e7bcd65Smrg <emphasis remap='I'>to_in_out</emphasis> 27269e7bcd65Smrg </term> 27279e7bcd65Smrg <listitem> 27289e7bcd65Smrg <para> 27299e7bcd65SmrgReturns the converted value. 27309e7bcd65Smrg </para> 27319e7bcd65Smrg </listitem> 27329e7bcd65Smrg </varlistentry> 27339e7bcd65Smrg <varlistentry> 27349e7bcd65Smrg <term> 27359e7bcd65Smrg <emphasis remap='I'>cache_ref_return</emphasis> 27369e7bcd65Smrg </term> 27379e7bcd65Smrg <listitem> 27389e7bcd65Smrg <para> 27399e7bcd65SmrgReturns a conversion cache id. 27409e7bcd65Smrg </para> 27419e7bcd65Smrg </listitem> 27429e7bcd65Smrg </varlistentry> 27439e7bcd65Smrg</variablelist> 27449e7bcd65Smrg 27459e7bcd65Smrg<para> 27469e7bcd65SmrgThe 27479e7bcd65Smrg<xref linkend='XtCallConverter' xrefstyle='select: title'/> 27489e7bcd65Smrgfunction looks up the 27499e7bcd65Smrgspecified type converter in the application context associated with 27509e7bcd65Smrgthe display and, if the converter was not registered or was registered 27519e7bcd65Smrgwith cache type 27529e7bcd65Smrg<function>XtCacheAll</function> 27539e7bcd65Smrgor 27549e7bcd65Smrg<function>XtCacheByDisplay</function>, 27559e7bcd65Smrglooks in the conversion cache to see if this conversion procedure 27569e7bcd65Smrghas been called with the specified conversion arguments. If so, it 27579e7bcd65Smrgchecks the success status of the prior call, and if 27589e7bcd65Smrgthe conversion failed, 27599e7bcd65Smrg<xref linkend='XtCallConverter' xrefstyle='select: title'/> 27609e7bcd65Smrgreturns 27619e7bcd65Smrg<function>False</function> 27629e7bcd65Smrgimmediately; 27639e7bcd65Smrgotherwise it checks the size specified in the <emphasis remap='I'>to</emphasis> argument, and, if it is 27649e7bcd65Smrggreater than or equal to the size stored in the cache, copies the 27659e7bcd65Smrginformation stored in the cache into the location specified by 27669e7bcd65Smrg<emphasis remap='I'>to->addr</emphasis>, stores the cache size into <emphasis remap='I'>to->size</emphasis>, and returns 27679e7bcd65Smrg<function>True</function>. 27689e7bcd65SmrgIf the size specified in the <emphasis remap='I'>to</emphasis> argument is smaller than the size stored 27699e7bcd65Smrgin the cache, 27709e7bcd65Smrg<xref linkend='XtCallConverter' xrefstyle='select: title'/> 27719e7bcd65Smrgcopies the cache size into <emphasis remap='I'>to->size</emphasis> and returns 27729e7bcd65Smrg<function>False</function>. 27739e7bcd65SmrgIf the converter was registered with cache type 27749e7bcd65Smrg<function>XtCacheNone</function> 27759e7bcd65Smrgor no value was found in the conversion cache, 27769e7bcd65Smrg<xref linkend='XtCallConverter' xrefstyle='select: title'/> 27779e7bcd65Smrgcalls the converter, and if it was not registered with cache type 27789e7bcd65Smrg<function>XtCacheNone</function>, 27799e7bcd65Smrgenters the result in the cache. 27809e7bcd65Smrg<xref linkend='XtCallConverter' xrefstyle='select: title'/> 27819e7bcd65Smrgthen returns what the converter returned. 27829e7bcd65Smrg</para> 27839e7bcd65Smrg 27849e7bcd65Smrg<para> 27859e7bcd65SmrgThe <emphasis remap='I'>cache_ref_return</emphasis> field specifies storage allocated by the caller in which 27869e7bcd65Smrgan opaque value will be stored. If the type converter has been 27879e7bcd65Smrgregistered with the 27889e7bcd65Smrg<function>XtCacheRefCount</function> 27899e7bcd65Smrgmodifier and if the value returned 27909e7bcd65Smrgin <emphasis remap='I'>cache_ref_return</emphasis> is non-NULL, then the caller should store the 27919e7bcd65Smrg<emphasis remap='I'>cache_ref_return</emphasis> value in order to decrement the reference count when 27929e7bcd65Smrgthe converted value is no longer required. The <emphasis remap='I'>cache_ref_return</emphasis> 27939e7bcd65Smrgargument should be 27949e7bcd65SmrgNULL if the caller is unwilling or unable to store the 27959e7bcd65Smrgvalue. 27969e7bcd65Smrg</para> 27979e7bcd65Smrg 27989e7bcd65Smrg<para> 27999e7bcd65SmrgTo explicitly decrement the reference counts for resources obtained 28009e7bcd65Smrgfrom 28019e7bcd65Smrg<xref linkend='XtCallConverter' xrefstyle='select: title'/>, 28029e7bcd65Smrguse 28039e7bcd65Smrg<xref linkend='XtAppReleaseCacheRefs' xrefstyle='select: title'/>. 28049e7bcd65Smrg</para> 28059e7bcd65Smrg 28069e7bcd65Smrg<funcsynopsis id='XtAppReleaseCacheRefs'> 28079e7bcd65Smrg<funcprototype> 28089e7bcd65Smrg<funcdef>void <function>XtAppReleaseCacheRefs</function></funcdef> 28099e7bcd65Smrg <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> 28109e7bcd65Smrg <paramdef>XtCacheRef *<parameter>refs</parameter></paramdef> 28119e7bcd65Smrg</funcprototype> 28129e7bcd65Smrg</funcsynopsis> 28139e7bcd65Smrg 28149e7bcd65Smrg<variablelist> 28159e7bcd65Smrg <varlistentry> 28169e7bcd65Smrg <term> 28179e7bcd65Smrg <emphasis remap='I'>app_context</emphasis> 28189e7bcd65Smrg </term> 28199e7bcd65Smrg <listitem> 28209e7bcd65Smrg <para> 28219e7bcd65SmrgSpecifies the application context. 28229e7bcd65Smrg </para> 28239e7bcd65Smrg </listitem> 28249e7bcd65Smrg </varlistentry> 28259e7bcd65Smrg <varlistentry> 28269e7bcd65Smrg <term> 28279e7bcd65Smrg <emphasis remap='I'>refs</emphasis> 28289e7bcd65Smrg </term> 28299e7bcd65Smrg <listitem> 28309e7bcd65Smrg <para> 28319e7bcd65SmrgSpecifies the list of cache references to be released. 28329e7bcd65Smrg </para> 28339e7bcd65Smrg </listitem> 28349e7bcd65Smrg </varlistentry> 28359e7bcd65Smrg</variablelist> 28369e7bcd65Smrg 28379e7bcd65Smrg<para> 28389e7bcd65Smrg<xref linkend='XtAppReleaseCacheRefs' xrefstyle='select: title'/> 28399e7bcd65Smrgdecrements the reference count for the 28409e7bcd65Smrgconversion entries identified by the <emphasis remap='I'>refs</emphasis> argument. 28419e7bcd65SmrgThis argument is a 28429e7bcd65Smrgpointer to a NULL-terminated list of 28439e7bcd65Smrg<function>XtCacheRef</function> 28449e7bcd65Smrgvalues. If any reference 28459e7bcd65Smrgcount reaches zero, the destructor, if any, will be called and 28469e7bcd65Smrgthe resource removed from the conversion cache. 28479e7bcd65Smrg</para> 28489e7bcd65Smrg 28499e7bcd65Smrg<para> 28509e7bcd65SmrgAs a convenience to clients needing to explicitly decrement reference 28519e7bcd65Smrgcounts via a callback function, the Intrinsics define two callback 28529e7bcd65Smrgprocedures, 28539e7bcd65Smrg<xref linkend='XtCallbackReleaseCacheRef' xrefstyle='select: title'/> 28549e7bcd65Smrgand 28559e7bcd65Smrg<xref linkend='XtCallbackReleaseCacheRefList' xrefstyle='select: title'/>. 28569e7bcd65Smrg</para> 28579e7bcd65Smrg 28589e7bcd65Smrg<funcsynopsis id='XtCallbackReleaseCacheRef'> 28599e7bcd65Smrg<funcprototype> 28609e7bcd65Smrg<funcdef>void <function>XtCallbackReleaseCacheRef</function></funcdef> 28619e7bcd65Smrg <paramdef>Widget <parameter>object</parameter></paramdef> 28629e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 28639e7bcd65Smrg <paramdef>XtPointer <parameter>call_data</parameter></paramdef> 28649e7bcd65Smrg</funcprototype> 28659e7bcd65Smrg</funcsynopsis> 28669e7bcd65Smrg 28679e7bcd65Smrg<variablelist> 28689e7bcd65Smrg <varlistentry> 28699e7bcd65Smrg <term> 28709e7bcd65Smrg <emphasis remap='I'>object</emphasis> 28719e7bcd65Smrg </term> 28729e7bcd65Smrg <listitem> 28739e7bcd65Smrg <para> 28749e7bcd65SmrgSpecifies the object with which the resource is associated. 28759e7bcd65Smrg </para> 28769e7bcd65Smrg </listitem> 28779e7bcd65Smrg </varlistentry> 28789e7bcd65Smrg <varlistentry> 28799e7bcd65Smrg <term> 28809e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 28819e7bcd65Smrg </term> 28829e7bcd65Smrg <listitem> 28839e7bcd65Smrg <para> 28849e7bcd65SmrgSpecifies the conversion cache entry to be released. 28859e7bcd65Smrg </para> 28869e7bcd65Smrg </listitem> 28879e7bcd65Smrg </varlistentry> 28889e7bcd65Smrg <varlistentry> 28899e7bcd65Smrg <term> 28909e7bcd65Smrg <emphasis remap='I'>call_data</emphasis> 28919e7bcd65Smrg </term> 28929e7bcd65Smrg <listitem> 28939e7bcd65Smrg <para> 28949e7bcd65SmrgIs ignored. 28959e7bcd65Smrg </para> 28969e7bcd65Smrg </listitem> 28979e7bcd65Smrg </varlistentry> 28989e7bcd65Smrg</variablelist> 28999e7bcd65Smrg 29009e7bcd65Smrg<para> 29019e7bcd65SmrgThis callback procedure may be added to a callback list to release a 29029e7bcd65Smrgpreviously returned 29039e7bcd65Smrg<function>XtCacheRef</function> 29049e7bcd65Smrgvalue. When adding the callback, the 29059e7bcd65Smrgcallback <emphasis remap='I'>client_data</emphasis> argument must be specified as the value of the 29069e7bcd65Smrg<function>XtCacheRef</function> 29079e7bcd65Smrgdata cast to type 29089e7bcd65Smrg<function>XtPointer</function>. 29099e7bcd65Smrg</para> 29109e7bcd65Smrg 29119e7bcd65Smrg<funcsynopsis id='XtCallbackReleaseCacheRefList'> 29129e7bcd65Smrg<funcprototype> 29139e7bcd65Smrg<funcdef>void <function>XtCallbackReleaseCacheRefList</function></funcdef> 29149e7bcd65Smrg <paramdef>Widget <parameter>object</parameter></paramdef> 29159e7bcd65Smrg <paramdef>XtPointer <parameter>client_data</parameter></paramdef> 29169e7bcd65Smrg <paramdef>XtPointer <parameter>call_data</parameter></paramdef> 29179e7bcd65Smrg</funcprototype> 29189e7bcd65Smrg</funcsynopsis> 29199e7bcd65Smrg 29209e7bcd65Smrg<variablelist> 29219e7bcd65Smrg <varlistentry> 29229e7bcd65Smrg <term> 29239e7bcd65Smrg <emphasis remap='I'>object</emphasis> 29249e7bcd65Smrg </term> 29259e7bcd65Smrg <listitem> 29269e7bcd65Smrg <para> 29279e7bcd65SmrgSpecifies the object with which the resources are associated. 29289e7bcd65Smrg </para> 29299e7bcd65Smrg </listitem> 29309e7bcd65Smrg </varlistentry> 29319e7bcd65Smrg <varlistentry> 29329e7bcd65Smrg <term> 29339e7bcd65Smrg <emphasis remap='I'>client_data</emphasis> 29349e7bcd65Smrg </term> 29359e7bcd65Smrg <listitem> 29369e7bcd65Smrg <para> 29379e7bcd65SmrgSpecifies the conversion cache entries to be released. 29389e7bcd65Smrg </para> 29399e7bcd65Smrg </listitem> 29409e7bcd65Smrg </varlistentry> 29419e7bcd65Smrg <varlistentry> 29429e7bcd65Smrg <term> 29439e7bcd65Smrg <emphasis remap='I'>call_data</emphasis> 29449e7bcd65Smrg </term> 29459e7bcd65Smrg <listitem> 29469e7bcd65Smrg <para> 29479e7bcd65SmrgIs ignored. 29489e7bcd65Smrg </para> 29499e7bcd65Smrg </listitem> 29509e7bcd65Smrg </varlistentry> 29519e7bcd65Smrg</variablelist> 29529e7bcd65Smrg 29539e7bcd65Smrg<para> 29549e7bcd65SmrgThis callback procedure may be added to a callback list to release a 29559e7bcd65Smrglist of previously returned 29569e7bcd65Smrg<function>XtCacheRef</function> 29579e7bcd65Smrgvalues. When adding the 29589e7bcd65Smrgcallback, the callback <emphasis remap='I'>client_data</emphasis> argument must be specified as a 29599e7bcd65Smrgpointer to a NULL-terminated list of 29609e7bcd65Smrg<function>XtCacheRef</function> 29619e7bcd65Smrgvalues. 29629e7bcd65Smrg</para> 29639e7bcd65Smrg 29649e7bcd65Smrg<para> 29659e7bcd65SmrgTo lookup and call a resource converter, copy the resulting value, 29669e7bcd65Smrgand free a cached resource when a widget is destroyed, use 29679e7bcd65Smrg<xref linkend='XtConvertAndStore' xrefstyle='select: title'/>. 29689e7bcd65Smrg</para> 29699e7bcd65Smrg 29709e7bcd65Smrg<funcsynopsis id='XtConvertAndStore'> 29719e7bcd65Smrg<funcprototype> 29729e7bcd65Smrg<funcdef>Boolean <function>XtConvertAndStore</function></funcdef> 29739e7bcd65Smrg <paramdef>Widget <parameter>object</parameter></paramdef> 29749e7bcd65Smrg <paramdef>String <parameter>from_type</parameter></paramdef> 29759e7bcd65Smrg <paramdef>XrmValuePtr <parameter>from</parameter></paramdef> 29769e7bcd65Smrg <paramdef>String <parameter>to_type</parameter></paramdef> 29779e7bcd65Smrg <paramdef>XrmValuePtr <parameter>to_in_out</parameter></paramdef> 29789e7bcd65Smrg</funcprototype> 29799e7bcd65Smrg</funcsynopsis> 29809e7bcd65Smrg 29819e7bcd65Smrg<variablelist> 29829e7bcd65Smrg <varlistentry> 29839e7bcd65Smrg <term> 29849e7bcd65Smrg <emphasis remap='I'>object</emphasis> 29859e7bcd65Smrg </term> 29869e7bcd65Smrg <listitem> 29879e7bcd65Smrg <para> 29889e7bcd65SmrgSpecifies the object to use for additional arguments, if any are needed, 29899e7bcd65Smrgand the destroy callback list. Must be of class Object or any subclass thereof. 29909e7bcd65Smrg </para> 29919e7bcd65Smrg </listitem> 29929e7bcd65Smrg </varlistentry> 29939e7bcd65Smrg <varlistentry> 29949e7bcd65Smrg <term> 29959e7bcd65Smrg <emphasis remap='I'>from_type</emphasis> 29969e7bcd65Smrg </term> 29979e7bcd65Smrg <listitem> 29989e7bcd65Smrg <para> 29999e7bcd65SmrgSpecifies the source type. 30009e7bcd65Smrg </para> 30019e7bcd65Smrg </listitem> 30029e7bcd65Smrg </varlistentry> 30039e7bcd65Smrg <varlistentry> 30049e7bcd65Smrg <term> 30059e7bcd65Smrg <emphasis remap='I'>from</emphasis> 30069e7bcd65Smrg </term> 30079e7bcd65Smrg <listitem> 30089e7bcd65Smrg <para> 30099e7bcd65SmrgSpecifies the value to be converted. 30109e7bcd65Smrg </para> 30119e7bcd65Smrg </listitem> 30129e7bcd65Smrg </varlistentry> 30139e7bcd65Smrg <varlistentry> 30149e7bcd65Smrg <term> 30159e7bcd65Smrg <emphasis remap='I'>to_type</emphasis> 30169e7bcd65Smrg </term> 30179e7bcd65Smrg <listitem> 30189e7bcd65Smrg <para> 30199e7bcd65SmrgSpecifies the destination type. 30209e7bcd65Smrg </para> 30219e7bcd65Smrg </listitem> 30229e7bcd65Smrg </varlistentry> 30239e7bcd65Smrg <varlistentry> 30249e7bcd65Smrg <term> 30259e7bcd65Smrg <emphasis remap='I'>to_in_out</emphasis> 30269e7bcd65Smrg </term> 30279e7bcd65Smrg <listitem> 30289e7bcd65Smrg <para> 30299e7bcd65SmrgSpecifies a descriptor for storage into which the converted value 30309e7bcd65Smrgwill be returned. 30319e7bcd65Smrg </para> 30329e7bcd65Smrg </listitem> 30339e7bcd65Smrg </varlistentry> 30349e7bcd65Smrg</variablelist> 30359e7bcd65Smrg 30369e7bcd65Smrg<para> 30379e7bcd65SmrgThe 30389e7bcd65Smrg<xref linkend='XtConvertAndStore' xrefstyle='select: title'/> 30399e7bcd65Smrgfunction looks up the type converter registered 30409e7bcd65Smrgto convert <emphasis remap='I'>from_type</emphasis> to <emphasis remap='I'>to_type</emphasis>, computes any additional arguments 30419e7bcd65Smrgneeded, and then calls 30429e7bcd65Smrg<xref linkend='XtCallConverter' xrefstyle='select: title'/> 30439e7bcd65Smrg(or 30449e7bcd65Smrg<xref linkend='XtDirectConvert' xrefstyle='select: title'/> 30459e7bcd65Smrgif an old-style converter was registered with 30469e7bcd65Smrg<xref linkend='XtAddConverter' xrefstyle='select: title'/> 30479e7bcd65Smrgor 30489e7bcd65Smrg<xref linkend='XtAppAddConverter' xrefstyle='select: title'/>; 30499e7bcd65Smrgsee Appendix C) with the <emphasis remap='I'>from</emphasis> and <emphasis remap='I'>to_in_out</emphasis> arguments. The 30509e7bcd65Smrg<emphasis remap='I'>to_in_out</emphasis> argument specifies the size and location into which the 30519e7bcd65Smrgconverted value will be stored and is passed directly to the 30529e7bcd65Smrgconverter. If the location is specified as NULL, it will be replaced 30539e7bcd65Smrgwith a pointer to private storage and the size will be returned in the 30549e7bcd65Smrgdescriptor. The caller is expected to copy this private storage 30559e7bcd65Smrgimmediately and must not modify it in any way. If a non-NULL location 30569e7bcd65Smrgis specified, the caller must allocate sufficient storage to hold the 30579e7bcd65Smrgconverted value and must also specify the size of that storage in the 30589e7bcd65Smrgdescriptor. 30599e7bcd65SmrgThe <emphasis remap='I'>size</emphasis> field will be modified on return to indicate the actual 30609e7bcd65Smrgsize of the converted data. 30619e7bcd65SmrgIf the conversion succeeds, 30629e7bcd65Smrg<xref linkend='XtConvertAndStore' xrefstyle='select: title'/> 30639e7bcd65Smrgreturns 30649e7bcd65Smrg<function>True</function>; 30659e7bcd65Smrgotherwise, it returns 30669e7bcd65Smrg<function>False</function>. 30679e7bcd65Smrg</para> 30689e7bcd65Smrg 30699e7bcd65Smrg<para> 30709e7bcd65Smrg<xref linkend='XtConvertAndStore' xrefstyle='select: title'/> 30719e7bcd65Smrgadds 30729e7bcd65Smrg<xref linkend='XtCallbackReleaseCacheRef' xrefstyle='select: title'/> 30739e7bcd65Smrgto the destroyCallback list of the specified object if the conversion 30749e7bcd65Smrgreturns an 30759e7bcd65Smrg<function>XtCacheRef</function> 30769e7bcd65Smrgvalue. The resulting resource should not be referenced 30779e7bcd65Smrgafter the object has been destroyed. 30789e7bcd65Smrg</para> 30799e7bcd65Smrg 30809e7bcd65Smrg<para> 30819e7bcd65Smrg<xref linkend='XtCreateWidget' xrefstyle='select: title'/> 30829e7bcd65Smrgperforms processing equivalent to 30839e7bcd65Smrg<xref linkend='XtConvertAndStore' xrefstyle='select: title'/> 30849e7bcd65Smrgwhen initializing the object instance. Because there is extra memory 30859e7bcd65Smrgoverhead required to implement reference counting, clients may 30869e7bcd65Smrgdistinguish those objects that are never destroyed before the 30879e7bcd65Smrgapplication exits from those that may be destroyed and whose 30889e7bcd65Smrgresources should be deallocated. 30899e7bcd65Smrg</para> 30909e7bcd65Smrg 30919e7bcd65Smrg<para> 30929e7bcd65SmrgTo specify whether reference counting is to be enabled for the 30939e7bcd65Smrgresources of a particular object when the object is created, the 30949e7bcd65Smrgclient can specify a value for the 30959e7bcd65Smrg<function>Boolean</function> 30969e7bcd65Smrgresource 30979e7bcd65SmrgXtNinitialResourcesPersistent, 30989e7bcd65Smrgclass 30999e7bcd65SmrgXtCInitialResourcesPersistent. 31009e7bcd65Smrg</para> 31019e7bcd65Smrg 31029e7bcd65Smrg<para> 31039e7bcd65SmrgWhen 31049e7bcd65Smrg<xref linkend='XtCreateWidget' xrefstyle='select: title'/> 31059e7bcd65Smrgis called, if this resource is not specified as 31069e7bcd65Smrg<function>False</function> 31079e7bcd65Smrgin either the arglist or the resource database, then the 31089e7bcd65Smrgresources referenced by this object are not reference-counted, regardless of 31099e7bcd65Smrghow the type converter may have been registered. The effective 31109e7bcd65Smrgdefault value is 31119e7bcd65Smrg<function>True</function>; 31129e7bcd65Smrgthus clients that expect to destroy one or 31139e7bcd65Smrgmore objects and want resources deallocated must explicitly specify 31149e7bcd65Smrg<function>False</function> 31159e7bcd65Smrgfor 31169e7bcd65SmrgXtNinitialResourcesPersistent. 31179e7bcd65Smrg</para> 31189e7bcd65Smrg 31199e7bcd65Smrg<para> 31209e7bcd65SmrgThe resources are still freed and destructors called when 31219e7bcd65Smrg<xref linkend='XtCloseDisplay' xrefstyle='select: title'/> 31229e7bcd65Smrgis called if the conversion was registered as 31239e7bcd65Smrg<function>XtCacheByDisplay</function>. 31249e7bcd65Smrg</para> 31259e7bcd65Smrg</sect2> 31269e7bcd65Smrg</sect1> 31279e7bcd65Smrg 31289e7bcd65Smrg<sect1 id="Reading_and_Writing_Widget_State"> 31299e7bcd65Smrg<title>Reading and Writing Widget State</title> 31309e7bcd65Smrg<para> 31319e7bcd65SmrgAny resource field in a widget can be read or written by a client. 31329e7bcd65SmrgOn a write operation, 31339e7bcd65Smrgthe widget decides what changes it will actually allow and updates all 31349e7bcd65Smrgderived fields appropriately. 31359e7bcd65Smrg</para> 31369e7bcd65Smrg<sect2 id="Obtaining_Widget_State"> 31379e7bcd65Smrg<title>Obtaining Widget State</title> 31389e7bcd65Smrg<para> 31399e7bcd65SmrgTo retrieve the current values of resources associated with a 31409e7bcd65Smrgwidget instance, use 31419e7bcd65Smrg<xref linkend='XtGetValues' xrefstyle='select: title'/>. 31429e7bcd65Smrg</para> 31439e7bcd65Smrg 31449e7bcd65Smrg<funcsynopsis id='XtGetValues'> 31459e7bcd65Smrg<funcprototype> 31469e7bcd65Smrg<funcdef>void <function>XtGetValues</function></funcdef> 31479e7bcd65Smrg <paramdef>Widget <parameter>object</parameter></paramdef> 31489e7bcd65Smrg <paramdef>ArgList <parameter>args</parameter></paramdef> 31499e7bcd65Smrg <paramdef>Cardinal <parameter>num_args</parameter></paramdef> 31509e7bcd65Smrg</funcprototype> 31519e7bcd65Smrg</funcsynopsis> 31529e7bcd65Smrg 31539e7bcd65Smrg<variablelist> 31549e7bcd65Smrg <varlistentry> 31559e7bcd65Smrg <term> 31569e7bcd65Smrg <emphasis remap='I'>object</emphasis> 31579e7bcd65Smrg </term> 31589e7bcd65Smrg <listitem> 31599e7bcd65Smrg <para> 31609e7bcd65SmrgSpecifies the object whose resource values are to be returned. Must be of class Object or any subclass thereof. 31619e7bcd65Smrg </para> 31629e7bcd65Smrg </listitem> 31639e7bcd65Smrg </varlistentry> 31649e7bcd65Smrg <varlistentry> 31659e7bcd65Smrg <term> 31669e7bcd65Smrg <emphasis remap='I'>args</emphasis> 31679e7bcd65Smrg </term> 31689e7bcd65Smrg <listitem> 31699e7bcd65Smrg <para> 31709e7bcd65SmrgSpecifies the argument list of name/address pairs that contain the 31719e7bcd65Smrgresource names and the addresses into which the resource values are to 31729e7bcd65Smrgbe stored. 31739e7bcd65SmrgThe resource names are widget-dependent. 31749e7bcd65Smrg </para> 31759e7bcd65Smrg </listitem> 31769e7bcd65Smrg </varlistentry> 31779e7bcd65Smrg <varlistentry> 31789e7bcd65Smrg <term> 31799e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 31809e7bcd65Smrg </term> 31819e7bcd65Smrg <listitem> 31829e7bcd65Smrg <para> 31839e7bcd65SmrgSpecifies the number of entries in the argument list. 31849e7bcd65Smrg </para> 31859e7bcd65Smrg </listitem> 31869e7bcd65Smrg </varlistentry> 31879e7bcd65Smrg</variablelist> 31889e7bcd65Smrg 31899e7bcd65Smrg<para> 31909e7bcd65SmrgThe 31919e7bcd65Smrg<xref linkend='XtGetValues' xrefstyle='select: title'/> 31929e7bcd65Smrgfunction starts with the resources specified for the Object class 31939e7bcd65Smrgand proceeds down the subclass chain to the class of the object. 31949e7bcd65SmrgThe <emphasis remap='I'>value</emphasis> field of a passed argument list must contain the 31959e7bcd65Smrgaddress into which to copy the contents of the corresponding 31969e7bcd65Smrgobject instance field. If the field is a pointer type, the lifetime 31979e7bcd65Smrgof the pointed-to data is defined by the object class. For the 31989e7bcd65SmrgIntrinsics-defined resources, the following lifetimes apply: 31999e7bcd65Smrg</para> 32009e7bcd65Smrg<itemizedlist spacing='compact'> 32019e7bcd65Smrg <listitem> 32029e7bcd65Smrg <para> 32039e7bcd65SmrgNot valid following any operation that modifies the resource: 32049e7bcd65Smrg </para> 32059e7bcd65Smrg </listitem> 32069e7bcd65Smrg <listitem> 32079e7bcd65Smrg <itemizedlist spacing='compact'> 32089e7bcd65Smrg <listitem> 32099e7bcd65Smrg <para> 32109e7bcd65SmrgXtNchildren resource of composite widgets. 32119e7bcd65Smrg </para> 32129e7bcd65Smrg </listitem> 32139e7bcd65Smrg <listitem> 32149e7bcd65Smrg <para> 32159e7bcd65SmrgAll resources of representation type XtRCallback. 32169e7bcd65Smrg </para> 32179e7bcd65Smrg </listitem> 32189e7bcd65Smrg </itemizedlist> 32199e7bcd65Smrg </listitem> 32209e7bcd65Smrg <listitem> 32219e7bcd65Smrg <para> 32229e7bcd65SmrgRemain valid at least until the widget is destroyed: 32239e7bcd65Smrg </para> 32249e7bcd65Smrg </listitem> 32259e7bcd65Smrg <listitem> 32269e7bcd65Smrg <itemizedlist spacing='compact'> 32279e7bcd65Smrg <listitem> 32289e7bcd65Smrg <para> 32299e7bcd65SmrgXtNaccelerators, XtNtranslations. 32309e7bcd65Smrg </para> 32319e7bcd65Smrg </listitem> 32329e7bcd65Smrg </itemizedlist> 32339e7bcd65Smrg </listitem> 32349e7bcd65Smrg <listitem> 32359e7bcd65Smrg <para> 32369e7bcd65SmrgRemain valid until the Display is closed: 32379e7bcd65Smrg </para> 32389e7bcd65Smrg </listitem> 32399e7bcd65Smrg <listitem> 32409e7bcd65Smrg <itemizedlist spacing='compact'> 32419e7bcd65Smrg <listitem> 32429e7bcd65Smrg <para> 32439e7bcd65SmrgXtNscreen. 32449e7bcd65Smrg </para> 32459e7bcd65Smrg </listitem> 32469e7bcd65Smrg </itemizedlist> 32479e7bcd65Smrg </listitem> 32489e7bcd65Smrg</itemizedlist> 32499e7bcd65Smrg<para> 32509e7bcd65SmrgIt is the caller's responsibility 32519e7bcd65Smrgto allocate and deallocate storage for the copied data 32529e7bcd65Smrgaccording to the size of the 32539e7bcd65Smrgresource representation type used within the object. 32549e7bcd65Smrg</para> 32559e7bcd65Smrg 32569e7bcd65Smrg<para> 32579e7bcd65SmrgIf the class of the object's parent is a subclass of 32589e7bcd65Smrg<function>constraintWidgetClass</function>, 32599e7bcd65Smrg<xref linkend='XtGetValues' xrefstyle='select: title'/> 32609e7bcd65Smrgthen fetches the values for any constraint resources requested. 32619e7bcd65SmrgIt starts with the constraint resources specified for 32629e7bcd65Smrg<function>constraintWidgetClass</function> 32639e7bcd65Smrgand proceeds down the subclass chain to the parent's constraint resources. 32649e7bcd65SmrgIf the argument list contains a resource name that is not found in any of the 32659e7bcd65Smrgresource lists searched, 32669e7bcd65Smrgthe value at the corresponding address is not modified. 32679e7bcd65SmrgIf any get_values_hook procedures in the 32689e7bcd65Smrgobject's class or superclass records are non-NULL, 32699e7bcd65Smrgthey are called in superclass-to-subclass order after 32709e7bcd65Smrgall the resource values have been fetched by 32719e7bcd65Smrg<xref linkend='XtGetValues' xrefstyle='select: title'/>. 32729e7bcd65SmrgFinally, if the object's parent is a 32739e7bcd65Smrgsubclass of 32749e7bcd65Smrg<function>constraintWidgetClass</function>, 32759e7bcd65Smrgand if any of the parent's class or 32769e7bcd65Smrgsuperclass records have declared 32779e7bcd65Smrg<function>ConstraintClassExtension</function> 32789e7bcd65Smrgrecords in 32799e7bcd65Smrgthe Constraint class part <emphasis remap='I'>extension</emphasis> field with a record type of 32809e7bcd65Smrg<emphasis role='strong'>NULLQUARK</emphasis>, 32819e7bcd65Smrgand if the <emphasis remap='I'>get_values_hook</emphasis> field in the extension record is non-NULL, 32829e7bcd65Smrg<xref linkend='XtGetValues' xrefstyle='select: title'/> 32839e7bcd65Smrgcalls the get_values_hook procedures in superclass-to-subclass order. 32849e7bcd65SmrgThis permits a Constraint parent to provide 32859e7bcd65Smrgnonresource data via 32869e7bcd65Smrg<xref linkend='XtGetValues' xrefstyle='select: title'/>. 32879e7bcd65Smrg</para> 32889e7bcd65Smrg 32899e7bcd65Smrg<para> 32909e7bcd65SmrgGet_values_hook procedures may modify the data stored at the 32919e7bcd65Smrglocation addressed by the <emphasis remap='I'>value</emphasis> field, including (but not 32929e7bcd65Smrglimited to) making a copy of data whose resource representation is a 32939e7bcd65Smrgpointer. None of the Intrinsics-defined object classes copy 32949e7bcd65Smrgdata in this manner. Any operation that modifies the queried 32959e7bcd65Smrgobject resource may invalidate the pointed-to data. 32969e7bcd65Smrg</para> 32979e7bcd65Smrg 32989e7bcd65Smrg<para> 32999e7bcd65SmrgTo retrieve the current values of resources associated with a widget 33009e7bcd65Smrginstance using varargs lists, use 33019e7bcd65Smrg<xref linkend='XtVaGetValues' xrefstyle='select: title'/>. 33029e7bcd65Smrg</para> 33039e7bcd65Smrg 33049e7bcd65Smrg<funcsynopsis id='XtVaGetValues'> 33059e7bcd65Smrg<funcprototype> 33069e7bcd65Smrg<funcdef>void <function>XtVaGetValues</function></funcdef> 33079e7bcd65Smrg <paramdef>Widget <parameter>object</parameter></paramdef> 33089e7bcd65Smrg <paramdef><parameter>...</parameter></paramdef> 33099e7bcd65Smrg</funcprototype> 33109e7bcd65Smrg</funcsynopsis> 33119e7bcd65Smrg 33129e7bcd65Smrg<variablelist> 33139e7bcd65Smrg <varlistentry> 33149e7bcd65Smrg <term> 33159e7bcd65Smrg <emphasis remap='I'>object</emphasis> 33169e7bcd65Smrg </term> 33179e7bcd65Smrg <listitem> 33189e7bcd65Smrg <para> 33199e7bcd65SmrgSpecifies the object whose resource values are to be returned. Must be of class Object or any subclass thereof. 33209e7bcd65Smrg </para> 33219e7bcd65Smrg </listitem> 33229e7bcd65Smrg </varlistentry> 33239e7bcd65Smrg <varlistentry> 33249e7bcd65Smrg <term> 33259e7bcd65Smrg ... 33269e7bcd65Smrg </term> 33279e7bcd65Smrg <listitem> 33289e7bcd65Smrg <para> 33299e7bcd65SmrgSpecifies the variable argument list for the resources to 33309e7bcd65Smrgbe returned. 33319e7bcd65Smrg </para> 33329e7bcd65Smrg </listitem> 33339e7bcd65Smrg </varlistentry> 33349e7bcd65Smrg</variablelist> 33359e7bcd65Smrg 33369e7bcd65Smrg<para> 33379e7bcd65Smrg<xref linkend='XtVaGetValues' xrefstyle='select: title'/> 33389e7bcd65Smrgis identical in function to 33399e7bcd65Smrg<xref linkend='XtGetValues' xrefstyle='select: title'/> 33409e7bcd65Smrgwith the <emphasis remap='I'>args</emphasis> 33419e7bcd65Smrgand <emphasis remap='I'>num_args</emphasis> parameters replaced by a varargs list, as described in 33429e7bcd65SmrgSection 2.5.1. All value entries in the list must specify pointers to 33439e7bcd65Smrgstorage allocated by the caller to which the resource value will be 33449e7bcd65Smrgcopied. It is the caller's responsibility to ensure that sufficient 33459e7bcd65Smrgstorage is allocated. If 33469e7bcd65Smrg<function>XtVaTypedArg</function> 33479e7bcd65Smrgis specified, the <emphasis remap='I'>type</emphasis> argument 33489e7bcd65Smrgspecifies the representation desired by the caller and <emphasis remap='I'>the</emphasis> size argument 33499e7bcd65Smrgspecifies the number of bytes allocated to store the result of the 33509e7bcd65Smrgconversion. If the size is insufficient, a warning message is issued 33519e7bcd65Smrgand the list entry is skipped. 33529e7bcd65Smrg</para> 33539e7bcd65Smrg<sect3 id="Widget_Subpart_Resource_Data_The_get_values_hook_Procedure"> 33549e7bcd65Smrg<title>Widget Subpart Resource Data: The get_values_hook Procedure</title> 33559e7bcd65Smrg<para> 33569e7bcd65SmrgWidgets that have subparts can return resource values from them through 33579e7bcd65Smrg<xref linkend='XtGetValues' xrefstyle='select: title'/> 33589e7bcd65Smrgby supplying a get_values_hook procedure. 33599e7bcd65SmrgThe get_values_hook procedure pointer is of type 33609e7bcd65Smrg<xref linkend='XtArgsProc' xrefstyle='select: title'/>. 33619e7bcd65Smrg</para> 33629e7bcd65Smrg 33639e7bcd65Smrg<funcsynopsis id='_XtArgsProc'> 33649e7bcd65Smrg<funcprototype> 33659e7bcd65Smrg<funcdef>typedef void <function>(*XtArgsProc)</function></funcdef> 33669e7bcd65Smrg 33679e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 33689e7bcd65Smrg <paramdef>ArgList <parameter>args</parameter></paramdef> 33699e7bcd65Smrg <paramdef>Cardinal *<parameter>num_args</parameter></paramdef> 33709e7bcd65Smrg</funcprototype> 33719e7bcd65Smrg</funcsynopsis> 33729e7bcd65Smrg 33739e7bcd65Smrg<variablelist> 33749e7bcd65Smrg <varlistentry> 33759e7bcd65Smrg <term> 33769e7bcd65Smrg <emphasis remap='I'>w</emphasis> 33779e7bcd65Smrg </term> 33789e7bcd65Smrg <listitem> 33799e7bcd65Smrg <para> 33809e7bcd65SmrgSpecifies the widget whose subpart resource values are to be retrieved. 33819e7bcd65Smrg </para> 33829e7bcd65Smrg </listitem> 33839e7bcd65Smrg </varlistentry> 33849e7bcd65Smrg <varlistentry> 33859e7bcd65Smrg <term> 33869e7bcd65Smrg <emphasis remap='I'>args</emphasis> 33879e7bcd65Smrg </term> 33889e7bcd65Smrg <listitem> 33899e7bcd65Smrg <para> 33909e7bcd65SmrgSpecifies the argument list that was passed to 33919e7bcd65Smrg<xref linkend='XtGetValues' xrefstyle='select: title'/> 33929e7bcd65Smrgor the transformed varargs list passed to 33939e7bcd65Smrg<xref linkend='XtVaGetValues' xrefstyle='select: title'/>. 33949e7bcd65Smrg </para> 33959e7bcd65Smrg </listitem> 33969e7bcd65Smrg </varlistentry> 33979e7bcd65Smrg <varlistentry> 33989e7bcd65Smrg <term> 33999e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 34009e7bcd65Smrg </term> 34019e7bcd65Smrg <listitem> 34029e7bcd65Smrg <para> 34039e7bcd65SmrgSpecifies the number of entries in the argument list. 34049e7bcd65Smrg </para> 34059e7bcd65Smrg </listitem> 34069e7bcd65Smrg </varlistentry> 34079e7bcd65Smrg</variablelist> 34089e7bcd65Smrg 34099e7bcd65Smrg<para> 34109e7bcd65SmrgThe widget with subpart resources should call 34119e7bcd65Smrg<xref linkend='XtGetSubvalues' xrefstyle='select: title'/> 34129e7bcd65Smrgin the get_values_hook procedure 34139e7bcd65Smrgand pass in its subresource list and the <emphasis remap='I'>args</emphasis> and <emphasis remap='I'>num_args</emphasis> parameters. 34149e7bcd65Smrg</para> 34159e7bcd65Smrg</sect3> 34169e7bcd65Smrg<sect3 id="Widget_Subpart_State"> 34179e7bcd65Smrg<title>Widget Subpart State</title> 34189e7bcd65Smrg<para> 34199e7bcd65SmrgTo retrieve the current values of subpart resource data associated with a 34209e7bcd65Smrgwidget instance, use 34219e7bcd65Smrg<xref linkend='XtGetSubvalues' xrefstyle='select: title'/>. 34229e7bcd65SmrgFor a discussion of subpart resources, 34239e7bcd65Smrgsee <xref linkend='Subresources' />. 34249e7bcd65Smrg</para> 34259e7bcd65Smrg 34269e7bcd65Smrg<funcsynopsis id='XtGetSubvalues'> 34279e7bcd65Smrg<funcprototype> 34289e7bcd65Smrg<funcdef>void <function>XtGetSubvalues</function></funcdef> 34299e7bcd65Smrg <paramdef>XtPointer <parameter>base</parameter></paramdef> 34309e7bcd65Smrg <paramdef>XtResourceList <parameter>resources</parameter></paramdef> 34319e7bcd65Smrg <paramdef>Cardinal <parameter>num_resources</parameter></paramdef> 34329e7bcd65Smrg <paramdef>ArgList <parameter>args</parameter></paramdef> 34339e7bcd65Smrg <paramdef>Cardinal <parameter>num_args</parameter></paramdef> 34349e7bcd65Smrg</funcprototype> 34359e7bcd65Smrg</funcsynopsis> 34369e7bcd65Smrg 34379e7bcd65Smrg<variablelist> 34389e7bcd65Smrg <varlistentry> 34399e7bcd65Smrg <term> 34409e7bcd65Smrg <emphasis remap='I'>base</emphasis> 34419e7bcd65Smrg </term> 34429e7bcd65Smrg <listitem> 34439e7bcd65Smrg <para> 34449e7bcd65SmrgSpecifies the base address of the subpart data structure for which the 34459e7bcd65Smrgresources should be retrieved. 34469e7bcd65Smrg </para> 34479e7bcd65Smrg </listitem> 34489e7bcd65Smrg </varlistentry> 34499e7bcd65Smrg <varlistentry> 34509e7bcd65Smrg <term> 34519e7bcd65Smrg <emphasis remap='I'>resources</emphasis> 34529e7bcd65Smrg </term> 34539e7bcd65Smrg <listitem> 34549e7bcd65Smrg <para> 34559e7bcd65SmrgSpecifies the subpart resource list. 34569e7bcd65Smrg </para> 34579e7bcd65Smrg </listitem> 34589e7bcd65Smrg </varlistentry> 34599e7bcd65Smrg <varlistentry> 34609e7bcd65Smrg <term> 34619e7bcd65Smrg <emphasis remap='I'>num_resources</emphasis> 34629e7bcd65Smrg </term> 34639e7bcd65Smrg <listitem> 34649e7bcd65Smrg <para> 34659e7bcd65SmrgSpecifies the number of entries in the resource list. 34669e7bcd65Smrg </para> 34679e7bcd65Smrg </listitem> 34689e7bcd65Smrg </varlistentry> 34699e7bcd65Smrg <varlistentry> 34709e7bcd65Smrg <term> 34719e7bcd65Smrg <emphasis remap='I'>args</emphasis> 34729e7bcd65Smrg </term> 34739e7bcd65Smrg <listitem> 34749e7bcd65Smrg <para> 34759e7bcd65SmrgSpecifies the argument list of name/address pairs that contain the 34769e7bcd65Smrgresource names and the addresses into which the resource values are to 34779e7bcd65Smrgbe stored. 34789e7bcd65Smrg </para> 34799e7bcd65Smrg </listitem> 34809e7bcd65Smrg </varlistentry> 34819e7bcd65Smrg <varlistentry> 34829e7bcd65Smrg <term> 34839e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 34849e7bcd65Smrg </term> 34859e7bcd65Smrg <listitem> 34869e7bcd65Smrg <para> 34879e7bcd65SmrgSpecifies the number of entries in the argument list. 34889e7bcd65Smrg </para> 34899e7bcd65Smrg </listitem> 34909e7bcd65Smrg </varlistentry> 34919e7bcd65Smrg</variablelist> 34929e7bcd65Smrg 34939e7bcd65Smrg<para> 34949e7bcd65SmrgThe 34959e7bcd65Smrg<xref linkend='XtGetSubvalues' xrefstyle='select: title'/> 34969e7bcd65Smrgfunction obtains resource values from the structure identified by <emphasis remap='I'>base</emphasis>. 34979e7bcd65SmrgThe <emphasis remap='I'>value</emphasis> field in each argument entry must contain the address into 34989e7bcd65Smrgwhich to store the corresponding resource value. It is the caller's 34999e7bcd65Smrgresponsibility to allocate and deallocate this storage according to 35009e7bcd65Smrgthe size of the resource representation type used within the subpart. 35019e7bcd65SmrgIf the argument list contains a resource name that is not found in the 35029e7bcd65Smrgresource list, the value at the corresponding address is not modified. 35039e7bcd65Smrg</para> 35049e7bcd65Smrg 35059e7bcd65Smrg<para> 35069e7bcd65SmrgTo retrieve the current values of subpart resources associated with 35079e7bcd65Smrga widget instance using varargs lists, use 35089e7bcd65Smrg<xref linkend='XtVaGetSubvalues' xrefstyle='select: title'/>. 35099e7bcd65Smrg</para> 35109e7bcd65Smrg 35119e7bcd65Smrg<funcsynopsis id='XtVaGetSubvalues'> 35129e7bcd65Smrg<funcprototype> 35139e7bcd65Smrg<funcdef>void <function>XtVaGetSubvalues</function></funcdef> 35149e7bcd65Smrg <paramdef>XtPointer <parameter>base</parameter></paramdef> 35159e7bcd65Smrg <paramdef>XtResourceList <parameter>resources</parameter></paramdef> 35169e7bcd65Smrg <paramdef>Cardinal <parameter>num_resources</parameter></paramdef> 35179e7bcd65Smrg <paramdef> <parameter>...</parameter></paramdef> 35189e7bcd65Smrg</funcprototype> 35199e7bcd65Smrg</funcsynopsis> 35209e7bcd65Smrg 35219e7bcd65Smrg<variablelist> 35229e7bcd65Smrg <varlistentry> 35239e7bcd65Smrg <term> 35249e7bcd65Smrg <emphasis remap='I'>base</emphasis> 35259e7bcd65Smrg </term> 35269e7bcd65Smrg <listitem> 35279e7bcd65Smrg <para> 35289e7bcd65SmrgSpecifies the base address of the subpart data structure for which the 35299e7bcd65Smrgresources should be retrieved. 35309e7bcd65Smrg </para> 35319e7bcd65Smrg </listitem> 35329e7bcd65Smrg </varlistentry> 35339e7bcd65Smrg <varlistentry> 35349e7bcd65Smrg <term> 35359e7bcd65Smrg <emphasis remap='I'>resources</emphasis> 35369e7bcd65Smrg </term> 35379e7bcd65Smrg <listitem> 35389e7bcd65Smrg <para> 35399e7bcd65SmrgSpecifies the subpart resource list. 35409e7bcd65Smrg </para> 35419e7bcd65Smrg </listitem> 35429e7bcd65Smrg </varlistentry> 35439e7bcd65Smrg <varlistentry> 35449e7bcd65Smrg <term> 35459e7bcd65Smrg <emphasis remap='I'>num_resources</emphasis> 35469e7bcd65Smrg </term> 35479e7bcd65Smrg <listitem> 35489e7bcd65Smrg <para> 35499e7bcd65SmrgSpecifies the number of entries in the resource list. 35509e7bcd65Smrg </para> 35519e7bcd65Smrg </listitem> 35529e7bcd65Smrg </varlistentry> 35539e7bcd65Smrg <varlistentry> 35549e7bcd65Smrg <term> 35559e7bcd65Smrg ... 35569e7bcd65Smrg </term> 35579e7bcd65Smrg <listitem> 35589e7bcd65Smrg <para> 35599e7bcd65SmrgSpecifies a variable argument list of name/address pairs that 35609e7bcd65Smrgcontain the resource names and the addresses into which the resource 35619e7bcd65Smrgvalues are to be stored. 35629e7bcd65Smrg </para> 35639e7bcd65Smrg </listitem> 35649e7bcd65Smrg </varlistentry> 35659e7bcd65Smrg</variablelist> 35669e7bcd65Smrg 35679e7bcd65Smrg<para> 35689e7bcd65Smrg<xref linkend='XtVaGetSubvalues' xrefstyle='select: title'/> 35699e7bcd65Smrgis identical in function to 35709e7bcd65Smrg<xref linkend='XtGetSubvalues' xrefstyle='select: title'/> 35719e7bcd65Smrgwith the 35729e7bcd65Smrg<emphasis remap='I'>args</emphasis> and <emphasis remap='I'>num_args</emphasis> parameters replaced by a varargs list, as described 35739e7bcd65Smrgin Section 2.5.1. 35749e7bcd65Smrg<function>XtVaTypedArg</function> 35759e7bcd65Smrgis not supported for 35769e7bcd65Smrg<xref linkend='XtVaGetSubvalues' xrefstyle='select: title'/>. 35779e7bcd65SmrgIf 35789e7bcd65Smrg<function>XtVaTypedArg</function> 35799e7bcd65Smrgis specified in the list, a warning message is issued 35809e7bcd65Smrgand the entry is then ignored. 35819e7bcd65Smrg</para> 35829e7bcd65Smrg</sect3> 35839e7bcd65Smrg</sect2> 35849e7bcd65Smrg 35859e7bcd65Smrg<sect2 id="Setting_Widget_State"> 35869e7bcd65Smrg<title>Setting Widget State</title> 35879e7bcd65Smrg<para> 35889e7bcd65SmrgTo modify the current values of resources associated with a widget 35899e7bcd65Smrginstance, use 35909e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/>. 35919e7bcd65Smrg</para> 35929e7bcd65Smrg 35939e7bcd65Smrg<funcsynopsis id='XtSetValues'> 35949e7bcd65Smrg<funcprototype> 35959e7bcd65Smrg<funcdef>void <function>XtSetValues</function></funcdef> 35969e7bcd65Smrg <paramdef>Widget <parameter>object</parameter></paramdef> 35979e7bcd65Smrg <paramdef>ArgList <parameter>args</parameter></paramdef> 35989e7bcd65Smrg <paramdef>Cardinal <parameter>num_args</parameter></paramdef> 35999e7bcd65Smrg</funcprototype> 36009e7bcd65Smrg</funcsynopsis> 36019e7bcd65Smrg 36029e7bcd65Smrg<variablelist> 36039e7bcd65Smrg <varlistentry> 36049e7bcd65Smrg <term> 36059e7bcd65Smrg <emphasis remap='I'>object</emphasis> 36069e7bcd65Smrg </term> 36079e7bcd65Smrg <listitem> 36089e7bcd65Smrg <para> 36099e7bcd65SmrgSpecifies the object whose resources are to be modified. Must be of class Object or any subclass thereof. 36109e7bcd65Smrg </para> 36119e7bcd65Smrg </listitem> 36129e7bcd65Smrg </varlistentry> 36139e7bcd65Smrg <varlistentry> 36149e7bcd65Smrg <term> 36159e7bcd65Smrg <emphasis remap='I'>args</emphasis> 36169e7bcd65Smrg </term> 36179e7bcd65Smrg <listitem> 36189e7bcd65Smrg <para> 36199e7bcd65SmrgSpecifies the argument list of name/value pairs that contain the 36209e7bcd65Smrgresources to be modified and their new values. 36219e7bcd65Smrg </para> 36229e7bcd65Smrg </listitem> 36239e7bcd65Smrg </varlistentry> 36249e7bcd65Smrg <varlistentry> 36259e7bcd65Smrg <term> 36269e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 36279e7bcd65Smrg </term> 36289e7bcd65Smrg <listitem> 36299e7bcd65Smrg <para> 36309e7bcd65SmrgSpecifies the number of entries in the argument list. 36319e7bcd65Smrg </para> 36329e7bcd65Smrg </listitem> 36339e7bcd65Smrg </varlistentry> 36349e7bcd65Smrg</variablelist> 36359e7bcd65Smrg 36369e7bcd65Smrg<para> 36379e7bcd65SmrgThe 36389e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 36399e7bcd65Smrgfunction starts with the resources specified for the 36409e7bcd65SmrgObject 36419e7bcd65Smrgclass fields and proceeds down the subclass chain to the object. 36429e7bcd65SmrgAt each stage, it replaces the <emphasis remap='I'>object</emphasis> resource fields with any values 36439e7bcd65Smrgspecified in the argument list. 36449e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 36459e7bcd65Smrgthen calls the set_values procedures for the object in superclass-to-subclass 36469e7bcd65Smrgorder. 36479e7bcd65SmrgIf the object has any non-NULL <emphasis remap='I'>set_values_hook</emphasis> fields, 36489e7bcd65Smrgthese are called immediately after the 36499e7bcd65Smrgcorresponding set_values procedure. 36509e7bcd65SmrgThis procedure permits subclasses to set subpart data via 36519e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/>. 36529e7bcd65Smrg</para> 36539e7bcd65Smrg 36549e7bcd65Smrg<para> 36559e7bcd65SmrgIf the class of the object's parent is a subclass of 36569e7bcd65Smrg<function>constraintWidgetClass</function>, 36579e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 36589e7bcd65Smrgalso updates the object's constraints. 36599e7bcd65SmrgIt starts with the constraint resources specified for 36609e7bcd65Smrg<function>constraintWidgetClass</function> 36619e7bcd65Smrgand proceeds down the subclass chain to the parent's class. 36629e7bcd65SmrgAt each stage, it replaces the constraint resource fields with any 36639e7bcd65Smrgvalues specified in the argument list. 36649e7bcd65SmrgIt then calls the constraint set_values procedures from 36659e7bcd65Smrg<function>constraintWidgetClass</function> 36669e7bcd65Smrgdown to the parent's class. 36679e7bcd65SmrgThe constraint set_values procedures are called with widget arguments, 36689e7bcd65Smrgas for all set_values procedures, not just the constraint records, 36699e7bcd65Smrgso that they can make adjustments to the desired values based 36709e7bcd65Smrgon full information about the widget. Any arguments specified that 36719e7bcd65Smrgdo not match a resource list entry are silently ignored. 36729e7bcd65Smrg</para> 36739e7bcd65Smrg 36749e7bcd65Smrg<para> 36759e7bcd65SmrgIf the object is of a subclass of 36769e7bcd65SmrgRectObj, 36779e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 36789e7bcd65Smrgdetermines if a geometry request is needed by comparing the old object to 36799e7bcd65Smrgthe new object. 36809e7bcd65SmrgIf any geometry changes are required, 36819e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 36829e7bcd65Smrgrestores the original geometry and makes the request on behalf of the widget. 36839e7bcd65SmrgIf the geometry manager returns 36849e7bcd65Smrg<function>XtGeometryYes</function>, 36859e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 36869e7bcd65Smrgcalls the object's resize procedure. 36879e7bcd65SmrgIf the geometry manager returns 36889e7bcd65Smrg<function>XtGeometryDone</function>, 36899e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 36909e7bcd65Smrgcontinues, as the object's resize procedure should have been called 36919e7bcd65Smrgby the geometry manager. 36929e7bcd65SmrgIf the geometry manager returns 36939e7bcd65Smrg<function>XtGeometryNo</function>, 36949e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 36959e7bcd65Smrgignores the geometry request and continues. 36969e7bcd65SmrgIf the geometry manager returns 36979e7bcd65Smrg<function>XtGeometryAlmost</function>, 36989e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 36999e7bcd65Smrgcalls the set_values_almost procedure, 37009e7bcd65Smrgwhich determines what should be done. 37019e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 37029e7bcd65Smrgthen repeats this process, 37039e7bcd65Smrgdeciding once more whether the geometry manager should be called. 37049e7bcd65Smrg</para> 37059e7bcd65Smrg 37069e7bcd65Smrg<para> 37079e7bcd65SmrgFinally, if any of the set_values procedures returned 37089e7bcd65Smrg<function>True</function>, 37099e7bcd65Smrgand the widget is realized, 37109e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 37119e7bcd65Smrgcauses the widget's expose procedure to be invoked by calling 37129e7bcd65Smrg<function>XClearArea</function> 37139e7bcd65Smrgon the widget's window. 37149e7bcd65Smrg</para> 37159e7bcd65Smrg 37169e7bcd65Smrg<para> 37179e7bcd65SmrgTo modify the current values of resources associated with a widget 37189e7bcd65Smrginstance using varargs lists, use 37199e7bcd65Smrg<xref linkend='XtVaSetValues' xrefstyle='select: title'/>. 37209e7bcd65Smrg</para> 37219e7bcd65Smrg 37229e7bcd65Smrg<funcsynopsis id='XtVaSetValues'> 37239e7bcd65Smrg<funcprototype> 37249e7bcd65Smrg<funcdef>void <function>XtVaSetValues</function></funcdef> 37259e7bcd65Smrg <paramdef>Widget <parameter>object</parameter></paramdef> 37269e7bcd65Smrg <paramdef> <parameter>...</parameter></paramdef> 37279e7bcd65Smrg</funcprototype> 37289e7bcd65Smrg</funcsynopsis> 37299e7bcd65Smrg 37309e7bcd65Smrg<variablelist> 37319e7bcd65Smrg <varlistentry> 37329e7bcd65Smrg <term> 37339e7bcd65Smrg <emphasis remap='I'>object</emphasis> 37349e7bcd65Smrg </term> 37359e7bcd65Smrg <listitem> 37369e7bcd65Smrg <para> 37379e7bcd65SmrgSpecifies the object whose resources are to be modified. Must be of class Object or any subclass thereof. 37389e7bcd65Smrg </para> 37399e7bcd65Smrg </listitem> 37409e7bcd65Smrg </varlistentry> 37419e7bcd65Smrg <varlistentry> 37429e7bcd65Smrg <term> 37439e7bcd65Smrg ... 37449e7bcd65Smrg </term> 37459e7bcd65Smrg <listitem> 37469e7bcd65Smrg <para> 37479e7bcd65SmrgSpecifies the variable argument list of name/value pairs that 37489e7bcd65Smrgcontain the resources to be modified and their new values. 37499e7bcd65Smrg </para> 37509e7bcd65Smrg </listitem> 37519e7bcd65Smrg </varlistentry> 37529e7bcd65Smrg</variablelist> 37539e7bcd65Smrg 37549e7bcd65Smrg<para> 37559e7bcd65Smrg<xref linkend='XtVaSetValues' xrefstyle='select: title'/> 37569e7bcd65Smrgis identical in function to 37579e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 37589e7bcd65Smrgwith the <emphasis remap='I'>args</emphasis> and <emphasis remap='I'>num_args</emphasis> parameters replaced by a varargs list, as 37599e7bcd65Smrgdescribed in Section 2.5.1. 37609e7bcd65Smrg</para> 37619e7bcd65Smrg<sect3 id="Widget_State_The_set_values_Procedure"> 37629e7bcd65Smrg<title>Widget State: The set_values Procedure</title> 37639e7bcd65Smrg<para> 37649e7bcd65SmrgThe set_values procedure pointer in a widget class is of type 37659e7bcd65Smrg<xref linkend='XtSetValuesFunc' xrefstyle='select: title'/>. 37669e7bcd65Smrg</para> 37679e7bcd65Smrg 37689e7bcd65Smrg<funcsynopsis id='XtSetValuesFunc'> 37699e7bcd65Smrg<funcprototype> 37709e7bcd65Smrg<funcdef>typedef Boolean <function>(*XtSetValuesFunc)</function></funcdef> 37719e7bcd65Smrg 37729e7bcd65Smrg <paramdef>Widget <parameter>current</parameter></paramdef> 37739e7bcd65Smrg <paramdef>Widget <parameter>request</parameter></paramdef> 37749e7bcd65Smrg <paramdef>Widget <parameter>new</parameter></paramdef> 37759e7bcd65Smrg <paramdef>ArgList <parameter>args</parameter></paramdef> 37769e7bcd65Smrg <paramdef>Cardinal *<parameter>num_args</parameter></paramdef> 37779e7bcd65Smrg</funcprototype> 37789e7bcd65Smrg</funcsynopsis> 37799e7bcd65Smrg 37809e7bcd65Smrg<variablelist> 37819e7bcd65Smrg <varlistentry> 37829e7bcd65Smrg <term> 37839e7bcd65Smrg <emphasis remap='I'>current</emphasis> 37849e7bcd65Smrg </term> 37859e7bcd65Smrg <listitem> 37869e7bcd65Smrg <para> 37879e7bcd65SmrgSpecifies a copy of the widget as it was before the 37889e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 37899e7bcd65Smrgcall. 37909e7bcd65Smrg </para> 37919e7bcd65Smrg </listitem> 37929e7bcd65Smrg </varlistentry> 37939e7bcd65Smrg <varlistentry> 37949e7bcd65Smrg <term> 37959e7bcd65Smrg <emphasis remap='I'>request</emphasis> 37969e7bcd65Smrg </term> 37979e7bcd65Smrg <listitem> 37989e7bcd65Smrg <para> 37999e7bcd65SmrgSpecifies a copy of the widget with all values changed as asked for by the 38009e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 38019e7bcd65Smrgcall before any class set_values procedures have been called. 38029e7bcd65Smrg </para> 38039e7bcd65Smrg </listitem> 38049e7bcd65Smrg </varlistentry> 38059e7bcd65Smrg <varlistentry> 38069e7bcd65Smrg <term> 38079e7bcd65Smrg <emphasis remap='I'>new</emphasis> 38089e7bcd65Smrg </term> 38099e7bcd65Smrg <listitem> 38109e7bcd65Smrg <para> 38119e7bcd65SmrgSpecifies the widget with the new values that are actually allowed. 38129e7bcd65Smrg </para> 38139e7bcd65Smrg </listitem> 38149e7bcd65Smrg </varlistentry> 38159e7bcd65Smrg <varlistentry> 38169e7bcd65Smrg <term> 38179e7bcd65Smrg <emphasis remap='I'>args</emphasis> 38189e7bcd65Smrg </term> 38199e7bcd65Smrg <listitem> 38209e7bcd65Smrg <para> 38219e7bcd65SmrgSpecifies the argument list passed to 38229e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 38239e7bcd65Smrgor the transformed argument list passed to 38249e7bcd65Smrg<xref linkend='XtVaSetValues' xrefstyle='select: title'/>. 38259e7bcd65Smrg </para> 38269e7bcd65Smrg </listitem> 38279e7bcd65Smrg </varlistentry> 38289e7bcd65Smrg <varlistentry> 38299e7bcd65Smrg <term> 38309e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 38319e7bcd65Smrg </term> 38329e7bcd65Smrg <listitem> 38339e7bcd65Smrg <para> 38349e7bcd65SmrgSpecifies the number of entries in the argument list. 38359e7bcd65Smrg </para> 38369e7bcd65Smrg </listitem> 38379e7bcd65Smrg </varlistentry> 38389e7bcd65Smrg</variablelist> 38399e7bcd65Smrg 38409e7bcd65Smrg<para> 38419e7bcd65SmrgThe set_values procedure should recompute any field 38429e7bcd65Smrgderived from resources that are changed 38439e7bcd65Smrg(for example, many GCs depend on foreground and background pixels). 38449e7bcd65SmrgIf no recomputation is necessary, and if none of the resources specific to a 38459e7bcd65Smrgsubclass require the window to be redisplayed when their values are changed, 38469e7bcd65Smrgyou can specify NULL for the <emphasis remap='I'>set_values</emphasis> field in the class record. 38479e7bcd65Smrg</para> 38489e7bcd65Smrg 38499e7bcd65Smrg<para> 38509e7bcd65SmrgLike the initialize procedure, 38519e7bcd65Smrgset_values mostly deals only with the fields defined in the subclass, 38529e7bcd65Smrgbut it has to resolve conflicts with its superclass, 38539e7bcd65Smrgespecially conflicts over width and height. 38549e7bcd65Smrg</para> 38559e7bcd65Smrg 38569e7bcd65Smrg<para> 38579e7bcd65SmrgSometimes a subclass may want to overwrite values filled in by its 38589e7bcd65Smrgsuperclass. 38599e7bcd65SmrgIn particular, size calculations of a superclass are often 38609e7bcd65Smrgincorrect for a subclass, and, in this case, 38619e7bcd65Smrgthe subclass must modify or recalculate fields declared 38629e7bcd65Smrgand computed by its superclass. 38639e7bcd65Smrg</para> 38649e7bcd65Smrg 38659e7bcd65Smrg<para> 38669e7bcd65SmrgAs an example, 38679e7bcd65Smrga subclass can visually surround its superclass display. 38689e7bcd65SmrgIn this case, the width and height calculated by the superclass set_values 38699e7bcd65Smrgprocedure are too small and need to be incremented by the size of the surround. 38709e7bcd65SmrgThe subclass needs to know if its superclass's size was calculated by the 38719e7bcd65Smrgsuperclass or was specified explicitly. 38729e7bcd65SmrgAll widgets must place themselves into whatever size is explicitly given, 38739e7bcd65Smrgbut they should compute a reasonable size if no size is requested. 38749e7bcd65SmrgHow does a subclass know the difference between a specified size 38759e7bcd65Smrgand a size computed by a superclass? 38769e7bcd65Smrg</para> 38779e7bcd65Smrg 38789e7bcd65Smrg<para> 38799e7bcd65SmrgThe <emphasis remap='I'>request</emphasis> and <emphasis remap='I'>new</emphasis> parameters provide the necessary information. 38809e7bcd65SmrgThe <emphasis remap='I'>request</emphasis> widget is a copy of the widget, updated as originally requested. 38819e7bcd65SmrgThe <emphasis remap='I'>new</emphasis> widget starts with the values in the request, 38829e7bcd65Smrgbut it has additionally been updated by all superclass set_values 38839e7bcd65Smrgprocedures called so far. 38849e7bcd65SmrgA subclass set_values procedure can compare these two to resolve 38859e7bcd65Smrgany potential conflicts. 38869e7bcd65SmrgThe set_values procedure need not refer to the <emphasis remap='I'>request</emphasis> widget 38879e7bcd65Smrgunless it must resolve conflicts between the <emphasis remap='I'>current</emphasis> and <emphasis remap='I'>new</emphasis> widgets. 38889e7bcd65SmrgAny changes the widget needs to make, including geometry changes, 38899e7bcd65Smrgshould be made in the <emphasis remap='I'>new</emphasis> widget. 38909e7bcd65Smrg</para> 38919e7bcd65Smrg 38929e7bcd65Smrg<para> 38939e7bcd65SmrgIn the above example, 38949e7bcd65Smrgthe subclass with the visual surround can see 38959e7bcd65Smrgif the <emphasis remap='I'>width</emphasis> and <emphasis remap='I'>height</emphasis> in the <emphasis remap='I'>request</emphasis> widget are zero. 38969e7bcd65SmrgIf so, 38979e7bcd65Smrgit adds its surround size to the <emphasis remap='I'>width</emphasis> and 38989e7bcd65Smrg<emphasis remap='I'>height</emphasis> fields in the <emphasis remap='I'>new</emphasis> widget. 38999e7bcd65SmrgIf not, it must make do with the size originally specified. 39009e7bcd65SmrgIn this case, zero is a special value defined by the class to permit 39019e7bcd65Smrgthe application to invoke this behavior. 39029e7bcd65Smrg</para> 39039e7bcd65Smrg 39049e7bcd65Smrg<para> 39059e7bcd65SmrgThe <emphasis remap='I'>new</emphasis> widget is the actual widget instance record. 39069e7bcd65SmrgTherefore, 39079e7bcd65Smrgthe set_values procedure should do all its work on the <emphasis remap='I'>new</emphasis> widget; 39089e7bcd65Smrgthe <emphasis remap='I'>request</emphasis> widget should never be modified. 39099e7bcd65SmrgIf the set_values procedure needs to call any routines that operate on 39109e7bcd65Smrga widget, it should specify <emphasis remap='I'>new</emphasis> as the widget instance. 39119e7bcd65Smrg</para> 39129e7bcd65Smrg 39139e7bcd65Smrg<para> 39149e7bcd65SmrgBefore calling the set_values procedures, the Intrinsics modify the 39159e7bcd65Smrgresources of the <emphasis remap='I'>request</emphasis> widget according to the contents of the arglist; 39169e7bcd65Smrgif the widget names all its resources in the class resource list, it is 39179e7bcd65Smrgnever necessary to examine the contents of <emphasis remap='I'>args</emphasis>. 39189e7bcd65Smrg</para> 39199e7bcd65Smrg 39209e7bcd65Smrg<para> 39219e7bcd65SmrgFinally, the set_values procedure must return a Boolean that indicates whether 39229e7bcd65Smrgthe widget needs to be redisplayed. 39239e7bcd65SmrgNote that a change in the geometry fields alone does not require 39249e7bcd65Smrgthe set_values procedure to return 39259e7bcd65Smrg<function>True</function>; 39269e7bcd65Smrgthe X server will eventually generate an 39279e7bcd65Smrg<function>Expose</function> 39289e7bcd65Smrgevent, if necessary. 39299e7bcd65SmrgAfter calling all the set_values procedures, 39309e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 39319e7bcd65Smrgforces a redisplay by calling 39329e7bcd65Smrg<function>XClearArea</function> 39339e7bcd65Smrgif any of the set_values procedures returned 39349e7bcd65Smrg<function>True</function>. 39359e7bcd65SmrgTherefore, a set_values procedure should not try to do its own redisplaying. 39369e7bcd65Smrg</para> 39379e7bcd65Smrg 39389e7bcd65Smrg<para> 39399e7bcd65SmrgSet_values procedures should not do any work in response to changes in 39409e7bcd65Smrggeometry because 39419e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 39429e7bcd65Smrgeventually will perform a geometry request, and that request might be denied. 39439e7bcd65SmrgIf the widget actually changes size in response to a 39449e7bcd65Smrgcall to 39459e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/>, 39469e7bcd65Smrgits resize procedure is called. 39479e7bcd65SmrgWidgets should do any geometry-related work in their resize procedure. 39489e7bcd65Smrg</para> 39499e7bcd65Smrg 39509e7bcd65Smrg<para> 39519e7bcd65SmrgNote that it is permissible to call 39529e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 39539e7bcd65Smrgbefore a widget is realized. 39549e7bcd65SmrgTherefore, the set_values procedure must not assume that the widget is realized. 39559e7bcd65Smrg</para> 39569e7bcd65Smrg</sect3> 39579e7bcd65Smrg<sect3 id="Widget_State_The_set_values_almost_Procedure"> 39589e7bcd65Smrg<title>Widget State: The set_values_almost Procedure</title> 39599e7bcd65Smrg<para> 39609e7bcd65SmrgThe set_values_almost procedure pointer in the widget class record is of type 39619e7bcd65Smrg<xref linkend='XtAlmostProc' xrefstyle='select: title'/>. 39629e7bcd65Smrg</para> 39639e7bcd65Smrg 39649e7bcd65Smrg<funcsynopsis id='XtAlmostProc'> 39659e7bcd65Smrg<funcprototype> 39669e7bcd65Smrg<funcdef>typedef void <function>(*XtAlmostProc)</function></funcdef> 39679e7bcd65Smrg 39689e7bcd65Smrg <paramdef>Widget <parameter>old</parameter></paramdef> 39699e7bcd65Smrg <paramdef>Widget <parameter>new</parameter></paramdef> 39709e7bcd65Smrg <paramdef>XtWidgetGeometry *<parameter>request</parameter></paramdef> 39719e7bcd65Smrg <paramdef>XtWidgetGeometry *<parameter>reply</parameter></paramdef> 39729e7bcd65Smrg</funcprototype> 39739e7bcd65Smrg</funcsynopsis> 39749e7bcd65Smrg 39759e7bcd65Smrg<variablelist> 39769e7bcd65Smrg <varlistentry> 39779e7bcd65Smrg <term> 39789e7bcd65Smrg <emphasis remap='I'>old</emphasis> 39799e7bcd65Smrg </term> 39809e7bcd65Smrg <listitem> 39819e7bcd65Smrg <para> 39829e7bcd65SmrgSpecifies a copy of the object as it was before the 39839e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 39849e7bcd65Smrgcall. 39859e7bcd65Smrg </para> 39869e7bcd65Smrg </listitem> 39879e7bcd65Smrg </varlistentry> 39889e7bcd65Smrg <varlistentry> 39899e7bcd65Smrg <term> 39909e7bcd65Smrg <emphasis remap='I'>new</emphasis> 39919e7bcd65Smrg </term> 39929e7bcd65Smrg <listitem> 39939e7bcd65Smrg <para> 39949e7bcd65SmrgSpecifies the object instance record. 39959e7bcd65Smrg </para> 39969e7bcd65Smrg </listitem> 39979e7bcd65Smrg </varlistentry> 39989e7bcd65Smrg <varlistentry> 39999e7bcd65Smrg <term> 40009e7bcd65Smrg <emphasis remap='I'>request</emphasis> 40019e7bcd65Smrg </term> 40029e7bcd65Smrg <listitem> 40039e7bcd65Smrg <para> 40049e7bcd65SmrgSpecifies the original geometry request that was sent to the geometry 40059e7bcd65Smrgmanager that caused 40069e7bcd65Smrg<function>XtGeometryAlmost</function> 40079e7bcd65Smrgto be returned. 40089e7bcd65Smrg </para> 40099e7bcd65Smrg </listitem> 40109e7bcd65Smrg </varlistentry> 40119e7bcd65Smrg <varlistentry> 40129e7bcd65Smrg <term> 40139e7bcd65Smrg <emphasis remap='I'>reply</emphasis> 40149e7bcd65Smrg </term> 40159e7bcd65Smrg <listitem> 40169e7bcd65Smrg <para> 40179e7bcd65SmrgSpecifies the compromise geometry that was returned by the geometry 40189e7bcd65Smrgmanager with 40199e7bcd65Smrg<function>XtGeometryAlmost</function>. 40209e7bcd65Smrg </para> 40219e7bcd65Smrg </listitem> 40229e7bcd65Smrg </varlistentry> 40239e7bcd65Smrg</variablelist> 40249e7bcd65Smrg 40259e7bcd65Smrg<para> 40269e7bcd65SmrgMost classes inherit the set_values_almost procedure from their superclass by 40279e7bcd65Smrgspecifying 40289e7bcd65Smrg<function>XtInheritSetValuesAlmost</function> 40299e7bcd65Smrgin the class initialization. 40309e7bcd65SmrgThe 40319e7bcd65Smrgset_values_almost procedure in 40329e7bcd65Smrg<function>rectObjClass</function> 40339e7bcd65Smrgaccepts the compromise suggested. 40349e7bcd65Smrg</para> 40359e7bcd65Smrg 40369e7bcd65Smrg<para> 40379e7bcd65SmrgThe set_values_almost procedure is called when a client tries to set a widget's 40389e7bcd65Smrggeometry by means of a call to 40399e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 40409e7bcd65Smrgand the geometry manager cannot 40419e7bcd65Smrgsatisfy the request but instead returns 40429e7bcd65Smrg<function>XtGeometryNo</function> 40439e7bcd65Smrgor 40449e7bcd65Smrg<function>XtGeometryAlmost</function> 40459e7bcd65Smrgand a compromise geometry. 40469e7bcd65SmrgThe <emphasis remap='I'>new</emphasis> object is the actual instance record. The <emphasis remap='I'>x</emphasis>, <emphasis remap='I'>y</emphasis>, 40479e7bcd65Smrg<emphasis remap='I'>width</emphasis>, <emphasis remap='I'>height</emphasis>, 40489e7bcd65Smrgand <emphasis remap='I'>border_width</emphasis> fields contain the original values as they were 40499e7bcd65Smrgbefore the 40509e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 40519e7bcd65Smrgcall, and all other fields contain the new 40529e7bcd65Smrgvalues. The <emphasis remap='I'>request</emphasis> parameter contains the new geometry request that 40539e7bcd65Smrgwas made to the parent. The <emphasis remap='I'>reply</emphasis> parameter contains 40549e7bcd65Smrg<emphasis remap='I'>reply->request_mode</emphasis> equal to zero if the parent returned 40559e7bcd65Smrg<function>XtGeometryNo</function> 40569e7bcd65Smrgand contains the parent's compromise geometry otherwise. The 40579e7bcd65Smrgset_values_almost procedure takes the original geometry and the 40589e7bcd65Smrgcompromise geometry and determines if the compromise is 40599e7bcd65Smrgacceptable or whether 40609e7bcd65Smrgto try a different compromise. 40619e7bcd65SmrgIt returns its results in the <emphasis remap='I'>request</emphasis> parameter, 40629e7bcd65Smrgwhich is then sent back to the geometry manager for another try. 40639e7bcd65SmrgTo accept the compromise, the procedure must copy the contents 40649e7bcd65Smrgof the <emphasis remap='I'>reply</emphasis> geometry into the <emphasis remap='I'>request</emphasis> geometry; to attempt an 40659e7bcd65Smrgalternative geometry, the procedure may modify any part of the <emphasis remap='I'>request</emphasis> 40669e7bcd65Smrgargument; to terminate the geometry negotiation and retain the 40679e7bcd65Smrgoriginal geometry, the procedure must set <emphasis remap='I'>request->request_mode</emphasis> to 40689e7bcd65Smrgzero. The geometry fields of the <emphasis remap='I'>old</emphasis> and <emphasis remap='I'>new</emphasis> instances must not be modified 40699e7bcd65Smrgdirectly. 40709e7bcd65Smrg</para> 40719e7bcd65Smrg</sect3> 40729e7bcd65Smrg<sect3 id="Widget_State_The_ConstraintClassPart_set_values_Procedure"> 40739e7bcd65Smrg<title>Widget State: The ConstraintClassPart set_values Procedure</title> 40749e7bcd65Smrg<para> 40759e7bcd65SmrgThe constraint set_values procedure pointer is of type 40769e7bcd65Smrg<xref linkend='XtSetValuesFunc' xrefstyle='select: title'/>. 40779e7bcd65SmrgThe values passed to the parent's constraint set_values procedure 40789e7bcd65Smrgare the same as those passed to the child's class 40799e7bcd65Smrgset_values procedure. 40809e7bcd65SmrgA class can specify NULL for the <emphasis remap='I'>set_values</emphasis> field of the 40819e7bcd65Smrg<function>ConstraintPart</function> 40829e7bcd65Smrgif it need not compute anything. 40839e7bcd65Smrg</para> 40849e7bcd65Smrg 40859e7bcd65Smrg<para> 40869e7bcd65SmrgThe constraint set_values procedure should recompute any constraint fields 40879e7bcd65Smrgderived from constraint resources that are changed. 40889e7bcd65SmrgFurthermore, it may modify other widget fields as appropriate. 40899e7bcd65SmrgFor example, if a constraint for the maximum height of a widget is changed 40909e7bcd65Smrgto a value smaller than the widget's current height, 40919e7bcd65Smrgthe constraint set_values procedure may reset the <emphasis remap='I'>height</emphasis> field in the 40929e7bcd65Smrgwidget. 40939e7bcd65Smrg</para> 40949e7bcd65Smrg</sect3> 40959e7bcd65Smrg<sect3 id='Widget_Subpart_State_2'> 40969e7bcd65Smrg<title>Widget Subpart State</title> 40979e7bcd65Smrg<para> 40989e7bcd65SmrgTo set the current values of subpart resources associated with a 40999e7bcd65Smrgwidget instance, use 41009e7bcd65Smrg<xref linkend='XtSetSubvalues' xrefstyle='select: title'/>. 41019e7bcd65SmrgFor a discussion of subpart resources, 41029e7bcd65Smrgsee <xref linkend='Subresources' />. 41039e7bcd65Smrg</para> 41049e7bcd65Smrg 41059e7bcd65Smrg<funcsynopsis id='XtSetSubvalues'> 41069e7bcd65Smrg<funcprototype> 41079e7bcd65Smrg<funcdef>void <function>XtSetSubvalues</function></funcdef> 41089e7bcd65Smrg <paramdef>XtPointer <parameter>base</parameter></paramdef> 41099e7bcd65Smrg <paramdef>XtResourceList <parameter>resources</parameter></paramdef> 41109e7bcd65Smrg <paramdef>Cardinal <parameter>num_resources</parameter></paramdef> 41119e7bcd65Smrg <paramdef>ArgList <parameter>args</parameter></paramdef> 41129e7bcd65Smrg <paramdef>Cardinal <parameter>num_args</parameter></paramdef> 41139e7bcd65Smrg</funcprototype> 41149e7bcd65Smrg</funcsynopsis> 41159e7bcd65Smrg 41169e7bcd65Smrg<variablelist> 41179e7bcd65Smrg <varlistentry> 41189e7bcd65Smrg <term> 41199e7bcd65Smrg <emphasis remap='I'>base</emphasis> 41209e7bcd65Smrg </term> 41219e7bcd65Smrg <listitem> 41229e7bcd65Smrg <para> 41239e7bcd65SmrgSpecifies the base address of the subpart data structure into which the 41249e7bcd65Smrgresources should be written. 41259e7bcd65Smrg </para> 41269e7bcd65Smrg </listitem> 41279e7bcd65Smrg </varlistentry> 41289e7bcd65Smrg <varlistentry> 41299e7bcd65Smrg <term> 41309e7bcd65Smrg <emphasis remap='I'>resources</emphasis> 41319e7bcd65Smrg </term> 41329e7bcd65Smrg <listitem> 41339e7bcd65Smrg <para> 41349e7bcd65SmrgSpecifies the subpart resource list. 41359e7bcd65Smrg </para> 41369e7bcd65Smrg </listitem> 41379e7bcd65Smrg </varlistentry> 41389e7bcd65Smrg <varlistentry> 41399e7bcd65Smrg <term> 41409e7bcd65Smrg <emphasis remap='I'>num_resources</emphasis> 41419e7bcd65Smrg </term> 41429e7bcd65Smrg <listitem> 41439e7bcd65Smrg <para> 41449e7bcd65SmrgSpecifies the number of entries in the resource list. 41459e7bcd65Smrg </para> 41469e7bcd65Smrg </listitem> 41479e7bcd65Smrg </varlistentry> 41489e7bcd65Smrg <varlistentry> 41499e7bcd65Smrg <term> 41509e7bcd65Smrg <emphasis remap='I'>args</emphasis> 41519e7bcd65Smrg </term> 41529e7bcd65Smrg <listitem> 41539e7bcd65Smrg <para> 41549e7bcd65SmrgSpecifies the argument list of name/value pairs that contain the 41559e7bcd65Smrgresources to be modified and their new values. 41569e7bcd65Smrg </para> 41579e7bcd65Smrg </listitem> 41589e7bcd65Smrg </varlistentry> 41599e7bcd65Smrg <varlistentry> 41609e7bcd65Smrg <term> 41619e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 41629e7bcd65Smrg </term> 41639e7bcd65Smrg <listitem> 41649e7bcd65Smrg <para> 41659e7bcd65SmrgSpecifies the number of entries in the argument list. 41669e7bcd65Smrg </para> 41679e7bcd65Smrg </listitem> 41689e7bcd65Smrg </varlistentry> 41699e7bcd65Smrg</variablelist> 41709e7bcd65Smrg 41719e7bcd65Smrg<para> 41729e7bcd65SmrgThe 41739e7bcd65Smrg<xref linkend='XtSetSubvalues' xrefstyle='select: title'/> 41749e7bcd65Smrgfunction updates the resource fields of the structure identified by 41759e7bcd65Smrg<emphasis remap='I'>base</emphasis>. Any specified arguments that do not match an entry in the 41769e7bcd65Smrgresource list are silently ignored. 41779e7bcd65Smrg</para> 41789e7bcd65Smrg 41799e7bcd65Smrg<para> 41809e7bcd65SmrgTo set the current values of subpart resources associated with 41819e7bcd65Smrga widget instance using varargs lists, use 41829e7bcd65Smrg<xref linkend='XtVaSetSubvalues' xrefstyle='select: title'/>. 41839e7bcd65Smrg</para> 41849e7bcd65Smrg 41859e7bcd65Smrg<funcsynopsis id='XtVaSetSubvalues'> 41869e7bcd65Smrg<funcprototype> 41879e7bcd65Smrg<funcdef>void <function>XtVaSetSubvalues</function></funcdef> 41889e7bcd65Smrg <paramdef>XtPointer <parameter>base</parameter></paramdef> 41899e7bcd65Smrg <paramdef>XtResourceList <parameter>resources</parameter></paramdef> 41909e7bcd65Smrg <paramdef>Cardinal <parameter>num_resources</parameter></paramdef> 41919e7bcd65Smrg</funcprototype> 41929e7bcd65Smrg</funcsynopsis> 41939e7bcd65Smrg 41949e7bcd65Smrg<variablelist> 41959e7bcd65Smrg <varlistentry> 41969e7bcd65Smrg <term> 41979e7bcd65Smrg <emphasis remap='I'>base</emphasis> 41989e7bcd65Smrg </term> 41999e7bcd65Smrg <listitem> 42009e7bcd65Smrg <para> 42019e7bcd65SmrgSpecifies the base address of the subpart data structure into which the 42029e7bcd65Smrgresources should be written. 42039e7bcd65Smrg </para> 42049e7bcd65Smrg </listitem> 42059e7bcd65Smrg </varlistentry> 42069e7bcd65Smrg <varlistentry> 42079e7bcd65Smrg <term> 42089e7bcd65Smrg <emphasis remap='I'>resources</emphasis> 42099e7bcd65Smrg </term> 42109e7bcd65Smrg <listitem> 42119e7bcd65Smrg <para> 42129e7bcd65SmrgSpecifies the subpart resource list. 42139e7bcd65Smrg </para> 42149e7bcd65Smrg </listitem> 42159e7bcd65Smrg </varlistentry> 42169e7bcd65Smrg <varlistentry> 42179e7bcd65Smrg <term> 42189e7bcd65Smrg <emphasis remap='I'>num_resources</emphasis> 42199e7bcd65Smrg </term> 42209e7bcd65Smrg <listitem> 42219e7bcd65Smrg <para> 42229e7bcd65SmrgSpecifies the number of entries in the resource list. 42239e7bcd65Smrg </para> 42249e7bcd65Smrg </listitem> 42259e7bcd65Smrg </varlistentry> 42269e7bcd65Smrg <varlistentry> 42279e7bcd65Smrg <term> 42289e7bcd65Smrg ... 42299e7bcd65Smrg </term> 42309e7bcd65Smrg <listitem> 42319e7bcd65Smrg <para> 42329e7bcd65SmrgSpecifies the variable argument list of name/value pairs that 42339e7bcd65Smrgcontain the resources to be modified and their new values. 42349e7bcd65Smrg </para> 42359e7bcd65Smrg </listitem> 42369e7bcd65Smrg </varlistentry> 42379e7bcd65Smrg</variablelist> 42389e7bcd65Smrg 42399e7bcd65Smrg<para> 42409e7bcd65Smrg<xref linkend='XtVaSetSubvalues' xrefstyle='select: title'/> 42419e7bcd65Smrgis identical in function to 42429e7bcd65Smrg<xref linkend='XtSetSubvalues' xrefstyle='select: title'/> 42439e7bcd65Smrgwith the <emphasis remap='I'>args</emphasis> and <emphasis remap='I'>num_args</emphasis> parameters replaced by a varargs list, as 42449e7bcd65Smrgdescribed in Section 2.5.1. 42459e7bcd65Smrg<function>XtVaTypedArg</function> 42469e7bcd65Smrgis not supported for 42479e7bcd65Smrg<xref linkend='XtVaSetSubvalues' xrefstyle='select: title'/>. 42489e7bcd65SmrgIf an entry containing 42499e7bcd65Smrg<function>XtVaTypedArg</function> 42509e7bcd65Smrgis specified in the list, a warning message is issued 42519e7bcd65Smrgand the entry is ignored. 42529e7bcd65Smrg</para> 42539e7bcd65Smrg</sect3> 42549e7bcd65Smrg 42559e7bcd65Smrg<sect3 id='Widget_Subpart_Resource_Data_The_set_values_hook_Procedure'> 42569e7bcd65Smrg<title>Widget Subpart Resource Data: The set_values_hook Procedure</title> 42579e7bcd65Smrg<note><para> 42589e7bcd65SmrgThe set_values_hook procedure is obsolete, as the same information 42599e7bcd65Smrgis now available to the set_values procedure. The procedure has been 42609e7bcd65Smrgretained for those widgets that used it in versions prior to Release 4. 42619e7bcd65Smrg</para> 42629e7bcd65Smrg</note> 42639e7bcd65Smrg<para> 42649e7bcd65SmrgWidgets that have a subpart can set the subpart resource values through 42659e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 42669e7bcd65Smrgby supplying a set_values_hook procedure. 42679e7bcd65SmrgThe set_values_hook procedure pointer in a widget class is of type 42689e7bcd65Smrg<xref linkend='XtArgsFunc' xrefstyle='select: title'/>. 42699e7bcd65Smrg</para> 42709e7bcd65Smrg 42719e7bcd65Smrg<funcsynopsis id='XtArgsFunc'> 42729e7bcd65Smrg<funcprototype> 42739e7bcd65Smrg<funcdef>typedef Boolean <function>(*XtArgsFunc)</function></funcdef> 42749e7bcd65Smrg <paramdef>Widget <parameter>w</parameter></paramdef> 42759e7bcd65Smrg <paramdef>Arglist <parameter>args</parameter></paramdef> 42769e7bcd65Smrg <paramdef>Cardinal *<parameter>num_args</parameter></paramdef> 42779e7bcd65Smrg</funcprototype> 42789e7bcd65Smrg</funcsynopsis> 42799e7bcd65Smrg 42809e7bcd65Smrg<variablelist> 42819e7bcd65Smrg <varlistentry> 42829e7bcd65Smrg <term> 42839e7bcd65Smrg <emphasis remap='I'>w</emphasis> 42849e7bcd65Smrg </term> 42859e7bcd65Smrg <listitem> 42869e7bcd65Smrg <para> 42879e7bcd65SmrgSpecifies the widget whose subpart resource values are to be changed. 42889e7bcd65Smrg </para> 42899e7bcd65Smrg </listitem> 42909e7bcd65Smrg </varlistentry> 42919e7bcd65Smrg <varlistentry> 42929e7bcd65Smrg <term> 42939e7bcd65Smrg <emphasis remap='I'>args</emphasis> 42949e7bcd65Smrg </term> 42959e7bcd65Smrg <listitem> 42969e7bcd65Smrg <para> 42979e7bcd65SmrgSpecifies the argument list that was passed to 42989e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 42999e7bcd65Smrgor the transformed varargs list passed to 43009e7bcd65Smrg<xref linkend='XtVaSetValues' xrefstyle='select: title'/>. 43019e7bcd65Smrg </para> 43029e7bcd65Smrg </listitem> 43039e7bcd65Smrg </varlistentry> 43049e7bcd65Smrg <varlistentry> 43059e7bcd65Smrg <term> 43069e7bcd65Smrg <emphasis remap='I'>num_args</emphasis> 43079e7bcd65Smrg </term> 43089e7bcd65Smrg <listitem> 43099e7bcd65Smrg <para> 43109e7bcd65SmrgSpecifies the number of entries in the argument list. 43119e7bcd65Smrg </para> 43129e7bcd65Smrg </listitem> 43139e7bcd65Smrg </varlistentry> 43149e7bcd65Smrg</variablelist> 43159e7bcd65Smrg 43169e7bcd65Smrg<para> 43179e7bcd65SmrgThe widget with subpart resources may call 43189e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/> 43199e7bcd65Smrgfrom the set_values_hook procedure 43209e7bcd65Smrgand pass in its subresource list and the 43219e7bcd65Smrg<emphasis remap='I'>args</emphasis> and <emphasis remap='I'>num_args</emphasis> parameters. 43229e7bcd65Smrg</para> 43239e7bcd65Smrg</sect3> 43249e7bcd65Smrg</sect2> 43259e7bcd65Smrg</sect1> 43269e7bcd65Smrg</chapter> 4327