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
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
|
.\" $Xorg: appC,v 1.3 2000/08/17 19:42:48 cpqbld Exp $
.\" Copyright \(co 1985, 1986, 1987, 1988, 1991, 1994
.\" X Consortium
.\"
.\" Permission is hereby granted, free of charge, to any person obtaining
.\" a copy of this software and associated documentation files (the
.\" "Software"), to deal in the Software without restriction, including
.\" without limitation the rights to use, copy, modify, merge, publish,
.\" distribute, sublicense, and/or sell copies of the Software, and to
.\" permit persons to whom the Software is furnished to do so, subject to
.\" the following conditions:
.\"
.\" The above copyright notice and this permission notice shall be included
.\" in all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
.\" OTHER DEALINGS IN THE SOFTWARE.
.\"
.\" Except as contained in this notice, the name of the X Consortium shall
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from the X Consortium.
.\"
.\" Copyright \(co 1985, 1986, 1987, 1988, 1991, 1994
.\" Digital Equipment Corporation, Maynard, Massachusetts.
.\"
.\" Permission to use, copy, modify and distribute this documentation for any
.\" purpose and without fee is hereby granted, provided that the above copyright
.\" notice appears in all copies and that both that copyright notice and this
.\" permission notice appear in supporting documentation, and that the name of
.\" Digital not be used in in advertising or publicity pertaining
.\" to distribution of the software without specific, written prior permission.
.\" Digital makes no representations about the suitability of the
.\" software described herein for any purpose.
.\" It is provided ``as is'' without express or implied warranty.
.\"
.bp
\&
.sp 1
.ce 3
\s+1\fBAppendix C\fP\s-1
\s+1\fBCompatibility Functions\fP\s-1
.sp 2
.LP
.XS
\fBAppendix C \(em Compatibility Functions\fP
.XE
.FS
This appendix is part of the formal Intrinsics Specification.
.FE
.LP
In prototype versions of the \*(tk
each widget class
implemented an Xt<\^\fIWidget\fP\^>Create (for example,
.PN XtLabelCreate )
function, in which most of the code was identical from widget to widget.
In the \*(xI, a single generic
.PN XtCreateWidget
performs most of the common work and then calls the initialize procedure
implemented for the particular widget class.
.LP
Each Composite class also implemented the procedures
Xt<\^\fIWidget\fP\^>Add and an Xt<\^\fIWidget\fP\^>Delete (for example,
.PN XtButtonBoxAddButton
and
.PN XtButtonBoxDeleteButton ).
In the \*(xI, the Composite generic procedures
.PN XtManageChildren
and
.PN XtUnmanageChildren
perform error checking and screening out of certain children.
Then they call the change_managed procedure
implemented for the widget's Composite class.
If the widget's parent has not yet been realized,
the call to the change_managed procedure is delayed until realization time.
.LP
Old-style calls can be implemented in the \*(tk by defining
one-line procedures or macros that invoke a generic routine. For example,
you could define the macro
.PN XtLabelCreate
as:
.IP
.Ds 0
.TA .5i 3i
.ta .5i 3i
#define XtLabelCreate(\fIname\fP, \fIparent\fP, \fIargs\fP, \fInum_args\fP) \\
((LabelWidget) XtCreateWidget(\fIname\fP, \fIlabelWidgetClass\fP, \
\fIparent\fP, \fIargs\fP, \fInum_args\fP))
.De
.sp
.LP
Pop-up shells in some of the prototypes automatically performed an
.PN XtManageChild
on their child within their insert_child procedure.
.IN "insert_child procedure"
Creators of pop-up children need to call
.PN XtManageChild
themselves.
.sp
.LP
.PN XtAppInitialize
and
.PN XtVaAppInitialize
have been replaced by
.PN XtOpenApplication
and
.PN XtVaOpenApplication .
.LP
To initialize the \*(xI internals, create an application context,
open and initialize a display, and create the initial application shell
instance, an application may use
.PN XtAppInitialize
or
.PN XtVaAppInitialize .
.LP
.IN "XtAppInitialize" "" "@DEF@"
.sM
.FD 0
Widget XtAppInitialize(\fIapp_context_return\fP, \fIapplication_class\fP, \
\fIoptions\fP, \fInum_options\fP,
.br
\fIargc_in_out\fP, \fIargv_in_out\fP, \
\fIfallback_resources\fP, \fIargs\fP, \fInum_args\fP)
.br
XtAppContext *\fIapp_context_return\fP;
.br
String \fIapplication_class\fP;
.br
XrmOptionDescList \fIoptions\fP;
.br
Cardinal \fInum_options\fP;
.br
int *\fIargc_in_out\fP;
.br
String *\fIargv_in_out\fP;
.br
String *\fIfallback_resources\fP;
.br
ArgList \fIargs\fP;
.br
Cardinal \fInum_args\fP;
.FN
.IP \fIapp_context_return\fP 1.5i
Returns the application context, if non-NULL.
.IP \fIapplication_class\fP 1.5i
Specifies the class name of the application.
.IP \fIoptions\fP 1.5i
Specifies the command line options table.
.IP \fInum_options\fP 1.5i
Specifies the number of entries in \fIoptions\fP.
.IP \fIargc_in_out\fP 1.5i
Specifies a pointer to the number of command line arguments.
.IP \fIargv_in_out\fP 1.5i
Specifies a pointer to the command line arguments.
.IP \fIfallback_resources\fP 1.5i
Specifies resource values to be used if the application class resource
file cannot be opened or read, or NULL.
.IP \fIargs\fP 1.5i
Specifies the argument list to override any
other resource specifications for the created shell widget.
.IP \fInum_args\fP 1.5i
Specifies the number of entries in the argument list.
.LP
.eM
The
.PN XtAppInitialize
function calls
.PN XtToolkitInitialize
followed by
.PN XtCreateApplicationContext ,
then calls
.PN XtOpenDisplay
with \fIdisplay_string\fP NULL and
\fIapplication_name\fP NULL, and finally calls
.PN XtAppCreateShell
with \fIapplication_name\fP NULL, \fIwidget_class\fP
.PN application\%Shell\%Widget\%Class ,
and the specified \fIargs\fP and \fInum_args\fP
and returns the created shell. The modified \fIargc\fP and \fIargv\fP returned by
.PN XtDisplayInitialize
are returned in \fIargc_in_out\fP and \fIargv_in_out\fP. If
\fIapp_context_return\fP is not NULL, the created application context is
also returned. If the display specified by the command line cannot be
opened, an error message is issued and
.PN XtAppInitialize
terminates the application. If \fIfallback_resources\fP is non-NULL,
.PN XtAppSetFallbackResources
is called with the value prior to calling
.PN XtOpenDisplay .
.sp
.LP
.IN "XtVaAppInitialize" "" "@DEF@"
.sM
.FD 0
Widget XtVaAppInitialize(\fIapp_context_return\fP, \fIapplication_class\fP, \
\fIoptions\fP, \fInum_options\fP,
.br
\fIargc_in_out\fP, \fIargv_in_out\fP, \
\fIfallback_resources\fP, ...)
.br
XtAppContext *\fIapp_context_return\fP;
.br
String \fIapplication_class\fP;
.br
XrmOptionDescList \fIoptions\fP;
.br
Cardinal \fInum_options\fP;
.br
int *\fIargc_in_out\fP;
.br
String *\fIargv_in_out\fP;
.br
String *\fIfallback_resources\fP;
.FN
.IP \fIapp_context_return\fP 1.5i
Returns the application context, if non-NULL.
.IP \fIapplication_class\fP 1.5i
Specifies the class name of the application.
.IP \fIoptions\fP 1.5i
Specifies the command line options table.
.IP \fInum_options\fP 1.5i
Specifies the number of entries in \fIoptions\fP.
.IP \fIargc_in_out\fP 1.5i
Specifies a pointer to the number of command line arguments.
.IP \fIargv_in_out\fP 1.5i
Specifies the command line arguments array.
.IP \fIfallback_resources\fP 1.5i
Specifies resource values to be used if the application class
resource file cannot be opened, or NULL.
.IP ... 1.5i
Specifies the variable argument list to override any other
resource specifications for the created shell.
.LP
.eM
The
.PN XtVaAppInitialize
procedure is identical in function to
.PN XtAppInitialize
with the \fIargs\fP and \fInum_args\fP parameters replaced by a varargs list,
as described
in Section 2.5.1.
.sp
.LP
As a convenience to people converting from earlier versions of the toolkit
without application contexts, the following routines exist:
.PN XtInitialize ,
.PN XtMainLoop ,
.PN XtNextEvent ,
.PN XtProcessEvent ,
.PN XtPeekEvent ,
.PN XtPending ,
.PN XtAddInput ,
.PN XtAddTimeOut ,
.PN XtAddWorkProc ,
.PN XtCreateApplicationShell ,
.PN XtAddActions ,
.PN XtSetSelectionTimeout ,
and
.PN XtGetSelectionTimeout .
.LP
.IN "XtInitialize" "" "@DEF@"
.sM
.FD 0
Widget XtInitialize(\fIshell_name\fP, \fIapplication_class\fP, \fIoptions\fP, \
\fInum_options\fP, \fIargc\fP, \fIargv\fP)
.br
String \fIshell_name\fP;
.br
String \fIapplication_class\fP;
.br
XrmOptionDescRec \fIoptions\fP[];
.br
Cardinal \fInum_options\fP;
.br
int *\fIargc\fP;
.br
String \fIargv\fP[];
.FN
.IP \fIshell_name\fP 1i
This parameter is ignored; therefore, you can specify NULL.
.IP \fIapplication_class\fP 1i
Specifies the class name of this application.
.IP \fIoptions\fP 1i
Specifies how to parse the command line for any application-specific resources.
The \fIoptions\fP argument is passed as a parameter to
.PN XrmParseCommand .
.IP \fInum_options\fP 1i
Specifies the number of entries in the options list.
.IP \fIargc\fP 1i
Specifies a pointer to the number of command line parameters.
.IP \fIargv\fP 1i
Specifies the command line parameters.
.LP
.eM
.PN XtInitialize
calls
.PN XtToolkitInitialize
to initialize the toolkit internals,
creates a default application context for use by the other convenience
routines, calls
.PN XtOpenDisplay
with \fIdisplay_string\fP NULL and \fIapplication_name\fP NULL, and
finally calls
.PN XtAppCreateShell
with \fIapplication_name\fP NULL and
returns the created shell.
The semantics of calling
.PN XtInitialize
more than once are undefined.
This routine has been replaced by
.PN XtOpenApplication .
.sp
.IN "XtMainLoop" "" "@DEF@"
.sM
.FD 0
void XtMainLoop(void)
.FN
.LP
.eM
.PN XtMainLoop
first reads the next alternate input, timer, or X event by calling
.PN XtNextEvent .
Then it dispatches this to the appropriate registered procedure by calling
.PN XtDispatchEvent .
This routine has been replaced by
.PN XtAppMainLoop .
.sp
.IN "XtNextEvent" "" "@DEF@"
.sM
.FD 0
void XtNextEvent(\fIevent_return\fP)
.br
XEvent *\fIevent_return\fP;
.FN
.IP \fIevent_return\fP 1i
Returns the event information to the specified event structure.
.LP
.eM
If no input is on the X input queue for the default application context,
.PN XtNextEvent
flushes the X output buffer
and waits for an event while looking at the alternate input sources
and timeout values and calling any callback procedures triggered by them.
This routine has been replaced by
.PN XtAppNextEvent .
.PN XtInitialize
must be called before using this routine.
.sp
.IN "XtProcessEvent" "" "@DEF@"
.sM
.FD 0
void XtProcessEvent(\fImask\fP)
.br
XtInputMask \fImask\fP;
.FN
.IP \fImask\fP 1i
Specifies the type of input to process.
.LP
.eM
.PN XtProcessEvent
processes one X event, timeout, or alternate input source
(depending on the value of \fImask\fP), blocking if necessary.
It has been replaced by
.PN XtAppProcessEvent .
.PN XtInitialize
must be called before using this function.
.sp
.IN "XtPeekEvent" "" "@DEF@"
.sM
.FD 0
Boolean XtPeekEvent(\fIevent_return\fP)
.br
XEvent *\fIevent_return\fP;
.FN
.IP \fIevent_return\fP 1i
Returns the event information to the specified event structure.
.LP
.eM
If there is an event in the queue for the default application context,
.PN XtPeekEvent
fills in the event and returns a nonzero value.
If no X input is on the queue,
.PN XtPeekEvent
flushes the output buffer and blocks until input is available, possibly
calling some timeout callbacks in the process.
If the input is an event,
.PN XtPeekEvent
fills in the event and returns a nonzero value.
Otherwise, the input is for an alternate input source, and
.PN XtPeekEvent
returns zero.
This routine has been replaced by
.PN XtAppPeekEvent .
.PN XtInitialize
must be called before using this routine.
.sp
.IN "XtPending" "" "@DEF@"
.sM
.FD 0
Boolean XtPending()
.FN
.LP
.eM
.PN XtPending
returns a nonzero value if there are
events pending from the X server or alternate input sources in the default
application context.
If there are no events pending,
it flushes the output buffer and returns a zero value.
It has been replaced by
.PN XtAppPending .
.PN XtInitialize
must be called before using this routine.
.sp
.IN "XtAddInput" "" "@DEF@"
.sM
.FD 0
XtInputId XtAddInput(\fIsource\fP, \fIcondition\fP, \fIproc\fP, \
\fIclient_data\fP)
.br
int \fIsource\fP;
.br
XtPointer \fIcondition\fP;
.br
XtInputCallbackProc \fIproc\fP;
.br
XtPointer \fIclient_data\fP;
.FN
.IP \fIsource\fP 1i
Specifies the source file descriptor on a POSIX-based system
or other operating-system-dependent device specification.
.IP \fIcondition\fP 1i
Specifies the mask that indicates either a read, write, or exception condition
or some operating-system-dependent condition.
.IP \fIproc\fP 1i
Specifies the procedure called when input is available.
.IP \fIclient_data\fP 1i
Specifies the parameter to be passed to \fIproc\fP when input is available.
.LP
.eM
The
.PN XtAddInput
function registers in the default application context a new
source of events,
which is usually file input but can also be file output.
(The word \fIfile\fP should be loosely interpreted to mean any sink
or source of data.)
.PN XtAddInput
also specifies the conditions under which the source can generate events.
When input is pending on this source in the default application context,
the callback procedure is called.
This routine has been replaced by
.PN XtAppAddInput .
.PN XtInitialize
must be called before using this routine.
.sp
.IN "XtAddTimeOut" "" "@DEF@"
.sM
.FD 0
XtIntervalId XtAddTimeOut(\fIinterval\fP, \fIproc\fP, \fIclient_data\fP)
.br
unsigned long \fIinterval\fP;
.br
XtTimerCallbackProc \fIproc\fP;
.br
XtPointer \fIclient_data\fP;
.FN
.IP \fIinterval\fP 1i
Specifies the time interval in milliseconds.
.IP \fIproc\fP 1i
Specifies the procedure to be called when time expires.
.IP \fIclient_data\fP 1i
Specifies the parameter to be passed to \fIproc\fP when it is called.
.LP
.eM
The
.PN XtAddTimeOut
function creates a timeout in the default application context
and returns an identifier for it.
The timeout value is set to \fIinterval\fP.
The callback procedure will be called after
the time interval elapses, after which the timeout is removed.
This routine has been replaced by
.PN XtAppAddTimeOut .
.PN XtInitialize
must be called before using this routine.
.sp
.IN "XtAddWorkProc" "" "@DEF@"
.sM
.FD 0
XtWorkProcId XtAddWorkProc(\fIproc\fP, \fIclient_data\fP)
.br
XtWorkProc \fIproc\fP;
.br
XtPointer \fIclient_data\fP;
.FN
.IP \fIproc\fP 1i
Procedure to call to do the work.
.IP \fIclient_data\fP 1i
Client data to pass to \fIproc\fP when it is called.
.LP
.eM
This routine registers a work procedure in the default application context. It has
been replaced by
.PN XtAppAddWorkProc .
.PN XtInitialize
must be called before using this routine.
.sp
.IN "XtCreateApplicationShell" "" "@DEF@"
.sM
.FD 0
Widget XtCreateApplicationShell(\fIname\fP, \fIwidget_class\fP, \fIargs\fP, \
\fInum_args\fP)
.br
String \fIname\fP;
.br
WidgetClass \fIwidget_class\fP;
.br
ArgList \fIargs\fP;
.br
Cardinal \fInum_args\fP;
.FN
.IP \fIname\fP 1i
This parameter is ignored; therefore, you can specify NULL.
.IP \fIwidget_class\fP 1i
Specifies the widget class pointer for the created application shell widget.
This will usually be
.PN topLevelShellWidgetClass
or a subclass thereof.
.IP \fIargs\fP 1i
Specifies the argument list to override any other resource specifications.
.IP \fInum_args\fP 1i
Specifies the number of entries in \fIargs\fP.
.LP
.eM
The procedure
.PN XtCreateApplicationShell
calls
.PN XtAppCreateShell
with \fIapplication_name\fP NULL, the application class passed to
.PN XtInitialize ,
and the default application context created by
.PN XtInitialize .
This routine has been replaced by
.PN XtAppCreateShell .
.sp
.LP
An old-format resource type converter procedure pointer is of type
.PN XtConverter .
.LP
.IN "XtConverter" "" "@DEF@"
.sM
.FD 0
typedef void (*XtConverter)(XrmValue*, Cardinal*, XrmValue*, XrmValue*);
.br
XrmValue *\fIargs\fP;
.br
Cardinal *\fInum_args\fP;
.br
XrmValue *\fIfrom\fP;
.br
XrmValue *\fIto\fP;
.FN
.IP \fIargs\fP 1i
Specifies a list of additional
.PN XrmValue
arguments to the converter if additional context is needed
to perform the conversion, or NULL.
.IP \fInum_args\fP 1i
Specifies the number of entries in \fIargs\fP.
.IP \fIfrom\fP 1i
Specifies the value to convert.
.IP \fIto\fP 1i
Specifies the descriptor to use to return the converted value.
.LP
.eM
Type converters should perform the following actions:
.IP \(bu 5
Check to see that the number of arguments passed is correct.
.IP \(bu 5
Attempt the type conversion.
.IP \(bu 5
If successful, return the size and pointer to the data in the \fIto\fP argument;
otherwise, call
.PN XtWarningMsg
and return without modifying the \fIto\fP argument.
.LP
Most type converters just take the data described by the specified \fIfrom\fP
argument and return data by writing into the specified \fIto\fP argument.
A few need other information, which is available in the specified
argument list.
A type converter can invoke another type converter,
which allows differing sources that may convert into a common intermediate
result to make maximum use of the type converter cache.
.LP
Note that the address returned in \fIto->addr\fP cannot be that of a local variable of
the converter because this is not valid after the converter returns.
It should be a pointer to a static variable.
.LP
The procedure type
.PN XtConverter
has been replaced by
.PN XtTypeConverter .
.sp
.LP
The
.PN XtStringConversionWarning
.IN "XtStringConversionWarning" "" "@DEF@"
function is a convenience routine for old-format resource converters
that convert from strings.
.LP
.sM
.FD 0
void XtStringConversionWarning(\fIsrc\fP, \fIdst_type\fP)
.br
String \fIsrc\fP, \fIdst_type\fP;
.FN
.IP \fIsrc\fP 1i
Specifies the string that could not be converted.
.IP \fIdst_type\fP 1i
Specifies the name of the type to which the string could not be converted.
.LP
.eM
The
.PN XtStringConversionWarning
function issues a warning message with name ``conversionError'',
type ``string'', class ``XtToolkitError, and the default message string
``Cannot convert "\fIsrc\fP" to type \fIdst_type\fP''. This routine
has been superseded by
.PN XtDisplayStringConversionWarning .
.sp
.LP
To register an old-format converter, use
.PN XtAddConverter
.IN "XtAddConverter" "" "@DEF@"
or
.PN XtAppAddConverter .
.IN "XtAppAddConverter" "" "@DEF@"
.LP
.sM
.FD 0
void XtAddConverter(\fIfrom_type\fP, \fIto_type\fP, \fIconverter\fP, \
\fIconvert_args\fP, \fInum_args\fP)
.br
String \fIfrom_type\fP;
.br
String \fIto_type\fP;
.br
XtConverter \fIconverter\fP;
.br
XtConvertArgList \fIconvert_args\fP;
.br
Cardinal \fInum_args\fP;
.FN
.IP \fIfrom_type\fP 1i
Specifies the source type.
.IP \fIto_type\fP 1i
Specifies the destination type.
.IP \fIconverter\fP 1i
Specifies the type converter procedure.
.IP \fIconvert_args\fP 1i
Specifies how to compute the additional arguments to the converter, or NULL.
.IP \fInum_args\fP 1i
Specifies the number of entries in \fIconvert_args\fP.
.sp
.LP
.eM
.PN XtAddConverter
is equivalent in function to
.PN XtSetTypeConverter
with \fIcache_type\fP equal to
.PN XtCacheAll
for old-format type converters. It has been superseded by
.PN XtSetTypeConverter .
.sp
.sM
.FD 0
void XtAppAddConverter(\fIapp_context\fP, \fIfrom_type\fP, \fIto_type\fP, \
\fIconverter\fP, \fIconvert_args\fP, \fInum_args\fP)
.br
XtAppContext \fIapp_context\fP;
.br
String \fIfrom_type\fP;
.br
String \fIto_type\fP;
.br
XtConverter \fIconverter\fP;
.br
XtConvertArgList \fIconvert_args\fP;
.br
Cardinal \fInum_args\fP;
.FN
.IP \fIapp_context\fP 1i
Specifies the application context.
.IP \fIfrom_type\fP 1i
Specifies the source type.
.IP \fIto_type\fP 1i
Specifies the destination type.
.IP \fIconverter\fP 1i
Specifies the type converter procedure.
.IP \fIconvert_args\fP 1i
Specifies how to compute the additional arguments to the converter, or NULL.
.IP \fInum_args\fP 1i
Specifies the number of entries in \fIconvert_args\fP.
.LP
.eM
.PN XtAppAddConverter
is equivalent in function to
.PN XtAppSetTypeConverter
with \fIcache_type\fP equal to
.PN XtCacheAll
for old-format type converters. It has been superseded by
.PN XtAppSetTypeConverter .
.sp
.LP
To invoke resource conversions, a client may use
.PN XtConvert
or, for old-format converters only,
.PN XtDirectConvert .
.LP
.IN "XtConvert" "" "@DEF@"
.sM
.FD 0
void XtConvert(\fIw\fP, \fIfrom_type\fP, \fIfrom\fP, \fIto_type\fP, \
\fIto_return\fP)
.br
Widget \fIw\fP;
.br
String \fIfrom_type\fP;
.br
XrmValuePtr \fIfrom\fP;
.br
String \fIto_type\fP;
.br
XrmValuePtr \fIto_return\fP;
.FN
.IP \fIw\fP 1i
Specifies the widget to use for additional arguments, if any are
needed.
.IP \fIfrom_type\fP 1i
Specifies the source type.
.IP \fIfrom\fP 1i
Specifies the value to be converted.
.IP \fIto_type\fP 1i
Specifies the destination type.
.IP \fIto_return\fP 1i
Returns the converted value.
.LP
.IN "XtDirectConvert" "" "@DEF@"
.FD 0
void XtDirectConvert(\fIconverter\fP, \fIargs\fP, \fInum_args\fP, \fIfrom\fP, \
\fIto_return\fP)
.br
XtConverter \fIconverter\fP;
.br
XrmValuePtr \fIargs\fP;
.br
Cardinal \fInum_args\fP;
.br
XrmValuePtr \fIfrom\fP;
.br
XrmValuePtr \fIto_return\fP;
.FN
.IP \fIconverter\fP 1i
Specifies the conversion procedure to be called.
.IP \fIargs\fP 1i
Specifies the argument list that contains the additional arguments
needed to perform the conversion (often NULL).
.IP \fInum_args\fP 1i
Specifies the number of entries in \fIargs\fP.
.IP \fIfrom\fP 1i
Specifies the value to be converted.
.IP \fIto_return\fP 1i
Returns the converted value.
.LP
.eM
The
.PN XtConvert
function looks up the type converter registered to convert \fIfrom_type\fP
to \fIto_type\fP, computes any additional arguments needed, and then calls
.PN XtDirectConvert
or
.PN XtCallConverter .
The
.PN XtDirectConvert
function looks in the converter cache to see if this conversion procedure
has been called with the specified arguments.
If so, it returns a descriptor for information stored in the cache;
otherwise, it calls the converter and enters the result in the cache.
.LP
Before calling the specified converter,
.PN XtDirectConvert
sets the return value size to zero and the return value address to NULL.
To determine if the conversion was successful,
the client should check \fIto_return.addr\fP for non-NULL.
The data returned by
.PN XtConvert
must be copied immediately by the caller,
as it may point to static data in the type converter.
.LP
.PN XtConvert
has been replaced by
.PN XtConvertAndStore ,
and
.PN XtDirectConvert
has been superseded by
.PN XtCallConverter .
.sp
.LP
To deallocate a shared GC when it is no longer needed, use
.PN XtDestroyGC .
.LP
.IN "XtDestroyGC" "" "@DEF@"
.sM
.FD 0
void XtDestroyGC(\fIw\fP, \fIgc\fP)
.br
Widget \fIw\fP;
.br
GC \fIgc\fP;
.FN
.IP \fIw\fP 1i
Specifies any object on the display for which the shared GC was
created. \*(oI
.IP \fIgc\fP 1i
Specifies the shared GC to be deallocated.
.LP
.eM
References to sharable GCs are counted and a free request is generated to the
server when the last user of a given GC destroys it.
Note that some earlier versions of
.PN XtDestroyGC
had only a \fIgc\fP argument.
Therefore, this function is not very portable,
and you are encouraged to use
.PN XtReleaseGC
instead.
.sp
.LP
To declare an action table in the default application context
and register it with the translation manager, use
.PN XtAddActions .
.LP
.IN "XtAddActions" "" "@DEF@"
.sM
.FD 0
void XtAddActions(\fIactions\fP, \fInum_actions\fP)
.br
XtActionList \fIactions\fP;
.br
Cardinal \fInum_actions\fP;
.FN
.IP \fIactions\fP 1i
Specifies the action table to register.
.IP \fInum_actions\fP 1i
Specifies the number of entries in \fIactions\fP.
.LP
.eM
If more than one action is registered with the same name,
the most recently registered action is used.
If duplicate actions exist in an action table,
the first is used.
The \*(xI register an action table for
.PN XtMenuPopup
and
.PN XtMenuPopdown
as part of \*(tk initialization.
This routine has been replaced by
.PN XtAppAddActions .
.PN XtInitialize
must be called before using this routine.
.sp
.LP
To set the \*(xI selection timeout in the default application context, use
.PN XtSetSelectionTimeout .
.LP
.IN "XtSetSelectionTimeout" "" "@DEF@"
.sM
.FD 0
void XtSetSelectionTimeout(\fItimeout\fP)
.br
unsigned long \fItimeout\fP;
.FN
.IP \fItimeout\fP 1i
Specifies the selection timeout in milliseconds.
This routine has been replaced by
.PN XtAppSetSelectionTimeout .
.PN XtInitialize
must be called before using this routine.
.LP
.eM
.sp
.LP
To get the current selection timeout value in the default application
context, use
.PN XtGetSelectionTimeout .
.LP
.IN "XtGetSelectionTimeout" "" "@DEF@"
.sM
.FD 0
unsigned long XtGetSelectionTimeout()
.FN
.LP
.eM
The selection timeout is the time within which the two communicating
applications must respond to one another.
If one of them does not respond within this interval,
the \*(xI abort the selection request.
.LP
This routine has been replaced by
.PN XtAppGetSelectionTimeout .
.PN XtInitialize
must be called before using this routine.
.sp
.LP
To obtain the global error database (for example, to merge with
an application- or widget-specific database), use
.PN XtGetErrorDatabase .
.LP
.IN "XtGetErrorDatabase" "" "@DEF@"
.sM
.FD 0
XrmDatabase *XtGetErrorDatabase()
.FN
.LP
.eM
The
.PN XtGetErrorDatabase
function returns the address of the error database.
The \*(xI do a lazy binding of the error database and do not merge in the
database file until the first call to
.PN XtGetErrorDatbaseText .
This routine has been replaced by
.PN XtAppGetErrorDatabase .
.sp
.LP
An error message handler can obtain the error database text for an
error or a warning by calling
.PN XtGetErrorDatabaseText .
.LP
.IN "XtGetErrorDatabaseText" "" "@DEF@"
.sM
.FD 0
void XtGetErrorDatabaseText(\fIname\fP, \fItype\fP, \fIclass\fP, \
\fIdefault\fP, \fIbuffer_return\fP, \fInbytes\fP)
.br
String \fIname\fP, \fItype\fP, \fIclass\fP;
.br
String \fIdefault\fP;
.br
String \fIbuffer_return\fP;
.br
int \fInbytes\fP;
.FN
.IP \fIname\fP 1i
.br
.ns
.IP \fItype\fP 1i
Specify the name and type that are concatenated to form the resource name
of the error message.
.IP \fIclass\fP 1i
Specifies the resource class of the error message.
.IP \fIdefault\fP 1i
Specifies the default message to use if an error database entry is not found.
.IP \fIbuffer_return\fP 1i
Specifies the buffer into which the error message is to be returned.
.IP \fInbytes\fP 1i
Specifies the size of the buffer in bytes.
.LP
.eM
The
.PN XtGetErrorDatabaseText
returns the appropriate message from the error database
associated with the default application context
or returns the specified default message if one is not found in the
error database.
To form the full resource name and class when querying the database,
the \fIname\fP and \fItype\fP are concatenated with a single ``.''
between them and the \fIclass\fP is concatenated with itself with a
single ``.'' if it does not already contain a ``.''.
This routine has been superseded by
.PN XtAppGetErrorDatabaseText .
.sp
.LP
To register a procedure to be called on fatal error conditions, use
.PN XtSetErrorMsgHandler .
.LP
.IN "XtSetErrorMsgHandler" "" "@DEF@"
.sM
.FD 0
void XtSetErrorMsgHandler(\fImsg_handler\fP)
.br
XtErrorMsgHandler \fImsg_handler\fP;
.FN
.IP \fImsg_handler\fP 1i
Specifies the new fatal error procedure, which should not return.
.LP
.eM
The default error handler provided by the \*(xI constructs a
string from the error resource database and calls
.PN XtError .
Fatal error message handlers should not return.
If one does,
subsequent \*(xI behavior is undefined.
This routine has been superseded by
.PN XtAppSetErrorMsgHandler .
.sp
.LP
To call the high-level error handler, use
.PN XtErrorMsg .
.LP
.IN "XtErrorMsg" "" "@DEF@"
.sM
.FD 0
void XtErrorMsg(\fIname\fP, \fItype\fP, \fIclass\fP, \fIdefault\fP, \
\fIparams\fP, \fInum_params\fP)
.br
String \fIname\fP;
.br
String \fItype\fP;
.br
String \fIclass\fP;
.br
String \fIdefault\fP;
.br
String *\fIparams\fP;
.br
Cardinal *\fInum_params\fP;
.FN
.IP \fIname\fP 1i
Specifies the general kind of error.
.IP \fItype\fP 1i
Specifies the detailed name of the error.
.IP \fIclass\fP 1i
Specifies the resource class.
.IP \fIdefault\fP 1i
Specifies the default message to use if an error database entry is not found.
.IP \fIparams\fP 1i
Specifies a pointer to a list of values to be stored in the message.
.IP \fInum_params\fP 1i
Specifies the number of entries in \fIparams\fP.
.LP
.eM
This routine has been superseded by
.PN XtAppErrorMsg .
.sp
.LP
To register a procedure to be called on nonfatal error conditions, use
.PN XtSetWarningMsgHandler .
.LP
.IN "XtSetWarningMsgHandler" "" "@DEF@"
.sM
.FD 0
void XtSetWarningMsgHandler(\fImsg_handler\fP)
.br
XtErrorMsgHandler \fImsg_handler\fP;
.FN
.IP \fImsg_handler\fP 1i
Specifies the new nonfatal error procedure, which usually returns.
.LP
.eM
The default warning handler provided by the \*(xI constructs a string
from the error resource database and calls
.PN XtWarning .
This routine has been superseded by
.PN XtAppSetWarningMsgHandler .
.sp
.LP
To call the installed high-level warning handler, use
.PN XtWarningMsg .
.LP
.IN "XtWarningMsg" "" "@DEF@"
.sM
.FD 0
void XtWarningMsg(\fIname\fP, \fItype\fP, \fIclass\fP, \fIdefault\fP, \
\fIparams\fP, \fInum_params\fP)
.br
String \fIname\fP;
.br
String \fItype\fP;
.br
String \fIclass\fP;
.br
String \fIdefault\fP;
.br
String *\fIparams\fP;
.br
Cardinal *\fInum_params\fP;
.FN
.IP \fIname\fP 1i
Specifies the general kind of error.
.IP \fItype\fP 1i
Specifies the detailed name of the error.
.IP \fIclass\fP 1i
Specifies the resource class.
.IP \fIdefault\fP 1i
Specifies the default message to use if an error database entry is not found.
.IP \fIparams\fP 1i
Specifies a pointer to a list of values to be stored in the message.
.IP \fInum_params\fP 1i
Specifies the number of entries in \fIparams\fP.
.LP
.eM
This routine has been superseded by
.PN XtAppWarningMsg .
.sp
.LP
To register a procedure to be called on fatal error conditions, use
.PN XtSetErrorHandler .
.LP
.IN "XtSetErrorHandler" "" "@DEF@"
.sM
.FD 0
void XtSetErrorHandler(\fIhandler\fP)
.br
XtErrorHandler \fIhandler\fP;
.FN
.IP \fIhandler\fP 1i
Specifies the new fatal error procedure, which should not return.
.LP
.eM
The default error handler provided by the \*(xI is
.PN _XtError .
On POSIX-based systems,
it prints the message to standard error and terminates the application.
Fatal error message handlers should not return.
If one does,
subsequent \*(tk behavior is undefined.
This routine has been superseded by
.PN XtAppSetErrorHandler .
.sp
.LP
To call the installed fatal error procedure, use
.PN XtError .
.LP
.IN "XtError" "" "@DEF@"
.sM
.FD 0
void XtError(\fImessage\fP)
.br
String \fImessage\fP;
.FN
.IP \fImessage\fP 1i
Specifies the message to be reported.
.LP
.eM
Most programs should use
.PN XtAppErrorMsg ,
not
.PN XtError ,
to provide for customization and internationalization of error
messages. This routine has been superseded by
.PN XtAppError .
.sp
.LP
To register a procedure to be called on nonfatal error conditions, use
.PN XtSetWarningHandler .
.LP
.IN "XtSetWarningHandler" "" "@DEF@"
.sM
.FD 0
void XtSetWarningHandler(\fIhandler\fP)
.br
XtErrorHandler \fIhandler\fP;
.FN
.IP \fIhandler\fP 1i
Specifies the new nonfatal error procedure, which usually returns.
.LP
.eM
The default warning handler provided by the \*(xI is
.PN _XtWarning .
On POSIX-based systems,
it prints the message to standard error and returns to the caller.
This routine has been superseded by
.PN XtAppSetWarningHandler .
.sp
.LP
To call the installed nonfatal error procedure, use
.PN XtWarning .
.LP
.IN "XtWarning" "" "@DEF@"
.sM
.FD 0
void XtWarning(\fImessage\fP)
.br
String \fImessage\fP;
.FN
.IP \fImessage\fP 1i
Specifies the nonfatal error message to be reported.
.LP
.eM
Most programs should use
.PN XtAppWarningMsg ,
not
.PN XtWarning ,
to provide for customization and internationalization of warning messages.
This routine has been superseded by
.PN XtAppWarning .
|