summaryrefslogtreecommitdiff
path: root/specs/CH12.xml
blob: 011a98bfc9f76b10d4794870d6dc1d287370797e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">

<chapter id='Nonwidget_Objects'>
<title>Nonwidget Objects</title>

<para>
Although widget writers are free to treat
Core
as the base class of
the widget hierarchy, there are actually three classes above it.
These classes are
Object,
RectObj
(Rectangle Object), and (unnamed),
and members of these classes
are referred to generically as <emphasis remap='I'>objects</emphasis>.  By convention, the term
<emphasis remap='I'>widget</emphasis> refers only to objects that are a subclass of
Core,
and the term <emphasis remap='I'>nonwidget</emphasis> refers to objects that are not a subclass of
Core.
In the preceding portion of this specification, the interface
descriptions indicate explicitly whether the generic <emphasis remap='I'>widget</emphasis> argument
is restricted to particular subclasses of Object.  Sections 12.2.5,
12.3.5, and 12.5 summarize the permissible classes of the arguments to, and
return values from, each of the Intrinsics routines.
</para>
<sect1 id="Data_Structures">
<title>Data Structures</title>
<para>
In order not to conflict with previous widget code, the data
structures used by nonwidget objects do not follow all the same
conventions as those for widgets.  In particular, the class records
are not composed of parts but instead are complete data structures
with filler for the widget fields they do not use.  This
allows the static class initializers for existing widgets to remain
unchanged.
</para>
</sect1>

<sect1 id="Object_Objects">
<title>Object Objects</title>
<para>
The
Object
object contains the definitions of fields common to all
objects.  It encapsulates the mechanisms for resource management.
All objects and widgets are members of subclasses of
Object,
which is defined by the
<function>ObjectClassPart</function>
and
<function>ObjectPart</function>
structures.
</para>
<sect2 id="ObjectClassPart_Structure">
<title>ObjectClassPart Structure</title>
<para>
The common fields for all object classes are defined in the
<function>ObjectClassPart</function>
structure.  All fields have the same purpose,
function, and restrictions as the corresponding fields in
<function>CoreClassPart</function>;
fields whose
names are obj<emphasis remap='I'>n</emphasis> for some integer <emphasis remap='I'>n</emphasis> are not
used for Object,
but exist to pad the data structure so that it matches Core's class
record.  The class record initialization must fill all
obj<emphasis remap='I'>n</emphasis> fields with NULL or zero as appropriate to the type.
</para>
<programlisting>
typedef struct _ObjectClassPart {
        WidgetClass     superclass;
        String          class_name;
        Cardinal        widget_size;
        XtProc          class_initialize;
        XtWidgetClassProc class_part_initialize;
        XtEnum          class_inited;
        XtInitProc      initialize;
        XtArgsProc      initialize_hook;
        XtProc          obj1;
        XtPointer       obj2;
        Cardinal        obj3;
        XtResourceList  resources;
        Cardinal        num_resources;
        XrmClass        xrm_class;
        Boolean         obj4;
        XtEnum          obj5;
        Boolean         obj6;
        Boolean         obj7;
        XtWidgetProc    destroy;
        XtProc          obj8;
        XtProc          obj9;
        XtSetValuesFunc set_values;
        XtArgsFunc      set_values_hook;
        XtProc          obj10;
        XtArgsProc      get_values_hook;
        XtProc          obj11;
        XtVersionType   version;
        XtPointer       callback_private;
        String          obj12;
        XtProc          obj13;
        XtProc          obj14;
        XtPointer       extension;
} ObjectClassPart;
</programlisting>
<para>
The extension record defined for
<function>ObjectClassPart</function>
with a <emphasis remap='I'>record_type</emphasis> equal to
<emphasis role='strong'>NULLQUARK</emphasis>
is
<function>ObjectClassExtensionRec</function>.
</para>
<programlisting>
typedef struct {
        XtPointer next_extension;        <lineannotation>See <xref linkend='Class_Extension_Records' /></lineannotation>
        XrmQuark record_type;            <lineannotation>See <xref linkend='Class_Extension_Records' /></lineannotation>
        long version;                    <lineannotation>See <xref linkend='Class_Extension_Records' /></lineannotation>
        Cardinal record_size;            <lineannotation>See <xref linkend='Class_Extension_Records' /></lineannotation>
        XtAllocateProc allocate;         <lineannotation>See <xref linkend='Widget_Instance_Allocation_The_allocate_Procedure' /></lineannotation>
        XtDeallocateProc deallocate;     <lineannotation>See <xref linkend='Widget_Instance_Deallocation_The_deallocate_Procedure' /></lineannotation>
} ObjectClassExtensionRec, *ObjectClassExtension;
</programlisting>
<para>
The prototypical
<function>ObjectClass</function>
consists of just the
<function>ObjectClassPart</function>.
</para>
<programlisting>
typedef struct _ObjectClassRec {
        ObjectClassPart object_class;
} ObjectClassRec, *ObjectClass;
</programlisting>
<para>
The predefined class record and pointer for
<function>ObjectClassRec</function>
are
</para>

<para>
In
<filename class="headerfile">IntrinsicP.h</filename>:
</para>
<programlisting>
extern ObjectClassRec objectClassRec;
</programlisting>
<para>
In
<filename class="headerfile">Intrinsic.h</filename>:
</para>
<programlisting>
extern WidgetClass objectClass;
</programlisting>
<para>
The opaque types
<function>Object</function>
and
<function>ObjectClass</function>
and the opaque variable
<function>objectClass</function>
are defined for generic actions on objects.
The symbolic constant for the
<function>ObjectClassExtension</function>
version identifier is
<function>XtObjectExtensionVersion</function>
(see <xref linkend='Class_Extension_Records' />).
<filename class="headerfile">Intrinsic.h</filename>
uses an incomplete structure definition to ensure that the
compiler catches attempts to access private data:
</para>
<programlisting>
typedef struct _ObjectClassRec* ObjectClass;
</programlisting>

</sect2>

<sect2 id="ObjectPart_Structure">
<title>ObjectPart Structure</title>
<para>
The common fields for all object instances are defined in the
<function>ObjectPart</function>
structure.  All fields have the same meaning as the
corresponding fields in
<function>CorePart</function>.
</para>
<programlisting>
typedef struct _ObjectPart {
        Widget          self;
        WidgetClass     widget_class;
        Widget          parent;
        Boolean         being_destroyed;
        XtCallbackList  destroy_callbacks;
        XtPointer       constraints;
} ObjectPart;
</programlisting>
<para>
All object instances have the
Object
fields as their first component.  The prototypical type
<function>Object</function>
is defined with only this set of fields.
Various routines can cast object pointers, as needed, to specific
object types.
</para>

<para>
In
<filename class="headerfile">IntrinsicP.h</filename>:
</para>
<programlisting>
typedef struct _ObjectRec {
        ObjectPart object;
} ObjectRec, *Object;
</programlisting>
<para>
In
<filename class="headerfile">Intrinsic.h</filename>:
</para>
<programlisting>
typedef struct _ObjectRec *Object;
</programlisting>

</sect2>

<sect2 id="Object_Resources">
<title>Object Resources</title>
<para>
The resource names, classes, and representation types specified in the
<function>objectClassRec</function>
resource list are:
</para>

<informaltable frame='topbot'>
  <?dbfo keep-together="always" ?>
  <tgroup cols='3' align='left' colsep='0' rowsep='0'>
  <colspec colwidth='1.0*' colname='c1'/>
  <colspec colwidth='1.0*' colname='c2'/>
  <colspec colwidth='1.0*' colname='c3'/>
  <thead>
    <row rowsep='1'>
      <entry>Name</entry>
      <entry>Class</entry>
      <entry>Representation</entry>
    </row>
  </thead>
  <tbody>
    <row>
      <entry>XtNdestroyCallback</entry>
      <entry>XtCCallback</entry>
      <entry>XtRCallback</entry>
    </row>
  </tbody>
  </tgroup>
</informaltable>
</sect2>

<sect2 id="ObjectPart_Default_Values">
<title>ObjectPart Default Values</title>
<para>
All fields in
<function>ObjectPart</function>
have the same default values as the corresponding fields in
<function>CorePart</function>.
</para>
</sect2>

<sect2 id="Object_Arguments_to_xI_Routines">
<title>Object Arguments to Intrinsics Routines</title>
<para>
The WidgetClass arguments to the following procedures may be
<function>objectClass</function>
or any subclass:
</para>

<itemizedlist spacing='compact'>
<listitem>
<para>
<xref linkend='XtInitializeWidgetClass' xrefstyle='select: title'/>,
<xref linkend='XtCreateWidget' xrefstyle='select: title'/>,
<xref linkend='XtVaCreateWidget' xrefstyle='select: title'/>
</para>
</listitem>
<listitem>
<para>
<xref linkend='XtIsSubclass' xrefstyle='select: title'/>,
<xref linkend='XtCheckSubclass' xrefstyle='select: title'/>
</para>
</listitem>
<listitem>
<para>
<xref linkend='XtGetResourceList' xrefstyle='select: title'/>,
<xref linkend='XtGetConstraintResourceList' xrefstyle='select: title'/>
</para>
</listitem>
</itemizedlist>

<para>
The Widget arguments to the following procedures may be of class
Object
or any subclass:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
<xref linkend='XtCreateWidget' xrefstyle='select: title'/>,
<xref linkend='XtVaCreateWidget' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtAddCallback' xrefstyle='select: title'/>,
<xref linkend='XtAddCallbacks' xrefstyle='select: title'/>,
<xref linkend='XtRemoveCallback' xrefstyle='select: title'/>,
<xref linkend='XtRemoveCallbacks' xrefstyle='select: title'/>,
<xref linkend='XtRemoveAllCallbacks' xrefstyle='select: title'/>,
<xref linkend='XtCallCallbacks' xrefstyle='select: title'/>,
<xref linkend='XtHasCallbacks' xrefstyle='select: title'/>,
<xref linkend='XtCallCallbackList' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtClass' xrefstyle='select: title'/>,
<function>XtSuperclass</function>,
<xref linkend='XtIsSubclass' xrefstyle='select: title'/>,
<xref linkend='XtCheckSubclass' xrefstyle='select: title'/>,
<function>XtIsObject</function>,
<function>XtIsRectObj</function>,
<function>XtIsWidget</function>,
<function>XtIsComposite</function>,
<function>XtIsConstraint</function>,
<function>XtIsShell</function>,
<function>XtIsOverrideShell</function>,
<function>XtIsWMShell</function>,
<function>XtIsVendorShell</function>,
<function>XtIsTransientShell</function>,
<function>XtIsTopLevelShell</function>,
<function>XtIsApplicationShell</function>,
<function>XtIsSessionShell</function>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtIsManaged' xrefstyle='select: title'/>,
<xref linkend='XtIsSensitive' xrefstyle='select: title'/>
(both will return
<function>False</function>
if argument is not a subclass of
RectObj)
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtIsRealized' xrefstyle='select: title'/>
(returns the state of the nearest windowed ancestor
if class of argument is not a subclass of
Core)
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtWidgetToApplicationContext' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtDestroyWidget' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<function>XtParent</function>,
<xref linkend='XtDisplayOfObject' xrefstyle='select: title'/>,
<xref linkend='XtScreenOfObject' xrefstyle='select: title'/>,
<xref linkend='XtWindowOfObject' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtSetKeyboardFocus' xrefstyle='select: title'/>
(descendant)
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtGetGC' xrefstyle='select: title'/>,
<xref linkend='XtReleaseGC' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtName' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtSetValues' xrefstyle='select: title'/>,
<xref linkend='XtGetValues' xrefstyle='select: title'/>,
<xref linkend='XtVaSetValues' xrefstyle='select: title'/>,
<xref linkend='XtVaGetValues' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtGetSubresources' xrefstyle='select: title'/>,
<xref linkend='XtGetApplicationResources' xrefstyle='select: title'/>,
<xref linkend='XtVaGetSubresources' xrefstyle='select: title'/>,
<xref linkend='XtVaGetApplicationResources' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtConvert' xrefstyle='select: title'/>,
<xref linkend='XtConvertAndStore' xrefstyle='select: title'/>
    </para>
  </listitem>
</itemizedlist>
<para>
The return value of the following procedures will be of class
Object
or a subclass:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
<xref linkend='XtCreateWidget' xrefstyle='select: title'/>,
<xref linkend='XtVaCreateWidget' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<function>XtParent</function>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtNameToWidget' xrefstyle='select: title'/>
    </para>
  </listitem>
</itemizedlist>
<para>
The return value of the following procedures will be
<function>objectClass</function>
or a subclass:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
<xref linkend='XtClass' xrefstyle='select: title'/>,
<function>XtSuperclass</function>
    </para>
  </listitem>
</itemizedlist>
</sect2>

<sect2 id="Use_of_Objects">
<title>Use of Objects</title>
<para>
The
Object
class exists to enable programmers to use the Intrinsics'
classing and resource-handling mechanisms for things smaller
and simpler than widgets.
Objects make obsolete many common uses of subresources as described in
Sections 9.4, 9.7.2.4, and 9.7.2.5.
</para>

<para>
Composite
widget classes that wish to accept nonwidget children must
set the <emphasis remap='I'>accepts_objects</emphasis> field in the
<function>CompositeClassExtension</function>
structure to
<function>True</function>.
<xref linkend='XtCreateWidget' xrefstyle='select: title'/>
will otherwise generate an error message on an attempt to create a
nonwidget child.
</para>

<para>
Of the classes defined by the Intrinsics,
ApplicationShell
and
SessionShell
accept nonwidget children, and the class of any nonwidget child
must not be
<function>rectObjClass</function>
or any subclass.  The intent of allowing
Object
children of
ApplicationShell
and
SessionShell
is to provide clients a simple mechanism
for establishing the resource-naming root of an object hierarchy.
</para>
</sect2>
</sect1>

<sect1 id="Rectangle_Objects">
<title>Rectangle Objects</title>
<para>
The class of rectangle objects is a subclass of
Object
that represents
rectangular areas.  It encapsulates the mechanisms for geometry
management and is called RectObj
to avoid conflict with the Xlib
<function>Rectangle</function>
data type.
</para>
<sect2 id="RectObjClassPart_Structure">
<title>RectObjClassPart Structure</title>
<para>
As with the
<function>ObjectClassPart</function>
structure, all fields in the
<function>RectObjClassPart</function>
structure have the same
purpose and function as the corresponding fields in
<function>CoreClassPart</function>;
fields whose names are rect<emphasis remap='I'>n</emphasis> for some integer
<emphasis remap='I'>n</emphasis> are not used for
RectObj, but exist to pad the data structure so that it matches
Core's
class record.  The class record initialization must fill all
rect<emphasis remap='I'>n</emphasis> fields with NULL or zero as appropriate to the type.
</para>
<programlisting>
typedef struct _RectObjClassPart {
        WidgetClass     superclass;
        String          class_name;
        Cardinal        widget_size;
        XtProc          class_initialize;
        XtWidgetClassProc class_part_initialize;
        XtEnum          class_inited;
        XtInitProc      initialize;
        XtArgsProc      initialize_hook;
        XtProc          rect1;
        XtPointer       rect2;
        Cardinal        rect3;
        XtResourceList  resources;
        Cardinal        num_resources;
        XrmClass        xrm_class;
        Boolean         rect4;
        XtEnum          rect5;
        Boolean         rect6;
        Boolean         rect7;
        XtWidgetProc    destroy;
        XtWidgetProc    resize;
        XtExposeProc    expose;
        XtSetValuesFunc set_values;
        XtArgsFunc      set_values_hook;
        XtAlmostProc    set_values_almost;
        XtArgsProc      get_values_hook;
        XtProc          rect9;
        XtVersionType   version;
        XtPointer       callback_private;
        String          rect10;
        XtGeometryHandler query_geometry;
        XtProc          rect11;
        XtPointer       extension;
} RectObjClassPart;
</programlisting>
<para>
The
RectObj
class record consists of just the
<function>RectObjClassPart</function>.
</para>
<programlisting>
typedef struct _RectObjClassRec {
        RectObjClassPart rect_class;
} RectObjClassRec, *RectObjClass;
</programlisting>
<para>
The predefined class record and pointer for
<function>RectObjClassRec</function>
are
</para>

<para>
In
<filename class="headerfile">Intrinsic.h</filename>:
</para>
<programlisting>
extern RectObjClassRec rectObjClassRec;
</programlisting>
<para>
In
<filename class="headerfile">Intrinsic.h</filename>:
</para>
<programlisting>
extern WidgetClass rectObjClass;
</programlisting>
<para>
The opaque types
<function>RectObj</function>
and
<function>RectObjClass</function>
and the opaque variable
<function>rectObjClass</function>
are defined for generic actions on objects
whose class is RectObj or a subclass of
RectObj.
<filename class="headerfile">Intrinsic.h</filename>
uses an incomplete structure definition to ensure that the compiler
catches attempts to access private data:
</para>
<programlisting>
typedef struct _RectObjClassRec* RectObjClass;
</programlisting>

</sect2>

<sect2 id="RectObjPart_Structure">
<title>RectObjPart Structure</title>
<para>
In addition to the
<function>ObjectPart</function>
fields,
RectObj
objects have the following fields defined in the
<function>RectObjPart</function>
structure.  All fields have the same meaning as the corresponding field in
<function>CorePart</function>.
</para>
<programlisting>
typedef struct _RectObjPart {
        Position        x, y;
        Dimension       width, height;
        Dimension       border_width;
        Boolean         managed;
        Boolean         sensitive;
        Boolean         ancestor_sensitive;
} RectObjPart;
</programlisting>
<para>
RectObj
objects have the RectObj fields immediately following the Object fields.
</para>
<programlisting>
typedef struct _RectObjRec {
        ObjectPart object;
        RectObjPart rectangle;
} RectObjRec, *RectObj;
</programlisting>
<para>
In
<filename class="headerfile">Intrinsic.h</filename>:
</para>
<programlisting>
typedef struct _RectObjRec* RectObj;
</programlisting>

</sect2>

<sect2 id="RectObj_Resources">
<title>RectObj Resources</title>
<para>
The resource names, classes, and representation types that are specified in the
<function>rectObjClassRec</function>
resource list are:
<informaltable frame='topbot'>
  <?dbfo keep-together="always" ?>
  <tgroup cols='3' align='left' colsep='0' rowsep='0'>
  <colspec colwidth='1.0*' colname='c1'/>
  <colspec colwidth='1.0*' colname='c2'/>
  <colspec colwidth='1.0*' colname='c3'/>
  <thead>
    <row rowsep='1'>
      <entry>Name</entry>
      <entry>Class</entry>
      <entry>Representation</entry>
    </row>
  </thead>
  <tbody>
    <row>
      <entry>XtNancestorSensitive</entry>
      <entry>XtCSensitive</entry>
      <entry>XtRBoolean</entry>
    </row>
    <row>
      <entry>XtNborderWidth</entry>
      <entry>XtCBorderWidth</entry>
      <entry>XtRDimension</entry>
    </row>
    <row>
      <entry>XtNheight</entry>
      <entry>XtCHeight</entry>
      <entry>XtRDimension</entry>
    </row>
    <row>
      <entry>XtNsensitive</entry>
      <entry>XtCSensitive</entry>
      <entry>XtRBoolean</entry>
    </row>
    <row>
      <entry>XtNwidth</entry>
      <entry>XtCWidth</entry>
      <entry>XtRDimension</entry>
    </row>
    <row>
      <entry>XtNx</entry>
      <entry>XtCPosition</entry>
      <entry>XtRPosition</entry>
    </row>
    <row>
      <entry>XtNy</entry>
      <entry>XtCPosition</entry>
      <entry>XtRPosition</entry>
    </row>
  </tbody>
  </tgroup>
</informaltable>
</para>
</sect2>

<sect2 id="RectObjPart_Default_Values">
<title>RectObjPart Default Values</title>
<para>
All fields in
<function>RectObjPart</function>
have the same default values as the corresponding fields in
<function>CorePart</function>.
</para>
</sect2>

<sect2 id="Widget_Arguments_to_xI_Routines">
<title>Widget Arguments to Intrinsics Routines</title>
<para>
The WidgetClass arguments to the following procedures may be
<function>rectObjClass</function>
or any subclass:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
<xref linkend='XtCreateManagedWidget' xrefstyle='select: title'/>,
<xref linkend='XtVaCreateManagedWidget' xrefstyle='select: title'/>
    </para>
  </listitem>
</itemizedlist>
<para>
The Widget arguments to the following procedures may be of class
RectObj
or any subclass:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
<xref linkend='XtConfigureWidget' xrefstyle='select: title'/>,
<xref linkend='XtMoveWidget' xrefstyle='select: title'/>,
<xref linkend='XtResizeWidget' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtMakeGeometryRequest' xrefstyle='select: title'/>,
<xref linkend='XtMakeResizeRequest' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtManageChildren' xrefstyle='select: title'/>,
<xref linkend='XtManageChild' xrefstyle='select: title'/>,
<xref linkend='XtUnmanageChildren' xrefstyle='select: title'/>,
<xref linkend='XtUnmanageChild' xrefstyle='select: title'/>,
<xref linkend='XtChangeManagedSet' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtQueryGeometry' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtSetSensitive' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtTranslateCoords' xrefstyle='select: title'/>
    </para>
  </listitem>
</itemizedlist>
<para>
The return value of the following procedures will be of class
RectObj
or a subclass:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
<xref linkend='XtCreateManagedWidget' xrefstyle='select: title'/>,
<xref linkend='XtVaCreateManagedWidget' xrefstyle='select: title'/>
    </para>
  </listitem>
</itemizedlist>
</sect2>

<sect2 id="Use_of_Rectangle_Objects">
<title>Use of Rectangle Objects</title>
<para>
RectObj
can be subclassed to provide widgetlike objects (sometimes
called gadgets) that do not use windows and do not have those
features that are seldom used in simple widgets.  This can save memory
resources both in the server and in applications
but requires additional support code in the parent.
In the following
discussion, <emphasis remap='I'>rectobj</emphasis> refers only to objects
whose class is RectObj or a subclass of
RectObj,
but not Core or a subclass of
Core.
</para>

<para>
Composite
widget classes that wish to accept rectobj children must set
the <emphasis remap='I'>accepts_objects</emphasis> field in the
<function>CompositeClassExtension</function>
extension structure to
<function>True</function>.
<xref linkend='XtCreateWidget' xrefstyle='select: title'/>
or
<xref linkend='XtCreateManagedWidget' xrefstyle='select: title'/>
will otherwise generate an error if called to create a nonwidget child.
If the composite widget supports only children of class
RectObj
or a subclass (i.e., not of the general Object class), it
must declare an insert_child procedure and check the subclass of each
new child in that procedure.  None of the classes defined by the
Intrinsics accept rectobj children.
</para>

<para>
If gadgets are defined in an object set, the parent is responsible for
much more than the parent of a widget.  The parent must request and handle
input events that occur for the gadget and is responsible for making
sure that when it receives an exposure event the gadget children get
drawn correctly.
Rectobj children may
have expose procedures
specified in their class records, but the parent is free to
ignore them, instead drawing the contents of the child itself.  This
can potentially save graphics context switching.  The precise contents
of the exposure event and region arguments to the RectObj expose
procedure are not specified by the Intrinsics; a particular rectangle object is
free to define the coordinate system origin (self-relative or
parent-relative) and whether or not the rectangle or region is assumed to
have been intersected with the visible region of the object.
</para>

<para>
In general, it is expected that a composite widget that accepts
nonwidget children will document those children it is able to handle,
since a gadget cannot be viewed as a completely self-contained entity,
as can a widget.  Since a particular composite widget class is usually
designed to handle nonwidget children of only a limited set of classes, it should
check the classes of newly added children in its insert_child
procedure to make sure that it can deal with them.
</para>

<para>
The Intrinsics will clear areas of a parent window obscured by
rectobj children, causing exposure events, under the following
circumstances:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
A rectobj child is managed or unmanaged.
    </para>
  </listitem>
  <listitem>
    <para>
In a call to
<xref linkend='XtSetValues' xrefstyle='select: title'/>
on a rectobj child, one or more of the set_values procedures returns
<function>True</function>.
    </para>
  </listitem>
  <listitem>
    <para>
In a call to
<xref linkend='XtConfigureWidget' xrefstyle='select: title'/>
on a rectobj child, areas will
be cleared corresponding to both the old and the new child
geometries, including the border, if the geometry changes.
    </para>
  </listitem>
  <listitem>
    <para>
In a call to
<xref linkend='XtMoveWidget' xrefstyle='select: title'/>
on a rectobj child, areas will be
cleared corresponding to both the old and the new child
geometries, including the border, if the geometry changes.
    </para>
  </listitem>
  <listitem>
    <para>
In a call to
<xref linkend='XtResizeWidget' xrefstyle='select: title'/>
on a rectobj child, a single
rectangle will be cleared corresponding to the larger of the
old and the new child geometries if they are different.
    </para>
  </listitem>
  <listitem>
    <para>
In a call to
<xref linkend='XtMakeGeometryRequest' xrefstyle='select: title'/>
(or
<xref linkend='XtMakeResizeRequest' xrefstyle='select: title'/>)
on a rectobj child with
<function>XtQueryOnly</function>
not set, if the manager returns
<function>XtGeometryYes</function>,
two rectangles will be cleared corresponding to both the old and
the new child geometries.
    </para>
  </listitem>
</itemizedlist>
<para>
Stacking order is not supported for rectobj children.  Composite widgets with
rectobj children are free to define any semantics desired if the child
geometries overlap, including making this an error.
</para>

<para>
When a rectobj is playing the role of a widget, developers must be
reminded to avoid making assumptions about the object passed in the
Widget argument to a callback procedure.
</para>
</sect2>
</sect1>

<sect1 id="Undeclared_Class">
<title>Undeclared Class</title>
<para>
The Intrinsics define an unnamed class between
RectObj
and
Core
for possible future use by the X Consortium. The only assumptions that
may be made about the unnamed class are
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
The <emphasis remap='I'>core_class.superclass</emphasis> field of
<function>coreWidgetClassRec</function>
contains a pointer to the unnamed class record.
    </para>
  </listitem>
  <listitem>
    <para>
A pointer to the unnamed class record when dereferenced as an
<function>ObjectClass</function>
will contain a pointer to
<function>rectObjClassRec</function>
in its <emphasis remap='I'>object_class.superclass</emphasis> field.
    </para>
  </listitem>
</itemizedlist>
<para>
Except for the above, the contents of the class record for this class
and the result of an attempt to subclass or to create a widget of this
unnamed class are undefined.
</para>
</sect1>

<sect1 id="Widget_Arguments_to_Intrinsics_Routines">
<title>Widget Arguments to Intrinsics Routines</title>
<para>
The WidgetClass arguments to the following procedures must be of class
Shell
or a subclass:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
<xref linkend='XtCreatePopupShell' xrefstyle='select: title'/>,
<xref linkend='XtVaCreatePopupShell' xrefstyle='select: title'/>,
<xref linkend='XtAppCreateShell' xrefstyle='select: title'/>,
<xref linkend='XtVaAppCreateShell' xrefstyle='select: title'/>,
<xref linkend='XtOpenApplication' xrefstyle='select: title'/>,
<xref linkend='XtVaOpenApplication' xrefstyle='select: title'/>
    </para>
  </listitem>
</itemizedlist>
<para>
The Widget arguments to the following procedures must be of class
Core
or any subclass:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
<xref linkend='XtCreatePopupShell' xrefstyle='select: title'/>,
<xref linkend='XtVaCreatePopupShell' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtAddEventHandler' xrefstyle='select: title'/>,
<xref linkend='XtAddRawEventHandler' xrefstyle='select: title'/>,
<xref linkend='XtRemoveEventHandler' xrefstyle='select: title'/>,
<xref linkend='XtRemoveRawEventHandler' xrefstyle='select: title'/>,
<xref linkend='XtInsertEventHandler' xrefstyle='select: title'/>,
<xref linkend='XtInsertRawEventHandler' xrefstyle='select: title'/>
<xref linkend='XtInsertEventTypeHandler' xrefstyle='select: title'/>,
<xref linkend='XtRemoveEventTypeHandler' xrefstyle='select: title'/>,
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtRegisterDrawable' xrefstyle='select: title'/>
<xref linkend='XtDispatchEventToWidget' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtAddGrab' xrefstyle='select: title'/>,
<xref linkend='XtRemoveGrab' xrefstyle='select: title'/>,
<xref linkend='XtGrabKey' xrefstyle='select: title'/>,
<xref linkend='XtGrabKeyboard' xrefstyle='select: title'/>,
<xref linkend='XtUngrabKey' xrefstyle='select: title'/>,
<xref linkend='XtUngrabKeyboard' xrefstyle='select: title'/>,
<xref linkend='XtGrabButton' xrefstyle='select: title'/>,
<xref linkend='XtGrabPointer' xrefstyle='select: title'/>,
<xref linkend='XtUngrabButton' xrefstyle='select: title'/>,
<xref linkend='XtUngrabPointer' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtBuildEventMask' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtCreateWindow' xrefstyle='select: title'/>,
<function>XtDisplay</function>,
<xref linkend='XtScreen' xrefstyle='select: title'/>,
<xref linkend='XtWindow' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtNameToWidget' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtGetSelectionValue' xrefstyle='select: title'/>,
<xref linkend='XtGetSelectionValues' xrefstyle='select: title'/>,
<xref linkend='XtOwnSelection' xrefstyle='select: title'/>,
<xref linkend='XtDisownSelection' xrefstyle='select: title'/>,
<xref linkend='XtOwnSelectionIncremental' xrefstyle='select: title'/>,
<xref linkend='XtGetSelectionValueIncremental' xrefstyle='select: title'/>,
<xref linkend='XtGetSelectionValuesIncremental' xrefstyle='select: title'/>,
<xref linkend='XtGetSelectionRequest' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtInstallAccelerators' xrefstyle='select: title'/>,
<xref linkend='XtInstallAllAccelerators' xrefstyle='select: title'/>
(both destination and source)
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtAugmentTranslations' xrefstyle='select: title'/>,
<xref linkend='XtOverrideTranslations' xrefstyle='select: title'/>,
<xref linkend='XtUninstallTranslations' xrefstyle='select: title'/>,
<xref linkend='XtCallActionProc' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtMapWidget' xrefstyle='select: title'/>,
<xref linkend='XtUnmapWidget' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtRealizeWidget' xrefstyle='select: title'/>,
<xref linkend='XtUnrealizeWidget' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtSetMappedWhenManaged' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtCallAcceptFocus' xrefstyle='select: title'/>,
<xref linkend='XtSetKeyboardFocus' xrefstyle='select: title'/>
(subtree)
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtResizeWindow' xrefstyle='select: title'/>
    </para>
  </listitem>
  <listitem>
    <para>
<xref linkend='XtSetWMColormapWindows' xrefstyle='select: title'/>
    </para>
  </listitem>
</itemizedlist>
<para>
The Widget arguments to the following procedures must be of class
Composite
or any subclass:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
<xref linkend='XtCreateManagedWidget' xrefstyle='select: title'/>,
<xref linkend='XtVaCreateManagedWidget' xrefstyle='select: title'/>
    </para>
  </listitem>
</itemizedlist>
<para>
The Widget arguments to the following procedures must be of a subclass of
Shell:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
<xref linkend='XtPopdown' xrefstyle='select: title'/>,
<xref linkend='XtCallbackPopdown' xrefstyle='select: title'/>,
<xref linkend='XtPopup' xrefstyle='select: title'/>,
<xref linkend='XtCallbackNone' xrefstyle='select: title'/>,
<xref linkend='XtCallbackNonexclusive' xrefstyle='select: title'/>,
<xref linkend='XtCallbackExclusive' xrefstyle='select: title'/>,
<xref linkend='XtPopupSpringLoaded' xrefstyle='select: title'/>
    </para>
  </listitem>
</itemizedlist>
<para>
The return value of the following procedure will be of class
Core
or a subclass:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
<xref linkend='XtWindowToWidget' xrefstyle='select: title'/>
    </para>
  </listitem>
</itemizedlist>
<para>
The return value of the following procedures will be of a subclass of
Shell:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
<xref linkend='XtAppCreateShell' xrefstyle='select: title'/>,
<xref linkend='XtVaAppCreateShell' xrefstyle='select: title'/>,
<xref linkend='XtAppInitialize' xrefstyle='select: title'/>,
<xref linkend='XtVaAppInitialize' xrefstyle='select: title'/>,
<xref linkend='XtCreatePopupShell' xrefstyle='select: title'/>,
<xref linkend='XtVaCreatePopupShell' xrefstyle='select: title'/>
    </para>
  </listitem>
</itemizedlist>
</sect1>
</chapter>