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