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='Intrinsics_and_Widgets'> 59e7bcd65Smrg<title>Intrinsics and Widgets</title> 69e7bcd65Smrg<para> 79e7bcd65SmrgThe Intrinsics are a programming library tailored to the special requirements 89e7bcd65Smrgof user interface construction within a network window system, 99e7bcd65Smrgspecifically the X Window System. 109e7bcd65SmrgThe Intrinsics and a widget set make up an X Toolkit. 119e7bcd65Smrg</para> 129e7bcd65Smrg<sect1 id="Intrinsics"> 139e7bcd65Smrg<title>Intrinsics</title> 149e7bcd65Smrg<para> 159e7bcd65SmrgThe Intrinsics provide the base mechanism necessary to build 169e7bcd65Smrga wide variety of interoperating widget sets and application environments. 179e7bcd65SmrgThe Intrinsics are a layer on top of Xlib, the 189e7bcd65SmrgC Library X Interface. They extend the 199e7bcd65Smrgfundamental abstractions provided by the X Window System while still 209e7bcd65Smrgremaining independent of any particular user interface policy or 219e7bcd65Smrgstyle. 229e7bcd65Smrg</para> 239e7bcd65Smrg 249e7bcd65Smrg<para> 259e7bcd65SmrgThe Intrinsics use object-oriented programming techniques to supply a 269e7bcd65Smrgconsistent architecture for constructing and composing user interface 279e7bcd65Smrgcomponents, known as widgets. This 289e7bcd65Smrgallows programmers to extend a widget set in new ways, either by 299e7bcd65Smrgderiving new widgets from existing ones (subclassing) or by writing 309e7bcd65Smrgentirely new widgets following the established conventions. 319e7bcd65Smrg</para> 329e7bcd65Smrg 339e7bcd65Smrg<para> 349e7bcd65SmrgWhen the Intrinsics were first conceived, the root of the object 359e7bcd65Smrghierarchy was a widget class named 369e7bcd65SmrgCore. 379e7bcd65SmrgIn Release 4 of the 389e7bcd65SmrgIntrinsics, three nonwidget superclasses were added above Core. 399e7bcd65SmrgThese superclasses are described in <xref linkend='Nonwidget_Objects' />. 409e7bcd65SmrgThe name of the class 419e7bcd65Smrgnow at the root of the Intrinsics class hierarchy is 429e7bcd65SmrgObject. 439e7bcd65SmrgThe remainder of this 449e7bcd65Smrgspecification refers uniformly to <emphasis remap='I'>widgets</emphasis> and <emphasis remap='I'>Core</emphasis> 459e7bcd65Smrgas if they were the 469e7bcd65Smrgbase class for all Intrinsics operations. The argument descriptions 479e7bcd65Smrgfor each Intrinsics procedure and <xref linkend='Nonwidget_Objects' /> 489e7bcd65Smrgdescribe which operations 499e7bcd65Smrgare defined for the nonwidget superclasses of Core. The reader may 509e7bcd65Smrgdetermine by context whether a specific reference to <emphasis remap='I'>widget</emphasis> 510568f49bSmrgactually means “widget” or “object.” 529e7bcd65Smrg</para> 539e7bcd65Smrg</sect1> 549e7bcd65Smrg 559e7bcd65Smrg<sect1 id="Languages"> 569e7bcd65Smrg<title>Languages</title> 579e7bcd65Smrg<para> 589e7bcd65SmrgThe Intrinsics are intended to be used for two programming purposes. 599e7bcd65SmrgProgrammers writing widgets will be using most of the facilities 609e7bcd65Smrgprovided by the 619e7bcd65SmrgIntrinsics to construct user interface components from the simple, such 629e7bcd65Smrgas buttons and scrollbars, to the complex, such as control panels and 639e7bcd65Smrgproperty sheets. Application programmers will use a much smaller subset of 649e7bcd65Smrgthe Intrinsics procedures in combination with one or more sets of widgets to 659e7bcd65Smrgconstruct and present complete user interfaces on an X display. The 669e7bcd65SmrgIntrinsics 679e7bcd65Smrgprogramming interfaces primarily 689e7bcd65Smrgintended for application use are designed to be callable from most 699e7bcd65Smrgprocedural programming languages. Therefore, most arguments are passed by 709e7bcd65Smrgreference rather than by value. The interfaces primarily 719e7bcd65Smrgintended for widget programmers are expected to be used principally 729e7bcd65Smrgfrom the C language. In these cases, the usual C programming 739e7bcd65Smrgconventions apply. In this specification, the term <emphasis remap='I'>client</emphasis> refers to 749e7bcd65Smrgany module, widget, or application that calls an Intrinsics procedure. 759e7bcd65Smrg</para> 769e7bcd65Smrg 779e7bcd65Smrg<para> 789e7bcd65SmrgApplications that use the Intrinsics mechanisms 799e7bcd65Smrgmust include the header files 800568f49bSmrg<filename class="headerfile"><X11/Intrinsic.h></filename> 819e7bcd65Smrgand 820568f49bSmrg<filename class="headerfile"><X11/StringDefs.h></filename>, 839e7bcd65Smrgor their equivalent, 849e7bcd65Smrgand they may also include 850568f49bSmrg<filename class="headerfile"><X11/Xatoms.h></filename> 869e7bcd65Smrgand 870568f49bSmrg<filename class="headerfile"><X11/Shell.h></filename>. 889e7bcd65SmrgIn addition, widget implementations should include 890568f49bSmrg<filename class="headerfile"><X11/IntrinsicP.h></filename> 909e7bcd65Smrginstead of 910568f49bSmrg<filename class="headerfile"><X11/Intrinsic.h></filename>. 929e7bcd65Smrg</para> 939e7bcd65Smrg 949e7bcd65Smrg<para> 959e7bcd65SmrgThe applications must also include the additional header files for 969e7bcd65Smrgeach widget class that they are to use (for example, 970568f49bSmrg<filename class="headerfile"><X11/Xaw/Label.h></filename> 989e7bcd65Smrgor 990568f49bSmrg<filename class="headerfile"><X11/Xaw/Scrollbar.h>).</filename> 1009e7bcd65SmrgOn a POSIX-based system, 1019e7bcd65Smrgthe Intrinsics object library file is named 1020568f49bSmrg<filename class="libraryfile">libXt.a</filename> 1030568f49bSmrgand is usually referenced as -lXt when linking the application. 1049e7bcd65Smrg</para> 1059e7bcd65Smrg</sect1> 1069e7bcd65Smrg 1079e7bcd65Smrg<sect1 id="Procedures_and_Macros"> 1089e7bcd65Smrg<title>Procedures and Macros</title> 1099e7bcd65Smrg<para> 1109e7bcd65SmrgAll functions defined in this specification except those specified below 1119e7bcd65Smrgmay be implemented as C macros with arguments. C applications may use 1120568f49bSmrg“#undef” to remove a macro definition and ensure that the actual function 1139e7bcd65Smrgis referenced. Any such macro will expand to a single expression that 1149e7bcd65Smrghas the same precedence as a function call and that evaluates each 1159e7bcd65Smrgof its arguments exactly once, fully protected by parentheses, so that 1169e7bcd65Smrgarbitrary expressions may be used as arguments. 1179e7bcd65Smrg</para> 1189e7bcd65Smrg 1199e7bcd65Smrg<para> 1209e7bcd65SmrgThe following symbols are macros that do not have function 1219e7bcd65Smrgequivalents and that may expand their arguments in a manner other 1229e7bcd65Smrgthan that described above: 1239e7bcd65Smrg<xref linkend='XtCheckSubclass' xrefstyle='select: title'/>, 1249e7bcd65Smrg<xref linkend='XtNew' xrefstyle='select: title'/>, 1259e7bcd65Smrg<xref linkend='XtNumber' xrefstyle='select: title'/>, 1269e7bcd65Smrg<xref linkend='XtOffsetOf' xrefstyle='select: title'/>, 1279e7bcd65Smrg<xref linkend='XtOffset' xrefstyle='select: title'/>, 1289e7bcd65Smrgand 1299e7bcd65Smrg<xref linkend='XtSetArg' xrefstyle='select: title'/>. 1309e7bcd65Smrg</para> 1319e7bcd65Smrg</sect1> 1329e7bcd65Smrg 1339e7bcd65Smrg<sect1 id="Widgets"> 1349e7bcd65Smrg<title>Widgets</title> 1359e7bcd65Smrg<para> 1369e7bcd65SmrgThe fundamental abstraction and data type of the X Toolkit is the widget, 1379e7bcd65Smrgwhich is a combination of an X window and its associated 1389e7bcd65Smrginput and display semantics 1399e7bcd65Smrgand which is dynamically allocated and contains state information. 1409e7bcd65SmrgSome widgets display information (for example, text or graphics), 1419e7bcd65Smrgand others are merely containers for other widgets (for example, a menu box). 1429e7bcd65SmrgSome widgets are output-only and do not react to pointer or keyboard input, 1439e7bcd65Smrgand others change their display in response to input 1449e7bcd65Smrgand can invoke functions that an application has attached to them. 1459e7bcd65Smrg</para> 1469e7bcd65Smrg 1479e7bcd65Smrg<para> 1489e7bcd65SmrgEvery widget belongs to exactly one widget class, which is statically 1499e7bcd65Smrgallocated and initialized and which contains the operations allowable on 1509e7bcd65Smrgwidgets of that class. 1519e7bcd65SmrgLogically, a widget class is the procedures and data associated 1529e7bcd65Smrgwith all widgets belonging to that class. 1539e7bcd65SmrgThese procedures and data can be inherited by 1549e7bcd65Smrgsubclasses. 1559e7bcd65SmrgPhysically, a widget class is a pointer to a structure. 1569e7bcd65SmrgThe contents of this structure are constant for all widgets of the widget 1579e7bcd65Smrgclass but will vary from class to class. 1580568f49bSmrg(Here, “constant” means the class structure is initialized at compile time 1599e7bcd65Smrgand never changed, except for a one-time class initialization 1609e7bcd65Smrgand in-place compilation of resource lists, 1619e7bcd65Smrgwhich takes place when the first widget of the class or subclass is created.) 1629e7bcd65SmrgFor further information, 1639e7bcd65Smrgsee <xref linkend='Creating_Widgets' /> 1649e7bcd65Smrg</para> 1659e7bcd65Smrg 1669e7bcd65Smrg<para> 1679e7bcd65SmrgThe distribution of the declarations and code for a new widget class 1689e7bcd65Smrgamong a public .h file for application programmer use, a private .h file 1699e7bcd65Smrgfor widget programmer use, 1709e7bcd65Smrgand the implementation .c file is described in <xref linkend='Widget_Classing' /> 1719e7bcd65SmrgThe predefined widget classes adhere to these conventions. 1729e7bcd65Smrg</para> 1739e7bcd65Smrg 1749e7bcd65Smrg<para> 1759e7bcd65SmrgA widget instance is composed of two parts: 1769e7bcd65Smrg</para> 1779e7bcd65Smrg<itemizedlist spacing='compact'> 1789e7bcd65Smrg <listitem> 1799e7bcd65Smrg <para> 1809e7bcd65SmrgA data structure which contains instance-specific values. 1819e7bcd65Smrg </para> 1829e7bcd65Smrg </listitem> 1839e7bcd65Smrg <listitem> 1849e7bcd65Smrg <para> 1859e7bcd65SmrgA class structure which contains information that is applicable to 1869e7bcd65Smrgall widgets of that class. 1879e7bcd65Smrg </para> 1889e7bcd65Smrg </listitem> 1899e7bcd65Smrg</itemizedlist> 1909e7bcd65Smrg<para> 1919e7bcd65SmrgMuch of the input/output of a widget (for example, fonts, colors, sizes, 1929e7bcd65Smrgor border widths) is customizable by users. 1939e7bcd65Smrg</para> 1949e7bcd65Smrg 1959e7bcd65Smrg<para> 1969e7bcd65SmrgThis chapter discusses the base widget classes, 1979e7bcd65SmrgCore, Composite, and Constraint, and 1989e7bcd65Smrgends with a discussion of widget classing. 1999e7bcd65Smrg</para> 2009e7bcd65Smrg<sect2 id="Core_Widgets"> 2019e7bcd65Smrg<title>Core Widgets</title> 2029e7bcd65Smrg<para> 2039e7bcd65SmrgThe 2049e7bcd65SmrgCore 2059e7bcd65Smrgwidget class contains the definitions of fields common to all widgets. 2069e7bcd65SmrgAll widgets classes are subclasses of the 2079e7bcd65SmrgCore class, 2089e7bcd65Smrgwhich is defined by the 2099e7bcd65Smrg<function>CoreClassPart</function> 2109e7bcd65Smrgand 2119e7bcd65Smrg<function>CorePart</function> 2129e7bcd65Smrgstructures. 2139e7bcd65Smrg</para> 2149e7bcd65Smrg<sect3 id="CoreClassPart_Structure"> 2159e7bcd65Smrg<title>CoreClassPart Structure</title> 2169e7bcd65Smrg<para> 2179e7bcd65SmrgAll widget classes contain the fields defined in the 2189e7bcd65Smrg<function>CoreClassPart</function> 2199e7bcd65Smrgstructure. 2209e7bcd65Smrg</para> 2210568f49bSmrg<programlisting> 2229e7bcd65Smrgtypedef struct { 2230568f49bSmrg WidgetClass superclass; <lineannotation>See <xref linkend="Widget_Classing" xrefstyle='select: title' /></lineannotation> 2240568f49bSmrg String class_name; <lineannotation>See <xref linkend="Resource_Management" xrefstyle='select: title' /></lineannotation> 2250568f49bSmrg Cardinal widget_size; <lineannotation>See <xref linkend="Widget_Classing" xrefstyle='select: title' /></lineannotation> 2260568f49bSmrg XtProc class_initialize; <lineannotation>See <xref linkend="Widget_Classing" xrefstyle='select: title' /></lineannotation> 2270568f49bSmrg XtWidgetClassProc class_part_initialize; <lineannotation>See <xref linkend="Widget_Classing" xrefstyle='select: title' /></lineannotation> 2280568f49bSmrg XtEnum class_inited; <lineannotation>See <xref linkend="Widget_Classing" xrefstyle='select: title' /></lineannotation> 2290568f49bSmrg XtInitProc initialize; <lineannotation>See <xref linkend='Creating_Widgets' xrefstyle='select: title' /></lineannotation> 2300568f49bSmrg XtArgsProc initialize_hook; <lineannotation>See <xref linkend='Creating_Widgets' xrefstyle='select: title' /></lineannotation> 2310568f49bSmrg XtRealizeProc realize; <lineannotation>See <xref linkend='Realizing_Widgets' xrefstyle='select: title' /></lineannotation> 2320568f49bSmrg XtActionList actions; <lineannotation>See <xref linkend='Translation_Management' xrefstyle='select: title' /></lineannotation> 2330568f49bSmrg Cardinal num_actions; <lineannotation>See <xref linkend='Translation_Management' xrefstyle='select: title' /></lineannotation> 2340568f49bSmrg XtResourceList resources; <lineannotation>See <xref linkend="Resource_Management" xrefstyle='select: title' /></lineannotation> 2350568f49bSmrg Cardinal num_resources; <lineannotation>See <xref linkend="Resource_Management" xrefstyle='select: title' /></lineannotation> 2360568f49bSmrg XrmClass xrm_class; <lineannotation>Private to resource manager</lineannotation> 2370568f49bSmrg Boolean compress_motion; <lineannotation>See <xref linkend='X_Event_Filters' xrefstyle='select: title' /></lineannotation> 2380568f49bSmrg XtEnum compress_exposure; <lineannotation>See <xref linkend='X_Event_Filters' xrefstyle='select: title' /></lineannotation> 2390568f49bSmrg Boolean compress_enterleave; <lineannotation>See <xref linkend='X_Event_Filters' xrefstyle='select: title' /></lineannotation> 2400568f49bSmrg Boolean visible_interest; <lineannotation>See <xref linkend='Widget_Exposure_and_Visibility' xrefstyle='select: title' /></lineannotation> 2410568f49bSmrg XtWidgetProc destroy; <lineannotation>See <xref linkend='Destroying_Widgets' xrefstyle='select: title' /></lineannotation> 2420568f49bSmrg XtWidgetProc resize; <lineannotation>See <xref linkend='Geometry_Management' xrefstyle='select: title' /></lineannotation> 2430568f49bSmrg XtExposeProc expose; <lineannotation>See <xref linkend='Widget_Exposure_and_Visibility' xrefstyle='select: title' /></lineannotation> 2440568f49bSmrg XtSetValuesFunc set_values; <lineannotation>See <xref linkend='Reading_and_Writing_Widget_State' xrefstyle='select: title' /></lineannotation> 2450568f49bSmrg XtArgsFunc set_values_hook; <lineannotation>See <xref linkend='Reading_and_Writing_Widget_State' xrefstyle='select: title' /></lineannotation> 2460568f49bSmrg XtAlmostProc set_values_almost; <lineannotation>See <xref linkend='Reading_and_Writing_Widget_State' xrefstyle='select: title' /></lineannotation> 2470568f49bSmrg XtArgsProc get_values_hook; <lineannotation>See <xref linkend='Reading_and_Writing_Widget_State' xrefstyle='select: title' /></lineannotation> 2480568f49bSmrg XtAcceptFocusProc accept_focus; <lineannotation>See <xref linkend='Focusing_Events_on_a_Child' xrefstyle='select: title' /></lineannotation> 2490568f49bSmrg XtVersionType version; <lineannotation>See <xref linkend="Widget_Classing" xrefstyle='select: title' /></lineannotation> 2500568f49bSmrg XtPointer callback_private; <lineannotation>Private to callbacks</lineannotation> 2510568f49bSmrg String tm_table; <lineannotation>See <xref linkend='Translation_Management' xrefstyle='select: title' /></lineannotation> 2520568f49bSmrg XtGeometryHandler query_geometry; <lineannotation>See <xref linkend ='Geometry_Management' xrefstyle='select: title' /></lineannotation> 2530568f49bSmrg XtStringProc display_accelerator; <lineannotation>See <xref linkend='Translation_Management' xrefstyle='select: title' /></lineannotation> 2540568f49bSmrg XtPointer extension; <lineannotation>See <xref linkend="Widget_Classing" xrefstyle='select: title' /></lineannotation> 2559e7bcd65Smrg} CoreClassPart; 2560568f49bSmrg</programlisting> 2579e7bcd65Smrg<para> 2589e7bcd65SmrgAll widget classes have the Core class fields as their first component. 2599e7bcd65SmrgThe prototypical 2609e7bcd65Smrg<function>WidgetClass</function> 2619e7bcd65Smrgand 2629e7bcd65Smrg<function>CoreWidgetClass</function> 2639e7bcd65Smrgare defined with only this set of fields. 2649e7bcd65Smrg</para> 2650568f49bSmrg<programlisting> 2669e7bcd65Smrgtypedef struct { 2679e7bcd65Smrg CoreClassPart core_class; 2689e7bcd65Smrg} WidgetClassRec, *WidgetClass, CoreClassRec, *CoreWidgetClass; 2690568f49bSmrg</programlisting> 2709e7bcd65Smrg<para> 2719e7bcd65SmrgVarious routines can cast widget class pointers, as needed, 2729e7bcd65Smrgto specific widget class types. 2739e7bcd65Smrg</para> 2749e7bcd65Smrg 2759e7bcd65Smrg<para> 2769e7bcd65SmrgThe single occurrences of the class record and pointer for 2779e7bcd65Smrgcreating instances of Core are 2789e7bcd65Smrg</para> 2799e7bcd65Smrg 2809e7bcd65Smrg<para> 2819e7bcd65SmrgIn 2820568f49bSmrg<filename class="headerfile">IntrinsicP.h</filename>: 2839e7bcd65Smrg</para> 2840568f49bSmrg<programlisting> 2859e7bcd65Smrgextern WidgetClassRec widgetClassRec; 2869e7bcd65Smrg#define coreClassRec widgetClassRec 2870568f49bSmrg</programlisting> 2889e7bcd65Smrg<para> 2899e7bcd65SmrgIn 2900568f49bSmrg<filename class="headerfile">Intrinsic.h</filename>: 2919e7bcd65Smrg</para> 2920568f49bSmrg<programlisting> 2939e7bcd65Smrgextern WidgetClass widgetClass, coreWidgetClass; 2940568f49bSmrg</programlisting> 2959e7bcd65Smrg<para> 2969e7bcd65SmrgThe opaque types 2979e7bcd65Smrg<function>Widget</function> 2989e7bcd65Smrgand 2999e7bcd65Smrg<function>WidgetClass</function> 3009e7bcd65Smrgand the opaque variable 3019e7bcd65Smrg<function>widgetClass</function> 3029e7bcd65Smrgare defined for generic actions on widgets. 3039e7bcd65SmrgIn order to make these types opaque and ensure that the compiler 3049e7bcd65Smrgdoes not allow applications to access private data, the Intrinsics use 3059e7bcd65Smrgincomplete structure definitions in 3060568f49bSmrg<filename class="headerfile">Intrinsic.h</filename>: 3079e7bcd65Smrg</para> 3080568f49bSmrg<programlisting> 3099e7bcd65Smrgtypedef struct _WidgetClassRec *WidgetClass, *CoreWidgetClass; 3100568f49bSmrg</programlisting> 3119e7bcd65Smrg</sect3> 3129e7bcd65Smrg<sect3 id="CorePart_Structure"> 3139e7bcd65Smrg<title>CorePart Structure</title> 3149e7bcd65Smrg<para> 3159e7bcd65SmrgAll widget instances contain the fields defined in the 3169e7bcd65Smrg<function>CorePart</function> 3179e7bcd65Smrgstructure. 3189e7bcd65Smrg</para> 3190568f49bSmrg<programlisting> 3209e7bcd65Smrgtypedef struct _CorePart { 3210568f49bSmrg Widget self; <lineannotation>Described below</lineannotation> 3220568f49bSmrg WidgetClass widget_class; <lineannotation>See <xref linkend='Widget_Classing' xrefstyle='select: title' /></lineannotation> 3230568f49bSmrg Widget parent; <lineannotation>See <xref linkend='Creating_Widgets' xrefstyle='select: title' /></lineannotation> 3240568f49bSmrg Boolean being_destroyed; <lineannotation>See <xref linkend='Destroying_Widgets' xrefstyle='select: title' /></lineannotation> 3250568f49bSmrg XtCallbackList destroy_callbacks; <lineannotation>See <xref linkend='Destroying_Widgets' xrefstyle='select: title' /></lineannotation> 3260568f49bSmrg XtPointer constraints; <lineannotation>See <xref linkend='Constrained_Composite_Widgets' xrefstyle='select: title' /></lineannotation> 3270568f49bSmrg Position x; <lineannotation>See <xref linkend='Geometry_Management' xrefstyle='select: title' /></lineannotation> 3280568f49bSmrg Position y; <lineannotation>See <xref linkend='Geometry_Management' xrefstyle='select: title' /></lineannotation> 3290568f49bSmrg Dimension width; <lineannotation>See <xref linkend='Geometry_Management' xrefstyle='select: title' /></lineannotation> 3300568f49bSmrg Dimension height; <lineannotation>See <xref linkend='Geometry_Management' xrefstyle='select: title' /></lineannotation> 3310568f49bSmrg Dimension border_width; <lineannotation>See <xref linkend='Geometry_Management' xrefstyle='select: title' /></lineannotation> 3320568f49bSmrg Boolean managed; <lineannotation>See <xref linkend='Composite_Widgets_and_Their_Children' xrefstyle='select: title' /></lineannotation> 3330568f49bSmrg Boolean sensitive; <lineannotation>See <xref linkend='Setting_and_Checking_the_Sensitivity_State_of_a_Widget' xrefstyle='select: title' /></lineannotation> 3340568f49bSmrg Boolean ancestor_sensitive; <lineannotation>See <xref linkend='Setting_and_Checking_the_Sensitivity_State_of_a_Widget' xrefstyle='select: title' /></lineannotation> 3350568f49bSmrg XtTranslations accelerators; <lineannotation>See <xref linkend='Translation_Management' xrefstyle='select: title' /></lineannotation> 3360568f49bSmrg Pixel border_pixel; <lineannotation>See <xref linkend='Realizing_Widgets' xrefstyle='select: title' /></lineannotation> 3370568f49bSmrg Pixmap border_pixmap; <lineannotation>See <xref linkend='Realizing_Widgets' xrefstyle='select: title' /></lineannotation> 3380568f49bSmrg WidgetList popup_list; <lineannotation>See <xref linkend='Pop_Up_Widgets' xrefstyle='select: title' /></lineannotation> 3390568f49bSmrg Cardinal num_popups; <lineannotation>See <xref linkend='Pop_Up_Widgets' xrefstyle='select: title' /></lineannotation> 3400568f49bSmrg String name; <lineannotation>See <xref linkend='Resource_Management' xrefstyle='select: title' /></lineannotation> 3410568f49bSmrg Screen *screen; <lineannotation>See <xref linkend='Realizing_Widgets' xrefstyle='select: title' /></lineannotation> 3420568f49bSmrg Colormap colormap; <lineannotation>See <xref linkend='Realizing_Widgets' xrefstyle='select: title' /></lineannotation> 3430568f49bSmrg Window window; <lineannotation>See <xref linkend='Realizing_Widgets' xrefstyle='select: title' /></lineannotation> 3440568f49bSmrg Cardinal depth; <lineannotation>See <xref linkend='Realizing_Widgets' xrefstyle='select: title' /></lineannotation> 3450568f49bSmrg Pixel background_pixel; <lineannotation>See <xref linkend='Realizing_Widgets' xrefstyle='select: title' /></lineannotation> 3460568f49bSmrg Pixmap background_pixmap; <lineannotation>See <xref linkend='Realizing_Widgets' xrefstyle='select: title' /></lineannotation> 3470568f49bSmrg Boolean visible; <lineannotation>See <xref linkend='Widget_Exposure_and_Visibility' xrefstyle='select: title' /></lineannotation> 3480568f49bSmrg Boolean mapped_when_managed; <lineannotation>See <xref linkend='Composite_Widgets_and_Their_Children' xrefstyle='select: title' /></lineannotation> 3499e7bcd65Smrg} CorePart; 3500568f49bSmrg</programlisting> 3519e7bcd65Smrg<para> 3529e7bcd65SmrgAll widget instances have the Core fields as their first component. 3539e7bcd65SmrgThe prototypical type 3549e7bcd65Smrg<function>Widget</function> 3559e7bcd65Smrgis defined with only this set of fields. 3569e7bcd65Smrg</para> 3570568f49bSmrg<programlisting> 3589e7bcd65Smrgtypedef struct { 3599e7bcd65Smrg CorePart core; 3609e7bcd65Smrg} WidgetRec, *Widget, CoreRec, *CoreWidget; 3610568f49bSmrg</programlisting> 3629e7bcd65Smrg<para> 3639e7bcd65SmrgVarious routines can cast widget pointers, as needed, 3649e7bcd65Smrgto specific widget types. 3659e7bcd65Smrg</para> 3669e7bcd65Smrg 3679e7bcd65Smrg<para> 3689e7bcd65SmrgIn order to make these types opaque and ensure that the compiler 3699e7bcd65Smrgdoes not allow applications to access private data, the Intrinsics use 3709e7bcd65Smrgincomplete structure definitions in 3710568f49bSmrg<filename class="headerfile">Intrinsic.h</filename>. 3729e7bcd65Smrg</para> 3730568f49bSmrg<programlisting> 3749e7bcd65Smrgtypedef struct _WidgetRec *Widget, *CoreWidget; 3750568f49bSmrg</programlisting> 3769e7bcd65Smrg</sect3> 3779e7bcd65Smrg<sect3 id="Core_Resources"> 3789e7bcd65Smrg<title>Core Resources</title> 3799e7bcd65Smrg<para> 3809e7bcd65SmrgThe resource names, classes, and representation types specified in the 3819e7bcd65Smrg<function>coreClassRec</function> 3829e7bcd65Smrgresource list are 3839e7bcd65Smrg</para> 3849e7bcd65Smrg 3859e7bcd65Smrg<informaltable frame='topbot'> 3869e7bcd65Smrg <?dbfo keep-together="always" ?> 3879e7bcd65Smrg <tgroup cols='3' align='left' colsep='0' rowsep='0'> 3889e7bcd65Smrg <colspec colname='c1' colwidth='1.0*'/> 3899e7bcd65Smrg <colspec colname='c2' colwidth='1.0*'/> 3909e7bcd65Smrg <colspec colname='c3' colwidth='1.0*'/> 3919e7bcd65Smrg <thead> 3929e7bcd65Smrg <row rowsep='1'> 3939e7bcd65Smrg <entry>Name</entry> 3949e7bcd65Smrg <entry>Class</entry> 3959e7bcd65Smrg <entry>Representation</entry> 3969e7bcd65Smrg </row> 3979e7bcd65Smrg </thead> 3989e7bcd65Smrg <tbody> 3999e7bcd65Smrg <row> 4009e7bcd65Smrg <entry>XtNaccelerators</entry> 4019e7bcd65Smrg <entry>XtCAccelerators</entry> 4029e7bcd65Smrg <entry>XtRAcceleratorTable</entry> 4039e7bcd65Smrg </row> 4049e7bcd65Smrg <row> 4059e7bcd65Smrg <entry>XtNbackground</entry> 4069e7bcd65Smrg <entry>XtCBackground</entry> 4079e7bcd65Smrg <entry>XtRPixel</entry> 4089e7bcd65Smrg </row> 4099e7bcd65Smrg <row> 4109e7bcd65Smrg <entry>XtNbackgroundPixmap</entry> 4119e7bcd65Smrg <entry>XtCPixmap</entry> 4129e7bcd65Smrg <entry>XtRPixmap</entry> 4139e7bcd65Smrg </row> 4149e7bcd65Smrg <row> 4159e7bcd65Smrg <entry>XtNborderColor</entry> 4169e7bcd65Smrg <entry>XtCBorderColor</entry> 4179e7bcd65Smrg <entry>XtRPixel</entry> 4189e7bcd65Smrg </row> 4199e7bcd65Smrg <row> 4209e7bcd65Smrg <entry>XtNborderPixmap</entry> 4219e7bcd65Smrg <entry>XtCPixmap</entry> 4229e7bcd65Smrg <entry>XtRPixmap</entry> 4239e7bcd65Smrg </row> 4249e7bcd65Smrg <row> 4259e7bcd65Smrg <entry>XtNcolormap</entry> 4269e7bcd65Smrg <entry>XtCColormap</entry> 4279e7bcd65Smrg <entry>XtRColormap</entry> 4289e7bcd65Smrg </row> 4299e7bcd65Smrg <row> 4309e7bcd65Smrg <entry>XtNdepth</entry> 4319e7bcd65Smrg <entry>XtCDepth</entry> 4329e7bcd65Smrg <entry>XtRInt</entry> 4339e7bcd65Smrg </row> 4349e7bcd65Smrg <row> 4359e7bcd65Smrg <entry>XtNmappedWhenManaged</entry> 4369e7bcd65Smrg <entry>XtCMappedWhenManaged</entry> 4379e7bcd65Smrg <entry>XtRBoolean</entry> 4389e7bcd65Smrg </row> 4399e7bcd65Smrg <row> 4409e7bcd65Smrg <entry>XtNscreen</entry> 4419e7bcd65Smrg <entry>XtCScreen</entry> 4429e7bcd65Smrg <entry>XtRScreen</entry> 4439e7bcd65Smrg </row> 4449e7bcd65Smrg <row> 4459e7bcd65Smrg <entry>XtNtranslations</entry> 4469e7bcd65Smrg <entry>XtCTranslations</entry> 4479e7bcd65Smrg <entry>XtRTranslationTable</entry> 4489e7bcd65Smrg </row> 4499e7bcd65Smrg </tbody> 4509e7bcd65Smrg </tgroup> 4519e7bcd65Smrg</informaltable> 4529e7bcd65Smrg<para> 4539e7bcd65SmrgAdditional resources are defined for all widgets via the 4549e7bcd65Smrg<function>objectClassRec</function> 4559e7bcd65Smrgand 4569e7bcd65Smrg<function>rectObjClassRec</function> 4579e7bcd65Smrgresource lists; see <xref linkend='Object_Objects' /> and <xref linkend='Rectangle_Objects' /> for details. 4589e7bcd65Smrg</para> 4599e7bcd65Smrg</sect3> 4609e7bcd65Smrg<sect3 id="CorePart_Default_Values"> 4619e7bcd65Smrg<title>CorePart Default Values</title> 4629e7bcd65Smrg<para> 4639e7bcd65SmrgThe default values for the Core fields, which are filled in by the Intrinsics, 4649e7bcd65Smrgfrom the resource lists, and by the initialize procedures, are 4659e7bcd65Smrg</para> 4669e7bcd65Smrg<informaltable frame='topbot'> 4679e7bcd65Smrg <?dbfo keep-together="always" ?> 4689e7bcd65Smrg <tgroup cols='2' align='left' colsep='0' rowsep='0'> 4699e7bcd65Smrg <colspec colname='c1' colwidth='0.4*'/> 4709e7bcd65Smrg <colspec colname='c2' colwidth='1.0*'/> 4719e7bcd65Smrg <thead> 4729e7bcd65Smrg <row rowsep='1'> 4739e7bcd65Smrg <entry>Field</entry> 4749e7bcd65Smrg <entry>Default Value</entry> 4759e7bcd65Smrg </row> 4769e7bcd65Smrg </thead> 4779e7bcd65Smrg <tbody> 4789e7bcd65Smrg <row> 4799e7bcd65Smrg <entry>self</entry> 4809e7bcd65Smrg <entry>Address of the widget structure (may not be changed).</entry> 4819e7bcd65Smrg </row> 4829e7bcd65Smrg <row> 4839e7bcd65Smrg <entry>widget_class</entry> 4849e7bcd65Smrg <entry><emphasis remap='I'>widget_class</emphasis> argument to 4859e7bcd65Smrg <xref linkend='XtCreateWidget' xrefstyle='select: title'/> 4869e7bcd65Smrg (may not be changed).</entry> 4879e7bcd65Smrg </row> 4889e7bcd65Smrg <row> 4899e7bcd65Smrg <entry>parent</entry> 4909e7bcd65Smrg <entry><emphasis remap='I'>parent</emphasis> argument to 4919e7bcd65Smrg <xref linkend='XtCreateWidget' xrefstyle='select: title'/> 4929e7bcd65Smrg (may not be changed).</entry> 4939e7bcd65Smrg </row> 4949e7bcd65Smrg <row> 4959e7bcd65Smrg <entry>being_destroyed</entry> 4969e7bcd65Smrg <entry>Parent's <emphasis remap='I'>being_destroyed</emphasis> value.</entry> 4979e7bcd65Smrg </row> 4989e7bcd65Smrg <row> 4999e7bcd65Smrg <entry>destroy_callbacks</entry> 5009e7bcd65Smrg <entry>NULL</entry> 5019e7bcd65Smrg </row> 5029e7bcd65Smrg <row> 5039e7bcd65Smrg <entry>constraints</entry> 5049e7bcd65Smrg <entry>NULL</entry> 5059e7bcd65Smrg </row> 5069e7bcd65Smrg <row> 5079e7bcd65Smrg <entry>x</entry> 5089e7bcd65Smrg <entry>0</entry> 5099e7bcd65Smrg </row> 5109e7bcd65Smrg <row> 5119e7bcd65Smrg <entry>y</entry> 5129e7bcd65Smrg <entry>0</entry> 5139e7bcd65Smrg </row> 5149e7bcd65Smrg <row> 5159e7bcd65Smrg <entry>width</entry> 5169e7bcd65Smrg <entry>0</entry> 5179e7bcd65Smrg </row> 5189e7bcd65Smrg <row> 5199e7bcd65Smrg <entry>height</entry> 5209e7bcd65Smrg <entry>0</entry> 5219e7bcd65Smrg </row> 5229e7bcd65Smrg <row> 5239e7bcd65Smrg <entry>border_width</entry> 5249e7bcd65Smrg <entry>1</entry> 5259e7bcd65Smrg </row> 5269e7bcd65Smrg <row> 5279e7bcd65Smrg <entry>managed</entry> 5289e7bcd65Smrg <entry><function>False</function></entry> 5299e7bcd65Smrg </row> 5309e7bcd65Smrg <row> 5319e7bcd65Smrg <entry>sensitive</entry> 5329e7bcd65Smrg <entry><function>True</function></entry> 5339e7bcd65Smrg </row> 5349e7bcd65Smrg <row> 5359e7bcd65Smrg <entry>ancestor_sensitive</entry> 5369e7bcd65Smrg <entry>logical AND of parent's <emphasis remap='I'>sensitive</emphasis> and 5379e7bcd65Smrg <emphasis remap='I'>ancestor_sensitive</emphasis> values.</entry> 5389e7bcd65Smrg </row> 5399e7bcd65Smrg <row> 5409e7bcd65Smrg <entry>accelerators</entry> 5419e7bcd65Smrg <entry>NULL</entry> 5429e7bcd65Smrg </row> 5439e7bcd65Smrg <row> 5449e7bcd65Smrg <entry>border_pixel</entry> 5459e7bcd65Smrg <entry><function>XtDefaultForeground</function></entry> 5469e7bcd65Smrg </row> 5479e7bcd65Smrg <row> 5489e7bcd65Smrg <entry>border_pixmap</entry> 5499e7bcd65Smrg <entry><function>XtUnspecifiedPixmap</function></entry> 5509e7bcd65Smrg </row> 5519e7bcd65Smrg <row> 5529e7bcd65Smrg <entry>popup_list</entry> 5539e7bcd65Smrg <entry>NULL</entry> 5549e7bcd65Smrg </row> 5559e7bcd65Smrg <row> 5569e7bcd65Smrg <entry>num_popups</entry> 5579e7bcd65Smrg <entry>0</entry> 5589e7bcd65Smrg </row> 5599e7bcd65Smrg <row> 5609e7bcd65Smrg <entry>name</entry> 5619e7bcd65Smrg <entry><emphasis remap='I'>name</emphasis> argument to 5629e7bcd65Smrg <xref linkend='XtCreateWidget' xrefstyle='select: title'/> 5639e7bcd65Smrg (may not be changed).</entry> 5649e7bcd65Smrg </row> 5659e7bcd65Smrg <row> 5669e7bcd65Smrg <entry>screen</entry> 5679e7bcd65Smrg <entry>Parent's <emphasis remap='I'>screen</emphasis>; top-level widget gets screen from display specifier 5689e7bcd65Smrg (may not be changed).</entry> 5699e7bcd65Smrg </row> 5709e7bcd65Smrg <row> 5719e7bcd65Smrg <entry>colormap</entry> 5729e7bcd65Smrg <entry>Parent's <emphasis remap='I'>colormap</emphasis> value.</entry> 5739e7bcd65Smrg </row> 5749e7bcd65Smrg <row> 5759e7bcd65Smrg <entry>window</entry> 5769e7bcd65Smrg <entry>NULL</entry> 5779e7bcd65Smrg </row> 5789e7bcd65Smrg <row> 5799e7bcd65Smrg <entry>depth</entry> 5809e7bcd65Smrg <entry>Parent's <emphasis remap='I'>depth</emphasis>; top-level widget gets root window depth.</entry> 5819e7bcd65Smrg </row> 5829e7bcd65Smrg <row> 5839e7bcd65Smrg <entry>background_pixel</entry> 5849e7bcd65Smrg <entry><function>XtDefaultBackground</function></entry> 5859e7bcd65Smrg </row> 5869e7bcd65Smrg <row> 5879e7bcd65Smrg <entry>background_pixmap</entry> 5889e7bcd65Smrg <entry><function>XtUnspecifiedPixmap</function></entry> 5899e7bcd65Smrg </row> 5909e7bcd65Smrg <row> 5919e7bcd65Smrg <entry>visible</entry> 5929e7bcd65Smrg <entry><function>True</function></entry> 5939e7bcd65Smrg </row> 5949e7bcd65Smrg <row> 5959e7bcd65Smrg <entry>mapped_when_managed</entry> 5969e7bcd65Smrg <entry><function>True</function></entry> 5979e7bcd65Smrg </row> 5989e7bcd65Smrg </tbody> 5999e7bcd65Smrg </tgroup> 6009e7bcd65Smrg</informaltable> 6019e7bcd65Smrg<para> 6029e7bcd65Smrg<function>XtUnspecifiedPixmap</function> 6039e7bcd65Smrgis a symbolic constant guaranteed to be unequal to 6049e7bcd65Smrgany valid Pixmap id, 6059e7bcd65Smrg<function>None</function>, 6069e7bcd65Smrgand 6079e7bcd65Smrg<function>ParentRelative</function>. 6089e7bcd65Smrg</para> 6099e7bcd65Smrg</sect3> 6109e7bcd65Smrg</sect2> 6119e7bcd65Smrg 6129e7bcd65Smrg<sect2 id="Composite_Widgets"> 6139e7bcd65Smrg<title>Composite Widgets</title> 6149e7bcd65Smrg<para> 6159e7bcd65SmrgThe Composite 6169e7bcd65Smrgwidget class is a subclass of the 6179e7bcd65SmrgCore 6189e7bcd65Smrgwidget class (see <xref linkend='Composite_Widgets_and_Their_Children' />). 6199e7bcd65SmrgComposite widgets are intended to be containers for other widgets. 6209e7bcd65SmrgThe additional data used by composite widgets are defined by the 6219e7bcd65Smrg<function>CompositeClassPart</function> 6229e7bcd65Smrgand 6239e7bcd65Smrg<function>CompositePart</function> 6249e7bcd65Smrgstructures. 6259e7bcd65Smrg</para> 6269e7bcd65Smrg<sect3 id="CompositeClassPart_Structure"> 6279e7bcd65Smrg<title>CompositeClassPart Structure</title> 6289e7bcd65Smrg<para> 6299e7bcd65SmrgIn addition to the 6309e7bcd65SmrgCore 6319e7bcd65Smrgclass fields, 6329e7bcd65Smrgwidgets of the Composite class have the following class fields. 6339e7bcd65Smrg</para> 6340568f49bSmrg<programlisting> 6359e7bcd65Smrgtypedef struct { 6360568f49bSmrg XtGeometryHandler geometry_manager; <lineannotation>See <xref linkend='Geometry_Management' xrefstyle='select: title' /></lineannotation> 6370568f49bSmrg XtWidgetProc change_managed; <lineannotation>See <xref linkend='Composite_Widgets_and_Their_Children' xrefstyle='select: title' /></lineannotation> 6380568f49bSmrg XtWidgetProc insert_child; <lineannotation>See <xref linkend='Composite_Widgets_and_Their_Children' xrefstyle='select: title' /></lineannotation> 6390568f49bSmrg XtWidgetProc delete_child; <lineannotation>See <xref linkend='Composite_Widgets_and_Their_Children' xrefstyle='select: title' /></lineannotation> 6400568f49bSmrg XtPointer extension; <lineannotation>See <xref linkend='Widget_Classing' xrefstyle='select: title' /></lineannotation> 6419e7bcd65Smrg} CompositeClassPart; 6420568f49bSmrg</programlisting> 6439e7bcd65Smrg<para> 6449e7bcd65SmrgThe extension record defined for 6459e7bcd65Smrg<function>CompositeClassPart</function> 6469e7bcd65Smrgwith <emphasis remap='I'>record_type</emphasis> 6479e7bcd65Smrgequal to 6489e7bcd65Smrg<emphasis role='strong'>NULLQUARK</emphasis> 6499e7bcd65Smrgis 6509e7bcd65Smrg<function>CompositeClassExtensionRec</function>. 6519e7bcd65Smrg</para> 6520568f49bSmrg<programlisting> 6539e7bcd65Smrgtypedef struct { 6540568f49bSmrg XtPointer next_extension; <lineannotation>See <xref linkend='Class_Extension_Records' xrefstyle='select: title' /></lineannotation> 6550568f49bSmrg XrmQuark record_type; <lineannotation>See <xref linkend='Class_Extension_Records' xrefstyle='select: title' /></lineannotation> 6560568f49bSmrg long version; <lineannotation>See <xref linkend='Class_Extension_Records' xrefstyle='select: title' /></lineannotation> 6570568f49bSmrg Cardinal record_size; <lineannotation>See <xref linkend='Class_Extension_Records' xrefstyle='select: title' /></lineannotation> 6580568f49bSmrg Boolean accepts_objects; <lineannotation>See <xref linkend='Creating_a_Widget_Instance' xrefstyle='select: title' /></lineannotation> 6590568f49bSmrg Boolean allows_change_managed_set; <lineannotation>See <xref linkend='Bundling_Changes_to_the_Managed_Set' xrefstyle='select: title' /></lineannotation> 6609e7bcd65Smrg} CompositeClassExtensionRec, *CompositeClassExtension; 6610568f49bSmrg</programlisting> 6629e7bcd65Smrg<para> 6639e7bcd65SmrgComposite 6649e7bcd65Smrgclasses have the Composite class fields immediately following the 6659e7bcd65SmrgCore class fields. 6669e7bcd65Smrg</para> 6670568f49bSmrg<programlisting> 6689e7bcd65Smrgtypedef struct { 6699e7bcd65Smrg CoreClassPart core_class; 6709e7bcd65Smrg CompositeClassPart composite_class; 6719e7bcd65Smrg} CompositeClassRec, *CompositeWidgetClass; 6720568f49bSmrg</programlisting> 6739e7bcd65Smrg<para> 6749e7bcd65SmrgThe single occurrences of the class record and pointer for creating 6759e7bcd65Smrginstances of Composite are 6769e7bcd65Smrg</para> 6779e7bcd65Smrg 6789e7bcd65Smrg<para> 6799e7bcd65SmrgIn 6800568f49bSmrg<filename class="headerfile">IntrinsicP.h</filename>: 6819e7bcd65Smrg</para> 6820568f49bSmrg<programlisting> 6839e7bcd65Smrgextern CompositeClassRec compositeClassRec; 6840568f49bSmrg</programlisting> 6859e7bcd65Smrg<para> 6869e7bcd65SmrgIn 6870568f49bSmrg<filename class="headerfile">Intrinsic.h</filename>: 6889e7bcd65Smrg</para> 6890568f49bSmrg<programlisting> 6909e7bcd65Smrgextern WidgetClass compositeWidgetClass; 6910568f49bSmrg</programlisting> 6929e7bcd65Smrg<para> 6939e7bcd65SmrgThe opaque types 6949e7bcd65Smrg<function>CompositeWidget</function> 6959e7bcd65Smrgand 6969e7bcd65Smrg<function>CompositeWidgetClass</function> 6979e7bcd65Smrgand the opaque variable 6989e7bcd65Smrg<function>compositeWidgetClass</function> 6999e7bcd65Smrgare defined for generic operations on widgets whose class 7009e7bcd65Smrgis Composite or a subclass of Composite. 7019e7bcd65SmrgThe symbolic constant for the 7029e7bcd65Smrg<function>CompositeClassExtension</function> 7039e7bcd65Smrgversion identifier is 7049e7bcd65Smrg<function>XtCompositeExtensionVersion</function> 7059e7bcd65Smrg(see <xref linkend='Class_Extension_Records' />). 7060568f49bSmrg<filename class="headerfile">Intrinsic.h</filename> 7079e7bcd65Smrguses an incomplete structure 7089e7bcd65Smrgdefinition to ensure that the compiler catches attempts to access 7099e7bcd65Smrgprivate data. 7109e7bcd65Smrg</para> 7110568f49bSmrg<programlisting> 7129e7bcd65Smrgtypedef struct _CompositeClassRec *CompositeWidgetClass; 7130568f49bSmrg</programlisting> 7149e7bcd65Smrg</sect3> 7159e7bcd65Smrg<sect3 id="CompositePart_Structure"> 7169e7bcd65Smrg<title>CompositePart Structure</title> 7179e7bcd65Smrg<para> 7189e7bcd65SmrgIn addition to the 7199e7bcd65SmrgCore instance 7209e7bcd65Smrgfields, 7219e7bcd65Smrgwidgets of the Composite class have the following 7229e7bcd65Smrginstance fields defined in the 7239e7bcd65Smrg<function>CompositePart</function> 7249e7bcd65Smrgstructure. 7259e7bcd65Smrg</para> 7260568f49bSmrg<programlisting> 7279e7bcd65Smrgtypedef struct { 7280568f49bSmrg WidgetList children; <lineannotation>See <xref linkend='Composite_Widgets_and_Their_Children' xrefstyle='select: title' /></lineannotation> 7290568f49bSmrg Cardinal num_children; <lineannotation>See <xref linkend='Composite_Widgets_and_Their_Children' xrefstyle='select: title' /></lineannotation> 7300568f49bSmrg Cardinal num_slots; <lineannotation>See <xref linkend='Composite_Widgets_and_Their_Children' xrefstyle='select: title' /></lineannotation> 7310568f49bSmrg XtOrderProc insert_position; <lineannotation>See <xref linkend='Insertion_Order_of_Children_The_insert_position_Procedure' xrefstyle='select: title' /></lineannotation> 7329e7bcd65Smrg} CompositePart; 7330568f49bSmrg</programlisting> 7349e7bcd65Smrg<para> 7359e7bcd65SmrgComposite 7369e7bcd65Smrgwidgets have the Composite instance fields immediately following the Core 7379e7bcd65Smrginstance fields. 7389e7bcd65Smrg</para> 7390568f49bSmrg<programlisting> 7409e7bcd65Smrgtypedef struct { 7419e7bcd65Smrg CorePart core; 7429e7bcd65Smrg CompositePart composite; 7439e7bcd65Smrg} CompositeRec, *CompositeWidget; 7440568f49bSmrg</programlisting> 7459e7bcd65Smrg<para> 7460568f49bSmrg<filename class="headerfile">Intrinsic.h</filename> 7479e7bcd65Smrguses an incomplete structure definition to ensure that the 7489e7bcd65Smrgcompiler catches attempts to access private data. 7499e7bcd65Smrg</para> 7500568f49bSmrg<programlisting> 7519e7bcd65Smrgtypedef struct _CompositeRec *CompositeWidget; 7520568f49bSmrg</programlisting> 7539e7bcd65Smrg</sect3> 7549e7bcd65Smrg<sect3 id="Composite_Resources"> 7559e7bcd65Smrg<title>Composite Resources</title> 7569e7bcd65Smrg<para> 7579e7bcd65SmrgThe resource names, classes, and representation types 7589e7bcd65Smrgthat are specified in 7599e7bcd65Smrgthe 7609e7bcd65Smrg<function>compositeClassRec</function> 7619e7bcd65Smrgresource list are 7629e7bcd65Smrg</para> 7639e7bcd65Smrg 7649e7bcd65Smrg<informaltable frame='topbot'> 7659e7bcd65Smrg <?dbfo keep-together="always" ?> 7669e7bcd65Smrg <tgroup cols='3' align='left' colsep='0' rowsep='0'> 7679e7bcd65Smrg <colspec colname='c1' colwidth='1.0*'/> 7689e7bcd65Smrg <colspec colname='c2' colwidth='1.0*'/> 7699e7bcd65Smrg <colspec colname='c3' colwidth='1.0*'/> 7709e7bcd65Smrg <thead> 7719e7bcd65Smrg <row rowsep='1'> 7729e7bcd65Smrg <entry>Name</entry> 7739e7bcd65Smrg <entry>Class</entry> 7749e7bcd65Smrg <entry>Representation</entry> 7759e7bcd65Smrg </row> 7769e7bcd65Smrg </thead> 7779e7bcd65Smrg <tbody> 7789e7bcd65Smrg <row> 7799e7bcd65Smrg <entry>XtNchildren</entry> 7809e7bcd65Smrg <entry>XtCReadOnly</entry> 7819e7bcd65Smrg <entry>XtRWidgetList</entry> 7829e7bcd65Smrg </row> 7839e7bcd65Smrg <row> 7849e7bcd65Smrg <entry>XtNinsertPosition</entry> 7859e7bcd65Smrg <entry>XtCInsertPosition</entry> 7869e7bcd65Smrg <entry>XtRFunction</entry> 7879e7bcd65Smrg </row> 7889e7bcd65Smrg <row> 7899e7bcd65Smrg <entry>XtNnumChildren</entry> 7909e7bcd65Smrg <entry>XtCReadOnly</entry> 7919e7bcd65Smrg <entry>XtRCardinal</entry> 7929e7bcd65Smrg </row> 7939e7bcd65Smrg </tbody> 7949e7bcd65Smrg </tgroup> 7959e7bcd65Smrg</informaltable> 7969e7bcd65Smrg 7979e7bcd65Smrg</sect3> 7989e7bcd65Smrg<sect3 id="CompositePart_Default_Values"> 7999e7bcd65Smrg<title>CompositePart Default Values</title> 8009e7bcd65Smrg<para> 8019e7bcd65SmrgThe default values for the Composite fields, 8029e7bcd65Smrgwhich are filled in from the 8039e7bcd65SmrgComposite 8049e7bcd65Smrgresource list and by the 8059e7bcd65SmrgComposite 8069e7bcd65Smrginitialize procedure, are 8079e7bcd65Smrg</para> 8089e7bcd65Smrg 8099e7bcd65Smrg<informaltable frame='topbot'> 8109e7bcd65Smrg <?dbfo keep-together="always" ?> 8119e7bcd65Smrg <?dbfo table-width="50%" ?> 8129e7bcd65Smrg <tgroup cols='2' align='left' colsep='0' rowsep='0'> 8139e7bcd65Smrg <colspec colname='c1' colwidth='1.0*' colsep='0'/> 8149e7bcd65Smrg <colspec colname='c2' colwidth='1.0*' colsep='0'/> 8159e7bcd65Smrg <thead> 8169e7bcd65Smrg <row rowsep='1'> 8179e7bcd65Smrg <entry>Field</entry> 8189e7bcd65Smrg <entry>Default Value</entry> 8199e7bcd65Smrg </row> 8209e7bcd65Smrg </thead> 8219e7bcd65Smrg <tbody> 8229e7bcd65Smrg <row> 8239e7bcd65Smrg <entry>children</entry><entry>NULL</entry> 8249e7bcd65Smrg </row> 8259e7bcd65Smrg <row> 8269e7bcd65Smrg <entry>num_children</entry><entry>0</entry> 8279e7bcd65Smrg </row> 8289e7bcd65Smrg <row> 8299e7bcd65Smrg <entry>num_slots</entry><entry>0</entry> 8309e7bcd65Smrg </row> 8319e7bcd65Smrg <row> 8329e7bcd65Smrg <entry>insert_position</entry><entry>Internal function to insert at end</entry> 8339e7bcd65Smrg </row> 8349e7bcd65Smrg </tbody> 8359e7bcd65Smrg </tgroup> 8369e7bcd65Smrg</informaltable> 8379e7bcd65Smrg 8389e7bcd65Smrg<para> 8399e7bcd65SmrgThe <emphasis remap='I'>children</emphasis>, <emphasis remap='I'>num_children</emphasis>, 8409e7bcd65Smrgand <emphasis remap='I'>insert_position</emphasis> fields are declared 8419e7bcd65Smrgas resources; 8429e7bcd65SmrgXtNinsertPosition 8439e7bcd65Smrgis a settable resource, 8449e7bcd65SmrgXtNchildren 8459e7bcd65Smrgand 8469e7bcd65SmrgXtNnumChildren 8479e7bcd65Smrgmay be read by any client but should only be modified by the composite 8489e7bcd65Smrgwidget class procedures. 8499e7bcd65Smrg</para> 8509e7bcd65Smrg</sect3> 8519e7bcd65Smrg</sect2> 8529e7bcd65Smrg 8539e7bcd65Smrg<sect2 id="Constraint_Widgets"> 8549e7bcd65Smrg<title>Constraint Widgets</title> 8559e7bcd65Smrg<para> 8569e7bcd65SmrgThe Constraint 8579e7bcd65Smrgwidget class is a subclass of the 8589e7bcd65SmrgComposite 8599e7bcd65Smrgwidget class (see <xref linkend='Constrained_Composite_Widgets' />). Constraint 8609e7bcd65Smrgwidgets maintain additional state 8619e7bcd65Smrgdata for each child; for example, client-defined constraints on the child's 8629e7bcd65Smrggeometry. 8639e7bcd65SmrgThe additional data used by constraint widgets are defined by the 8649e7bcd65Smrg<function>ConstraintClassPart</function> 8659e7bcd65Smrgand 8669e7bcd65Smrg<function>ConstraintPart</function> 8679e7bcd65Smrgstructures. 8689e7bcd65Smrg</para> 8699e7bcd65Smrg<sect3 id="ConstraintClassPart_Structure"> 8709e7bcd65Smrg<title>ConstraintClassPart Structure</title> 8719e7bcd65Smrg<para> 8729e7bcd65SmrgIn addition to the 8739e7bcd65SmrgCore 8749e7bcd65Smrgand 8759e7bcd65SmrgComposite 8769e7bcd65Smrgclass fields, 8779e7bcd65Smrgwidgets of the Constraint class 8789e7bcd65Smrghave the following class fields. 8799e7bcd65Smrg</para> 8800568f49bSmrg<programlisting> 8819e7bcd65Smrgtypedef struct { 8820568f49bSmrg XtResourceList resources; <lineannotation>See <xref linkend='Resource_Management' xrefstyle='select: title' /></lineannotation> 8830568f49bSmrg Cardinal num_resources; <lineannotation>See <xref linkend='Resource_Management' xrefstyle='select: title' /></lineannotation> 8840568f49bSmrg Cardinal constraint_size; <lineannotation>See <xref linkend='Constrained_Composite_Widgets' xrefstyle='select: title' /></lineannotation> 8850568f49bSmrg XtInitProc initialize; <lineannotation>See <xref linkend='Constrained_Composite_Widgets' xrefstyle='select: title' /></lineannotation> 8860568f49bSmrg XtWidgetProc destroy; <lineannotation>See <xref linkend='Constrained_Composite_Widgets' xrefstyle='select: title' /></lineannotation> 8870568f49bSmrg XtSetValuesFunc set_values; <lineannotation>See <xref linkend='Setting_Widget_State' xrefstyle='select: title' /></lineannotation> 8880568f49bSmrg XtPointer extension; <lineannotation>See <xref linkend='Widget_Classing' xrefstyle='select: title' /></lineannotation> 8899e7bcd65Smrg} ConstraintClassPart; 8900568f49bSmrg</programlisting> 8919e7bcd65Smrg<para> 8929e7bcd65SmrgThe extension record defined for 8939e7bcd65Smrg<function>ConstraintClassPart</function> 8949e7bcd65Smrgwith <emphasis remap='I'>record_type</emphasis> equal to 8959e7bcd65Smrg<emphasis role='strong'>NULLQUARK</emphasis> 8969e7bcd65Smrgis 8979e7bcd65Smrg<function>ConstraintClassExtensionRec</function>. 8989e7bcd65Smrg</para> 8990568f49bSmrg<programlisting> 9009e7bcd65Smrgtypedef struct { 9010568f49bSmrg XtPointer next_extension; <lineannotation>See <xref linkend='Class_Extension_Records' xrefstyle='select: title' /></lineannotation> 9020568f49bSmrg XrmQuark record_type; <lineannotation>See <xref linkend='Class_Extension_Records' xrefstyle='select: title' /></lineannotation> 9030568f49bSmrg long version; <lineannotation>See <xref linkend='Class_Extension_Records' xrefstyle='select: title' /></lineannotation> 9040568f49bSmrg Cardinal record_size; <lineannotation>See <xref linkend='Class_Extension_Records' xrefstyle='select: title' /></lineannotation> 9050568f49bSmrg XtArgsProc get_values_hook; <lineannotation>See <xref linkend='Obtaining_Widget_State' xrefstyle='select: title' /></lineannotation> 9069e7bcd65Smrg} ConstraintClassExtensionRec, *ConstraintClassExtension; 9070568f49bSmrg</programlisting> 9089e7bcd65Smrg<para> 9099e7bcd65SmrgConstraint 9109e7bcd65Smrgclasses have the Constraint class fields immediately following the 9119e7bcd65SmrgComposite class fields. 9129e7bcd65Smrg</para> 9130568f49bSmrg<programlisting> 9149e7bcd65Smrgtypedef struct _ConstraintClassRec { 9159e7bcd65Smrg CoreClassPart core_class; 9169e7bcd65Smrg CompositeClassPart composite_class; 9179e7bcd65Smrg ConstraintClassPart constraint_class; 9189e7bcd65Smrg} ConstraintClassRec, *ConstraintWidgetClass; 9190568f49bSmrg</programlisting> 9209e7bcd65Smrg<para> 9219e7bcd65SmrgThe single occurrences of the class record and pointer for creating 9229e7bcd65Smrginstances of Constraint are 9239e7bcd65Smrg</para> 9249e7bcd65Smrg 9259e7bcd65Smrg<para> 9269e7bcd65SmrgIn 9270568f49bSmrg<filename class="headerfile">IntrinsicP.h</filename>: 9289e7bcd65Smrg</para> 9290568f49bSmrg<programlisting> 9309e7bcd65Smrgextern ConstraintClassRec constraintClassRec; 9310568f49bSmrg</programlisting> 9329e7bcd65Smrg<para> 9339e7bcd65SmrgIn 9340568f49bSmrg<filename class="headerfile">Intrinsic.h</filename>: 9359e7bcd65Smrg</para> 9360568f49bSmrg<programlisting> 9379e7bcd65Smrgextern WidgetClass constraintWidgetClass; 9380568f49bSmrg</programlisting> 9399e7bcd65Smrg<para> 9409e7bcd65SmrgThe opaque types 9419e7bcd65Smrg<function>ConstraintWidget</function> 9429e7bcd65Smrgand 9439e7bcd65Smrg<function>ConstraintWidgetClass</function> 9449e7bcd65Smrgand the opaque variable 9459e7bcd65Smrg<function>constraintWidgetClass</function> 9469e7bcd65Smrgare defined for generic operations on widgets 9479e7bcd65Smrgwhose class is Constraint or a subclass 9489e7bcd65Smrgof Constraint. 9499e7bcd65SmrgThe symbolic constant for the 9509e7bcd65Smrg<function>ConstraintClassExtension</function> 9519e7bcd65Smrgversion identifier is 9529e7bcd65Smrg<function>XtConstraintExtensionVersion</function> 9539e7bcd65Smrg(see <xref linkend='Class_Extension_Records' />). 9540568f49bSmrg<filename class="headerfile">Intrinsic.h</filename> 9559e7bcd65Smrguses an incomplete structure definition to ensure that the 9569e7bcd65Smrgcompiler catches attempts to access private data. 9579e7bcd65Smrg</para> 9580568f49bSmrg<programlisting> 9599e7bcd65Smrgtypedef struct _ConstraintClassRec *ConstraintWidgetClass; 9600568f49bSmrg</programlisting> 9619e7bcd65Smrg</sect3> 9629e7bcd65Smrg<sect3 id="ConstraintPart_Structure"> 9639e7bcd65Smrg<title>ConstraintPart Structure</title> 9649e7bcd65Smrg<para> 9659e7bcd65SmrgIn addition to the 9669e7bcd65SmrgCore 9679e7bcd65Smrgand 9689e7bcd65SmrgComposite instance 9699e7bcd65Smrgfields, 9709e7bcd65Smrgwidgets of the Constraint class have the following unused 9719e7bcd65Smrginstance fields defined in the 9729e7bcd65Smrg<function>ConstraintPart</function> 9739e7bcd65Smrgstructure 9749e7bcd65Smrg</para> 9750568f49bSmrg<programlisting> 9769e7bcd65Smrgtypedef struct { 9779e7bcd65Smrg int empty; 9789e7bcd65Smrg} ConstraintPart; 9790568f49bSmrg</programlisting> 9809e7bcd65Smrg<para> 9819e7bcd65SmrgConstraint 9829e7bcd65Smrgwidgets have the Constraint instance fields immediately following the 9839e7bcd65SmrgComposite instance fields. 9849e7bcd65Smrg</para> 9850568f49bSmrg<programlisting> 9869e7bcd65Smrgtypedef struct { 9879e7bcd65Smrg CorePart core; 9889e7bcd65Smrg CompositePart composite; 9899e7bcd65Smrg ConstraintPart constraint; 9909e7bcd65Smrg} ConstraintRec, *ConstraintWidget; 9910568f49bSmrg</programlisting> 9929e7bcd65Smrg<para> 9930568f49bSmrg<filename class="headerfile">Intrinsic.h</filename> 9949e7bcd65Smrguses an incomplete structure definition to ensure that the 9959e7bcd65Smrgcompiler catches attempts to access private data. 9969e7bcd65Smrg</para> 9970568f49bSmrg<programlisting> 9989e7bcd65Smrgtypedef struct _ConstraintRec *ConstraintWidget; 9990568f49bSmrg</programlisting> 10009e7bcd65Smrg</sect3> 10019e7bcd65Smrg<sect3 id="Constraint_Resources"> 10029e7bcd65Smrg<title>Constraint Resources</title> 10039e7bcd65Smrg<para> 10049e7bcd65SmrgThe 10059e7bcd65Smrg<function>constraintClassRec</function> 10069e7bcd65Smrg<emphasis remap='I'>core_class</emphasis> and <emphasis remap='I'>constraint_class resources</emphasis> fields are NULL, 10079e7bcd65Smrgand the <emphasis remap='I'>num_resources</emphasis> fields are zero; 10089e7bcd65Smrgno additional resources beyond those declared by 10099e7bcd65Smrgthe superclasses 10109e7bcd65Smrgare defined for 10119e7bcd65SmrgConstraint. 10129e7bcd65Smrg</para> 10139e7bcd65Smrg</sect3> 10149e7bcd65Smrg</sect2> 10159e7bcd65Smrg</sect1> 10169e7bcd65Smrg 10179e7bcd65Smrg<sect1 id="Implementation_Specific_Types"> 10189e7bcd65Smrg<title>Implementation-Specific Types</title> 10199e7bcd65Smrg<para> 10209e7bcd65SmrgTo increase the portability of widget and application source code 10219e7bcd65Smrgbetween different system environments, the Intrinsics define several 10229e7bcd65Smrgtypes whose precise representation is explicitly dependent upon, 10239e7bcd65Smrgand chosen by, each individual implementation of the Intrinsics. 10249e7bcd65Smrg</para> 10259e7bcd65Smrg 10269e7bcd65Smrg<para> 10279e7bcd65SmrgThese implementation-defined types are 10289e7bcd65Smrg</para> 10299e7bcd65Smrg<variablelist> 10309e7bcd65Smrg <varlistentry> 10319e7bcd65Smrg <term> 10329e7bcd65Smrg <emphasis role='strong'>Boolean</emphasis> 10339e7bcd65Smrg </term> 10349e7bcd65Smrg <listitem> 10359e7bcd65Smrg <para> 10369e7bcd65SmrgA datum that contains a zero or nonzero value. 10379e7bcd65SmrgUnless explicitly stated, clients should not assume 10389e7bcd65Smrgthat the nonzero value is equal to the symbolic 10399e7bcd65Smrgvalue 10409e7bcd65Smrg<function>True</function>. 10419e7bcd65Smrg </para> 10429e7bcd65Smrg </listitem> 10439e7bcd65Smrg </varlistentry> 10449e7bcd65Smrg 10459e7bcd65Smrg <varlistentry> 10469e7bcd65Smrg <term> 10479e7bcd65Smrg <emphasis role='strong'>Cardinal</emphasis> 10489e7bcd65Smrg </term> 10499e7bcd65Smrg <listitem> 10509e7bcd65Smrg <para> 10510568f49bSmrgAn unsigned integer datum with a minimum range of [0..2<superscript>16</superscript>-1]. 10529e7bcd65Smrg </para> 10539e7bcd65Smrg </listitem> 10549e7bcd65Smrg </varlistentry> 10559e7bcd65Smrg 10569e7bcd65Smrg <varlistentry> 10579e7bcd65Smrg <term> 10589e7bcd65Smrg <emphasis role='strong'>Dimension</emphasis> 10599e7bcd65Smrg </term> 10609e7bcd65Smrg <listitem> 10619e7bcd65Smrg <para> 10620568f49bSmrgAn unsigned integer datum with a minimum range of [0..2<superscript>16</superscript>-1]. 10639e7bcd65Smrg </para> 10649e7bcd65Smrg </listitem> 10659e7bcd65Smrg </varlistentry> 10669e7bcd65Smrg 10679e7bcd65Smrg <varlistentry> 10689e7bcd65Smrg <term> 10699e7bcd65Smrg <emphasis role='strong'>Position</emphasis> 10709e7bcd65Smrg </term> 10719e7bcd65Smrg <listitem> 10729e7bcd65Smrg <para> 10730568f49bSmrgA signed integer datum with a minimum range of [-2<superscript>15</superscript>..2<superscript>15</superscript>-1]. 10749e7bcd65Smrg </para> 10759e7bcd65Smrg </listitem> 10769e7bcd65Smrg </varlistentry> 10779e7bcd65Smrg 10789e7bcd65Smrg <varlistentry> 10799e7bcd65Smrg <term> 10809e7bcd65Smrg <emphasis role='strong'>XtPointer</emphasis> 10819e7bcd65Smrg </term> 10829e7bcd65Smrg <listitem> 10839e7bcd65Smrg <para> 10849e7bcd65SmrgA datum large enough to contain the largest of a char*, int*, function 10859e7bcd65Smrgpointer, structure pointer, or long value. A pointer 10869e7bcd65Smrgto any type or function, or a long value may be converted 10879e7bcd65Smrgto an 10889e7bcd65Smrg<function>XtPointer</function> 10899e7bcd65Smrgand back again and the result will 10909e7bcd65Smrgcompare equal to the original value. In ANSI C 10919e7bcd65Smrgenvironments it is expected that 10929e7bcd65Smrg<function>XtPointer</function> 10939e7bcd65Smrgwill be 10949e7bcd65Smrgdefined as void*. 10959e7bcd65Smrg </para> 10969e7bcd65Smrg </listitem> 10979e7bcd65Smrg </varlistentry> 10989e7bcd65Smrg 10999e7bcd65Smrg <varlistentry> 11009e7bcd65Smrg <term> 11019e7bcd65Smrg <emphasis role='strong'>XtArgVal</emphasis> 11029e7bcd65Smrg </term> 11039e7bcd65Smrg <listitem> 11049e7bcd65Smrg <para> 11059e7bcd65SmrgA datum large enough to contain an 11069e7bcd65Smrg<function>XtPointer</function>, 11079e7bcd65Smrg<function>Cardinal</function>, 11089e7bcd65Smrg<function>Dimension</function>, 11099e7bcd65Smrgor 11109e7bcd65Smrg<function>Position</function> 11119e7bcd65Smrgvalue. 11129e7bcd65Smrg </para> 11139e7bcd65Smrg </listitem> 11149e7bcd65Smrg </varlistentry> 11159e7bcd65Smrg 11169e7bcd65Smrg <varlistentry> 11179e7bcd65Smrg <term> 11189e7bcd65Smrg <emphasis role='strong'>XtEnum</emphasis> 11199e7bcd65Smrg </term> 11209e7bcd65Smrg <listitem> 11219e7bcd65Smrg <para> 11229e7bcd65SmrgAn integer datum large enough to encode at least 128 distinct 11239e7bcd65Smrgvalues, two of which are the symbolic values 11249e7bcd65Smrg<function>True</function> 11259e7bcd65Smrgand 11269e7bcd65Smrg<function>False</function>. 11279e7bcd65SmrgThe symbolic values 11289e7bcd65Smrg<emphasis role='strong'>TRUE</emphasis> 11299e7bcd65Smrgand 11309e7bcd65Smrg<emphasis role='strong'>FALSE</emphasis> 11319e7bcd65Smrgare 11329e7bcd65Smrgalso defined to be equal to 11339e7bcd65Smrg<function>True</function> 11349e7bcd65Smrgand 11359e7bcd65Smrg<function>False</function>, 11369e7bcd65Smrgrespectively. 11379e7bcd65Smrg </para> 11389e7bcd65Smrg </listitem> 11399e7bcd65Smrg </varlistentry> 11409e7bcd65Smrg</variablelist> 11419e7bcd65Smrg 11429e7bcd65Smrg<para> 11439e7bcd65SmrgIn addition to these specific types, the precise order of the 11449e7bcd65Smrgfields within the structure declarations for any of the instance 11459e7bcd65Smrgpart records 11469e7bcd65Smrg<function>ObjectPart</function>, 11479e7bcd65Smrg<function>RectObjPart</function>, 11489e7bcd65Smrg<function>CorePart</function>, 11499e7bcd65Smrg<function>CompositePart</function>, 11509e7bcd65Smrg<function>ShellPart</function>, 11519e7bcd65Smrg<function>WMShellPart</function>, 11529e7bcd65Smrg<function>TopLevelShellPart</function>, 11539e7bcd65Smrgand 11549e7bcd65Smrg<function>ApplicationShellPart</function> 11559e7bcd65Smrgis implementation-defined. These 11569e7bcd65Smrgstructures may also have additional private 11579e7bcd65Smrgfields internal to the implementation. 11589e7bcd65SmrgThe 11599e7bcd65Smrg<function>ObjectPart</function>, 11609e7bcd65Smrg<function>RectObjPart</function>, 11619e7bcd65Smrgand 11629e7bcd65Smrg<function>CorePart</function> 11639e7bcd65Smrgstructures must be defined so that any member with the same name 11649e7bcd65Smrgappears at the same offset in 11659e7bcd65Smrg<function>ObjectRec</function>, 11669e7bcd65Smrg<function>RectObjRec</function>, 11679e7bcd65Smrgand 11689e7bcd65Smrg<function>CoreRec</function> 11699e7bcd65Smrg<function>( WidgetRec ).</function> 11709e7bcd65SmrgNo other relations between the offsets of any two 11719e7bcd65Smrgfields may be assumed. 11729e7bcd65Smrg</para> 11739e7bcd65Smrg</sect1> 11749e7bcd65Smrg 11759e7bcd65Smrg<sect1 id="Widget_Classing"> 11769e7bcd65Smrg<title>Widget Classing</title> 11779e7bcd65Smrg<para> 11789e7bcd65SmrgThe <emphasis remap='I'>widget_class</emphasis> field of a widget points to its widget class structure, 11799e7bcd65Smrgwhich contains information that is constant across all widgets of that class. 11809e7bcd65SmrgAs a consequence, 11819e7bcd65Smrgwidgets usually do not implement directly callable procedures; 11829e7bcd65Smrgrather, they implement procedures, called methods, that are available through 11839e7bcd65Smrgtheir widget class structure. 11849e7bcd65SmrgThese methods are invoked by generic procedures that envelop common actions 11859e7bcd65Smrgaround the methods implemented by the widget class. 11869e7bcd65SmrgSuch procedures are applicable to all widgets 11879e7bcd65Smrgof that class and also to widgets whose classes are subclasses of that class. 11889e7bcd65Smrg</para> 11899e7bcd65Smrg 11909e7bcd65Smrg<para> 11919e7bcd65SmrgAll widget classes are a subclass of 11929e7bcd65SmrgCore 11939e7bcd65Smrgand can be subclassed further. 11949e7bcd65SmrgSubclassing reduces the amount of code and declarations 11959e7bcd65Smrgnecessary to make a 11969e7bcd65Smrgnew widget class that is similar to an existing class. 11979e7bcd65SmrgFor example, you do not have to describe every resource your widget uses in an 11989e7bcd65Smrg<function>XtResourceList</function>. 11999e7bcd65SmrgInstead, you describe only the resources your widget has 12009e7bcd65Smrgthat its superclass does not. 12019e7bcd65SmrgSubclasses usually inherit many of their superclasses' procedures 12029e7bcd65Smrg(for example, the expose procedure or geometry handler). 12039e7bcd65Smrg</para> 12049e7bcd65Smrg 12059e7bcd65Smrg<para> 12069e7bcd65SmrgSubclassing, however, can be taken too far. 12079e7bcd65SmrgIf you create a subclass that inherits none of the procedures of its 12089e7bcd65Smrgsuperclass, 12099e7bcd65Smrgyou should consider whether you have chosen the most 12109e7bcd65Smrgappropriate superclass. 12119e7bcd65Smrg</para> 12129e7bcd65Smrg 12139e7bcd65Smrg<para> 12149e7bcd65SmrgTo make good use of subclassing, 12159e7bcd65Smrgwidget declarations and naming conventions are highly stylized. 12169e7bcd65SmrgA widget consists of three files: 12179e7bcd65Smrg</para> 12189e7bcd65Smrg<itemizedlist spacing='compact'> 12199e7bcd65Smrg <listitem> 12209e7bcd65Smrg <para> 12219e7bcd65SmrgA public .h file, used by client widgets or applications. 12229e7bcd65Smrg </para> 12239e7bcd65Smrg </listitem> 12249e7bcd65Smrg <listitem> 12259e7bcd65Smrg <para> 12269e7bcd65SmrgA private .h file, used by widgets whose classes 12279e7bcd65Smrgare subclasses of the widget class. 12289e7bcd65Smrg </para> 12299e7bcd65Smrg </listitem> 12309e7bcd65Smrg <listitem> 12319e7bcd65Smrg <para> 12329e7bcd65SmrgA .c file, which implements the widget. 12339e7bcd65Smrg </para> 12349e7bcd65Smrg </listitem> 12359e7bcd65Smrg</itemizedlist> 12369e7bcd65Smrg<sect2 id="Widget_Naming_Conventions"> 12379e7bcd65Smrg<title>Widget Naming Conventions</title> 12389e7bcd65Smrg<para> 12399e7bcd65SmrgThe Intrinsics provide a vehicle by which programmers can create 12409e7bcd65Smrgnew widgets and organize a collection of widgets into an application. 12419e7bcd65SmrgTo ensure that applications need not deal with as many styles of capitalization 12429e7bcd65Smrgand spelling as the number of widget classes it uses, 12439e7bcd65Smrgthe following guidelines should be followed when writing new widgets: 12449e7bcd65Smrg</para> 12459e7bcd65Smrg<itemizedlist spacing='compact'> 12469e7bcd65Smrg <listitem> 12479e7bcd65Smrg <para> 12489e7bcd65SmrgUse the X library naming conventions that are applicable. 12499e7bcd65SmrgFor example, a record component name is all lowercase 12509e7bcd65Smrgand uses underscores (_) for compound words (for example, background_pixmap). 12519e7bcd65SmrgType and procedure names start with uppercase and use capitalization for 12529e7bcd65Smrgcompound words (for example, 12539e7bcd65Smrg<function>ArgList</function> 12549e7bcd65Smrgor 12559e7bcd65Smrg<function>XtSetValues ).</function> 12569e7bcd65Smrg </para> 12579e7bcd65Smrg </listitem> 12589e7bcd65Smrg <listitem> 12599e7bcd65Smrg <para> 12609e7bcd65SmrgA resource name is spelled identically to the field name 12619e7bcd65Smrgexcept that compound names use capitalization rather than underscore. 12629e7bcd65SmrgTo let the compiler catch spelling errors, 12639e7bcd65Smrgeach resource name should have a symbolic identifier prefixed with 12640568f49bSmrg“XtN”. 12659e7bcd65SmrgFor example, 12669e7bcd65Smrgthe <emphasis remap='I'>background_pixmap</emphasis> field has the corresponding identifier 12679e7bcd65SmrgXtNbackgroundPixmap, 12680568f49bSmrgwhich is defined as the string “backgroundPixmap”. 12699e7bcd65SmrgMany predefined names are listed in 12700568f49bSmrg<filename class="headerfile"><X11/StringDefs.h></filename>. 12719e7bcd65SmrgBefore you invent a new name, 12729e7bcd65Smrgyou should make sure there is not already a name that you can use. 12739e7bcd65Smrg </para> 12749e7bcd65Smrg </listitem> 12759e7bcd65Smrg <listitem> 12769e7bcd65Smrg <para> 12779e7bcd65SmrgA resource class string starts with a capital letter 12780568f49bSmrgand uses capitalization for compound names (for example,“BorderWidth”). 12799e7bcd65SmrgEach resource class string should have a symbolic identifier prefixed with 12800568f49bSmrg“XtC” 12819e7bcd65Smrg(for example, XtCBorderWidth). 12829e7bcd65SmrgMany predefined classes are listed in 12830568f49bSmrg<filename class="headerfile"><X11/StringDefs.h></filename>. 12849e7bcd65Smrg </para> 12859e7bcd65Smrg </listitem> 12869e7bcd65Smrg <listitem> 12879e7bcd65Smrg <para> 12889e7bcd65SmrgA resource representation string is spelled identically to the type name 12890568f49bSmrg(for example, “TranslationTable”). 12909e7bcd65SmrgEach representation string should have a symbolic identifier prefixed with 12910568f49bSmrg“XtR” 12929e7bcd65Smrg(for example, XtRTranslationTable). 12939e7bcd65SmrgMany predefined representation types are listed in 12940568f49bSmrg<filename class="headerfile"><X11/StringDefs.h></filename>. 12959e7bcd65Smrg </para> 12969e7bcd65Smrg </listitem> 12979e7bcd65Smrg <listitem> 12989e7bcd65Smrg <para> 12999e7bcd65SmrgNew widget classes start with a capital and use uppercase for compound 13009e7bcd65Smrgwords. 13019e7bcd65SmrgGiven a new class name AbcXyz, you should derive several names: 13029e7bcd65Smrg </para> 13039e7bcd65Smrg <itemizedlist spacing='compact'> 13049e7bcd65Smrg <listitem> 13059e7bcd65Smrg <para> 13069e7bcd65SmrgAdditional widget instance structure part name AbcXyzPart. 13079e7bcd65Smrg </para> 13089e7bcd65Smrg </listitem> 13099e7bcd65Smrg <listitem> 13109e7bcd65Smrg <para> 13119e7bcd65SmrgComplete widget instance structure names AbcXyzRec and _AbcXyzRec. 13129e7bcd65Smrg </para> 13139e7bcd65Smrg </listitem> 13149e7bcd65Smrg <listitem> 13159e7bcd65Smrg <para> 13169e7bcd65SmrgWidget instance structure pointer type name AbcXyzWidget. 13179e7bcd65Smrg </para> 13189e7bcd65Smrg </listitem> 13199e7bcd65Smrg <listitem> 13209e7bcd65Smrg <para> 13219e7bcd65SmrgAdditional class structure part name AbcXyzClassPart. 13229e7bcd65Smrg </para> 13239e7bcd65Smrg </listitem> 13249e7bcd65Smrg <listitem> 13259e7bcd65Smrg <para> 13269e7bcd65SmrgComplete class structure names AbcXyzClassRec and _AbcXyzClassRec. 13279e7bcd65Smrg </para> 13289e7bcd65Smrg </listitem> 13299e7bcd65Smrg <listitem> 13309e7bcd65Smrg <para> 13319e7bcd65SmrgClass structure pointer type name AbcXyzWidgetClass. 13329e7bcd65Smrg </para> 13339e7bcd65Smrg </listitem> 13349e7bcd65Smrg <listitem> 13359e7bcd65Smrg <para> 13369e7bcd65SmrgClass structure variable abcXyzClassRec. 13379e7bcd65Smrg </para> 13389e7bcd65Smrg </listitem> 13399e7bcd65Smrg <listitem> 13409e7bcd65Smrg <para> 13419e7bcd65SmrgClass structure pointer variable abcXyzWidgetClass. 13429e7bcd65Smrg </para> 13439e7bcd65Smrg </listitem> 13449e7bcd65Smrg </itemizedlist> 13459e7bcd65Smrg </listitem> 13469e7bcd65Smrg <listitem> 13479e7bcd65Smrg <para> 13489e7bcd65SmrgAction procedures available to translation specifications should follow the 13499e7bcd65Smrgsame naming conventions as procedures. 13509e7bcd65SmrgThat is, 13519e7bcd65Smrgthey start with a capital letter, and compound names use uppercase 13520568f49bSmrg(for example, “Highlight” and “NotifyClient”). 13539e7bcd65Smrg </para> 13549e7bcd65Smrg </listitem> 13559e7bcd65Smrg</itemizedlist> 13569e7bcd65Smrg<para> 13579e7bcd65SmrgThe symbolic identifiers XtN..., XtC..., and XtR... 13589e7bcd65Smrgmay be implemented 13599e7bcd65Smrgas macros, as global symbols, or as a mixture of the two. The 13609e7bcd65Smrg(implicit) type of the identifier is 13619e7bcd65Smrg<function>String</function>. 13629e7bcd65SmrgThe pointer value itself 13639e7bcd65Smrgis not significant; clients must not assume that inequality of two 13649e7bcd65Smrgidentifiers implies inequality of the resource name, class, or 13659e7bcd65Smrgrepresentation string. Clients should also note that although global 13669e7bcd65Smrgsymbols permit savings in literal storage in some environments, they 13679e7bcd65Smrgalso introduce the possibility of multiple definition conflicts when 13689e7bcd65Smrgapplications attempt to use independently developed widgets 13699e7bcd65Smrgsimultaneously. 13709e7bcd65Smrg</para> 13719e7bcd65Smrg</sect2> 13729e7bcd65Smrg 13739e7bcd65Smrg<sect2 id="Widget_Subclassing_in_Public_h_Files"> 13749e7bcd65Smrg<title>Widget Subclassing in Public .h Files</title> 13759e7bcd65Smrg<para> 13769e7bcd65SmrgThe public .h file for a widget class is imported by clients 13779e7bcd65Smrgand contains 13789e7bcd65Smrg</para> 13799e7bcd65Smrg<itemizedlist spacing='compact'> 13809e7bcd65Smrg <listitem> 13819e7bcd65Smrg <para> 13829e7bcd65SmrgA reference to the public .h file for the superclass. 13839e7bcd65Smrg </para> 13849e7bcd65Smrg </listitem> 13859e7bcd65Smrg <listitem> 13869e7bcd65Smrg <para> 13879e7bcd65SmrgSymbolic identifiers for 13889e7bcd65Smrgthe names and classes of the new resources that this widget adds 13899e7bcd65Smrgto its superclass. 13909e7bcd65SmrgThe definitions should 13919e7bcd65Smrghave a single space between the definition name and the value and no 13929e7bcd65Smrgtrailing space or comment in order to reduce the possibility of 13939e7bcd65Smrgcompiler warnings from similar declarations in multiple classes. 13949e7bcd65Smrg </para> 13959e7bcd65Smrg </listitem> 13969e7bcd65Smrg <listitem> 13979e7bcd65Smrg <para> 13989e7bcd65SmrgType declarations for any new resource data types defined by the class. 13999e7bcd65Smrg </para> 14009e7bcd65Smrg </listitem> 14019e7bcd65Smrg <listitem> 14029e7bcd65Smrg <para> 14039e7bcd65SmrgThe class record pointer variable used to create widget instances. 14049e7bcd65Smrg </para> 14059e7bcd65Smrg </listitem> 14069e7bcd65Smrg <listitem> 14079e7bcd65Smrg <para> 14089e7bcd65SmrgThe C type that corresponds to widget instances of this class. 14099e7bcd65Smrg </para> 14109e7bcd65Smrg </listitem> 14119e7bcd65Smrg <listitem> 14129e7bcd65Smrg <para> 14139e7bcd65SmrgEntry points for new class methods. 14149e7bcd65Smrg </para> 14159e7bcd65Smrg </listitem> 14169e7bcd65Smrg</itemizedlist> 14179e7bcd65Smrg<para> 14189e7bcd65SmrgFor example, the following is the public .h file for a possible 14199e7bcd65Smrgimplementation of a Label widget: 14209e7bcd65Smrg</para> 14210568f49bSmrg<programlisting> 14229e7bcd65Smrg#ifndef LABEL_H 14239e7bcd65Smrg#define LABEL_H 14240568f49bSmrg 14259e7bcd65Smrg/* New resources */ 14260568f49bSmrg#define XtNjustify "justify" 14270568f49bSmrg#define XtNforeground "foreground" 14280568f49bSmrg#define XtNlabel "label" 14290568f49bSmrg#define XtNfont "font" 14300568f49bSmrg#define XtNinternalWidth "internalWidth" 14310568f49bSmrg#define XtNinternalHeight "internalHeight" 14320568f49bSmrg 14339e7bcd65Smrg/* Class record pointer */ 14349e7bcd65Smrgextern WidgetClass labelWidgetClass; 14350568f49bSmrg 14369e7bcd65Smrg/* C Widget type definition */ 14370568f49bSmrgtypedef struct _LabelRec *LabelWidget; 14380568f49bSmrg 14399e7bcd65Smrg/* New class method entry points */ 14400568f49bSmrgextern void LabelSetText(Widget w, String text); 14410568f49bSmrgextern String LabelGetText(Widget w); 14420568f49bSmrg 14439e7bcd65Smrg#endif LABEL_H 14440568f49bSmrg</programlisting> 14459e7bcd65Smrg<para> 14469e7bcd65SmrgThe conditional inclusion of the text allows the application 14479e7bcd65Smrgto include header files for different widgets without being concerned 14489e7bcd65Smrgthat they already may be included as a superclass of another widget. 14499e7bcd65Smrg</para> 14509e7bcd65Smrg 14519e7bcd65Smrg<para> 14529e7bcd65SmrgTo accommodate operating systems with file name length restrictions, 14539e7bcd65Smrgthe name of the public .h file is the first ten characters of the 14549e7bcd65Smrgwidget class. 14559e7bcd65SmrgFor example, 14569e7bcd65Smrgthe public .h file for the 14579e7bcd65SmrgConstraint 14589e7bcd65Smrgwidget class is 14590568f49bSmrg<filename class="headerfile">Constraint.h</filename>. 14609e7bcd65Smrg</para> 14619e7bcd65Smrg</sect2> 14629e7bcd65Smrg 14639e7bcd65Smrg<sect2 id="Widget_Subclassing_in_Private_h_Files"> 14649e7bcd65Smrg<title>Widget Subclassing in Private .h Files</title> 14659e7bcd65Smrg<para> 14669e7bcd65SmrgThe private .h file for a widget is imported by widget classes that are 14679e7bcd65Smrgsubclasses of the widget and contains 14689e7bcd65Smrg</para> 14699e7bcd65Smrg<itemizedlist spacing='compact'> 14709e7bcd65Smrg <listitem> 14719e7bcd65Smrg <para> 14729e7bcd65SmrgA reference to the public .h file for the class. 14739e7bcd65Smrg </para> 14749e7bcd65Smrg </listitem> 14759e7bcd65Smrg <listitem> 14769e7bcd65Smrg <para> 14779e7bcd65SmrgA reference to the private .h file for the superclass. 14789e7bcd65Smrg </para> 14799e7bcd65Smrg </listitem> 14809e7bcd65Smrg <listitem> 14819e7bcd65Smrg <para> 14829e7bcd65SmrgSymbolic identifiers for any new resource representation types defined 14839e7bcd65Smrgby the class. The definitions should have a single space between the 14849e7bcd65Smrgdefinition name and the value and no trailing space or comment. 14859e7bcd65Smrg </para> 14869e7bcd65Smrg </listitem> 14879e7bcd65Smrg <listitem> 14889e7bcd65Smrg <para> 14899e7bcd65SmrgA structure part definition for 14909e7bcd65Smrgthe new fields that the widget instance adds to its superclass's 14919e7bcd65Smrgwidget structure. 14929e7bcd65Smrg </para> 14939e7bcd65Smrg </listitem> 14949e7bcd65Smrg <listitem> 14959e7bcd65Smrg <para> 14969e7bcd65SmrgThe complete widget instance structure definition for this widget. 14979e7bcd65Smrg </para> 14989e7bcd65Smrg </listitem> 14999e7bcd65Smrg <listitem> 15009e7bcd65Smrg <para> 15019e7bcd65SmrgA structure part definition for 15029e7bcd65Smrgthe new fields that this widget class adds to its superclass's 15039e7bcd65Smrgconstraint 15049e7bcd65Smrgstructure if the widget class is a subclass of 15059e7bcd65SmrgConstraint. 15069e7bcd65Smrg </para> 15079e7bcd65Smrg </listitem> 15089e7bcd65Smrg <listitem> 15099e7bcd65Smrg <para> 15109e7bcd65SmrgThe complete 15119e7bcd65Smrgconstraint 15129e7bcd65Smrgstructure definition if the widget class is a subclass of 15139e7bcd65SmrgConstraint. 15149e7bcd65Smrg </para> 15159e7bcd65Smrg </listitem> 15169e7bcd65Smrg <listitem> 15179e7bcd65Smrg <para> 15189e7bcd65SmrgType definitions for any new procedure types used by class methods 15199e7bcd65Smrgdeclared in the widget class part. 15209e7bcd65Smrg </para> 15219e7bcd65Smrg </listitem> 15229e7bcd65Smrg <listitem> 15239e7bcd65Smrg <para> 15249e7bcd65SmrgA structure part definition for 15259e7bcd65Smrgthe new fields that this widget class adds to its superclass's widget class 15269e7bcd65Smrgstructure. 15279e7bcd65Smrg </para> 15289e7bcd65Smrg </listitem> 15299e7bcd65Smrg <listitem> 15309e7bcd65Smrg <para> 15319e7bcd65SmrgThe complete widget class structure definition for this widget. 15329e7bcd65Smrg </para> 15339e7bcd65Smrg </listitem> 15349e7bcd65Smrg <listitem> 15359e7bcd65Smrg <para> 15369e7bcd65SmrgThe complete widget class extension structure definition 15379e7bcd65Smrgfor this widget, if any. 15389e7bcd65Smrg </para> 15399e7bcd65Smrg </listitem> 15409e7bcd65Smrg <listitem> 15419e7bcd65Smrg <para> 15429e7bcd65SmrgThe symbolic constant identifying the class extension version, if any. 15439e7bcd65Smrg </para> 15449e7bcd65Smrg </listitem> 15459e7bcd65Smrg <listitem> 15469e7bcd65Smrg <para> 15479e7bcd65SmrgThe name of the global class structure variable containing the generic 15489e7bcd65Smrgclass structure for this class. 15499e7bcd65Smrg </para> 15509e7bcd65Smrg </listitem> 15519e7bcd65Smrg <listitem> 15529e7bcd65Smrg <para> 15539e7bcd65SmrgAn inherit constant for each new procedure in the widget class part structure. 15549e7bcd65Smrg </para> 15559e7bcd65Smrg </listitem> 15569e7bcd65Smrg</itemizedlist> 15579e7bcd65Smrg<para> 15589e7bcd65SmrgFor example, the following is the private .h file for a possible Label widget: 15599e7bcd65Smrg</para> 15600568f49bSmrg<programlisting> 15619e7bcd65Smrg#ifndef LABELP_H 15629e7bcd65Smrg#define LABELP_H 15630568f49bSmrg 15649e7bcd65Smrg#include <X11/Label.h> 15650568f49bSmrg 15669e7bcd65Smrg/* New representation types used by the Label widget */ 15679e7bcd65Smrg#define XtRJustify "Justify" 15680568f49bSmrg 15699e7bcd65Smrg/* New fields for the Label widget record */ 15709e7bcd65Smrgtypedef struct { 15719e7bcd65Smrg/* Settable resources */ 15720568f49bSmrg Pixel foreground; 15739e7bcd65Smrg XFontStruct *font; 15740568f49bSmrg String label; /* text to display */ 15750568f49bSmrg XtJustify justify; 15760568f49bSmrg Dimension internal_width; /* # pixels horizontal border */ 15770568f49bSmrg Dimension internal_height; /* # pixels vertical border */ 15789e7bcd65Smrg/* Data derived from resources */ 15790568f49bSmrg GC normal_GC; 15800568f49bSmrg GC gray_GC; 15810568f49bSmrg Pixmap gray_pixmap; 15820568f49bSmrg Position label_x; 15830568f49bSmrg Position label_y; 15840568f49bSmrg Dimension label_width; 15850568f49bSmrg Dimension label_height; 15860568f49bSmrg Cardinal label_len; 15870568f49bSmrg Boolean display_sensitive; 15889e7bcd65Smrg} LabelPart; 15890568f49bSmrg 15909e7bcd65Smrg/* Full instance record declaration */ 15919e7bcd65Smrgtypedef struct _LabelRec { 15920568f49bSmrg CorePart core; 15930568f49bSmrg LabelPart label; 15949e7bcd65Smrg} LabelRec; 15950568f49bSmrg 15969e7bcd65Smrg/* Types for Label class methods */ 15970568f49bSmrgtypedef void (*LabelSetTextProc)(Widget w, String text); 15980568f49bSmrgtypedef String (*LabelGetTextProc)(Widget w); 15990568f49bSmrg 16009e7bcd65Smrg/* New fields for the Label widget class record */ 16019e7bcd65Smrgtypedef struct { 16029e7bcd65Smrg LabelSetTextProc set_text; 16039e7bcd65Smrg LabelGetTextProc get_text; 16049e7bcd65Smrg XtPointer extension; 16059e7bcd65Smrg} LabelClassPart; 16060568f49bSmrg 16079e7bcd65Smrg/* Full class record declaration */ 16089e7bcd65Smrgtypedef struct _LabelClassRec { 16099e7bcd65Smrg CoreClassPart core_class; 16109e7bcd65Smrg LabelClassPart label_class; 16119e7bcd65Smrg} LabelClassRec; 16120568f49bSmrg 16139e7bcd65Smrg/* Class record variable */ 16149e7bcd65Smrgextern LabelClassRec labelClassRec; 16150568f49bSmrg 16169e7bcd65Smrg#define LabelInheritSetText((LabelSetTextProc)_XtInherit) 16179e7bcd65Smrg#define LabelInheritGetText((LabelGetTextProc)_XtInherit) 16180568f49bSmrg 16199e7bcd65Smrg#endif LABELP_H 16200568f49bSmrg</programlisting> 16219e7bcd65Smrg<para> 16229e7bcd65SmrgTo accommodate operating systems with file name length restrictions, 16239e7bcd65Smrgthe name of the private .h file is the first nine characters of the 16249e7bcd65Smrgwidget class followed by a capital P. 16259e7bcd65SmrgFor example, 16269e7bcd65Smrgthe private .h file for the 16279e7bcd65SmrgConstraint 16289e7bcd65Smrgwidget class is 16290568f49bSmrg<filename class="headerfile">ConstrainP.h</filename>. 16309e7bcd65Smrg</para> 16319e7bcd65Smrg</sect2> 16329e7bcd65Smrg 16339e7bcd65Smrg<sect2 id="Widget_Subclassing_in_c_Files"> 16349e7bcd65Smrg<title>Widget Subclassing in .c Files</title> 16359e7bcd65Smrg<para> 16369e7bcd65SmrgThe .c file for a widget contains the structure initializer 16379e7bcd65Smrgfor the class record variable, 16389e7bcd65Smrgwhich contains the following parts: 16399e7bcd65Smrg</para> 16409e7bcd65Smrg<itemizedlist spacing='compact'> 16419e7bcd65Smrg <listitem> 16429e7bcd65Smrg <para> 16439e7bcd65SmrgClass information (for example, <emphasis remap='I'>superclass</emphasis>, <emphasis remap='I'>class_name</emphasis>, 16449e7bcd65Smrg<emphasis remap='I'>widget_size</emphasis>, 16459e7bcd65Smrg<emphasis remap='I'>class_initialize</emphasis>, and <emphasis remap='I'>class_inited</emphasis>). 16469e7bcd65Smrg </para> 16479e7bcd65Smrg </listitem> 16489e7bcd65Smrg <listitem> 16499e7bcd65Smrg <para> 16509e7bcd65SmrgData constants (for example, <emphasis remap='I'>resources</emphasis> and <emphasis remap='I'>num_resources</emphasis>, 16519e7bcd65Smrg<emphasis remap='I'>actions</emphasis> and <emphasis remap='I'>num_actions</emphasis>, <emphasis remap='I'>visible_interest</emphasis>, 16529e7bcd65Smrg<emphasis remap='I'>compress_motion</emphasis>, 16539e7bcd65Smrg<emphasis remap='I'>compress_exposure</emphasis>, and <emphasis remap='I'>version</emphasis>). 16549e7bcd65Smrg </para> 16559e7bcd65Smrg </listitem> 16569e7bcd65Smrg <listitem> 16579e7bcd65Smrg <para> 16589e7bcd65SmrgWidget operations (for example, <emphasis remap='I'>initialize</emphasis>, <emphasis remap='I'>realize</emphasis>, <emphasis remap='I'>destroy</emphasis>, 16599e7bcd65Smrg<emphasis remap='I'>resize</emphasis>, <emphasis remap='I'>expose</emphasis>, <emphasis remap='I'>set_values</emphasis>, <emphasis remap='I'>accept_focus</emphasis>, 16609e7bcd65Smrgand any new operations specific to 16619e7bcd65Smrgthe widget). 16629e7bcd65Smrg </para> 16639e7bcd65Smrg </listitem> 16649e7bcd65Smrg</itemizedlist> 16659e7bcd65Smrg<para> 16669e7bcd65SmrgThe <emphasis remap='I'>superclass</emphasis> field points to the superclass 16679e7bcd65Smrgglobal class 16689e7bcd65Smrgrecord, declared in the superclass private .h file. 16699e7bcd65SmrgFor direct subclasses of the generic core widget, 16709e7bcd65Smrg<emphasis remap='I'>superclass</emphasis> should be initialized to the address of the 16719e7bcd65Smrg<function>widgetClassRec</function> 16729e7bcd65Smrgstructure. 16739e7bcd65SmrgThe superclass is used for class chaining operations and for 16749e7bcd65Smrginheriting or enveloping a superclass's operations 16759e7bcd65Smrg(see <xref linkend='Superclass_Chaining' />, 16760568f49bSmrg<xref linkend='Initializing_a_Widget_Class' />, and 16779e7bcd65Smrg<xref linkend='Inheritance_of_Superclass_Operations' />. 16789e7bcd65Smrg</para> 16799e7bcd65Smrg 16809e7bcd65Smrg<para> 16819e7bcd65SmrgThe <emphasis remap='I'>class_name</emphasis> field contains the text name for this class, 16829e7bcd65Smrgwhich is used by 16839e7bcd65Smrgthe resource manager. 16840568f49bSmrgFor example, the Label widget has the string “Label”. 16859e7bcd65SmrgMore than one widget class can share the same text class name. 16869e7bcd65SmrgThis string must be permanently allocated prior to or during the 16879e7bcd65Smrgexecution of the class initialization procedure and must not be 16889e7bcd65Smrgsubsequently deallocated. 16899e7bcd65Smrg</para> 16909e7bcd65Smrg 16919e7bcd65Smrg<para> 16929e7bcd65SmrgThe <emphasis remap='I'>widget_size</emphasis> field is the size of the corresponding widget 16939e7bcd65Smrginstance structure 16949e7bcd65Smrg(not the size of the class structure). 16959e7bcd65Smrg</para> 16969e7bcd65Smrg 16979e7bcd65Smrg<para> 16989e7bcd65SmrgThe <emphasis remap='I'>version</emphasis> field indicates the toolkit 16999e7bcd65Smrgimplementation version number and is used for 17009e7bcd65Smrgruntime consistency checking of the X Toolkit and widgets in an application. 17019e7bcd65SmrgWidget writers must set it to the 17029e7bcd65Smrgimplementation-defined symbolic value 17039e7bcd65Smrg<function>XtVersion</function> 17049e7bcd65Smrgin the widget class structure initialization. 17059e7bcd65SmrgThose widget writers who believe that their widget binaries are compatible 17069e7bcd65Smrgwith other implementations of the Intrinsics can put the special value 17079e7bcd65Smrg<function>XtVersionDontCheck</function> 17089e7bcd65Smrgin the <emphasis remap='I'>version</emphasis> field to disable version checking for those widgets. 17099e7bcd65SmrgIf a widget needs to compile alternative code for different 17109e7bcd65Smrgrevisions of the Intrinsics interface definition, it may use the symbol 17119e7bcd65Smrg<function>XtSpecificationRelease</function>, 17129e7bcd65Smrgas described in <xref linkend='Evolution_of_the_Intrinsics' />. 17139e7bcd65SmrgUse of 17149e7bcd65Smrg<function>XtVersion</function> 17159e7bcd65Smrgallows the Intrinsics implementation to recognize widget binaries 17169e7bcd65Smrgthat were compiled with older implementations. 17179e7bcd65Smrg</para> 17189e7bcd65Smrg 17199e7bcd65Smrg<para> 17209e7bcd65SmrgThe <emphasis remap='I'>extension</emphasis> field is for future upward compatibility. 17219e7bcd65SmrgIf the widget programmer adds fields to class parts, 17229e7bcd65Smrgall subclass structure layouts change, 17239e7bcd65Smrgrequiring complete recompilation. 17249e7bcd65SmrgTo allow clients to avoid recompilation, 17259e7bcd65Smrgan extension field at the end of each class part can point to a record 17269e7bcd65Smrgthat contains any additional class information required. 17279e7bcd65Smrg</para> 17289e7bcd65Smrg 17299e7bcd65Smrg<para> 17309e7bcd65SmrgAll other fields are described in their respective sections. 17319e7bcd65Smrg</para> 17329e7bcd65Smrg 17339e7bcd65Smrg<para> 17349e7bcd65SmrgThe .c file also contains the declaration of the global class 17359e7bcd65Smrgstructure pointer variable used to create instances of the class. 17369e7bcd65SmrgThe following is an abbreviated version of the .c file 17379e7bcd65Smrgfor a Label widget. 17389e7bcd65SmrgThe resources table is described in <xref linkend='Resource_Management' />. 17399e7bcd65Smrg</para> 17400568f49bSmrg<programlisting> 17419e7bcd65Smrg/* Resources specific to Label */ 17429e7bcd65Smrgstatic XtResource resources[] = { 17439e7bcd65Smrg {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), 17449e7bcd65Smrg XtOffset(LabelWidget, label.foreground), XtRString, 17459e7bcd65Smrg XtDefaultForeground}, 17469e7bcd65Smrg {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), 17479e7bcd65Smrg XtOffset(LabelWidget, label.font),XtRString, 17489e7bcd65Smrg XtDefaultFont}, 17499e7bcd65Smrg {XtNlabel, XtCLabel, XtRString, sizeof(String), 17509e7bcd65Smrg XtOffset(LabelWidget, label.label), XtRString, NULL}, 17519e7bcd65Smrg . 17529e7bcd65Smrg . 17539e7bcd65Smrg . 17549e7bcd65Smrg} 17550568f49bSmrg 17569e7bcd65Smrg/* Forward declarations of procedures */ 17570568f49bSmrgstatic void ClassInitialize(void); 17580568f49bSmrgstatic void Initialize(Widget, Widget, ArgList, Cardinal*); 17590568f49bSmrgstatic void Realize(Widget, XtValueMask*, XSetWindowAttributes*); 17600568f49bSmrgstatic void SetText(Widget, String); 17610568f49bSmrgstatic void GetText(Widget); 17629e7bcd65Smrg . 17639e7bcd65Smrg . 17649e7bcd65Smrg . 17650568f49bSmrg</programlisting> 17660568f49bSmrg<programlisting> 17679e7bcd65Smrg/* Class record constant */ 17689e7bcd65SmrgLabelClassRec labelClassRec = { 17699e7bcd65Smrg { 17709e7bcd65Smrg /* core_class fields */ 17710568f49bSmrg /* superclass */ (WidgetClass)&coreClassRec, 17720568f49bSmrg /* class_name */ "Label", 17730568f49bSmrg /* widget_size */ sizeof(LabelRec), 17740568f49bSmrg /* class_initialize */ ClassInitialize, 17750568f49bSmrg /* class_part_initialize */ NULL, 17760568f49bSmrg /* class_inited */ False, 17770568f49bSmrg /* initialize */ Initialize, 17780568f49bSmrg /* initialize_hook */ NULL, 17790568f49bSmrg /* realize */ Realize, 17800568f49bSmrg /* actions */ NULL, 17810568f49bSmrg /* num_actions */ 0, 17820568f49bSmrg /* resources */ resources, 17830568f49bSmrg /* num_resources */ XtNumber(resources), 17840568f49bSmrg /* xrm_class */ NULLQUARK, 17850568f49bSmrg /* compress_motion */ True, 17860568f49bSmrg /* compress_exposure */ True, 17870568f49bSmrg /* compress_enterleave */ True, 17880568f49bSmrg /* visible_interest */ False, 17890568f49bSmrg /* destroy */ NULL, 17900568f49bSmrg /* resize */ Resize, 17910568f49bSmrg /* expose */ Redisplay, 17920568f49bSmrg /* set_values */ SetValues, 17930568f49bSmrg /* set_values_hook */ NULL, 17940568f49bSmrg /* set_values_almost */ XtInheritSetValuesAlmost, 17950568f49bSmrg /* get_values_hook */ NULL, 17960568f49bSmrg /* accept_focus */ NULL, 17970568f49bSmrg /* version */ XtVersion, 17980568f49bSmrg /* callback_offsets */ NULL, 17990568f49bSmrg /* tm_table */ NULL, 18000568f49bSmrg /* query_geometry */ XtInheritQueryGeometry, 18010568f49bSmrg /* display_accelerator */ NULL, 18020568f49bSmrg /* extension */ NULL 18039e7bcd65Smrg }, 18049e7bcd65Smrg { 18050568f49bSmrg /* Label_class fields */ 18060568f49bSmrg /* get_text */ GetText, 18070568f49bSmrg /* set_text */ SetText, 18080568f49bSmrg /* extension */ NULL 18099e7bcd65Smrg } 18109e7bcd65Smrg}; 18110568f49bSmrg 18129e7bcd65Smrg/* Class record pointer */ 18139e7bcd65SmrgWidgetClass labelWidgetClass = (WidgetClass) &labelClassRec; 18140568f49bSmrg 18159e7bcd65Smrg/* New method access routines */ 18160568f49bSmrgvoid LabelSetText(Widget w, String text) 18179e7bcd65Smrg{ 18189e7bcd65Smrg LabelWidgetClass lwc = (Label WidgetClass)XtClass(w); 18199e7bcd65Smrg XtCheckSubclass(w, labelWidgetClass, NULL); 18209e7bcd65Smrg *(lwc->label_class.set_text)(w, text) 18219e7bcd65Smrg} 18220568f49bSmrg 18239e7bcd65Smrg/* Private procedures */ 18249e7bcd65Smrg . 18259e7bcd65Smrg . 18269e7bcd65Smrg . 18270568f49bSmrg</programlisting> 18289e7bcd65Smrg</sect2> 18299e7bcd65Smrg 18309e7bcd65Smrg<sect2 id="Widget_Class_and_Superclass_Look_Up"> 18319e7bcd65Smrg<title>Widget Class and Superclass Look Up</title> 18329e7bcd65Smrg<para> 18339e7bcd65SmrgTo obtain the class of a widget, use 18349e7bcd65Smrg<xref linkend='XtClass' xrefstyle='select: title'/>. 18359e7bcd65Smrg</para> 18369e7bcd65Smrg 18379e7bcd65Smrg 18389e7bcd65Smrg 18399e7bcd65Smrg<funcsynopsis id='XtClass'> 18409e7bcd65Smrg <funcprototype> 18419e7bcd65Smrg <funcdef>WidgetClass <function>XtClass</function></funcdef> 18429e7bcd65Smrg <paramdef>Widget<parameter> w</parameter></paramdef> 18439e7bcd65Smrg </funcprototype> 18449e7bcd65Smrg </funcsynopsis> 18459e7bcd65Smrg 18469e7bcd65Smrg<variablelist> 18479e7bcd65Smrg <varlistentry> 18489e7bcd65Smrg <term> 18499e7bcd65Smrg <emphasis remap='I'>w</emphasis> 18509e7bcd65Smrg </term> 18519e7bcd65Smrg <listitem> 18529e7bcd65Smrg <para> 18539e7bcd65SmrgSpecifies the widget. Must be of class Object or any subclass thereof. 18549e7bcd65Smrg </para> 18559e7bcd65Smrg </listitem> 18569e7bcd65Smrg </varlistentry> 18579e7bcd65Smrg</variablelist> 18589e7bcd65Smrg 18599e7bcd65Smrg 18609e7bcd65Smrg<para> 18619e7bcd65SmrgThe 18629e7bcd65Smrg<xref linkend='XtClass' xrefstyle='select: title'/> 18639e7bcd65Smrgfunction returns a pointer to the widget's class structure. 18649e7bcd65Smrg</para> 18659e7bcd65Smrg 18669e7bcd65Smrg<para> 18679e7bcd65SmrgTo obtain the superclass of a widget, use 18689e7bcd65Smrg<function>XtSuperclass</function>. 18699e7bcd65Smrg</para> 18709e7bcd65Smrg 18719e7bcd65Smrg<!-- 18729e7bcd65Smrg--> 18739e7bcd65Smrg<funcsynopsis id='XtSuperClass'> 18749e7bcd65Smrg<funcprototype> 18759e7bcd65Smrg <funcdef>WidgetClass <function>XtSuperClass</function></funcdef> 18769e7bcd65Smrg <paramdef>Widget<parameter> w</parameter></paramdef> 18779e7bcd65Smrg</funcprototype> 18789e7bcd65Smrg</funcsynopsis> 18799e7bcd65Smrg 18809e7bcd65Smrg<variablelist> 18819e7bcd65Smrg <varlistentry> 18829e7bcd65Smrg <term> 18839e7bcd65Smrg <emphasis remap='I'>w</emphasis> 18849e7bcd65Smrg </term> 18859e7bcd65Smrg <listitem> 18869e7bcd65Smrg <para> 18879e7bcd65SmrgSpecifies the widget. Must be of class Object or any subclass thereof. 18889e7bcd65Smrg </para> 18899e7bcd65Smrg </listitem> 18909e7bcd65Smrg </varlistentry> 18919e7bcd65Smrg</variablelist> 18929e7bcd65Smrg<!-- 18939e7bcd65Smrg--> 18949e7bcd65Smrg 18959e7bcd65Smrg<para> 18969e7bcd65SmrgThe 18979e7bcd65Smrg<function>XtSuperclass</function> 18989e7bcd65Smrgfunction returns a pointer to the widget's superclass class structure. 18999e7bcd65Smrg</para> 19009e7bcd65Smrg</sect2> 19019e7bcd65Smrg 19029e7bcd65Smrg<sect2 id="Widget_Subclass_Verification"> 19039e7bcd65Smrg<title>Widget Subclass Verification</title> 19049e7bcd65Smrg<para> 19059e7bcd65SmrgTo check the subclass to which a widget belongs, use 19069e7bcd65Smrg<xref linkend='XtIsSubclass' xrefstyle='select: title'/>. 19079e7bcd65Smrg</para> 19089e7bcd65Smrg 19099e7bcd65Smrg<funcsynopsis id='XtIsSubclass'> 19109e7bcd65Smrg<funcprototype> 19119e7bcd65Smrg <funcdef>Boolean <function>XtIsSubclass</function></funcdef> 19129e7bcd65Smrg <paramdef>Widget<parameter> w</parameter></paramdef> 19139e7bcd65Smrg <paramdef>WidgetClass<parameter> widget_class</parameter></paramdef> 19149e7bcd65Smrg</funcprototype> 19159e7bcd65Smrg</funcsynopsis> 19169e7bcd65Smrg 19179e7bcd65Smrg<variablelist> 19189e7bcd65Smrg <varlistentry> 19199e7bcd65Smrg <term> 19209e7bcd65Smrg <emphasis remap='I'>w</emphasis> 19219e7bcd65Smrg </term> 19229e7bcd65Smrg <listitem> 19239e7bcd65Smrg <para> 19249e7bcd65SmrgSpecifies the widget or object instance whose class is to be checked. Must be of class Object or any subclass thereof. 19259e7bcd65Smrg </para> 19269e7bcd65Smrg </listitem> 19279e7bcd65Smrg </varlistentry> 19289e7bcd65Smrg <varlistentry> 19299e7bcd65Smrg <term> 19309e7bcd65Smrg <emphasis remap='I'>widget_class</emphasis> 19319e7bcd65Smrg </term> 19329e7bcd65Smrg <listitem> 19339e7bcd65Smrg <para> 19349e7bcd65SmrgSpecifies the widget class for which to test. Must be <emphasis role='strong'>objectClass</emphasis> or any subclass thereof. 19359e7bcd65Smrg </para> 19369e7bcd65Smrg </listitem> 19379e7bcd65Smrg </varlistentry> 19389e7bcd65Smrg</variablelist> 19399e7bcd65Smrg 19409e7bcd65Smrg 19419e7bcd65Smrg<para> 19429e7bcd65SmrgThe 19439e7bcd65Smrg<xref linkend='XtIsSubclass' xrefstyle='select: title'/> 19449e7bcd65Smrgfunction returns 19459e7bcd65Smrg<function>True</function> 19469e7bcd65Smrgif the class of the specified widget is equal to 19479e7bcd65Smrgor is a subclass of the specified class. 19489e7bcd65SmrgThe widget's class can be any number of subclasses down the chain 19499e7bcd65Smrgand need not be an immediate subclass of the specified class. 19509e7bcd65SmrgComposite widgets that need to restrict the class of the items they 19519e7bcd65Smrgcontain can use 19529e7bcd65Smrg<xref linkend='XtIsSubclass' xrefstyle='select: title'/> 19539e7bcd65Smrgto find out if a widget belongs to the desired class of objects. 19549e7bcd65Smrg</para> 19559e7bcd65Smrg 19569e7bcd65Smrg<para> 19579e7bcd65SmrgTo test if a given widget belongs to a subclass of an Intrinsics-defined 19589e7bcd65Smrgclass, the Intrinsics define macros or functions equivalent to 19599e7bcd65Smrg<xref linkend='XtIsSubclass' xrefstyle='select: title'/> 19609e7bcd65Smrgfor each of the built-in classes. These procedures are 19619e7bcd65Smrg<function>XtIsObject</function>, 19629e7bcd65Smrg<function>XtIsRectObj</function>, 19639e7bcd65Smrg<function>XtIsWidget</function>, 19649e7bcd65Smrg<function>XtIsComposite</function>, 19659e7bcd65Smrg<function>XtIsConstraint</function>, 19669e7bcd65Smrg<function>XtIsShell</function>, 19679e7bcd65Smrg<function>XtIsOverrideShell</function>, 19689e7bcd65Smrg<function>XtIsWMShell</function>, 19699e7bcd65Smrg<function>XtIsVendorShell</function>, 19709e7bcd65Smrg<function>XtIsTransientShell</function>, 19719e7bcd65Smrg<function>XtIsTopLevelShell</function>, 19729e7bcd65Smrg<function>XtIsApplicationShell</function>, 19739e7bcd65Smrgand 19749e7bcd65Smrg<function>XtIsSessionShell</function>. 19759e7bcd65Smrg</para> 19769e7bcd65Smrg 19779e7bcd65Smrg<para> 19789e7bcd65SmrgAll these macros and functions have the same argument description. 19799e7bcd65Smrg</para> 19809e7bcd65Smrg 19819e7bcd65Smrg<funcsynopsis id='XtIs'> 19829e7bcd65Smrg<funcprototype> 19830568f49bSmrg <funcdef>Boolean <function>XtIs<subscript><class></subscript></function></funcdef> 19849e7bcd65Smrg <paramdef>Widget<parameter> w</parameter></paramdef> 19859e7bcd65Smrg</funcprototype> 19869e7bcd65Smrg</funcsynopsis> 19879e7bcd65Smrg 19889e7bcd65Smrg<variablelist> 19899e7bcd65Smrg <varlistentry> 19909e7bcd65Smrg <term> 19919e7bcd65Smrg <emphasis remap='I'>w</emphasis> 19929e7bcd65Smrg </term> 19939e7bcd65Smrg <listitem> 19949e7bcd65Smrg <para> 19959e7bcd65SmrgSpecifies the widget or object instance whose class is to be checked. Must be of class Object or any subclass thereof. 19969e7bcd65Smrg </para> 19979e7bcd65Smrg </listitem> 19989e7bcd65Smrg </varlistentry> 19999e7bcd65Smrg</variablelist> 20009e7bcd65Smrg 20019e7bcd65Smrg<para> 20029e7bcd65SmrgThese procedures may be faster than calling 20039e7bcd65Smrg<xref linkend='XtIsSubclass' xrefstyle='select: title'/> 20049e7bcd65Smrgdirectly for the built-in classes. 20059e7bcd65Smrg</para> 20069e7bcd65Smrg 20079e7bcd65Smrg<para> 20089e7bcd65SmrgTo check a widget's class 20099e7bcd65Smrgand to generate a debugging error message, use 20109e7bcd65Smrg<xref linkend='XtCheckSubclass' xrefstyle='select: title'/>, 20119e7bcd65Smrgdefined in 20120568f49bSmrg<filename class="headerfile"><X11/IntrinsicP.h></filename>: 20139e7bcd65Smrg</para> 20149e7bcd65Smrg 20159e7bcd65Smrg<funcsynopsis id='XtCheckSubclass'> 20169e7bcd65Smrg<funcprototype> 20179e7bcd65Smrg <funcdef>void <function>XtCheckSubclass</function></funcdef> 20189e7bcd65Smrg <paramdef>Widget<parameter> w</parameter></paramdef> 20199e7bcd65Smrg <paramdef>WidgetClass<parameter> widget_class</parameter></paramdef> 20209e7bcd65Smrg <paramdef>String<parameter> message</parameter></paramdef> 20219e7bcd65Smrg</funcprototype> 20229e7bcd65Smrg</funcsynopsis> 20239e7bcd65Smrg 20249e7bcd65Smrg<variablelist> 20259e7bcd65Smrg <varlistentry> 20269e7bcd65Smrg <term> 20279e7bcd65Smrg <emphasis remap='I'>w</emphasis> 20289e7bcd65Smrg </term> 20299e7bcd65Smrg <listitem> 20309e7bcd65Smrg <para> 20319e7bcd65SmrgSpecifies the widget or object whose class is to be checked. Must be of class Object or any subclass thereof. 20329e7bcd65Smrg </para> 20339e7bcd65Smrg </listitem> 20349e7bcd65Smrg </varlistentry> 20359e7bcd65Smrg <varlistentry> 20369e7bcd65Smrg <term> 20379e7bcd65Smrg <emphasis remap='I'>widget_class</emphasis> 20389e7bcd65Smrg </term> 20399e7bcd65Smrg <listitem> 20409e7bcd65Smrg <para> 20419e7bcd65SmrgSpecifies the widget class for which to test. Must be <emphasis role='strong'>objectClass</emphasis> or any subclass thereof. 20429e7bcd65Smrg </para> 20439e7bcd65Smrg </listitem> 20449e7bcd65Smrg </varlistentry> 20459e7bcd65Smrg <varlistentry> 20469e7bcd65Smrg <term> 20479e7bcd65Smrg <emphasis remap='I'>message</emphasis> 20489e7bcd65Smrg </term> 20499e7bcd65Smrg <listitem> 20509e7bcd65Smrg <para> 20519e7bcd65SmrgSpecifies the message to be used. 20529e7bcd65Smrg </para> 20539e7bcd65Smrg </listitem> 20549e7bcd65Smrg </varlistentry> 20559e7bcd65Smrg</variablelist> 20569e7bcd65Smrg 20579e7bcd65Smrg<para> 20589e7bcd65SmrgThe 20599e7bcd65Smrg<xref linkend='XtCheckSubclass' xrefstyle='select: title'/> 20609e7bcd65Smrgmacro determines if the class of the specified widget is equal to 20619e7bcd65Smrgor is a subclass of the specified class. 20629e7bcd65SmrgThe widget's class can be any number of subclasses down the chain 20639e7bcd65Smrgand need not be an immediate subclass of the specified class. 20649e7bcd65SmrgIf the specified widget's class is not a subclass, 20659e7bcd65Smrg<xref linkend='XtCheckSubclass' xrefstyle='select: title'/> 20669e7bcd65Smrgconstructs an error message from the supplied message, 20679e7bcd65Smrgthe widget's actual class, and the expected class and calls 20689e7bcd65Smrg<xref linkend='XtErrorMsg' xrefstyle='select: title'/>. 20699e7bcd65Smrg<xref linkend='XtCheckSubclass' xrefstyle='select: title'/> 20709e7bcd65Smrgshould be used at the entry point of exported routines to ensure 20719e7bcd65Smrgthat the client has passed in a valid widget class for the exported operation. 20729e7bcd65Smrg</para> 20739e7bcd65Smrg 20749e7bcd65Smrg<para> 20759e7bcd65Smrg<xref linkend='XtCheckSubclass' xrefstyle='select: title'/> 20769e7bcd65Smrgis only executed when the module has been compiled with the compiler symbol 20779e7bcd65SmrgDEBUG defined; otherwise, it is defined as the empty string 20789e7bcd65Smrgand generates no code. 20799e7bcd65Smrg</para> 20809e7bcd65Smrg</sect2> 20819e7bcd65Smrg 20829e7bcd65Smrg<sect2 id="Superclass_Chaining"> 20839e7bcd65Smrg<title>Superclass Chaining</title> 20849e7bcd65Smrg<para> 20859e7bcd65SmrgWhile most fields in a widget class structure are self-contained, 20869e7bcd65Smrgsome fields are linked to their corresponding fields in their superclass 20879e7bcd65Smrgstructures. 20889e7bcd65SmrgWith a linked field, 20899e7bcd65Smrgthe Intrinsics access the field's value only after accessing its corresponding 20909e7bcd65Smrgsuperclass value (called downward superclass chaining) or 20919e7bcd65Smrgbefore accessing its corresponding superclass value (called upward superclass 20929e7bcd65Smrgchaining). The self-contained fields are</para> 20930568f49bSmrg<programlisting> 20940568f49bSmrgIn all widget classes: <emphasis remap='I'>class_name</emphasis> 20950568f49bSmrg <emphasis remap='I'>class_initialize</emphasis> 20960568f49bSmrg <emphasis remap='I'>widget_size</emphasis> 20970568f49bSmrg <emphasis remap='I'>realize</emphasis> 20980568f49bSmrg <emphasis remap='I'>visible_interest</emphasis> 20990568f49bSmrg <emphasis remap='I'>resize</emphasis> 21000568f49bSmrg <emphasis remap='I'>expose</emphasis> 21010568f49bSmrg <emphasis remap='I'>accept_focus</emphasis> 21020568f49bSmrg <emphasis remap='I'>compress_motion</emphasis> 21030568f49bSmrg <emphasis remap='I'>compress_exposure</emphasis> 21040568f49bSmrg <emphasis remap='I'>compress_enterleave</emphasis> 21050568f49bSmrg <emphasis remap='I'>set_values_almost</emphasis> 21060568f49bSmrg <emphasis remap='I'>tm_table</emphasis> 21070568f49bSmrg <emphasis remap='I'>version</emphasis> 21080568f49bSmrg <emphasis remap='I'>allocate</emphasis> 21090568f49bSmrg <emphasis remap='I'>deallocate</emphasis> 21100568f49bSmrg 21110568f49bSmrgIn Composite widget classes: <emphasis remap='I'>geometry_manager</emphasis> 21120568f49bSmrg <emphasis remap='I'>change_managed</emphasis> 21130568f49bSmrg <emphasis remap='I'>insert_child</emphasis> 21140568f49bSmrg <emphasis remap='I'>delete_child</emphasis> 21150568f49bSmrg <emphasis remap='I'>accepts_objects</emphasis> 21160568f49bSmrg <emphasis remap='I'>allows_change_managed_set</emphasis> 21170568f49bSmrg 21180568f49bSmrgIn Constraint widget classes: <emphasis remap='I'>constraint_size</emphasis> 21190568f49bSmrg 21200568f49bSmrgIn Shell widget classes: <emphasis remap='I'>root_geometry_manager</emphasis> 21210568f49bSmrg</programlisting> 21229e7bcd65Smrg 21239e7bcd65Smrg<para> 21249e7bcd65SmrgWith downward superclass chaining, 21259e7bcd65Smrgthe invocation of an operation first accesses the field from the 21269e7bcd65SmrgObject, 21279e7bcd65SmrgRectObj, 21289e7bcd65Smrgand 21299e7bcd65SmrgCore 21309e7bcd65Smrgclass structures, then from the subclass structure, and so on down the class chain to 21319e7bcd65Smrgthat widget's class structure. These superclass-to-subclass fields are 21329e7bcd65Smrg</para> 21330568f49bSmrg<programlisting> 21340568f49bSmrg <emphasis remap='I'>class_part_initialize</emphasis> 21350568f49bSmrg <emphasis remap='I'>get_values_hook</emphasis> 21360568f49bSmrg <emphasis remap='I'>initialize</emphasis> 21370568f49bSmrg <emphasis remap='I'>initialize_hook</emphasis> 21380568f49bSmrg <emphasis remap='I'>set_values</emphasis> 21390568f49bSmrg <emphasis remap='I'>set_values_hook</emphasis> 21400568f49bSmrg <emphasis remap='I'>resources</emphasis> 21410568f49bSmrg</programlisting> 21429e7bcd65Smrg 21439e7bcd65Smrg<para> 21449e7bcd65SmrgIn addition, for subclasses of 21459e7bcd65SmrgConstraint, 21469e7bcd65Smrgthe following fields of the 21479e7bcd65Smrg<function>ConstraintClassPart</function> 21489e7bcd65Smrgand 21499e7bcd65Smrg<function>ConstraintClassExtensionRec</function> 21509e7bcd65Smrgstructures are chained from the 21519e7bcd65SmrgConstraint 21529e7bcd65Smrgclass down to the subclass: 21539e7bcd65Smrg</para> 21540568f49bSmrg<programlisting> 21550568f49bSmrg <emphasis remap='I'>resources</emphasis> 21560568f49bSmrg <emphasis remap='I'>initialize</emphasis> 21570568f49bSmrg <emphasis remap='I'>set_values</emphasis> 21580568f49bSmrg <emphasis remap='I'>get_values_hook</emphasis> 21590568f49bSmrg</programlisting> 21609e7bcd65Smrg 21619e7bcd65Smrg<para> 21629e7bcd65SmrgWith upward superclass chaining, 21639e7bcd65Smrgthe invocation of an operation first accesses the field from the widget 21649e7bcd65Smrgclass structure, then from the superclass structure, 21659e7bcd65Smrgand so on up the class chain to the 21669e7bcd65SmrgCore, 21679e7bcd65SmrgRectObj, 21689e7bcd65Smrgand 21699e7bcd65SmrgObject 21709e7bcd65Smrgclass structures. 21719e7bcd65SmrgThe subclass-to-superclass fields are 21729e7bcd65Smrg</para> 21730568f49bSmrg<programlisting> 21740568f49bSmrg <emphasis remap='I'>destroy</emphasis> 21750568f49bSmrg <emphasis remap='I'>actions</emphasis> 21760568f49bSmrg</programlisting> 21779e7bcd65Smrg 21789e7bcd65Smrg<para> 21799e7bcd65SmrgFor subclasses of 21809e7bcd65SmrgConstraint, 21819e7bcd65Smrgthe following field of 21829e7bcd65Smrg<function>ConstraintClassPart</function> 21839e7bcd65Smrgis chained from the subclass up to the 21849e7bcd65SmrgConstraint class: 21859e7bcd65Smrg</para> 21860568f49bSmrg<programlisting> 21870568f49bSmrg <emphasis remap='I'>destroy</emphasis> 21880568f49bSmrg</programlisting> 21899e7bcd65Smrg</sect2> 21909e7bcd65Smrg 21919e7bcd65Smrg<sect2 id="Class_Initialization_class_initialize_and_class_part_initialize_Procedures"> 21929e7bcd65Smrg<title>Class Initialization: class_initialize and class_part_initialize Procedures</title> 21939e7bcd65Smrg<para> 21949e7bcd65SmrgMany class records can be initialized completely at compile or link time. 21959e7bcd65SmrgIn some cases, however, 21969e7bcd65Smrga class may need to register type converters or perform other sorts of 21979e7bcd65Smrgonce-only runtime initialization. 21989e7bcd65Smrg</para> 21999e7bcd65Smrg 22009e7bcd65Smrg<para> 22019e7bcd65SmrgBecause the C language does not have initialization procedures 22029e7bcd65Smrgthat are invoked automatically when a program starts up, 22039e7bcd65Smrga widget class can declare a class_initialize procedure 22049e7bcd65Smrgthat will be automatically called exactly once by the Intrinsics. 22059e7bcd65SmrgA class initialization procedure pointer is of type 22069e7bcd65Smrg<function>XtProc</function>: 22079e7bcd65Smrg</para> 22089e7bcd65Smrg 22099e7bcd65Smrg<para> 22109e7bcd65Smrgtypedef void (*XtProc)(void); 22119e7bcd65Smrg</para> 22129e7bcd65Smrg<para> 22139e7bcd65SmrgA widget class indicates that it has no class initialization procedure by 22149e7bcd65Smrgspecifying NULL in the <emphasis remap='I'>class_initialize</emphasis> field. 22159e7bcd65Smrg</para> 22169e7bcd65Smrg 22179e7bcd65Smrg<para> 22189e7bcd65SmrgIn addition to the class initialization that is done exactly once, 22199e7bcd65Smrgsome classes perform initialization for fields in their parts 22209e7bcd65Smrgof the class record. 22219e7bcd65SmrgThese are performed not just for the particular class, 22229e7bcd65Smrgbut for subclasses as well, and are 22239e7bcd65Smrgdone in the class's class part initialization procedure, 22249e7bcd65Smrga pointer to which is stored in the <emphasis remap='I'>class_part_initialize</emphasis> field. 22259e7bcd65SmrgThe class_part_initialize procedure pointer is of type 22269e7bcd65Smrg<function>XtWidgetClassProc</function>. 22279e7bcd65Smrg</para> 22289e7bcd65Smrg 22299e7bcd65Smrg<funcsynopsis> 22309e7bcd65Smrg<funcprototype> 22310568f49bSmrg <funcdef>typedef void <function>(*XtWidgetClassProc)(WidgetClass)</function></funcdef> 22329e7bcd65Smrg <paramdef>WidgetClass<parameter> widget_class</parameter></paramdef> 22339e7bcd65Smrg</funcprototype> 22349e7bcd65Smrg</funcsynopsis> 22359e7bcd65Smrg 22369e7bcd65Smrg<variablelist> 22379e7bcd65Smrg <varlistentry> 22389e7bcd65Smrg <term> 22399e7bcd65Smrg <emphasis remap='I'>widget_class</emphasis> 22409e7bcd65Smrg </term> 22419e7bcd65Smrg <listitem> 22429e7bcd65Smrg <para> 22439e7bcd65SmrgPoints to the class structure for the class being initialized. 22449e7bcd65Smrg </para> 22459e7bcd65Smrg </listitem> 22469e7bcd65Smrg </varlistentry> 22479e7bcd65Smrg</variablelist> 22489e7bcd65Smrg<para> 22499e7bcd65SmrgDuring class initialization, 22509e7bcd65Smrgthe class part initialization procedures for the class and all its superclasses 22519e7bcd65Smrgare called in superclass-to-subclass order on the class record. 22529e7bcd65SmrgThese procedures have the responsibility of doing any dynamic initializations 22539e7bcd65Smrgnecessary to their class's part of the record. 22549e7bcd65SmrgThe most common is the resolution of any inherited methods defined in the 22559e7bcd65Smrgclass. 22569e7bcd65SmrgFor example, 22579e7bcd65Smrgif a widget class C has superclasses 22589e7bcd65SmrgCore, 22599e7bcd65SmrgComposite, 22609e7bcd65SmrgA, and B, the class record for C first is passed to 22619e7bcd65SmrgCore 's 22629e7bcd65Smrgclass_part_initialize procedure. 22639e7bcd65SmrgThis resolves any inherited Core methods and compiles the textual 22649e7bcd65Smrgrepresentations of the resource list and action table that are defined in the 22659e7bcd65Smrgclass record. 22669e7bcd65SmrgNext, Composite's 22679e7bcd65Smrgclass_part_initialize procedure is called to initialize the 22689e7bcd65Smrgcomposite part of C's class record. 22699e7bcd65SmrgFinally, the class_part_initialize procedures for A, B, and C, in that order, 22709e7bcd65Smrgare called. 22719e7bcd65SmrgFor further information, 22729e7bcd65Smrgsee <xref linkend='Initializing_a_Widget_Class' /> 22739e7bcd65SmrgClasses that do not define any new class fields 22749e7bcd65Smrgor that need no extra processing for them can specify NULL 22759e7bcd65Smrgin the <emphasis remap='I'>class_part_initialize</emphasis> field. 22769e7bcd65Smrg</para> 22779e7bcd65Smrg 22789e7bcd65Smrg<para> 22799e7bcd65SmrgAll widget classes, whether they have a class initialization procedure or not, 22809e7bcd65Smrgmust start with their <emphasis remap='I'>class_inited</emphasis> field 22819e7bcd65Smrg<function>False</function>. 22829e7bcd65Smrg</para> 22839e7bcd65Smrg 22849e7bcd65Smrg<para> 22859e7bcd65SmrgThe first time a widget of a class is created, 22869e7bcd65Smrg<xref linkend='XtCreateWidget' xrefstyle='select: title'/> 22879e7bcd65Smrgensures that the widget class and all superclasses are initialized, in 22889e7bcd65Smrgsuperclass-to-subclass order, by checking each <emphasis remap='I'>class_inited</emphasis> field and, 22899e7bcd65Smrgif it is 22909e7bcd65Smrg<function>False</function>, 22919e7bcd65Smrgby calling the class_initialize and the class_part_initialize procedures 22929e7bcd65Smrgfor the class and all its superclasses. 22939e7bcd65SmrgThe Intrinsics then set the <emphasis remap='I'>class_inited</emphasis> field to a nonzero value. 22949e7bcd65SmrgAfter the one-time initialization, 22959e7bcd65Smrga class structure is constant. 22969e7bcd65Smrg</para> 22979e7bcd65Smrg 22989e7bcd65Smrg<para> 22999e7bcd65SmrgThe following example provides the class initialization procedure for a Label class. 23009e7bcd65Smrg</para> 23010568f49bSmrg<programlisting> 23020568f49bSmrgstatic void ClassInitialize(void) 23039e7bcd65Smrg{ 23049e7bcd65Smrg XtSetTypeConverter(XtRString, XtRJustify, CvtStringToJustify, 23059e7bcd65Smrg NULL, 0, XtCacheNone, NULL); 23069e7bcd65Smrg} 23070568f49bSmrg</programlisting> 23089e7bcd65Smrg</sect2> 23099e7bcd65Smrg 23109e7bcd65Smrg<sect2 id="Initializing_a_Widget_Class"> 23119e7bcd65Smrg<title>Initializing a Widget Class</title> 23129e7bcd65Smrg<para> 23139e7bcd65SmrgA class is initialized when the first widget of that class or any 23149e7bcd65Smrgsubclass is created. 23159e7bcd65SmrgTo initialize a widget class without creating any widgets, use 23169e7bcd65Smrg<xref linkend='XtInitializeWidgetClass' xrefstyle='select: title'/>. 23179e7bcd65Smrg</para> 23189e7bcd65Smrg 23199e7bcd65Smrg<funcsynopsis id='XtInitializeWidgetClass'> 23209e7bcd65Smrg<funcprototype> 23219e7bcd65Smrg <funcdef>void <function>XtInitializeWidgetClass</function></funcdef> 23229e7bcd65Smrg <paramdef>WidgetClass<parameter> object_class</parameter></paramdef> 23239e7bcd65Smrg</funcprototype> 23249e7bcd65Smrg</funcsynopsis> 23259e7bcd65Smrg 23269e7bcd65Smrg<variablelist> 23279e7bcd65Smrg <varlistentry> 23289e7bcd65Smrg <term> 23299e7bcd65Smrg <emphasis remap='I'>object_class</emphasis> 23309e7bcd65Smrg </term> 23319e7bcd65Smrg <listitem> 23329e7bcd65Smrg <para> 23339e7bcd65SmrgSpecifies the object class to initialize. May be 23349e7bcd65Smrg<function>objectClass</function> 23359e7bcd65Smrgor any subclass thereof. 23369e7bcd65Smrg </para> 23379e7bcd65Smrg </listitem> 23389e7bcd65Smrg </varlistentry> 23399e7bcd65Smrg</variablelist> 23409e7bcd65Smrg 23419e7bcd65Smrg<para> 23429e7bcd65SmrgIf the specified widget class is already initialized, 23439e7bcd65Smrg<xref linkend='XtInitializeWidgetClass' xrefstyle='select: title'/> 23449e7bcd65Smrgreturns immediately. 23459e7bcd65Smrg</para> 23469e7bcd65Smrg 23479e7bcd65Smrg<para> 23489e7bcd65SmrgIf the class initialization procedure registers type converters, 23499e7bcd65Smrgthese type converters are not available until the first object 23509e7bcd65Smrgof the class or subclass is created or 23519e7bcd65Smrg<xref linkend='XtInitializeWidgetClass' xrefstyle='select: title'/> 23529e7bcd65Smrgis called 23539e7bcd65Smrg(see <xref linkend='Resource_Conversions' />). 23549e7bcd65Smrg</para> 23559e7bcd65Smrg</sect2> 23569e7bcd65Smrg 23579e7bcd65Smrg<sect2 id="Inheritance_of_Superclass_Operations"> 23589e7bcd65Smrg<title>Inheritance of Superclass Operations</title> 23599e7bcd65Smrg<para> 23609e7bcd65SmrgA widget class is free to use any of its superclass's self-contained 23619e7bcd65Smrgoperations rather than implementing its own code. 23629e7bcd65SmrgThe most frequently inherited operations are 23639e7bcd65Smrg</para> 23649e7bcd65Smrg<itemizedlist spacing='compact'> 23659e7bcd65Smrg <listitem> 23669e7bcd65Smrg <para> 23679e7bcd65Smrgexpose 23689e7bcd65Smrg </para> 23699e7bcd65Smrg </listitem> 23709e7bcd65Smrg <listitem> 23719e7bcd65Smrg <para> 23729e7bcd65Smrgrealize 23739e7bcd65Smrg </para> 23749e7bcd65Smrg </listitem> 23759e7bcd65Smrg <listitem> 23769e7bcd65Smrg <para> 23779e7bcd65Smrginsert_child 23789e7bcd65Smrg </para> 23799e7bcd65Smrg </listitem> 23809e7bcd65Smrg <listitem> 23819e7bcd65Smrg <para> 23829e7bcd65Smrgdelete_child 23839e7bcd65Smrg </para> 23849e7bcd65Smrg </listitem> 23859e7bcd65Smrg <listitem> 23869e7bcd65Smrg <para> 23879e7bcd65Smrggeometry_manager 23889e7bcd65Smrg </para> 23899e7bcd65Smrg </listitem> 23909e7bcd65Smrg <listitem> 23919e7bcd65Smrg <para> 23929e7bcd65Smrgset_values_almost 23939e7bcd65Smrg </para> 23949e7bcd65Smrg </listitem> 23959e7bcd65Smrg</itemizedlist> 23969e7bcd65Smrg 23979e7bcd65Smrg<para> 23989e7bcd65SmrgTo inherit an operation <emphasis remap='I'>xyz</emphasis>, 23999e7bcd65Smrgspecify the constant 24009e7bcd65Smrg<function>XtInherit</function> <emphasis remap='I'>Xyz</emphasis> 24019e7bcd65Smrgin your class record. 24029e7bcd65Smrg</para> 24039e7bcd65Smrg 24049e7bcd65Smrg<para> 24059e7bcd65SmrgEvery class that declares a new procedure in its widget class part must 24069e7bcd65Smrgprovide for inheriting the procedure in its class_part_initialize 24079e7bcd65Smrgprocedure. 24089e7bcd65SmrgThe chained operations declared in Core 24099e7bcd65Smrgand Constraint 24109e7bcd65Smrgrecords are never inherited. 24119e7bcd65SmrgWidget classes that do nothing beyond what their superclass does 24129e7bcd65Smrgspecify NULL for chained procedures 24139e7bcd65Smrgin their class records. 24149e7bcd65Smrg</para> 24159e7bcd65Smrg 24169e7bcd65Smrg<para> 24179e7bcd65SmrgInheriting works by comparing the value of the field with a known, special 24189e7bcd65Smrgvalue and by copying in the superclass's value for that field if a match 24199e7bcd65Smrgoccurs. 24209e7bcd65SmrgThis special value, called the inheritance constant, 24219e7bcd65Smrgis usually the Intrinsics internal value 24229e7bcd65Smrg<function>_XtInherit</function> 24239e7bcd65Smrgcast to the appropriate type. 24249e7bcd65Smrg<function>_XtInherit</function> 24259e7bcd65Smrgis a procedure that issues an error message if it is actually called. 24269e7bcd65Smrg</para> 24279e7bcd65Smrg 24289e7bcd65Smrg<para> 24299e7bcd65SmrgFor example, 24300568f49bSmrg<filename class="headerfile">CompositeP.h</filename> 24319e7bcd65Smrgcontains these definitions: 24329e7bcd65Smrg</para> 24330568f49bSmrg<programlisting> 24349e7bcd65Smrg#define XtInheritGeometryManager ((XtGeometryHandler) _XtInherit) 24350568f49bSmrg#define XtInheritChangeManaged ((XtWidgetProc) _XtInherit) 24360568f49bSmrg#define XtInheritInsertChild ((XtArgsProc) _XtInherit) 24370568f49bSmrg#define XtInheritDeleteChild ((XtWidgetProc) _XtInherit) 24380568f49bSmrg</programlisting> 24399e7bcd65Smrg<para> 24409e7bcd65SmrgComposite's class_part_initialize procedure begins as follows: 24419e7bcd65Smrg</para> 24420568f49bSmrg<programlisting> 24430568f49bSmrgstatic void CompositeClassPartInitialize(WidgetClass widgetClass) 24449e7bcd65Smrg{ 24459e7bcd65Smrg CompositeWidgetClass wc = (CompositeWidgetClass)widgetClass; 24469e7bcd65Smrg CompositeWidgetClass super = (CompositeWidgetClass)wc->core_class.superclass; 24479e7bcd65Smrg if (wc->composite_class.geometry_manager == XtInheritGeometryManager) { 24489e7bcd65Smrg wc->composite_class.geometry_manager = super->composite_class.geometry_manager; 24499e7bcd65Smrg } 24509e7bcd65Smrg if (wc->composite_class.change_managed == XtInheritChangeManaged) { 24519e7bcd65Smrg wc->composite_class.change_managed = super->composite_class.change_managed; 24529e7bcd65Smrg } 24539e7bcd65Smrg . 24549e7bcd65Smrg . 24559e7bcd65Smrg . 24560568f49bSmrg} 24570568f49bSmrg</programlisting> 24589e7bcd65Smrg<para> 24599e7bcd65SmrgNonprocedure fields may be inherited in the same manner as procedure 24609e7bcd65Smrgfields. The class may declare any reserved value it wishes for 24619e7bcd65Smrgthe inheritance constant for its new fields. The following inheritance 24629e7bcd65Smrgconstants are defined: 24639e7bcd65Smrg</para> 24649e7bcd65Smrg 24659e7bcd65Smrg<para> 24669e7bcd65SmrgFor Object: 24679e7bcd65Smrg</para> 24689e7bcd65Smrg<itemizedlist spacing='compact'> 24699e7bcd65Smrg <listitem> 24709e7bcd65Smrg <para> 24719e7bcd65Smrg<function>XtInheritAllocate</function> 24729e7bcd65Smrg </para> 24739e7bcd65Smrg </listitem> 24749e7bcd65Smrg <listitem> 24759e7bcd65Smrg <para> 24769e7bcd65Smrg<function>XtInheritDeallocate</function> 24779e7bcd65Smrg </para> 24789e7bcd65Smrg </listitem> 24799e7bcd65Smrg</itemizedlist> 24809e7bcd65Smrg<para> 24819e7bcd65SmrgFor Core: 24829e7bcd65Smrg</para> 24839e7bcd65Smrg<itemizedlist spacing='compact'> 24849e7bcd65Smrg <listitem> 24859e7bcd65Smrg <para> 24869e7bcd65Smrg<function>XtInheritRealize</function> 24879e7bcd65Smrg </para> 24889e7bcd65Smrg </listitem> 24899e7bcd65Smrg <listitem> 24909e7bcd65Smrg <para> 24919e7bcd65Smrg<function>XtInheritResize</function> 24929e7bcd65Smrg </para> 24939e7bcd65Smrg </listitem> 24949e7bcd65Smrg <listitem> 24959e7bcd65Smrg <para> 24969e7bcd65Smrg<function>XtInheritExpose</function> 24979e7bcd65Smrg </para> 24989e7bcd65Smrg </listitem> 24999e7bcd65Smrg <listitem> 25009e7bcd65Smrg <para> 25019e7bcd65Smrg<function>XtInheritSetValuesAlmost</function> 25029e7bcd65Smrg </para> 25039e7bcd65Smrg </listitem> 25049e7bcd65Smrg <listitem> 25059e7bcd65Smrg <para> 25069e7bcd65Smrg<function>XtInheritAcceptFocus</function> 25079e7bcd65Smrg </para> 25089e7bcd65Smrg </listitem> 25099e7bcd65Smrg <listitem> 25109e7bcd65Smrg <para> 25119e7bcd65Smrg<function>XtInheritQueryGeometry</function> 25129e7bcd65Smrg </para> 25139e7bcd65Smrg </listitem> 25149e7bcd65Smrg <listitem> 25159e7bcd65Smrg <para> 25169e7bcd65Smrg<function>XtInheritTranslations</function> 25179e7bcd65Smrg </para> 25189e7bcd65Smrg </listitem> 25199e7bcd65Smrg <listitem> 25209e7bcd65Smrg <para> 25219e7bcd65Smrg<function>XtInheritDisplayAccelerator</function> 25229e7bcd65Smrg </para> 25239e7bcd65Smrg </listitem> 25249e7bcd65Smrg</itemizedlist> 25259e7bcd65Smrg<para> 25269e7bcd65SmrgFor Composite: 25279e7bcd65Smrg</para> 25289e7bcd65Smrg<itemizedlist spacing='compact'> 25299e7bcd65Smrg <listitem> 25309e7bcd65Smrg <para> 25319e7bcd65Smrg<function>XtInheritGeometryManager</function> 25329e7bcd65Smrg </para> 25339e7bcd65Smrg </listitem> 25349e7bcd65Smrg <listitem> 25359e7bcd65Smrg <para> 25369e7bcd65Smrg<function>XtInheritChangeManaged</function> 25379e7bcd65Smrg </para> 25389e7bcd65Smrg </listitem> 25399e7bcd65Smrg <listitem> 25409e7bcd65Smrg <para> 25419e7bcd65Smrg<function>XtInheritInsertChild</function> 25429e7bcd65Smrg </para> 25439e7bcd65Smrg </listitem> 25449e7bcd65Smrg <listitem> 25459e7bcd65Smrg <para> 25469e7bcd65Smrg<function>XtInheritDeleteChild</function> 25479e7bcd65Smrg </para> 25489e7bcd65Smrg </listitem> 25499e7bcd65Smrg</itemizedlist> 25509e7bcd65Smrg<para> 25519e7bcd65SmrgFor Shell: 25529e7bcd65Smrg</para> 25539e7bcd65Smrg<itemizedlist spacing='compact'> 25549e7bcd65Smrg <listitem> 25559e7bcd65Smrg <para> 25569e7bcd65Smrg<function>XtInheritRootGeometryManager</function> 25579e7bcd65Smrg </para> 25589e7bcd65Smrg </listitem> 25599e7bcd65Smrg</itemizedlist> 25609e7bcd65Smrg</sect2> 25619e7bcd65Smrg 25629e7bcd65Smrg<sect2 id="Invocation_of_Superclass_Operations"> 25639e7bcd65Smrg<title>Invocation of Superclass Operations</title> 25649e7bcd65Smrg<para> 25659e7bcd65SmrgA widget sometimes needs to call a superclass operation 25669e7bcd65Smrgthat is not chained. 25679e7bcd65SmrgFor example, 25689e7bcd65Smrga widget's expose procedure might call its superclass's <emphasis remap='I'>expose</emphasis> 25699e7bcd65Smrgand then perform a little more work on its own. 25709e7bcd65SmrgFor example, a Composite 25719e7bcd65Smrgclass with predefined managed children can implement insert_child 25729e7bcd65Smrgby first calling its superclass's <emphasis remap='I'>insert_child</emphasis> 25739e7bcd65Smrgand then calling 25749e7bcd65Smrg<xref linkend='XtManageChild' xrefstyle='select: title'/> 25759e7bcd65Smrgto add the child to the managed set. 25769e7bcd65Smrg</para> 25779e7bcd65Smrg 25789e7bcd65Smrg<note> 25799e7bcd65Smrg<para> 25809e7bcd65SmrgA class method should not use 25819e7bcd65Smrg<function>XtSuperclass</function> 25829e7bcd65Smrgbut should instead call the class method of its own specific superclass 25839e7bcd65Smrgdirectly through the superclass record. 25849e7bcd65SmrgThat is, it should use its own class pointers only, 25859e7bcd65Smrgnot the widget's class pointers, 25869e7bcd65Smrgas the widget's class may be a subclass of the 25879e7bcd65Smrgclass whose implementation is being referenced. 25889e7bcd65Smrg</para> 25899e7bcd65Smrg</note> 25909e7bcd65Smrg<para> 25919e7bcd65SmrgThis technique is referred to as <emphasis remap='I'>enveloping</emphasis> the superclass's operation. 25929e7bcd65Smrg</para> 25939e7bcd65Smrg</sect2> 25949e7bcd65Smrg 25959e7bcd65Smrg<sect2 id="Class_Extension_Records"> 25969e7bcd65Smrg<title>Class Extension Records</title> 25979e7bcd65Smrg<para> 25989e7bcd65SmrgIt may be necessary at times to add new fields to already existing 25999e7bcd65Smrgwidget class structures. To permit this to be done without requiring 26009e7bcd65Smrgrecompilation of all subclasses, the last field in a class part structure 26019e7bcd65Smrgshould be an extension pointer. If no extension fields for a class 26029e7bcd65Smrghave yet been defined, subclasses should initialize the value of the 26039e7bcd65Smrgextension pointer to NULL. 26049e7bcd65Smrg</para> 26059e7bcd65Smrg 26069e7bcd65Smrg<para> 26079e7bcd65SmrgIf extension fields exist, as is the case with the 26089e7bcd65SmrgComposite, 26099e7bcd65SmrgConstraint, 26109e7bcd65Smrgand 26119e7bcd65SmrgShell 26129e7bcd65Smrgclasses, subclasses can provide values for these fields by setting the 26139e7bcd65Smrg<emphasis remap='I'>extension</emphasis> pointer for the appropriate part in their class structure to 26149e7bcd65Smrgpoint to a statically declared extension record containing the 26159e7bcd65Smrgadditional fields. 26169e7bcd65SmrgSetting the <emphasis remap='I'>extension</emphasis> field is never mandatory; code that uses fields 26179e7bcd65Smrgin the extension record must always check the <emphasis remap='I'>extension</emphasis> field and take 26189e7bcd65Smrgsome appropriate default action if it is NULL. 26199e7bcd65Smrg</para> 26209e7bcd65Smrg 26219e7bcd65Smrg<para> 26229e7bcd65SmrgIn order to permit multiple subclasses and libraries to chain extension 26239e7bcd65Smrgrecords from a single <emphasis remap='I'>extension</emphasis> field, extension records should be 26249e7bcd65Smrgdeclared as a linked list, and each extension record definition should 26259e7bcd65Smrgcontain the following four fields at the beginning of the structure 26269e7bcd65Smrgdeclaration: 26279e7bcd65Smrg</para> 26280568f49bSmrg<programlisting> 26299e7bcd65Smrgstruct { 26309e7bcd65Smrg XtPointer next_extension; 26310568f49bSmrg XrmQuark record_type; 26320568f49bSmrg long version; 26330568f49bSmrg Cardinal record_size; 26349e7bcd65Smrg}; 26350568f49bSmrg</programlisting> 26369e7bcd65Smrg 26379e7bcd65Smrg<variablelist> 26389e7bcd65Smrg <varlistentry> 26399e7bcd65Smrg <term> 26409e7bcd65Smrg <emphasis remap='I'>next_extension</emphasis> 26419e7bcd65Smrg </term> 26429e7bcd65Smrg <listitem> 26439e7bcd65Smrg <para> 26449e7bcd65SmrgSpecifies the next record in the list, or NULL. 26459e7bcd65Smrg </para> 26469e7bcd65Smrg </listitem> 26479e7bcd65Smrg </varlistentry> 26489e7bcd65Smrg <varlistentry> 26499e7bcd65Smrg <term> 26509e7bcd65Smrg <emphasis remap='I'>record_type</emphasis> 26519e7bcd65Smrg </term> 26529e7bcd65Smrg <listitem> 26539e7bcd65Smrg <para> 26549e7bcd65SmrgSpecifies the particular structure declaration to which 26559e7bcd65Smrgeach extension record instance conforms. 26569e7bcd65Smrg </para> 26579e7bcd65Smrg </listitem> 26589e7bcd65Smrg </varlistentry> 26599e7bcd65Smrg <varlistentry> 26609e7bcd65Smrg <term> 26619e7bcd65Smrg <emphasis remap='I'>version</emphasis> 26629e7bcd65Smrg </term> 26639e7bcd65Smrg <listitem> 26649e7bcd65Smrg <para> 26659e7bcd65SmrgSpecifies a version id symbolic constant supplied by 26669e7bcd65Smrgthe definer of the structure. 26679e7bcd65Smrg </para> 26689e7bcd65Smrg </listitem> 26699e7bcd65Smrg </varlistentry> 26709e7bcd65Smrg <varlistentry> 26719e7bcd65Smrg <term> 26729e7bcd65Smrg <emphasis remap='I'>record_size</emphasis> 26739e7bcd65Smrg </term> 26749e7bcd65Smrg <listitem> 26759e7bcd65Smrg <para> 26769e7bcd65SmrgSpecifies the total number of bytes allocated for the 26779e7bcd65Smrgextension record. 26789e7bcd65Smrg </para> 26799e7bcd65Smrg </listitem> 26809e7bcd65Smrg </varlistentry> 26819e7bcd65Smrg</variablelist> 26829e7bcd65Smrg 26839e7bcd65Smrg<para> 26849e7bcd65SmrgThe <emphasis remap='I'>record_type</emphasis> field identifies the contents of the extension record 26859e7bcd65Smrgand is used by the definer of the record to locate its particular 26869e7bcd65Smrgextension record in the list. The 26879e7bcd65Smrg<emphasis remap='I'>record_type</emphasis> field is normally assigned the 26889e7bcd65Smrgresult of 26899e7bcd65Smrg<function>XrmStringToQuark</function> 26909e7bcd65Smrgfor a registered string constant. The 26919e7bcd65SmrgIntrinsics reserve all record type strings beginning with the two 26920568f49bSmrgcharacters “XT” for future standard uses. The value 26939e7bcd65Smrg<emphasis role='strong'>NULLQUARK</emphasis> 26949e7bcd65Smrgmay also be used 26959e7bcd65Smrgby the class part owner in extension records attached to its own class 26969e7bcd65Smrgpart extension field to identify the extension record unique to that 26979e7bcd65Smrgparticular class. 26989e7bcd65Smrg</para> 26999e7bcd65Smrg 27009e7bcd65Smrg<para> 27019e7bcd65SmrgThe <emphasis remap='I'>version</emphasis> field is an owner-defined constant that may be used to 27029e7bcd65Smrgidentify binary files that have been compiled with alternate 27039e7bcd65Smrgdefinitions of the remainder of the extension record data structure. The private 27049e7bcd65Smrgheader file for a widget class should provide a symbolic constant for 27059e7bcd65Smrgsubclasses to use to initialize this field. 27069e7bcd65SmrgThe <emphasis remap='I'>record_size</emphasis> field value includes the four common header fields and 27079e7bcd65Smrgshould normally be initialized with 27080568f49bSmrg<function>sizeof().</function> 27099e7bcd65Smrg</para> 27109e7bcd65Smrg 27119e7bcd65Smrg<para> 27129e7bcd65SmrgAny value stored in the class part extension fields of 27139e7bcd65Smrg<function>CompositeClassPart</function>, 27149e7bcd65Smrg<function>ConstraintClassPart</function>, 27159e7bcd65Smrgor 27169e7bcd65Smrg<function>ShellClassPart</function> 27179e7bcd65Smrgmust point to an extension record conforming to this definition. 27189e7bcd65Smrg</para> 27199e7bcd65Smrg 27209e7bcd65Smrg<para> 27219e7bcd65SmrgThe Intrinsics provide a utility function for widget writers to locate a 27229e7bcd65Smrgparticular class extension record in a linked list, given a widget class 27239e7bcd65Smrgand the offset of the <emphasis remap='I'>extension</emphasis> field in the class record. 27249e7bcd65Smrg</para> 27259e7bcd65Smrg 27269e7bcd65Smrg<para> 27279e7bcd65SmrgTo locate a class extension record, use 27289e7bcd65Smrg<xref linkend='XtGetClassExtension' xrefstyle='select: title'/>. 27299e7bcd65Smrg</para> 27309e7bcd65Smrg 27319e7bcd65Smrg<funcsynopsis id='XtGetClassExtension'> 27329e7bcd65Smrg<funcprototype> 27339e7bcd65Smrg <funcdef>XtPointer <function>XtGetClassExtension</function></funcdef> 27349e7bcd65Smrg <paramdef>WidgetClass<parameter> object_class</parameter></paramdef> 27359e7bcd65Smrg <paramdef>Cardinal<parameter> byte_offset</parameter></paramdef> 27369e7bcd65Smrg <paramdef>XrmQuark<parameter> type</parameter></paramdef> 27379e7bcd65Smrg <paramdef>long<parameter> version</parameter></paramdef> 27389e7bcd65Smrg <paramdef>Cardinal<parameter> record_size</parameter></paramdef> 27399e7bcd65Smrg</funcprototype> 27409e7bcd65Smrg</funcsynopsis> 27419e7bcd65Smrg 27429e7bcd65Smrg<variablelist> 27439e7bcd65Smrg <varlistentry> 27449e7bcd65Smrg <term> 27459e7bcd65Smrg <emphasis remap='I'>object_class</emphasis> 27469e7bcd65Smrg </term> 27479e7bcd65Smrg <listitem> 27489e7bcd65Smrg <para> 27499e7bcd65SmrgSpecifies the object class containing the extension list to be searched. 27509e7bcd65Smrg </para> 27519e7bcd65Smrg </listitem> 27529e7bcd65Smrg </varlistentry> 27539e7bcd65Smrg <varlistentry> 27549e7bcd65Smrg <term> 27559e7bcd65Smrg <emphasis remap='I'>byte_offset</emphasis> 27569e7bcd65Smrg </term> 27579e7bcd65Smrg <listitem> 27589e7bcd65Smrg <para> 27599e7bcd65SmrgSpecifies the offset in bytes from the base of the 27609e7bcd65Smrgclass record of the extension field to be searched. 27619e7bcd65Smrg </para> 27629e7bcd65Smrg </listitem> 27639e7bcd65Smrg </varlistentry> 27649e7bcd65Smrg <varlistentry> 27659e7bcd65Smrg <term> 27669e7bcd65Smrg <emphasis remap='I'>type</emphasis> 27679e7bcd65Smrg </term> 27689e7bcd65Smrg <listitem> 27699e7bcd65Smrg <para> 27709e7bcd65SmrgSpecifies the record_type of the class extension to be located. 27719e7bcd65Smrg </para> 27729e7bcd65Smrg </listitem> 27739e7bcd65Smrg </varlistentry> 27749e7bcd65Smrg <varlistentry> 27759e7bcd65Smrg <term> 27769e7bcd65Smrg <emphasis remap='I'>version</emphasis> 27779e7bcd65Smrg </term> 27789e7bcd65Smrg <listitem> 27799e7bcd65Smrg <para> 27809e7bcd65SmrgSpecifies the minimum acceptable version of the class 27819e7bcd65Smrgextension required for a match. 27829e7bcd65Smrg </para> 27839e7bcd65Smrg </listitem> 27849e7bcd65Smrg </varlistentry> 27859e7bcd65Smrg <varlistentry> 27869e7bcd65Smrg <term> 27879e7bcd65Smrg <emphasis remap='I'>record_size</emphasis> 27889e7bcd65Smrg </term> 27899e7bcd65Smrg <listitem> 27909e7bcd65Smrg <para> 27919e7bcd65SmrgSpecifies the minimum acceptable length of the class 27929e7bcd65Smrgextension record required for a match, or 0. 27939e7bcd65Smrg </para> 27949e7bcd65Smrg </listitem> 27959e7bcd65Smrg </varlistentry> 27969e7bcd65Smrg</variablelist> 27979e7bcd65Smrg 27989e7bcd65Smrg<para> 27999e7bcd65SmrgThe list of extension records at the specified offset in the specified 28009e7bcd65Smrgobject class will be searched for a match on the specified type, 28019e7bcd65Smrga version greater than or equal to the specified version, and a record 28029e7bcd65Smrgsize greater than or equal the specified record_size if it is nonzero. 28039e7bcd65Smrg<xref linkend='XtGetClassExtension' xrefstyle='select: title'/> 28049e7bcd65Smrgreturns a pointer to a matching extension record or NULL if no match 28059e7bcd65Smrgis found. The returned extension record must not be modified or 28069e7bcd65Smrgfreed by the caller if the caller is not the extension owner. 28079e7bcd65Smrg</para> 28089e7bcd65Smrg</sect2> 28099e7bcd65Smrg</sect1> 28109e7bcd65Smrg</chapter> 2811