summaryrefslogtreecommitdiff
path: root/specs/CH10.xml
blob: 519f428136194fd7223350c72387e3f6913ec9aa (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
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
<?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='Translation_Management'>
<title>Translation Management</title>
<para>
Except under unusual circumstances,
widgets do not hardwire the mapping of user events into widget behavior
by using the event manager.
Instead, they provide a default mapping of events into behavior
that you can override.
</para>

<para>
The translation manager provides an interface to specify and manage the
mapping of X event sequences into widget-supplied functionality,
for example, calling procedure <emphasis remap='I'>Abc</emphasis> when the <emphasis remap='I'>y</emphasis> key
is pressed.
</para>

<para>
The translation manager uses two kinds of tables to perform translations:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
The action tables, which are in the widget class structure,
specify the mapping of externally available procedure name strings
to the corresponding procedure implemented by the widget class.
    </para>
  </listitem>
  <listitem>
    <para>
A translation table, which is in the widget class structure,
specifies the mapping of event sequences to procedure name strings.
    </para>
  </listitem>
</itemizedlist>
<para>
You can override the translation table in the class structure
for a specific widget instance by supplying a different translation table
for the widget instance.  The resources
XtNtranslations and XtNbaseTranslations are used to modify the class
default translation table; see <xref linkend='Translation_Table_Management' />.
</para>
<sect1 id="Action_Tables">
<title>Action Tables</title>
<para>
All widget class records contain an action table,
an array of
<function>XtActionsRec</function>
entries.
In addition,
an application can register its own action tables with the translation manager
so that the translation tables it provides to widget instances can access
application functionality directly.
The translation action procedure pointer is of type
<xref linkend='XtActionProc' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtActionProc'>
<funcprototype>
<funcdef>typedef void <function>(*XtActionProc)</function></funcdef>
   <paramdef>Widget <parameter>w</parameter></paramdef>
   <paramdef>XEvent *<parameter>event</parameter></paramdef>
   <paramdef>String *<parameter>params</parameter></paramdef>
   <paramdef>Cardinal *<parameter>num_params</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>w</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget that caused the action to be called.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>event</emphasis>
    </term>
    <listitem>
      <para>
Specifies the event that caused the action to be called.
If the action is called after a sequence of events,
then the last event in the sequence is used.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>params</emphasis>
    </term>
    <listitem>
      <para>
Specifies a pointer to the list of strings that were specified
in the translation table as arguments to the action, or NULL.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>num_params</emphasis>
    </term>
    <listitem>
      <para>
Specifies the number of entries in <emphasis remap='I'>params</emphasis>.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<programlisting>
typedef struct _XtActionsRec {
        String          string;
        XtActionProc    proc;
} XtActionsRec, *XtActionList;
</programlisting>
<para>
The <emphasis remap='I'>string</emphasis> field is the name used in translation tables to access
the procedure.
The <emphasis remap='I'>proc</emphasis> field is a pointer to a procedure that implements
the functionality.
</para>

<para>
When the action list is specified as the
<function>CoreClassPart</function>
<emphasis remap='I'>actions</emphasis> field, the string pointed to by <emphasis remap='I'>string</emphasis> must be
permanently allocated prior to or during the execution of the class
initialization procedure and must not be subsequently deallocated.
</para>

<para>
Action procedures should not assume that the widget in which they
are invoked is realized; an accelerator specification can cause
an action procedure to be called for a widget that does not yet
have a window.  Widget writers should also note which of a widget's
callback lists are invoked from action procedures and warn clients
not to assume the widget is realized in those callbacks.
</para>

<para>
For example, a Pushbutton widget has procedures to take the following actions:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
Set the button to indicate it is activated.
    </para>
  </listitem>
  <listitem>
    <para>
Unset the button back to its normal mode.
    </para>
  </listitem>
  <listitem>
    <para>
Highlight the button borders.
    </para>
  </listitem>
  <listitem>
    <para>
Unhighlight the button borders.
    </para>
  </listitem>
  <listitem>
    <para>
Notify any callbacks that the button has been activated.
    </para>
  </listitem>
</itemizedlist>
<para>
The action table for the Pushbutton widget class makes these functions
available to translation tables written for Pushbutton or any subclass.
The string entry is the name used in translation tables.
The procedure entry (usually spelled identically to the string)
is the name of the C procedure that implements that function:
</para>
<programlisting>
XtActionsRec actionTable[] = {
        {"Set",         Set},
        {"Unset",       Unset},
        {"Highlight",   Highlight},
        {"Unhighlight", Unhighlight}
        {"Notify",      Notify},
};
</programlisting>
<para>
The Intrinsics reserve all action names and parameters starting with
the characters &ldquo;Xt&rdquo; for future standard enhancements.  Users,
applications, and widgets should not declare action names or pass
parameters starting with these characters except to invoke specified
built-in Intrinsics functions.
</para>
<sect2 id="Action_Table_Registration">
<title>Action Table Registration</title>
<para>
The <emphasis remap='I'>actions</emphasis> and <emphasis remap='I'>num_actions</emphasis> fields of
<function>CoreClassPart</function>
specify the actions implemented by a widget class.  These are
automatically registered with the Intrinsics when the class is initialized
and must be allocated in writable storage prior to Core class_part
initialization, and never deallocated.  To save memory and optimize
access, the Intrinsics may overwrite the storage in order to compile the
list into an internal representation.
</para>

<para>
To declare an action table within an application
and register it with the translation manager, use
<xref linkend='XtAppAddActions' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtAppAddActions'>
<funcprototype>
<funcdef>void <function>XtAppAddActions</function></funcdef>
   <paramdef>XtAppContext <parameter>app_context</parameter></paramdef>
   <paramdef>XtActionList <parameter>actions</parameter></paramdef>
   <paramdef>Cardinal <parameter>num_actions</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>app_context</emphasis>
    </term>
    <listitem>
      <para>
Specifies the application context.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>actions</emphasis>
    </term>
    <listitem>
      <para>
Specifies the action table to register.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>num_actions</emphasis>
    </term>
    <listitem>
      <para>
Specifies the number of entries in this action table.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
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 Intrinsics register an action table containing
<xref linkend='XtMenuPopup' xrefstyle='select: title'/>
and
<xref linkend='XtMenuPopdown' xrefstyle='select: title'/>
as part of
<xref linkend='XtCreateApplicationContext' xrefstyle='select: title'/>.
</para>
</sect2>

<sect2 id="Action_Names_to_Procedure_Translations">
<title>Action Names to Procedure Translations</title>
<para>
The translation manager uses a simple algorithm to resolve the name of
a procedure specified in a translation table into the
actual procedure specified
in an action table.
When the widget
is realized, the translation manager
performs a search for the name in the following tables, in order:
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
The widget's class and all superclass action tables, in subclass-to-superclass
order.
    </para>
  </listitem>
  <listitem>
    <para>
The parent's class and all superclass action tables, in subclass-to-superclass
order, then on up the ancestor tree.
    </para>
  </listitem>
  <listitem>
    <para>
The action tables registered with
<xref linkend='XtAppAddActions' xrefstyle='select: title'/>
and
<xref linkend='XtAddActions' xrefstyle='select: title'/>
from the most recently added table to the oldest table.
    </para>
  </listitem>
</itemizedlist>
<para>
As soon as it finds a name,
the translation manager stops the search.
If it cannot find a name,
the translation manager generates a warning message.
</para>
</sect2>

<sect2 id="Action_Hook_Registration">
<title>Action Hook Registration</title>
<para>
An application can specify a procedure that will be called just before
every action routine is dispatched by the translation manager.  To do
so, the application supplies a procedure pointer of type
<xref linkend='XtActionHookProc' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtActionHookProc'>
<funcprototype>
<funcdef>typedef void <function>(*XtActionHookProc)</function></funcdef>
   <paramdef>Widget <parameter>w</parameter></paramdef>
   <paramdef>XtPointer <parameter>client_data</parameter></paramdef>
   <paramdef>String <parameter>action_name</parameter></paramdef>
   <paramdef>XEvent* <parameter>event</parameter></paramdef>
   <paramdef>String* <parameter>params</parameter></paramdef>
   <paramdef>Cardinal* <parameter>num_params</parameter></paramdef>
</funcprototype>
</funcsynopsis>



<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>w</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget whose action is about to be dispatched.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>client_data</emphasis>
    </term>
    <listitem>
      <para>
Specifies the application-specific closure that was passed to
<function>XtAppAddActionHook.</function>
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>action_name</emphasis>
    </term>
    <listitem>
      <para>
Specifies the name of the action to be dispatched.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>event</emphasis>
    </term>
    <listitem>
      <para>
Specifies the event argument that will be passed to the action routine.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>params</emphasis>
    </term>
    <listitem>
      <para>
Specifies the action parameters that will be passed to the action routine.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>num_params</emphasis>
    </term>
    <listitem>
      <para>
Specifies the number of entries in <emphasis remap='I'>params</emphasis>.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
Action hooks should not modify any of the data pointed to by the
arguments other than the <emphasis remap='I'>client_data</emphasis> argument.
</para>

<para>
To add an action hook, use
<xref linkend='XtAppAddActionHook' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtAppAddActionHook'>
<funcprototype>
<funcdef>XtActionHookId <function>XtAppAddActionHook</function></funcdef>
   <paramdef>XtAppContext <parameter>app</parameter></paramdef>
   <paramdef>XtActionHookProc <parameter>proc</parameter></paramdef>
   <paramdef>XtPointer <parameter>client_data</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>app</emphasis>
    </term>
    <listitem>
      <para>
Specifies the application context.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>proc</emphasis>
    </term>
    <listitem>
      <para>
Specifies the action hook procedure.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>client_data</emphasis>
    </term>
    <listitem>
      <para>
Specifies application-specific data to be passed to the action hook.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
<xref linkend='XtAppAddActionHook' xrefstyle='select: title'/>
adds the specified procedure to the front of a list
maintained in the application context.  In the future, when an action
routine is about to be invoked for any widget in this application
context, either through the translation manager or via
<xref linkend='XtCallActionProc' xrefstyle='select: title'/>,
the action hook procedures will be called in reverse
order of registration just prior to invoking the action routine.
</para>

<para>
Action hook procedures are removed automatically and the
<function>XtActionHookId is</function>
destroyed when the application context in which
they were added is destroyed.
</para>

<para>
To remove an action hook procedure without destroying the application
context, use
<xref linkend='XtRemoveActionHook' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtRemoveActionHook'>
<funcprototype>
<funcdef>void <function>XtRemoveActionHook</function></funcdef>
   <paramdef>XtActionHookId <parameter>id</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>id</emphasis>
    </term>
    <listitem>
      <para>
Specifies the action hook id returned by
<xref linkend='XtAppAddActionHook' xrefstyle='select: title'/>.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
<xref linkend='XtRemoveActionHook' xrefstyle='select: title'/>
removes the specified action hook procedure from
the list in which it was registered.
</para>
</sect2>
</sect1>

<sect1 id="Translation_Tables">
<title>Translation Tables</title>
<para>
All widget instance records contain a translation table,
which is a resource with a default value specified elsewhere in the
class record.
A translation table specifies what action procedures are invoked for
an event or a sequence of events.
A translation table
is a string containing a list of translations from an event sequence
into one or more action procedure calls.
The translations are separated from one another by newline characters
(ASCII LF).
The complete syntax of translation tables is specified in Appendix B.
</para>

<para>
As an example, the default behavior of Pushbutton is
</para>
<itemizedlist spacing='compact'>
  <listitem>
    <para>
Highlight on enter window.
    </para>
  </listitem>
  <listitem>
    <para>
Unhighlight on exit window.
    </para>
  </listitem>
  <listitem>
    <para>
Invert on left button down.
    </para>
  </listitem>
  <listitem>
    <para>
Call callbacks and reinvert on left button up.
    </para>
  </listitem>
</itemizedlist>
<para>
The following illustrates Pushbutton's default translation table:
</para>
<programlisting>
static String defaultTranslations =
        "&lt;EnterWindow&gt;:   Highlight()\n\
        &lt;LeaveWindow&gt;:    Unhighlight()\n\
        &lt;Btn1Down&gt;:       Set()\n\
        &lt;Btn1Up&gt;: Notify() Unset()";
</programlisting>
<para>
The <emphasis remap='I'>tm_table</emphasis> field of the
<function>CoreClassPart</function>
should be filled in at class initialization time with
the string containing the class's default translations.
If a class wants to inherit its superclass's translations,
it can store the special value
<function>XtInheritTranslations</function>
into <emphasis remap='I'>tm_table</emphasis>.
In Core's class part initialization procedure,
the Intrinsics compile this translation table into an efficient internal form.
Then, at widget creation time,
this default translation table is
combined with the XtNtranslations
and XtNbaseTranslations resources; see
<xref linkend='Translation_Table_Management' />.
</para>

<para>
The resource conversion mechanism automatically compiles
string translation tables that are specified in the resource database.
If a client uses translation tables that are not retrieved via a
resource conversion,
it must compile them itself using
<xref linkend='XtParseTranslationTable' xrefstyle='select: title'/>.
</para>

<para>
The Intrinsics use the compiled form of the translation table to register the
necessary events with the event manager.
Widgets need do nothing other than specify the action and translation tables
for events to be processed by the translation manager.
</para>
<sect2 id="Event_Sequences">
<title>Event Sequences</title>
<para>
An event sequence is a comma-separated list of X event descriptions
that describes a specific sequence of X events to map to a set of
program actions.
Each X event description consists of three parts:
The X event type, a prefix consisting of the X modifier bits, and
an event-specific suffix.
</para>

<para>
Various abbreviations are supported to make translation tables easier
to read.  The events must match incoming events in left-to-right order
to trigger the action sequence.
</para>
</sect2>

<sect2 id="Action_Sequences">
<title>Action Sequences</title>
<para>
Action sequences specify what program or widget actions to take in response to
incoming X events. An action sequence consists of space-separated
action procedure call specifications.
Each action procedure call consists of the name of an action procedure and a
parenthesized list of zero or more comma-separated
string parameters to pass to that procedure.
The actions are invoked in left-to-right order as specified in the
action sequence.
</para>
</sect2>

<sect2 id="Multi_Click_Time">
<title>Multi-Click Time</title>
<para>
Translation table entries may specify actions that are taken when two
or more identical events occur consecutively within a short time
interval, called the multi-click time.  The multi-click time value may
be specified as an application resource with name &ldquo;multiClickTime&rdquo; and
class &ldquo;MultiClickTime&rdquo; and may also be modified dynamically by the
application.  The multi-click time is unique for each Display value and
is retrieved from the resource database by
<xref linkend='XtDisplayInitialize' xrefstyle='select: title'/>.
If no value is specified, the initial value is 200 milliseconds.
</para>

<para>
To set the multi-click time dynamically, use
<xref linkend='XtSetMultiClickTime' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtSetMultiClickTime'>
<funcprototype>
<funcdef>void <function>XtSetMultiClickTime</function></funcdef>
   <paramdef>Display *<parameter>display</parameter></paramdef>
   <paramdef>int <parameter>time</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>display</emphasis>
    </term>
    <listitem>
      <para>
Specifies the display connection.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>time</emphasis>
    </term>
    <listitem>
      <para>
Specifies the multi-click time in milliseconds.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
<xref linkend='XtSetMultiClickTime' xrefstyle='select: title'/>
sets the time interval used by the translation
manager to determine when multiple events are interpreted as a
repeated event.  When a repeat count is specified in a translation
entry, the interval between the timestamps in each pair of repeated
events (e.g., between two
<function>ButtonPress</function>
events) must be less than the
multi-click time in order for the translation actions to be taken.
</para>

<para>
To read the multi-click time, use
<xref linkend='XtGetMultiClickTime' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtGetMultiClickTime'>
<funcprototype>
<funcdef>int <function>XtGetMultiClickTime</function></funcdef>
   <paramdef>Display *<parameter>display</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>display</emphasis>
    </term>
    <listitem>
      <para>
Specifies the display connection.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
<xref linkend='XtGetMultiClickTime' xrefstyle='select: title'/>
returns the time in milliseconds that the
translation manager uses to determine if multiple events are to be
interpreted as a repeated event for purposes of matching a translation
entry containing a repeat count.
</para>
</sect2>
</sect1>

<sect1 id="Translation_Table_Management">
<title>Translation Table Management</title>
<para>
Sometimes an application needs to merge
its own translations with a widget's translations.
For example, a window manager provides functions to move a window.
The window manager wishes to bind this operation to a specific
pointer button in the title bar without the possibility of user
override and bind it to other buttons that may be overridden by the user.
</para>

<para>
To accomplish this,
the window manager should first create the title bar
and then should merge the two translation tables into
the title bar's translations.
One translation table contains the translations that the window manager
wants only if the user has not specified a translation for a particular event
or event sequence (i.e., those that may be overridden).
The other translation table contains the translations that the
window manager wants regardless of what the user has specified.
</para>

<para>
Three Intrinsics functions support this merging:
</para>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>XtParseTranslationTable</emphasis>
    </term>
    <listitem>
      <para>Compiles a translation table.</para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>XtAugmentTranslations</emphasis>
    </term>
    <listitem>
      <para>Merges a compiled translation table into a widget's
      compiled translation table, ignoring any new translations that
      conflict with existing translations.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>XtOverrideTranslations</emphasis>
    </term>
    <listitem>
      <para>Merges a compiled translation table into a widget's
      compiled translation table, replacing any existing translations that
      conflict with new translations.
      </para>
    </listitem>
  </varlistentry>
</variablelist>

<para>
To compile a translation table, use
<xref linkend='XtParseTranslationTable' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtParseTranslationTable'>
<funcprototype>
<funcdef>XtTranslations <function>XtParseTranslationTable</function></funcdef>
   <paramdef>const char * <parameter>table</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>table</emphasis>
    </term>
    <listitem>
      <para>
Specifies the translation table to compile.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
The
<xref linkend='XtParseTranslationTable' xrefstyle='select: title'/>
function compiles the translation table, provided in the format given
in Appendix B, into an opaque internal representation
of type
<function>XtTranslations</function>.
Note that if an empty translation table is required for any purpose,
one can be obtained by calling
<xref linkend='XtParseTranslationTable' xrefstyle='select: title'/>
and passing an empty string.
</para>

<para>
To merge additional translations into an existing translation table, use
<xref linkend='XtAugmentTranslations' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtAugmentTranslations'>
<funcprototype>
<funcdef>void <function>XtAugmentTranslations</function></funcdef>
   <paramdef>Widget <parameter>w</parameter></paramdef>
   <paramdef>XtTranslations <parameter>translations</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>w</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget into which the new translations are to be merged.  Must be of class Core or any subclass thereof.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>translations</emphasis>
    </term>
    <listitem>
      <para>
Specifies the compiled translation table to merge in.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
The
<xref linkend='XtAugmentTranslations' xrefstyle='select: title'/>
function merges the new translations into the existing widget
translations, ignoring any
<function>#replace</function>,
<function>#augment</function>,
or
<function>#override</function>
directive that may have been specified
in the translation string.  The translation table specified by
<emphasis remap='I'>translations</emphasis> is not altered by this process.
<xref linkend='XtAugmentTranslations' xrefstyle='select: title'/>
logically appends the string representation of the new translations to
the string representation of the widget's current translations and reparses
the result with no warning messages about duplicate left-hand sides, then
stores the result back into the widget instance; i.e.,
if the new translations contain an event or event sequence that
already exists in the widget's translations,
the new translation is ignored.
</para>

<para>
To overwrite existing translations with new translations, use
<xref linkend='XtOverrideTranslations' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtOverrideTranslations'>
<funcprototype>
<funcdef>void <function>XtOverrideTranslations</function></funcdef>
   <paramdef>Widget <parameter>w</parameter></paramdef>
   <paramdef>XtTranslations <parameter>translations</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>w</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget into which the new translations are to be merged. Must be of class Core or any subclass thereof.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>translations</emphasis>
    </term>
    <listitem>
      <para>
Specifies the compiled translation table to merge in.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
The
<xref linkend='XtOverrideTranslations' xrefstyle='select: title'/>
function merges the new translations into the existing widget
translations, ignoring any
<function>#replace</function>,
<function>#augment</function>,
or
<function>#override</function>
directive that may have been
specified in the translation string.  The translation table
specified by <emphasis remap='I'>translations</emphasis> is not altered by this process.
<xref linkend='XtOverrideTranslations' xrefstyle='select: title'/>
logically appends the string representation of the widget's current
translations to the string representation of the new translations and
reparses the result with no warning messages about duplicate left-hand
sides, then stores the result back into the widget instance; i.e.,
if the new translations contain an event or event sequence that
already exists in the widget's translations,
the new translation overrides the widget's translation.
</para>

<para>
To replace a widget's translations completely, use
<xref linkend='XtSetValues' xrefstyle='select: title'/>
on the XtNtranslations resource and specify a compiled translation table
as the value.
</para>

<para>
To make it possible for users to easily modify translation tables in their
resource files,
the string-to-translation-table resource type converter
allows the string to specify whether the table should replace,
augment, or override any
existing translation table in the widget.
To specify this,
a pound sign (#) is given as the first character of the table
followed by one of the keywords &ldquo;replace&rdquo;, &ldquo;augment&rdquo;, or
&ldquo;override&rdquo; to indicate
whether to replace, augment, or override the existing table.
The replace or merge
operation is performed during the
Core
instance initialization.
Each merge operation produces a new
translation resource value; if the original tables were shared by
other widgets, they are unaffected.  If no directive is
specified, &ldquo;#replace&rdquo; is assumed.
</para>

<para>
At instance initialization
the XtNtranslations resource is first fetched.  Then, if it was
not specified or did not contain &ldquo;#replace&rdquo;, the
resource database is searched for the resource XtNbaseTranslations.
If XtNbaseTranslations is found, it is merged into the widget class
translation table.  Then the widget <emphasis remap='I'>translations</emphasis> field is
merged into the result or into the class translation table if
XtNbaseTranslations was not found.  This final table is then
stored into the widget <emphasis remap='I'>translations</emphasis> field.  If the XtNtranslations
resource specified &ldquo;#replace&rdquo;, no merge is done.
If neither XtNbaseTranslations or XtNtranslations are specified,
the class translation table is copied into the widget instance.
</para>

<para>
To completely remove existing translations, use
<xref linkend='XtUninstallTranslations' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtUninstallTranslations'>
<funcprototype>
<funcdef>void <function>XtUninstallTranslations</function></funcdef>
   <paramdef>Widget <parameter>w</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>w</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget from which the translations are to be removed.   Must be of class Core or any subclass thereof.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
The
<xref linkend='XtUninstallTranslations' xrefstyle='select: title'/>
function causes the entire translation table for the widget to be removed.
</para>
</sect1>

<sect1 id="Using_Accelerators">
<title>Using Accelerators</title>
<para>
It is often desirable to be able to bind events in one widget to actions in
another.
In particular,
it is often useful to be able to invoke menu actions from the keyboard.
The Intrinsics provide a facility, called accelerators, that lets you
accomplish this.
An accelerator table is a translation table that is bound with its
actions in the context of a particular widget, the <emphasis remap='I'>source</emphasis> widget.
The accelerator table can then be installed on one or more <emphasis remap='I'>destination</emphasis> widgets.
When an event sequence in the destination widget would cause an
accelerator action to be taken, and if the source widget is sensitive,
the actions are executed as though triggered by the same event sequence
in the accelerator source
widget.  The event is
passed to the action procedure without modification.  The action
procedures used within accelerators must not assume that the source
widget is realized nor that any fields of the event are in reference
to the source widget's window if the widget is realized.
</para>

<para>
Each widget instance contains that widget's exported accelerator table
as a resource.
Each class of widget exports a method that takes a
displayable string representation of the accelerators
so that widgets can display their current accelerators.
The representation is the accelerator table in canonical
translation table form (see Appendix B).
The display_accelerator procedure pointer is of type
<xref linkend='XtStringProc' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtStringProc'>
<funcprototype>
<funcdef>typedef void <function>(*XtStringProc)</function></funcdef>
   <paramdef>Widget <parameter>w</parameter></paramdef>
   <paramdef>String <parameter>string</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>w</emphasis>
    </term>
    <listitem>
      <para>
Specifies the source widget that supplied the accelerators.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>string</emphasis>
    </term>
    <listitem>
      <para>
Specifies the string representation of the accelerators for this widget.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
Accelerators can be specified in resource files,
and the string representation is the same as for a translation table.
However,
the interpretation of the
<function>#augment</function>
and
<function>#override</function>
directives applies to
what will happen when the accelerator is installed;
that is, whether or not the accelerator translations will override the
translations in the destination widget.
The default is
<function>#augment</function>,
which means that the accelerator translations have lower priority
than the destination translations.
The
<function>#replace</function>
directive is ignored for accelerator tables.
</para>

<para>
To parse an accelerator table, use
<xref linkend='XtParseAcceleratorTable' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtParseAcceleratorTable'>
<funcprototype>
<funcdef>XtAccelerators <function>XtParseAcceleratorTable</function></funcdef>
   <paramdef>const char * <parameter>source</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>source</emphasis>
    </term>
    <listitem>
      <para>
Specifies the accelerator table to compile.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
The
<xref linkend='XtParseAcceleratorTable' xrefstyle='select: title'/>
function compiles the accelerator table into an opaque internal representation.
The client
should set the XtNaccelerators resource of
each widget that is to be activated by these translations
to the returned value.
</para>

<para>
To install accelerators from a widget on another widget, use
<xref linkend='XtInstallAccelerators' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtInstallAccelerators'>
<funcprototype>
<funcdef>void <function>XtInstallAccelerators</function></funcdef>
   <paramdef>Widget <parameter>destination</parameter></paramdef>
   <paramdef>Widget <parameter>source</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>destination</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget on which the accelerators are to be installed.  Must be of class Core or any subclass thereof.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>source</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget from which the accelerators are to come.  Must be of class Core or any subclass thereof.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
The
<xref linkend='XtInstallAccelerators' xrefstyle='select: title'/>
function installs the <emphasis remap='I'>accelerators</emphasis> resource value from
<emphasis remap='I'>source</emphasis> onto <emphasis remap='I'>destination</emphasis>
by merging the source accelerators into the destination translations.
If the source <emphasis remap='I'>display_accelerator</emphasis> field is non-NULL,
<xref linkend='XtInstallAccelerators' xrefstyle='select: title'/>
calls it with the source widget and a string representation
of the accelerator table,
which indicates that its accelerators have been installed
and that it should display them appropriately.
The string representation of the accelerator table is its
canonical translation table representation.
</para>

<para>
As a convenience for installing all accelerators from a widget and all its
descendants onto one destination, use
<xref linkend='XtInstallAllAccelerators' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtInstallAllAccelerators'>
<funcprototype>
<funcdef>void <function>XtInstallAllAccelerators</function></funcdef>
   <paramdef>Widget <parameter>destination</parameter></paramdef>
   <paramdef>Widget <parameter>source</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>destination</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget on which the accelerators are to be installed.  Must be of class Core or any subclass thereof.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>source</emphasis>
    </term>
    <listitem>
      <para>
Specifies the root widget of the widget tree
from which the accelerators are to come.  Must be of class Core or any subclass thereof.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
The
<xref linkend='XtInstallAllAccelerators' xrefstyle='select: title'/>
function recursively descends the widget tree rooted at <emphasis remap='I'>source</emphasis>
and installs the accelerators resource value
of each widget encountered onto <emphasis remap='I'>destination</emphasis>.
A common use is to call
<xref linkend='XtInstallAllAccelerators' xrefstyle='select: title'/>
and pass the application main window as the source.
</para>
</sect1>

<sect1 id="KeyCode_to_KeySym_Conversions">
<title>KeyCode-to-KeySym Conversions</title>
<para>
The translation manager provides support for automatically translating
KeyCodes in incoming key events into KeySyms.
KeyCode-to-KeySym translator procedure pointers are of type
<xref linkend='XtKeyProc' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtKeyProc'>
<funcprototype>
<funcdef>typedef void <function>(*XtKeyProc)</function></funcdef>
   <paramdef>Display *<parameter>display</parameter></paramdef>
   <paramdef>KeyCode <parameter>keycode</parameter></paramdef>
   <paramdef>Modifiers <parameter>modifiers</parameter></paramdef>
   <paramdef>Modifiers *<parameter>modifiers_return</parameter></paramdef>
   <paramdef>KeySym *<parameter>keysym_return</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>display</emphasis>
    </term>
    <listitem>
      <para>
Specifies the display that the KeyCode is from.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>keycode</emphasis>
    </term>
    <listitem>
      <para>
Specifies the KeyCode to translate.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>modifiers</emphasis>
    </term>
    <listitem>
      <para>
Specifies the modifiers to the KeyCode.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>modifiers_return</emphasis>
    </term>
    <listitem>
      <para>
Specifies a location in which to store
a mask that indicates the subset of all
modifiers that are examined by the key translator for the specified keycode.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>keysym_return</emphasis>
    </term>
    <listitem>
      <para>
Specifies a location in which to store the resulting KeySym.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
This procedure takes a KeyCode and modifiers and produces a KeySym.
For any given key translator function and keyboard encoding,
<emphasis remap='I'>modifiers_return</emphasis> will be a constant per KeyCode that indicates
the subset of all modifiers that are examined by the key translator
for that KeyCode.
</para>

<para>
The KeyCode-to-KeySym translator procedure
must be implemented such that multiple calls with the same
<emphasis remap='I'>display</emphasis>, <emphasis remap='I'>keycode</emphasis>, and <emphasis remap='I'>modifiers</emphasis> return the same
result until either a new case converter, an
<xref linkend='XtCaseProc' xrefstyle='select: title'/>,
is installed or a
<function>MappingNotify</function>
event is received.
</para>

<para>
The Intrinsics maintain tables internally to map KeyCodes to KeySyms
for each open display.  Translator procedures and other clients may
share a single copy of this table to perform the same mapping.
</para>

<para>
To return a pointer to the KeySym-to-KeyCode mapping table for a
particular display, use
<xref linkend='XtGetKeysymTable' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtGetKeysymTable'>
<funcprototype>
<funcdef>KeySym *<function>XtGetKeysymTable</function></funcdef>
   <paramdef>Display *<parameter>display</parameter></paramdef>
   <paramdef>KeyCode *<parameter>min_keycode_return</parameter></paramdef>
   <paramdef>int *<parameter>keysyms_per_keycode_return</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>display</emphasis>
    </term>
    <listitem>
      <para>
Specifies the display whose table is required.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>min_keycode_return</emphasis>
    </term>
    <listitem>
      <para>
Returns the minimum KeyCode valid for the display.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>keysyms_per_keycode_return</emphasis>
    </term>
    <listitem>
      <para>
Returns the number of KeySyms stored for each KeyCode.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
<xref linkend='XtGetKeysymTable' xrefstyle='select: title'/>
returns a pointer to the Intrinsics' copy of the
server's KeyCode-to-KeySym table.  This table must not be modified.
There are <emphasis remap='I'>keysyms_per_keycode_return</emphasis> KeySyms associated with each
KeyCode, located in the table with indices starting at index
</para>
<programlisting>
    (test_keycode - min_keycode_return) * keysyms_per_keycode_return
</programlisting>
<para>
for KeyCode <emphasis remap='I'>test_keycode</emphasis>.  Any entries that have no KeySyms associated
with them contain the value
<function>NoSymbol</function>.
Clients should not cache the KeySym table but should call
<xref linkend='XtGetKeysymTable' xrefstyle='select: title'/>
each time the value is
needed, as the table may change prior to dispatching each event.
</para>

<para>
For more information on this table, see
<olink targetdoc='libX11' targetptr='Manipulating_the_Keyboard_Encoding'>Section 12.7</olink> in
<olink targetdoc='libX11' targetptr='libX11'>Xlib &mdash; C Language X Interface.</olink>.
</para>

<para>
To register a key translator, use
<xref linkend='XtSetKeyTranslator' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtSetKeyTranslator'>
<funcprototype>
<funcdef>void <function>XtSetKeyTranslator</function></funcdef>
   <paramdef>Display *<parameter>display</parameter></paramdef>
   <paramdef>XtKeyProc <parameter>proc</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>display</emphasis>
    </term>
    <listitem>
      <para>
Specifies the display from which to translate the events.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>proc</emphasis>
    </term>
    <listitem>
      <para>
Specifies the procedure to perform key translations.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
The
<xref linkend='XtSetKeyTranslator' xrefstyle='select: title'/>
function sets the specified procedure as the current key translator.
The default translator is
<function>XtTranslateKey</function>,
an
<xref linkend='XtKeyProc' xrefstyle='select: title'/>
that uses the Shift, Lock, numlock, and group modifiers
with the interpretations defined in <emphasis remap='I'>X Window System Protocol</emphasis>, Section 5.
It is provided so that new translators can call it to get default
KeyCode-to-KeySym translations and so that the default translator
can be reinstalled.
</para>

<para>
To invoke the currently registered KeyCode-to-KeySym translator,
use
<xref linkend='XtTranslateKeycode' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtTranslateKeycode'>
<funcprototype>
<funcdef>void <function>XtTranslateKeycode</function></funcdef>
   <paramdef>Display *<parameter>display</parameter></paramdef>
   <paramdef>KeyCode <parameter>keycode</parameter></paramdef>
   <paramdef>Modifiers <parameter>modifiers</parameter></paramdef>
   <paramdef>Modifiers *<parameter>modifiers_return</parameter></paramdef>
   <paramdef>KeySym *<parameter>keysym_return</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>display</emphasis>
    </term>
    <listitem>
      <para>
Specifies the display that the KeyCode is from.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>keycode</emphasis>
    </term>
    <listitem>
      <para>
Specifies the KeyCode to translate.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>modifiers</emphasis>
    </term>
    <listitem>
      <para>
Specifies the modifiers to the KeyCode.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>modifiers_return</emphasis>
    </term>
    <listitem>
      <para>
Returns a mask that indicates the modifiers actually used
to generate the KeySym.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>keysym_return</emphasis>
    </term>
    <listitem>
      <para>
Returns the resulting KeySym.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
The
<xref linkend='XtTranslateKeycode' xrefstyle='select: title'/>
function passes the specified arguments
directly to the currently registered KeyCode-to-KeySym translator.
</para>

<para>
To handle capitalization of nonstandard KeySyms, the Intrinsics allow
clients to register case conversion routines.
Case converter procedure pointers are of type
<xref linkend='XtCaseProc' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtCaseProc'>
<funcprototype>
<funcdef>typedef void <function>(*XtCaseProc)</function></funcdef>
   <paramdef>Display *<parameter>display</parameter></paramdef>
   <paramdef>KeySym <parameter>keysym</parameter></paramdef>
   <paramdef>KeySym *<parameter>lower_return</parameter></paramdef>
   <paramdef>KeySym *<parameter>upper_return</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>display</emphasis>
    </term>
    <listitem>
      <para>
Specifies the display connection for which the conversion is required.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>keysym</emphasis>
    </term>
    <listitem>
      <para>
Specifies the KeySym to convert.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>lower_return</emphasis>
    </term>
    <listitem>
      <para>
Specifies a location into which to store the lowercase equivalent for
the KeySym.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>upper_return</emphasis>
    </term>
    <listitem>
      <para>
Specifies a location into which to store the uppercase equivalent for
the KeySym.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
If there is no case distinction,
this procedure should store the KeySym into both return values.
</para>

<para>
To register a case converter, use
<xref linkend='XtRegisterCaseConverter' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtRegisterCaseConverter'>
<funcprototype>
<funcdef>void <function>XtRegisterCaseConverter</function></funcdef>
   <paramdef>Display *<parameter>display</parameter></paramdef>
   <paramdef>XtCaseProc <parameter>proc</parameter></paramdef>
   <paramdef>KeySym <parameter>start</parameter></paramdef>
   <paramdef>KeySym <parameter>stop</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>display</emphasis>
    </term>
    <listitem>
      <para>
Specifies the display from which the key events are to come.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>proc</emphasis>
    </term>
    <listitem>
      <para>
Specifies the
<xref linkend='XtCaseProc' xrefstyle='select: title'/>
to do the conversions.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>start</emphasis>
    </term>
    <listitem>
      <para>
Specifies the first KeySym for which this converter is valid.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>stop</emphasis>
    </term>
    <listitem>
      <para>
Specifies the last KeySym for which this converter is valid.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
The
<xref linkend='XtRegisterCaseConverter' xrefstyle='select: title'/>
registers the specified case converter.
The <emphasis remap='I'>start</emphasis> and <emphasis remap='I'>stop</emphasis> arguments provide the inclusive range of KeySyms
for which this converter is to be called.
The new converter overrides any previous converters for KeySyms in that range.
No interface exists to remove converters;
you need to register an identity converter.
When a new converter is registered,
the Intrinsics  refresh the keyboard state if necessary.
The default converter understands case conversion for all
Latin KeySyms defined in <emphasis remap='I'>X Window System Protocol</emphasis>, Appendix A.
</para>

<para>
To determine uppercase and lowercase equivalents for a KeySym, use
<xref linkend='XtConvertCase' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtConvertCase'>
<funcprototype>
<funcdef>void <function>XtConvertCase</function></funcdef>
   <paramdef>Display *<parameter>display</parameter></paramdef>
   <paramdef>KeySym <parameter>keysym</parameter></paramdef>
   <paramdef>KeySym *<parameter>lower_return</parameter></paramdef>
   <paramdef>KeySym *<parameter>upper_return</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>display</emphasis>
    </term>
    <listitem>
      <para>
Specifies the display that the KeySym came from.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>keysym</emphasis>
    </term>
    <listitem>
      <para>
Specifies the KeySym to convert.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>lower_return</emphasis>
    </term>
    <listitem>
      <para>
Returns the lowercase equivalent of the KeySym.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>upper_return</emphasis>
    </term>
    <listitem>
      <para>
Returns the uppercase equivalent of the KeySym.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
The
<xref linkend='XtConvertCase' xrefstyle='select: title'/>
function calls the appropriate converter and returns the results.
A user-supplied
<xref linkend='XtKeyProc' xrefstyle='select: title'/>
may need to use this function.
</para>
</sect1>

<sect1 id="Obtaining_a_KeySym_in_an_Action_Procedure">
<title>Obtaining a KeySym in an Action Procedure</title>
<para>
When an action procedure is invoked on a
<function>KeyPress</function>
or
<function>KeyRelease</function>
event, it often has a need to retrieve the KeySym and modifiers
corresponding to the event that caused it to be invoked.  In order to
avoid repeating the processing that was just performed by the
Intrinsics to match the translation entry, the KeySym and modifiers
are stored for the duration of the action procedure and are made
available to the client.
</para>

<para>
To retrieve the KeySym and modifiers that matched the final event
specification in the translation table entry, use
<xref linkend='XtGetActionKeysym' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtGetActionKeysym'>
<funcprototype>
<funcdef>KeySym <function>XtGetActionKeysym</function></funcdef>
   <paramdef>XEvent *<parameter>event</parameter></paramdef>
   <paramdef>Modifiers *<parameter>modifiers_return</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>event</emphasis>
    </term>
    <listitem>
      <para>
Specifies the event pointer passed to the action procedure by the Intrinsics.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>modifiers_return</emphasis>
    </term>
    <listitem>
      <para>
Returns the modifiers that caused the match, if non-NULL.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
If
<xref linkend='XtGetActionKeysym' xrefstyle='select: title'/>
is called after an action procedure has been
invoked by the Intrinsics and before that action procedure returns, and
if the event pointer has the same value as the event pointer passed to
that action routine, and if the event is a
<function>KeyPress</function>
or
<function>KeyRelease</function>
event, then
<xref linkend='XtGetActionKeysym' xrefstyle='select: title'/>
returns the KeySym that matched the final
event specification in the translation table and, if <emphasis remap='I'>modifiers_return</emphasis>
is non-NULL, the modifier state actually used to generate this KeySym;
otherwise, if the event is a
<function>KeyPress</function>
or
<function>KeyRelease</function>
event, then
<xref linkend='XtGetActionKeysym' xrefstyle='select: title'/>
calls
<xref linkend='XtTranslateKeycode' xrefstyle='select: title'/>
and returns the results;
else it returns
<function>NoSymbol</function>
and does not examine <emphasis remap='I'>modifiers_return</emphasis>.
</para>

<para>
Note that if an action procedure invoked by the Intrinsics
invokes a subsequent action procedure (and so on) via
<xref linkend='XtCallActionProc' xrefstyle='select: title'/>,
the nested action procedure may also call
<xref linkend='XtGetActionKeysym' xrefstyle='select: title'/>
to retrieve the Intrinsics' KeySym and modifiers.
</para>
</sect1>

<sect1 id="KeySym_to_KeyCode_Conversions">
<title>KeySym-to-KeyCode Conversions</title>
<para>
To return the list of KeyCodes that map to a particular KeySym in
the keyboard mapping table maintained by the Intrinsics, use
<xref linkend='XtKeysymToKeycodeList' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtKeysymToKeycodeList'>
<funcprototype>
<funcdef>void <function>XtKeysymToKeycodeList</function></funcdef>
   <paramdef>Display *<parameter>display</parameter></paramdef>
   <paramdef>KeySym <parameter>keysym</parameter></paramdef>
   <paramdef>KeyCode **<parameter>keycodes_return</parameter></paramdef>
   <paramdef>Cardinal *<parameter>keycount_return</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>display</emphasis>
    </term>
    <listitem>
      <para>
Specifies the display whose table is required.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>keysym</emphasis>
    </term>
    <listitem>
      <para>
Specifies the KeySym for which to search.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>keycodes_return</emphasis>
    </term>
    <listitem>
      <para>
Returns a list of KeyCodes that have <emphasis remap='I'>keysym</emphasis>
associated with them, or NULL if <emphasis remap='I'>keycount_return</emphasis> is 0.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>keycount_return</emphasis>
    </term>
    <listitem>
      <para>
Returns the number of KeyCodes in the keycode list.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
The
<xref linkend='XtKeysymToKeycodeList' xrefstyle='select: title'/>
procedure returns all the KeyCodes that have <emphasis remap='I'>keysym</emphasis>
in their entry for the keyboard mapping table associated with <emphasis remap='I'>display</emphasis>.
For each entry in the
table, the first four KeySyms (groups 1 and 2) are interpreted as
specified by <emphasis remap='I'>X Window System Protocol</emphasis>, Section 5.  If no KeyCodes map to the
specified KeySym, <emphasis remap='I'>keycount_return</emphasis> is zero and *<emphasis remap='I'>keycodes_return</emphasis> is NULL.
</para>

<para>
The caller should free the storage pointed to by <emphasis remap='I'>keycodes_return</emphasis> using
<xref linkend='XtFree' xrefstyle='select: title'/>
when it is no longer useful.  If the caller needs to examine
the KeyCode-to-KeySym table for a particular KeyCode, it should call
<xref linkend='XtGetKeysymTable' xrefstyle='select: title'/>.
</para>
</sect1>

<sect1 id="Registering_Button_and_Key_Grabs_for_Actions">
<title>Registering Button and Key Grabs for Actions</title>
<para>
To register button and key grabs for a widget's window according to the
event bindings in the widget's translation table, use
<xref linkend='XtRegisterGrabAction' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtRegisterGrabAction'>
<funcprototype>
<funcdef>void <function>XtRegisterGrabAction</function></funcdef>
   <paramdef>XtActionProc <parameter>action_proc</parameter></paramdef>
   <paramdef>Boolean <parameter>owner_events</parameter></paramdef>
   <paramdef>unsigned int <parameter>event_mask</parameter></paramdef>
   <paramdef>int <parameter>pointer_mode</parameter></paramdef>
   <paramdef>int <parameter>keyboard_mode</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>action_proc</emphasis>
    </term>
    <listitem>
      <para>
Specifies the action procedure to search for in translation tables.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>owner_events</emphasis>
    </term>
    <listitem>
      <para></para>

    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>event_mask</emphasis>
    </term>
    <listitem>
      <para></para>

    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>pointer_mode</emphasis>
    </term>
    <listitem>
      <para></para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>keyboard_mode</emphasis>
    </term>
    <listitem>
      <para>
Specify arguments to
<xref linkend='XtGrabButton' xrefstyle='select: title'/>
or
<xref linkend='XtGrabKey' xrefstyle='select: title'/>.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
<xref linkend='XtRegisterGrabAction' xrefstyle='select: title'/>
adds the specified <emphasis remap='I'>action_proc</emphasis> to a list known to
the translation manager.  When a widget is realized, or when the
translations of a realized widget or the accelerators installed on a
realized widget are modified, its translation table and any installed
accelerators are scanned for action procedures on this list.
If any are invoked on
<function>ButtonPress</function>
or
<function>KeyPress</function>
events as the only or final event
in a sequence, the Intrinsics will call
<xref linkend='XtGrabButton' xrefstyle='select: title'/>
or
<xref linkend='XtGrabKey' xrefstyle='select: title'/>
for the widget with every button or KeyCode which maps to the
event detail field, passing the specified <emphasis remap='I'>owner_events</emphasis>, <emphasis remap='I'>event_mask</emphasis>,
<emphasis remap='I'>pointer_mode</emphasis>, and <emphasis remap='I'>keyboard_mode</emphasis>.  For
<function>ButtonPress</function>
events, the modifiers
specified in the grab are determined directly from the translation
specification and <emphasis remap='I'>confine_to</emphasis> and <emphasis remap='I'>cursor</emphasis> are specified as
<function>None</function>.
For
<function>KeyPress</function>
events, if the translation table entry specifies colon (:) in
the modifier list, the modifiers are determined by calling the key
translator procedure registered for the display and calling
<xref linkend='XtGrabKey' xrefstyle='select: title'/>
for every combination of standard modifiers which map the KeyCode to
the specified event detail KeySym, and ORing any modifiers specified in
the translation table entry, and <emphasis remap='I'>event_mask</emphasis> is ignored.  If the
translation table entry does not specify colon in the modifier list,
the modifiers specified in the grab are those specified in the
translation table entry only.  For both
<function>ButtonPress</function>
and
<function>KeyPress</function>
events, don't-care modifiers are ignored unless the translation entry
explicitly specifies &ldquo;Any&rdquo; in the <emphasis remap='I'>modifiers</emphasis> field.
</para>

<para>
If the specified <emphasis remap='I'>action_proc</emphasis> is already registered for the calling
process, the new values will replace the previously specified values
for any widgets that become realized following the call, but existing
grabs are not altered on currently realized widgets.
</para>

<para>
When translations or installed accelerators are modified for a
realized widget, any previous key or button grabs registered
as a result of the old bindings are released if they do not appear in
the new bindings and are not explicitly grabbed by the client with
<xref linkend='XtGrabKey' xrefstyle='select: title'/>
or
<xref linkend='XtGrabButton' xrefstyle='select: title'/>.
</para>
</sect1>

<sect1 id="Invoking_Actions_Directly">
<title>Invoking Actions Directly</title>
<para>
Normally action procedures are invoked by the Intrinsics when an
event or event sequence arrives for a widget. To
invoke an action procedure directly, without generating
(or synthesizing) events, use
<xref linkend='XtCallActionProc' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtCallActionProc'>
<funcprototype>
<funcdef>void <function>XtCallActionProc</function></funcdef>
   <paramdef>Widget <parameter>widget</parameter></paramdef>
   <paramdef>const char * <parameter>action</parameter></paramdef>
   <paramdef>XEvent * <parameter>event</parameter></paramdef>
   <paramdef>String * <parameter>params</parameter></paramdef>
   <paramdef>Cardinal <parameter>num_params</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>widget</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget in which the action is to be invoked.  Must be of class Core or any subclass thereof.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>action</emphasis>
    </term>
    <listitem>
      <para>
Specifies the name of the action routine.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>event</emphasis>
    </term>
    <listitem>
      <para>
Specifies the contents of the <emphasis remap='I'>event</emphasis> passed to the action routine.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>params</emphasis>
    </term>
    <listitem>
      <para>
Specifies the contents of the <emphasis remap='I'>params</emphasis> passed to the action routine.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>num_params</emphasis>
    </term>
    <listitem>
      <para>
Specifies the number of entries in <emphasis remap='I'>params</emphasis>.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
<xref linkend='XtCallActionProc' xrefstyle='select: title'/>
searches for the named action routine in the same
manner and order as translation tables are bound, as described in
Section 10.1.2, except that application action tables are searched, if
necessary, as of the time of the call to
<xref linkend='XtCallActionProc' xrefstyle='select: title'/>.
If found,
the action routine is invoked with the specified widget, event pointer,
and parameters.  It is the responsibility of the caller to ensure that
the contents of the <emphasis remap='I'>event</emphasis>, <emphasis remap='I'>params</emphasis>, and <emphasis remap='I'>num_params</emphasis> arguments are
appropriate for the specified action routine and, if necessary, that
the specified widget is realized or sensitive.  If the named action
routine cannot be found,
<xref linkend='XtCallActionProc' xrefstyle='select: title'/>
generates a warning message and returns.
</para>
</sect1>

<sect1 id="Obtaining_a_Widget_s_Action_List">
<title>Obtaining a Widget's Action List</title>
<para>
Occasionally a subclass will require the pointers to one or more of
its superclass's action procedures.  This would be needed, for
example, in order to envelop the superclass's action.  To retrieve
the list of action procedures registered in the superclass's
<emphasis remap='I'>actions</emphasis> field, use
<xref linkend='XtGetActionList' xrefstyle='select: title'/>.
</para>

<funcsynopsis id='XtGetActionList'>
<funcprototype>
<funcdef>void <function>XtGetActionList</function></funcdef>
   <paramdef>WidgetClass <parameter>widget_class</parameter></paramdef>
   <paramdef>XtActionList *<parameter>actions_return</parameter></paramdef>
   <paramdef>Cardinal *<parameter>num_actions_return</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>widget_class</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget class whose actions are to be returned.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>actions_return</emphasis>
    </term>
    <listitem>
      <para>
Returns the action list.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>num_actions_return</emphasis>
    </term>
    <listitem>
      <para>
Returns the number of action procedures declared by the class.
    </para>
  </listitem>
  </varlistentry>
</variablelist>

<para>
<xref linkend='XtGetActionList' xrefstyle='select: title'/>
returns the action table defined by the specified
widget class.  This table does not include actions defined by the
superclasses.  If <emphasis remap='I'>widget_class</emphasis> is not initialized, or is not
<function>coreWidgetClass</function>
or a subclass thereof, or if the class does not define any actions,
*<emphasis remap='I'>actions_return</emphasis> will be NULL and *<emphasis remap='I'>num_actions_return</emphasis>
will be zero.
If *<emphasis remap='I'>actions_return</emphasis> is non-NULL the client is responsible for freeing
the table using
<xref linkend='XtFree' xrefstyle='select: title'/>
when it is no longer needed.
</para>
</sect1>
</chapter>