This file is indexed.

/usr/share/doc/libxaw7-dev/CH2.xml is in libxaw-doc 2:1.0.13-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
<chapter><title>Using Widgets</title>
<sect1 id='Using_Widgets'>
<title>Using Widgets</title>
<para>
Widgets serve as the primary tools for building a user interface or
application environment.  The Athena widget set consists of primitive
widgets that contain no children (for example, a command button) and
composite widgets which may contain one or more widget children (for
example, a Box widget).
</para>
<para>
The remaining chapters explain the widgets that are provided
by the Athena widget set.
These user-interface components serve as an interface for
application programmers who do not want to implement their own widgets.
In addition, they serve as a starting point
for those widget programmers who, using the Intrinsics mechanisms,
want to implement alternative application programming interfaces.
</para>
<para>
This chapter is a brief introduction to widget programming.  The
examples provided use the Athena widgets, though most of the concepts
will apply to all widget sets.  Although there are several programming
interfaces to the X Toolkit, only one is described here.  A full
description of the programming interface is provided in the document
<emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>.
</para>
<sect2 id="Setting_the_Locale">
<title>Setting the Locale</title>
<para>
<!-- .LP -->
<!-- .XS -->
<!-- 	Setting the Locale -->
<!-- .XE -->
If it is desirable that the application take advantage of
internationalization (i18n), you must establish locale with
<function>XtSetLanguageProc</function>
before <function>XtDisplayInitialize</function> or <xref linkend='XtAppInitialize' xrefstyle='select: title'/>
is called.  For full details, please refer to the document
<emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>, section 2.2. However, the following simplest-case
call is sufficient in many or most applications.
</para>
<para>
<!-- .LP -->
<!-- .IN "internationalization" "" "" -->
<!-- .IN "XtSetLanguageProc" "" "@DEF@" -->
<!-- .IN "locale" "" "" -->
<literallayout class="monospaced">
<!-- .TA .5i 2i -->
<!-- .ta .5i 2i -->
	XtSetLanguageProc(NULL, NULL, NULL);
</literallayout>
</para>
<para>
<!-- .LP -->
Most notably, this will affect the Standard C locale, determine which
resource files will be loaded, and what fonts will be required of FontSet
specifications.  In many cases, the addition of this line is the only source change
required to internationalize Xaw programs, and will not disturb the function
of programs in the default "C" locale.
</para>
</sect2>
<sect2 id="Initializing_the_Toolkit">
<title>Initializing the Toolkit</title>
<para>
<!-- .LP -->
<!-- .XS -->
<!-- 	Initializing the Toolkit -->
<!-- .XE -->
You must call a toolkit initialization function before invoking any
other toolkit routines (besides locale setting, above).
<xref linkend='XtAppInitialize' xrefstyle='select: title'/>
opens the X server connection, parses the command line,
and creates an initial widget that will serve as the root of
a tree of widgets created by this application.
<!-- .IN "initialization" "" "@DEF@" -->
<!-- .IN "toolkit initialization" "" "@DEF@" -->
<!-- .IN "XtAppInitialize" "" "@DEF@" -->
<!-- .IN "fallback resources" "" "@DEF@" -->
<funcsynopsis id='XtAppInitialize'>
<funcprototype>
  <funcdef>Widget<function> XtAppInitialize</function></funcdef>
  <paramdef>XtAppContext<parameter> app_context_return</parameter></paramdef>
  <paramdef>String<parameter> application_class</parameter></paramdef>
  <paramdef>XrmOptionDescRec<parameter> options</parameter></paramdef>
  <paramdef>Cardinal<parameter> num_options</parameter></paramdef>
  <paramdef>int<parameter> *argc_in_out</parameter></paramdef>
  <paramdef>String<parameter> *argv_in_out</parameter></paramdef>
  <paramdef>String<parameter> *fallback_resources</parameter></paramdef>
  <paramdef>ArgList<parameter> args</parameter></paramdef>
  <paramdef>Cardinal<parameter> num_args</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<!-- .FN -->
<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>app_con_return</emphasis>
    </term>
    <listitem>
      <para>
Returns the application context of this application, if non-NULL.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>application_class</emphasis>
    </term>
    <listitem>
      <para>
Specifies the class name of this application,
which is usually the generic name for all instances of this application.
A useful convention is to form the class name by capitalizing the
first letter of the application name. For example, the application named
``xman'' has a class name of ``Xman''.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>options</emphasis>
    </term>
    <listitem>
      <para>
Specifies how to parse the command line for any application-specific
resources.
The options argument is passed as a parameter to
<olink targetdoc='libX11' targetptr='XrmParseCommand'><function>XrmParseCommand</function></olink>.
For further information,
see <emphasis remap='I'>Xlib - C Language Interface</emphasis>.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>num_options</emphasis>
    </term>
    <listitem>
      <para>
Specifies the number of entries in the options list.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>argc_in_out</emphasis>
    </term>
    <listitem>
      <para>
Specifies a pointer to the number of command line parameters.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>argv_in_out</emphasis>
    </term>
    <listitem>
      <para>
Specifies the command line parameters.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>fallback_resources</emphasis>
    </term>
    <listitem>
      <para>
Specifies resource values to be used if the site-wide application class
defaults file cannot be opened, or NULL.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>args</emphasis>
    </term>
    <listitem>
      <para>
Specifies the argument list to use when creating the Application shell.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>num_args</emphasis>
    </term>
    <listitem>
      <para>
Specifies the number of arguments in <emphasis remap='I'>args</emphasis>.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
This function will remove the command line arguments that the toolkit
reads from <emphasis remap='I'>argc_in_out</emphasis>, and <emphasis remap='I'>argv_in_out</emphasis>.  It will then
attempt to open the display.  If the display cannot be opened, an error
message is issued and XtAppInitialize terminates the application.  Once
the display is opened, all resources are read from the locations
specified by the Intrinsics.  This function returns an ApplicationShell
widget to be used as the root of the application's widget tree.
</para>
</sect2>
<sect2 id="Creating_a_Widget">
<title>Creating a Widget</title>
<para>
<!-- .LP -->
<!-- .XS -->
<!-- 	Creating a Widget -->
<!-- .XE -->
<!-- .IN "widget creation" "" "@DEF@" -->
<!-- .IN "creating widgets" "" "@DEF@" -->
<!-- .IN "XtRealizeWidget" "" "" -->
Creating a widget is a three-step process.  First, the widget instance
is allocated, and various instance-specific attributes are set by
using <function>XtCreateWidget</function>.  Second, the widget's parent is informed
of the new child by using <function>XtManageChild</function>.  Finally, X windows are
created for the parent and all its children by using <xref linkend='XtRealizeWidget' xrefstyle='select: title'/>
and specifying the top-most widget. The first two steps can be
combined by using <xref linkend='XtCreateManagedWidget' xrefstyle='select: title'/>.  In addition,
<xref linkend='XtRealizeWidget' xrefstyle='select: title'/> is automatically called when the child becomes
managed if the parent is already realized.
</para>
<para>
<!-- .LP -->
To allocate, initialize, and manage a widget, use
<function>XtCreateManagedWidget .</function>
<!-- .IN "XtCreateManagedWidget" "" "@DEF@" -->
<funcsynopsis id='XtCreateManagedWidget'>
<funcprototype>
  <funcdef>Widget<function> XtCreateManagedWidget</function></funcdef>
  <paramdef>String<parameter> name</parameter></paramdef>
  <paramdef>WidgetClass<parameter> widget_class</parameter></paramdef>
  <paramdef>Widget<parameter> parent</parameter></paramdef>
  <paramdef>ArgList<parameter> args</parameter></paramdef>
  <paramdef>Cardinal<parameter> num_args</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<!-- .FN -->
<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>name</emphasis>
    </term>
    <listitem>
      <para>
Specifies the instance name for the created widget that is used for retrieving
widget resources.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>widget_class</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget class pointer for the created widget.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>parent</emphasis>
    </term>
    <listitem>
      <para>
Specifies the parent widget ID.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>args</emphasis>
    </term>
    <listitem>
      <para>
Specifies the argument list.  The argument list is a variable-length
list composed of name and value pairs that contain information
pertaining to the specific widget instance being created.  For further
information, see Section 2.7.2. <!-- xref> -->
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>num_args</emphasis>
    </term>
    <listitem>
      <para>
Specifies the number of arguments in the argument list.
If the num_args is zero, the argument list is never referenced.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
When a widget instance is successfully created, the widget identifier
is returned to the application.  If an error is encountered, the
<function>XtError</function>
routine is invoked to inform the user of the error.
<!-- .IN "XtError" "" "" -->
</para>
<para>
<!-- .LP -->
For further information, see <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>.
</para>
</sect2>
<sect2 id="Common_Resources">
<title>Common Resources</title>
<!-- .XS -->
<!-- 	Common Resources -->
<!-- .XE -->
<!-- .IN "resource" "" -->
<para>
<!-- .LP -->
Although a widget can have unique arguments that it understands, all
widgets have common arguments that provide some regularity of operation.
The common arguments allow arbitrary widgets to be managed by
higher-level components without regard for the individual widget type.
Widgets will ignore any argument that they do not understand.
</para>
<para>
<!-- .LP -->
The following resources are retrieved from the argument list
or from the resource database by all of the Athena widgets:
<informaltable>
  <tgroup cols='4' align='center'>
  <colspec colname='c1'/>
  <colspec colname='c2'/>
  <colspec colname='c3'/>
  <colspec colname='c4'/>
  <thead>
    <row>
      <entry>Name</entry>
      <entry>Class</entry>
      <entry>Type</entry>
      <entry>Default Value</entry>
    </row>
  </thead>
  <tbody>
    <row>
      <entry>accelerators</entry>
      <entry>Accelerators</entry>
      <entry>AcceleratorTable</entry>
      <entry>NULL</entry>
    </row>
    <row>
      <entry>ancestorSensitive</entry>
      <entry>AncestorSensitive</entry>
      <entry>Boolean</entry>
      <entry>True</entry>
    </row>
    <row>
      <entry>background</entry>
      <entry>Background</entry>
      <entry>Pixel</entry>
      <entry>XtDefaultBackground</entry>
    </row>
    <row>
      <entry>backgroundPixmap</entry>
      <entry>Pixmap</entry>
      <entry>Pixmap</entry>
      <entry>XtUnspecifiedPixmap</entry>
    </row>
    <row>
      <entry>borderColor</entry>
      <entry>BorderColor</entry>
      <entry>Pixel</entry>
      <entry>XtDefaultForeground</entry>
    </row>
    <row>
      <entry>borderPixmap</entry>
      <entry>Pixmap</entry>
      <entry>Pixmap</entry>
      <entry>XtUnspecifiedPixmap</entry>
    </row>
    <row>
      <entry>borderWidth</entry>
      <entry>BorderWidth</entry>
      <entry>Dimension</entry>
      <entry>1</entry>
    </row>
    <row>
      <entry>colormap</entry>
      <entry>Colormap</entry>
      <entry>Colormap</entry>
      <entry>Parent's Colormap</entry>
    </row>
    <row>
      <entry>depth</entry>
      <entry>Depth</entry>
      <entry>int</entry>
      <entry>Parent's Depth</entry>
    </row>
    <row>
      <entry>destroyCallback</entry>
      <entry>Callback</entry>
      <entry>XtCallbackList</entry>
      <entry>NULL</entry>
    </row>
    <row>
      <entry>height</entry>
      <entry>Height</entry>
      <entry>Dimension</entry>
      <entry><emphasis remap='I'>widget dependent</emphasis></entry>
    </row>
    <row>
      <entry>mappedWhenManaged</entry>
      <entry>MappedWhenManaged</entry>
      <entry>Boolean</entry>
      <entry>True</entry>
    </row>
    <row>
      <entry>screen</entry>
      <entry>Screen</entry>
      <entry>Screen</entry>
      <entry>Parent's Screen</entry>
    </row>
    <row>
      <entry>sensitive</entry>
      <entry>Sensitive</entry>
      <entry>Boolean</entry>
      <entry>True</entry>
    </row>
    <row>
      <entry>translations</entry>
      <entry>Translations</entry>
      <entry>TranslationTable</entry>
      <entry><emphasis remap='I'>widget dependent</emphasis></entry>
    </row>
    <row>
      <entry>width</entry>
      <entry>Width</entry>
      <entry>Dimension</entry>
      <entry><emphasis remap='I'>widget dependent</emphasis></entry>
    </row>
    <row>
      <entry>x</entry>
      <entry>Position</entry>
      <entry>Position</entry>
      <entry>0</entry>
    </row>
    <row>
      <entry>y</entry>
      <entry>Position</entry>
      <entry>Position</entry>
      <entry>0</entry>
    </row>
  </tbody>
  </tgroup>
</informaltable>
<!-- .IN "XtDefaultForeground" "" "" -->
<!-- .IN "XtDefaultBackground" "" "" -->
</para>
<para>
<!-- .LP -->
The following additional resources are retrieved from the argument list
or from the resource database by many of the Athena widgets:
<informaltable>
  <tgroup cols='4' align='center'>
  <colspec colname='c1'/>
  <colspec colname='c2'/>
  <colspec colname='c3'/>
  <colspec colname='c4'/>
  <thead>
    <row>
      <entry>Name</entry>
      <entry>Class</entry>
      <entry>Type</entry>
      <entry>Default Value</entry>
    </row>
  </thead>
  <tbody>
    <row>
      <entry>callback</entry>
      <entry>Callback</entry>
      <entry>XtCallbackList</entry>
      <entry>NULL</entry>
    </row>
    <row>
      <entry>cursor</entry>
      <entry>Cursor</entry>
      <entry>Cursor</entry>
      <entry><emphasis remap='I'>widget dependent</emphasis></entry>
    </row>
    <row>
      <entry>foreground</entry>
      <entry>Foreground</entry>
      <entry>Pixel</entry>
      <entry>XtDefaultForeground</entry>
    </row>
    <row>
      <entry>insensitiveBorder</entry>
      <entry>Insensitive</entry>
      <entry>Pixmap</entry>
      <entry>GreyPixmap</entry>
    </row>
  </tbody>
  </tgroup>
</informaltable>
<!-- .IN "XtDefaultForeground" "" "" -->
</para>
</sect2>
<sect2 id="Resource_Conversions">
<title>Resource Conversions</title>
<!-- .XS -->
<!-- 	Resource Conversions -->
<!-- .XE -->
<!-- .IN "conversions" "" "@DEF@" -->
<!-- .IN "string conversions" "" "@DEF@" -->
<!-- .IN "type conversions" "" "@DEF@" -->
<para>
<!-- .LP -->
Most resources in the Athena widget set have a converter registered that
will translate the string in a resource file to the correct internal
representation.  While some are obvious (string to integer, for example),
others need specific mention of the allowable values.  Three general
converters are described here:
</para>
<itemizedlist>
  <listitem>
    <para>
Cursor
    </para>
  </listitem>
  <listitem>
    <para>
Pixel
    </para>
  </listitem>
  <listitem>
    <para>
Bitmap
    </para>
  </listitem>
</itemizedlist>
<para>
<!-- .LP -->
Many widgets have defined special converters that apply only to that
widget.  When these occur, the documentation section for that widget
will describe the converter.
</para>
<sect3 id="Cursor_Conversion">
<title>Cursor Conversion</title>
<!-- .IN "conversions" "ColorCursor" "@DEF@" -->
<!-- .IN "conversions" "Cursor" "@DEF@" -->
<!-- .IN "cursor" "" "" -->
<para>
<!-- .LP -->
The value for the <function>cursorName</function> resource is specified in the resource
database as a string, and is of the following forms:
</para>
<itemizedlist>
  <listitem>
    <para>
A standard X cursor name from <function>&lt; X11/cursorfont.h &gt;</function>.
The names in <function>cursorfont.h</function> each describe a specific cursor.  The
resource names for these cursors are exactly like the names in this file
except the <function>XC_</function> is not used.  The cursor definition <function>XC_gumby</function>
has a resource name of <function>gumby</function>.
    </para>
  </listitem>
  <listitem>
    <para>
Glyphs, as in <emphasis remap='I'>FONT font-name glyph-index [[ font-name ] glyph-index ]</emphasis>.
The first font and glyph specify the cursor source pixmap.
The second font and glyph specify the cursor mask pixmap.
The mask font defaults to the source font,
and the mask glyph index defaults to the source glyph index.
    </para>
  </listitem>
  <listitem>
    <para>
A relative or absolute file name.
If a relative or absolute file name is specified, that file is used to
create the source pixmap.  Then the string "Mask" is appended to
locate the cursor mask pixmap.  If the "Mask" file does not exist, the
suffix "msk" is tried.  If "msk" fails, no cursor mask will be used.
If the filename does not start with '/' or './' the the bitmap
file path is used (see section 2.4.3). <!-- xref -->
    </para>
  </listitem>
</itemizedlist>
</sect3>
<sect3 id="Pixel_Conversion">
<title>Pixel Conversion</title>
<para>
<!-- .LP -->
<!-- .IN "conversions" "Pixel" "@DEF@" -->
<!-- .IN "pixel" "" "" -->
<!-- .IN "rgb.txt" "" "" -->
<!-- .IN "XtDefaultForeground" "" "" -->
<!-- .IN "XtDefaultBackground" "" "" -->
The string-to-pixel converter takes any name that is acceptable to
XParseColor (see <emphasis remap='I'>Xlib - C Language Interface</emphasis>).  In addition this routine understands
the special toolkit symbols `XtDefaultForeground' and
`XtDefaultBackground', described in <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>.  In short the acceptable
pixel names are:
</para>
<itemizedlist>
  <listitem>
    <para>
Any color name for the rgb.txt file (typically in the directory
/usr/lib/X11 on POSIX systems).
    </para>
  </listitem>
  <listitem>
    <para>
A numeric specification of the form #&lt;red&gt;&lt;green&gt;&lt;blue&gt; where these
numeric values are hexadecimal digits (both upper and lower case).
    </para>
  </listitem>
  <listitem>
    <para>
The special strings `XtDefaultForeground' and `XtDefaultBackground'
    </para>
  </listitem>
</itemizedlist>
</sect3>
<sect3 id="Bitmap_Conversion">
<title>Bitmap Conversion</title>
<!-- .IN "bitmap conversions" "" "@DEF@" -->
<!-- .IN "conversions" "Bitmap" "@DEF@" -->
<!-- .IN "bitmapFilePath" "" "@DEF@" -->
<!-- .IN "BitmapFilePath" "" "@DEF@" -->
<!-- .IN "/usr/include/X11/bitmaps" "" "" -->
<para>
<!-- .LP -->
The string-to-bitmap converter attempts to locate a file containing
bitmap data whose name is specified by the input string.  If the file
name is relative (i.e. does not begin with / or ./), the directories to
be searched are specified in the <function>bitmapFilePath</function> resource--class
<function>BitmapFilePath</function>.  This resource specifies a colon (:) separated
list of directories that will be searched for the named bitmap or
cursor glyph (see section 2.4.1).  The <function>bitmapFilePath</function> resource is
global to the application, and may <function>not</function> be specified differently
for each widget that wishes to convert a cursor to bitmap.  In addition
to the directories specified in the <function>bitmapFilePath</function> resource a
default directory is searched.  When using POSIX the default
directory is
<function>/usr/include/X11/bitmaps .</function>
</para>
</sect3>
</sect2>
<sect2 id="Realizing_a_Widget">
<title>Realizing a Widget</title>
<para>
<!-- .LP -->
<!-- .XS -->
<!-- 	Realizing a Widget -->
<!-- .XE -->
<!-- .IN "realizing widgets" "" "@DEF@" -->
The
<xref linkend='XtRealizeWidget' xrefstyle='select: title'/>
function performs two tasks:
</para>
<itemizedlist>
  <listitem>
    <para>
Calculates the geometry constraints of all managed descendants
of this widget.  The actual calculation is put off until realize time
for performance reasons.
    </para>
  </listitem>
  <listitem>
    <para>
Creates an X window for the widget and, if it is a composite widget,
realizes each of its managed children.
<!-- .IN "XtRealizeWidget" "" "@DEF@" -->
<funcsynopsis id='XtRealizeWidget'>
<funcprototype>
  <funcdef>void<function> XtRealizeWidget</function></funcdef>
  <paramdef>Widget<parameter> w</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<!-- .FN -->
    </para>
  </listitem>
  <listitem>
    <para>
Specifies the widget.
    </para>
  </listitem>
</itemizedlist>
<para>
<!-- .LP -->
For further information about this function,
see the <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>.
</para>
</sect2>
<sect2 id="Processing_Events">
<title>Processing Events</title>
<para>
<!-- .LP -->
<!-- .XS -->
<!-- 	Processing Events -->
<!-- .XE -->
<!-- .IN "events" "" "" -->
<!-- .IN "XtAppInitialize" "" "" -->
Now that the application has created, managed and realized its
widgets, it is ready to process the events that will be delivered by the
X Server to this client.  A function call that will process the
events is <xref linkend='XtAppMainLoop' xrefstyle='select: title'/>.
<!-- .IN "XtAppMainLoop" "" "@DEF@" -->
<funcsynopsis id='XtAppMainLoop'>
<funcprototype>
  <funcdef>void<function> XtAppMainLoop</function></funcdef>
  <paramdef>XtAppContext<parameter> app_context</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<!-- .FN -->
<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>app_context</emphasis>
    </term>
    <listitem>
      <para>
Specifies the application context of this application.  The value is
normally returned by <xref linkend='XtAppInitialize' xrefstyle='select: title'/>.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
This function never returns: it is an infinite loop that processes the
X events.  User input can be handled through callback procedures and
application defined action routines.  More details are provided in
<emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>.
</para>
</sect2>
<sect2 id="Standard_Widget_Manipulation_Functions">
<title>Standard Widget Manipulation Functions</title>
<!-- .XS -->
<!-- 	Standard Widget Manipulation Functions -->
<!-- .XE -->
<para>
<!-- .LP -->
After a widget has been created, a client can interact with that
widget by calling one of the standard widget manipulation routines
provided by the Intrinsics, or a widget class-specific manipulation routine.
</para>
<para>
<!-- .LP -->
The Intrinsics provide generic routines to give the application programmer
access to a set of standard widget functions.  The common widget
routines let an application or composite widget perform the following
operations on widgets without requiring explicit knowledge of the widget
type.
</para>
<itemizedlist>
  <listitem>
    <para>
Control the mapping of widget windows
    </para>
  </listitem>
  <listitem>
    <para>
Destroy a widget instance
    </para>
  </listitem>
  <listitem>
    <para>
Obtain an argument value
    </para>
  </listitem>
  <listitem>
    <para>
Set an argument value
    </para>
  </listitem>
</itemizedlist>
<sect3 id="Mapping_Widgets">
<title>Mapping Widgets</title>
<para>
<!-- .LP -->
By default,
widget windows are mapped (made viewable) automatically by
<xref linkend='XtRealizeWidget' xrefstyle='select: title'/>.  This behavior can be disabled by using
<xref linkend='XtSetMappedWhenManaged' xrefstyle='select: title'/>, making the client responsible for calling
<xref linkend='XtMapWidget' xrefstyle='select: title'/> to make the widget viewable.
<!-- .IN "XtSetMappedWhenManaged" "" "@DEF@" -->
<!-- .IN "XtMapWidget" "" "" -->
<!-- .IN "XtRealizeWidget" "" "" -->
<funcsynopsis id='XtSetMappedWhenManaged'>
<funcprototype>
  <funcdef>void<function> XtSetMappedWhenManaged</function></funcdef>
  <paramdef>Widget<parameter> w</parameter></paramdef>
  <paramdef>Boolean<parameter> map_when_managed</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<!-- .FN -->
<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>w</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>map_when_managed</emphasis>
    </term>
    <listitem>
      <para>
Specifies the new value.
If map_when_managed is <function>True</function>, the widget is mapped automatically
when it is realized.  If map_when_managed is <function>False</function>, the client
must call
<xref linkend='XtMapWidget' xrefstyle='select: title'/>
or make a second call to
<xref linkend='XtSetMappedWhenManaged' xrefstyle='select: title'/>
to cause the child window to be mapped.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
<!-- .sp -->
The definition for
<xref linkend='XtMapWidget' xrefstyle='select: title'/>
is:
<!-- .IN "XtMapWidget" "" "@DEF@" -->
<funcsynopsis id='XtMapWidget'>
<funcprototype>
  <funcdef>void<function> XtMapWidget</function></funcdef>
  <paramdef>Widget<parameter> w</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<!-- .FN -->
<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>w</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
When you are creating several children in sequence for a previously
realized common parent it is generally more efficient to construct a
list of children as they are created (using <function>XtCreateWidget</function>) and
then use <xref linkend='XtManageChildren' xrefstyle='select: title'/> to request that their parent managed
them all at once.  By managing a list of children at one time, the
parent can avoid wasteful duplication of geometry processing and the
associated ``screen flash''.
<!-- .IN "XtManageChildren" "" "@DEF@" -->
<!-- .IN "XtCreateWidget" "" "" -->
<funcsynopsis id='XtManageChildren'>
<funcprototype>
  <funcdef>void<function> XtManageChildren</function></funcdef>
  <paramdef>WidgetList<parameter> children</parameter></paramdef>
  <paramdef>Cardinal<parameter> num_children</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<!-- .FN -->
<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>children</emphasis>
    </term>
    <listitem>
      <para>
Specifies a list of children to add.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>num_children</emphasis>
    </term>
    <listitem>
      <para>
Specifies the number of children to add.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
If the parent is already visible on the screen, it is especially
important to batch updates so that the minimum amount of visible window
reconfiguration is performed.
</para>
<para>
<!-- .LP -->
For further information about these functions,
see the <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>.
</para>
</sect3>
<sect3 id="Destroying_Widgets">
<title>Destroying Widgets</title>
<para>
<!-- .LP -->
To destroy a widget instance of any type, use
<xref linkend='XtDestroyWidget' xrefstyle='select: title'/>
<!-- .IN "XtDestroyWidget" "" "@DEF@" -->
<funcsynopsis id='XtDestroyWidget'>
<funcprototype>
  <funcdef>void<function> XtDestroyWidget</function></funcdef>
  <paramdef>Widget<parameter> w</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<!-- .FN -->
<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>w</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
<xref linkend='XtDestroyWidget' xrefstyle='select: title'/>
destroys the widget and recursively destroys any children that it may have,
including the windows created by its children.
After calling
<function>XtDestroyWidget ,</function>
no further references should be made to the widget or any children
that the destroyed widget may have had.
</para>
</sect3>
<sect3 id="Retrieving_Widget_Resource_Values">
<title>Retrieving Widget Resource Values</title>
<para>
<!-- .LP -->
To retrieve the current value of a resource attribute associated
with a widget instance, use
<function>XtGetValues .</function>
<!-- .IN "XtGetValues" "" "@DEF@" -->
<funcsynopsis id='XtGetValues'>
<funcprototype>
  <funcdef>void<function> XtGetValues</function></funcdef>
  <paramdef>Widget<parameter> w</parameter></paramdef>
  <paramdef>ArgList<parameter> args</parameter></paramdef>
  <paramdef>Cardinal<parameter> num_args</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<!-- .FN -->
<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>w</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>args</emphasis>
    </term>
    <listitem>
      <para>
Specifies a variable-length argument list of name and <function>address</function>
pairs that contain the resource name and the address into which the
resource value is stored.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>num_args</emphasis>
    </term>
    <listitem>
      <para>
Specifies the number of arguments in the argument list.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
The arguments and values passed in the argument list are dependent on
the widget. Note that the caller is responsible for providing space
into which the returned resource value is copied; the <function>ArgList</function>
contains a pointer to this storage (e.g. x and y must be
allocated as Position).  For further information, see the <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>.
</para>
</sect3>
<sect3 id="Modifying_Widget_Resource_Values">
<title>Modifying Widget Resource Values</title>
<para>
<!-- .LP -->
To modify the current value of a resource attribute associated with a
widget instance, use
<function>XtSetValues .</function>
<!-- .IN "XtSetValues" "" "@DEF@" -->
<funcsynopsis id='XtSetValues'>
<funcprototype>
  <funcdef>void<function> XtSetValues</function></funcdef>
  <paramdef>Widget<parameter> w</parameter></paramdef>
  <paramdef>ArgList<parameter> args</parameter></paramdef>
  <paramdef>Cardinal<parameter> num_args</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<!-- .FN -->
<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>w</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>args</emphasis>
    </term>
    <listitem>
      <para>
Specifies an array of name and <function>value</function> pairs that contain the
arguments to be modified and their new values.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>num_args</emphasis>
    </term>
    <listitem>
      <para>
Specifies the number of arguments in the argument list.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
The arguments and values that are passed will depend on the widget
being modified.  Some widgets may not allow certain resources to be
modified after the widget instance has been created or realized.
No notification is given if any part of a <xref linkend='XtSetValues' xrefstyle='select: title'/> request is
ignored.
</para>
<para>
<!-- .LP -->
For further information about these functions, see the <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>.
<!-- .IN "XtGetValues" "" "" -->
<!-- .IN "XtSetValues" "" "" -->
<!-- .NT -->
The argument list entry for
<xref linkend='XtGetValues' xrefstyle='select: title'/>
specifies the address to which the caller wants the value copied.  The
argument list entry for
<function>XtSetValues ,</function>
however, contains the new value itself, if the size of value is less than
sizeof(XtArgVal) (architecture dependent, but at least sizeof(long));
otherwise, it is a pointer to the value.  String resources are always
passed as pointers, regardless of the length of the string.
<!-- .NE -->
</para>
</sect3>
</sect2>
<sect2 id="Using_the_Client_Callback_Interface">
<title>Using the Client Callback Interface</title>
<para>
<!-- .LP -->
<!-- .XS -->
<!-- 	Using the Client Callback Interface -->
<!-- .XE -->
<!-- .IN "callbacks" "" "" -->
Widgets can communicate changes in their state to their clients
by means of a callback facility.
The format for a client's callback handler is:
<!-- .IN "CallbackProc" "" "@DEF@" -->
<funcsynopsis id='CallbackProc'>
<funcprototype>
  <funcdef>void<function> CallbackProc</function></funcdef>
  <paramdef>Widget<parameter> w</parameter></paramdef>
  <paramdef>XtPointer<parameter> client_data</parameter></paramdef>
  <paramdef>XtPointer<parameter> call_data</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<!-- .FN -->
<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>w</emphasis>
    </term>
    <listitem>
      <para>
Specifies widget for which the callback is registered.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>client_data</emphasis>
    </term>
    <listitem>
      <para>
Specifies arbitrary client-supplied data that the widget should pass
back to the client when the widget executes the client's callback
procedure.  This is a way for the client registering the callback to
also register client-specific data: a pointer to additional information
about the widget, a reason for invoking the callback, and so on. If no
additional information is necessary, NULL may be passed as this argument.
This field is also frequently known as the <emphasis remap='I'>closure</emphasis>.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>call_data</emphasis>
    </term>
    <listitem>
      <para>
Specifies any callback-specific data the widget wants to pass to the client.
For example, when Scrollbar executes its <function>jumpProc</function> callback list,
it passes the current position of the thumb in <emphasis remap='I'>call_data</emphasis>.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
Callbacks can be registered either by creating an argument containing
the callback list described below or by using the special convenience
routines <xref linkend='XtAddCallback' xrefstyle='select: title'/> and <function>XtAddCallbacks</function>.  When the widget
is created, a pointer to a list of callback procedure and data pairs can
be passed in the argument list to
<function>XtCreateWidget .</function>
The list is of type
<function>XtCallbackList :</function>
<!-- .IN "XtCallbackProc" -->
<!-- .IN "XtAddCallbacks" -->
<!-- .IN "XtAddCallback" -->
<!-- .IN "XtCallbackList" "" "@DEF@" -->
<!-- .IN "XtCallbackRec" "" "@DEF@" -->
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .5i 3i -->
<!-- .ta .5i 3i -->
typedef struct {
	XtCallbackProc callback;
	XtPointer closure;
} XtCallbackRec, *XtCallbackList;
</literallayout>
</para>
<para>
<!-- .LP -->
The callback list must be allocated and initialized before calling
<function>XtCreateWidget .</function>
<!-- .IN "XtCreateWidget" -->
The end of the list is identified by an entry containing NULL in
callback and closure.  Once the widget is created, the client can change
or de-allocate this list; the widget itself makes no further reference
to it.  The closure field contains the client_data passed to the
callback when the callback list is executed.
</para>
<para>
<!-- .LP -->
The second method for registering callbacks is to use
<xref linkend='XtAddCallback' xrefstyle='select: title'/>
after the widget has been created.
<!-- .IN "XtAddCallback" "" "@DEF@" -->
<funcsynopsis id='XtAddCallback'>
<funcprototype>
  <funcdef>void<function> XtAddCallback</function></funcdef>
  <paramdef>Widget<parameter> w</parameter></paramdef>
  <paramdef>String<parameter> callback_name</parameter></paramdef>
  <paramdef>XtCallbackProc<parameter> callback</parameter></paramdef>
  <paramdef>XtPointer<parameter> client_data</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<!-- .FN -->
<variablelist>
  <varlistentry>
    <term>
      <emphasis remap='I'>w</emphasis>
    </term>
    <listitem>
      <para>
Specifies the widget to add the callback to.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>callback_name</emphasis>
    </term>
    <listitem>
      <para>
Specifies the callback list within the widget to append to.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>callback</emphasis>
    </term>
    <listitem>
      <para>
Specifies the callback procedure to add.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      <emphasis remap='I'>client_data</emphasis>
    </term>
    <listitem>
      <para>
Specifies the data to be passed to the callback when it is invoked.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
<xref linkend='XtAddCallback' xrefstyle='select: title'/>
adds the specified callback to the list for the named widget.
</para>
<para>
<!-- .LP -->
All widgets provide a callback list named
<function>destroyCallback</function>
<!-- .IN "destroyCallback" "" "@DEF@" -->
where clients can register procedures that are to be executed when the
widget is destroyed.  The destroy callbacks are executed when the widget
or an ancestor is destroyed.  The <emphasis remap='I'>call_data</emphasis> argument is unused for
destroy callbacks.
</para>
</sect2>
<sect2 id="Programming_Considerations">
<title>Programming Considerations</title>
<para>
<!-- .LP -->
<!-- .XS -->
<!-- 	Programming Considerations -->
<!-- .XE -->
This section provides some guidelines on how to set up an application
program that uses the X Toolkit.
</para>
<sect3 id="Writing_Applications">
<title>Writing Applications</title>
<para>
<!-- .LP -->
<!-- .IN "writing applications" -->
<!-- .IN "StringDefs.h" -->
<!-- .IN "Intrinsic.h" -->
When writing an application that uses the X Toolkit,
you should make sure that your application performs the following:
</para>
<orderedlist>
  <listitem>
    <para>
Include
<function>&lt; X11/Intrinsic.h &gt;</function>
in your application programs.
This header file automatically includes
<function>&lt; X11/Xlib.h &gt;,</function>
so all Xlib functions also are defined.
It may also be necessary to include <function>&lt; X11/StringDefs.h &gt;</function> when setting
up argument lists, as many of the XtN<emphasis remap='I'>something</emphasis> definitions are
only defined in this file.
    </para>
  </listitem>
  <listitem>
    <para>
Include the widget-specific header files for each widget type
that you need to use.
For example,
<function>&lt; X11/Xaw/Label.h &gt;</function>
and
<function>&lt; X11/Xaw/Command.h &gt;.</function>
    </para>
  </listitem>
  <listitem>
    <para>
Call the
<xref linkend='XtAppInitialize' xrefstyle='select: title'/>
<!-- .IN "XtAppInitialize" -->
function before invoking any other toolkit or Xlib functions.
For further information,
see Section 2.1 and the <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>.
    </para>
  </listitem>
  <listitem>
    <para>
To pass attributes to the widget creation routines that will override
any site or user customizations, set up argument lists.  In this
document, a list of valid argument names is provided in the discussion
of each widget.  The names each have a global symbol defined that begins
with <function>XtN</function> to help catch spelling errors.  For example,
<function>XtNlabel</function> is defined for the <function>label</function> resource of many widgets.
<!-- .IN "XtN" "" "@DEF@" -->
    </para>
  </listitem>
  <listitem>
    <para>
For further information, see Section 2.9.2.2.  <!-- xref -->
    </para>
  </listitem>
  <listitem>
    <para>
When the argument list is set up, create the widget with the
<xref linkend='XtCreateManagedWidget' xrefstyle='select: title'/> function.  For further information, see
Section 2.2 and the <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>.
<!-- .IN "XtCreateManagedWidget" -->
    </para>
  </listitem>
  <listitem>
    <para>
If the widget has any callback routines, set by the
<function>XtNcallback</function>
argument or the
<xref linkend='XtAddCallback' xrefstyle='select: title'/>
function, declare these routines within the application.
<!-- .IN "XtAddCallback" -->
    </para>
  </listitem>
  <listitem>
    <para>
After creating the initial widget hierarchy, windows must be created
for each widget by calling
<xref linkend='XtRealizeWidget' xrefstyle='select: title'/>
on the top level widget.
<!-- .IN "XtRealizeWidget" -->
    </para>
  </listitem>
  <listitem>
    <para>
Most applications now sit in a loop processing events using
<function>XtAppMainLoop ,</function>
for example:
<!-- .IN "XtAppMainLoop" -->
    </para>
  </listitem>
  <listitem>
    <para>
<literallayout class="monospaced">
XtCreateManagedWidget(<emphasis remap='I'>name</emphasis>, <emphasis remap='I'>class</emphasis>, <emphasis remap='I'>parent</emphasis>, <emphasis remap='I'>args</emphasis>, <emphasis remap='I'>num_args</emphasis>);
XtRealizeWidget(<emphasis remap='I'>shell</emphasis>);
XtAppMainLoop(<emphasis remap='I'>app_context</emphasis>);
</literallayout>
    </para>
  </listitem>
  <listitem>
    <para>
For information about this function, see the <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>.
    </para>
  </listitem>
  <listitem>
    <para>
Link your application with
<function>libXaw</function>
(the Athena widgets),
<function>libXmu</function>
(miscellaneous utilities),
<function>libXt</function>
(the X Toolkit Intrinsics),
<function>libSM</function>
(Session Management),
<function>libICE</function>
(Inter-Client Exchange),
<function>libXext</function>
(the extension library needed for the shape extension code which allows
rounded Command buttons), and
<function>libX11</function>
(the core X library).
The following provides a sample command line:
<!-- .IN "libXaw" -->
<!-- .IN "libXmu" -->
<!-- .IN "libXt" -->
<!-- .IN "libSM" -->
<!-- .IN "libICE" -->
<!-- .IN "libXext" -->
<!-- .IN "libX11" -->
<!-- .IN "linking applications" -->
<!-- .IN "compiling applications" -->
    </para>
  </listitem>
  <listitem>
    <para>
<literallayout class="monospaced">
cc -o <emphasis remap='I'>application</emphasis> <emphasis remap='I'>application</emphasis>.c \-lXaw \-lXmu \-lXt \
\-lSM \-lICE \-lXext \-lX11
</literallayout>
    </para>
  </listitem>
</orderedlist>
</sect3>
<sect3 id="Changing_Resource_Values">
<title>Changing Resource Values</title>
<!-- .IN "resource" "" -->
<para>
<!-- .LP -->
The Intrinsics support two methods of changing the default resource
values; the resource manager, and an argument list passed into
XtCreateWidget.  While resources values will get updated no matter
which method you use, the two methods provide slightly different
functionality.
<variablelist>
  <varlistentry>
    <term>Resource Manager</term>
    <listitem>
      <para>
This method picks up resource definitions described in <emphasis remap='I'>Xlib - C Language Interface</emphasis> from
many different locations at run time.  The locations most important to
the application programmer are the <emphasis remap='I'>fallback resources</emphasis> and the
<emphasis remap='I'>app-defaults</emphasis> file, (see <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis> for the complete list).
Since these resource are loaded at run time, they can be overridden by
the user, allowing an application to be customized to fit the
particular needs of each individual user.  These values can also be
modified without the need to rebuild the application, allowing rapid
prototyping of user interfaces.  Application programmers should use
resources in preference to hard-coded values whenever possible.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>Argument Lists</term>
    <listitem>
      <para>
The values passed into the widget at creation time via an argument list
cannot be modified by the user, and allow no opportunity for
customization.  It is used to set resources that cannot be specified as
strings (e.g. callback lists) or resources that should not be
overridden (e.g. window depth) by the user.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<sect4 id="Specifying_Resources">
<title>Specifying Resources</title>
<para>
<!-- .LP -->
It is important for all X Toolkit application programmers to
understand how to use the X Resource Manager to specify resources for
widgets in an X application.  This section will describe the most common
methods used to specify these resources, and how to use the X Resource
manager.
<!-- .IN "xrdb" -->
<variablelist>
  <varlistentry>
    <term>
      <function>Xrdb</function>
    </term>
    <listitem>
      <para>
The <function>xrdb</function> utility may be used to load a file containing
resources into the X server.   Once the resources are loaded, the
resources will affect any new applications started on the display that
they were loaded onto.
<!-- .IN "application defaults" -->
<!-- .IN "app-defaults" -->
<!-- .IN "/usr/lib/X11/app-defaults" -->
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>Application Defaults</term>
    <listitem>
      <para>
The application defaults (app-defaults) file (normally in
/usr/lib/X11/app-defaults/<emphasis remap='I'>classname</emphasis>) for an application is loaded
whenever the application is started.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
The resource specification has two colon-separated parts, a name, and
a value.  The <emphasis remap='I'>value</emphasis> is a string whose format is dependent on the
resource specified by <emphasis remap='I'>name</emphasis>.  <emphasis remap='I'>Name</emphasis> is constructed by
appending a resource name to a full widget name.
</para>
<para>
<!-- .LP -->
The full widget name is a list of the name of every ancestor of the
desired widget separated by periods (.).  Each widget also has a class
associated with it.  A class is a type of widget (e.g. Label or
Scrollbar or Box).  Notice that class names, by convention, begin with
capital letters and instance names begin with lower case letters.  The
class of any widget may be used in place of its name in a resource
specification.  Here are a few examples:
<variablelist>
  <varlistentry>
    <term>
      xman.form.button1
    </term>
    <listitem>
      <para>
This is a fully specified resource name, and will affect only widgets
called button1 that are children of widgets called form that are
children of
applications named xman.  (Note that while typically two widgets that
are siblings will have different names, it is not prohibited.)

      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      Xman.Form.Command
    </term>
    <listitem>
      <para>
This will match any Command widget that is a child of a Form widget
that is itself a child of an application of class <emphasis remap='I'>Xman</emphasis>.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      Xman.Form.button1
    </term>
    <listitem>
      <para>
This is a mixed resource name with both widget names and classes specified.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
This syntax allows an application programmer to specify any widget
in the widget tree.  To match more than one widget (for example a user
may want to make all Command buttons blue), use an asterisk (*)
instead of a period.  When an asterisk is used, any number of widgets
(including zero) may exist between the two widget names. For example:
<variablelist>
  <varlistentry>
    <term>
      Xman*Command
    </term>
    <listitem>
      <para>
This matches all Command widgets in the Xman application.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      Foo*button1
    </term>
    <listitem>
      <para>
This matches any widget in the Foo application that is named <emphasis remap='I'>button1</emphasis>.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
The root of all application widget trees is the widget returned by
<xref linkend='XtAppInitialize' xrefstyle='select: title'/>.  Even though this is actually an
ApplicationShell widget, the toolkit replaces its widget class with the
class name of the application.  The name of this widget is either
the name used to invoke the application (<function>argv[0]</function>) or the name of
the application specified using the standard <emphasis remap='I'>-name</emphasis> command line
option supported by the Intrinsics.
</para>
<para>
<!-- .LP -->
The last step in constructing the resource name is to append the name of
the resource with either a period or asterisk to the full or partial
widget name already constructed.
<variablelist>
  <varlistentry>
    <term>
      *foreground:Blue
    </term>
    <listitem>
      <para>
Specifies that all widgets in all applications will have a foreground
color of blue.
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      Xman*borderWidth:10
    </term>
    <listitem>
      <para>
Specifies that all widgets in an application whose class is Xman will
have a border width of 10 (pixels).
      </para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
      xman.form.button1.label:Testing
    </term>
    <listitem>
      <para>
Specifies that a particular widget in the xman application will have a
label named <emphasis remap='I'>Testing</emphasis>.
    </para>
  </listitem>
  </varlistentry>
</variablelist>
</para>
<para>
<!-- .LP -->
An exclamation point (!) in the first column of a line indicates
that the rest of the line should be treated as a comment.
</para>
<para>
<!-- .LP -->
<function>Final Words</function>
</para>
<para>
<!-- .LP -->
The Resource manager is a powerful tool that can be used very
effectively to customize X Toolkit applications at run time by either the
application programmer or the user.  Some final points to note:
</para>
<itemizedlist>
  <listitem>
    <para>
An application programmer may add new resources to their
application.  These resources are associated with the global
application, and not any particular widget.  The X Toolkit function used for
adding the application resources is <function>XtGetApplicationResources</function>.
<!-- .IN "XtGetApplicationResources" -->
    </para>
  </listitem>
  <listitem>
    <para>
Be careful when creating resource files.  Since widgets will
ignore resources that they do not understand, any spelling
errors will cause a resource to have no effect.
    </para>
  </listitem>
  <listitem>
    <para>
Only one resource line will match any given resource.  There is a set
of precedence rules, which take the following general stance.
<!-- .ta 10n -->
    </para>
  </listitem>
  <listitem>
    <itemizedlist>
      <listitem>
        <para>
More specific overrides less specific, thus period always overrides asterisk.
        </para>
      </listitem>
      <listitem>
        <para>
Names on the left are more specific and override names on the right.
        </para>
      </listitem>
      <listitem>
        <para>
When resource specifications are exactly the same, user defaults
will override program defaults.
        </para>
      </listitem>
    </itemizedlist>
  </listitem>
</itemizedlist>
<para>
<!-- .LP -->
For a complete explanation of the rules of precedence, and
other specific topics see <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis> and <emphasis remap='I'>Xlib - C Language Interface</emphasis>.
</para>
</sect4>
<sect4 id="Creating_Argument_Lists">
<title>Creating Argument Lists</title>
<!-- .IN "argument lists" "" "@DEF@" -->
<para>
<!-- .LP -->
To set up an argument list for the inline specification of widget attributes,
you may use any of the four approaches discussed in this section.
Each resource name has a global symbol associated with it.  This
global symbol has the form XtN<emphasis remap='I'>resource name</emphasis>.  For example, the
symbol for ``foreground'' is <function>XtNforeground</function>. For further information,
see the <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>.
</para>
<para>
<!-- .LP -->
Argument are specified by using the following structure:
<!-- .IN "ArgList" "" "@DEF@" -->
<!-- .IN "Arg" "" "@DEF@" -->
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .5i 1.5i -->
<!-- .ta .5i 1.5i -->
typedef struct {
	String name;
	XtArgVal value;
} Arg, *ArgList;
</literallayout>
</para>
<para>
<!-- .LP -->
The first approach is to statically initialize the argument list.
For example:
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .5i -->
<!-- .ta .5i -->
static Arg arglist[] = {
	{XtNwidth, (XtArgVal) 400},
	{XtNheight, (XtArgVal) 300},
};
</literallayout>
</para>
<para>
<!-- .LP -->
This approach is convenient for lists that do not need to be computed
at runtime and makes adding or deleting new elements easy.
The
<!-- .IN "XtNumber" -->
<function>XtNumber</function>
macro is used to compute the number of elements in the argument list,
preventing simple programming errors:
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
XtCreateWidget(<emphasis remap='I'>name</emphasis>, <emphasis remap='I'>class</emphasis>, <emphasis remap='I'>parent</emphasis>, <emphasis remap='I'>arglist</emphasis>, XtNumber(<emphasis remap='I'>arglist</emphasis>));
</literallayout>
<!-- .IN "XtSetArg" "" "@DEF@" -->
</para>
<para>
<!-- .LP -->
The second approach is to use the
<function>XtSetArg</function>
macro.
For example:
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .5i -->
<!-- .ta .5i -->
Arg arglist[10];
XtSetArg(arglist[1], XtNwidth, 400);
XtSetArg(arglist[2], XtNheight, 300);
</literallayout>
</para>
<para>
<!-- .LP -->
To make it easier to insert and delete entries,
you also can use a variable index:
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .5i -->
<!-- .ta .5i -->
Arg arglist[10];
Cardinal i=0;
XtSetArg(arglist[i], XtNwidth,  400);       i++;
XtSetArg(arglist[i], XtNheight, 300);       i++;
</literallayout>
</para>
<para>
<!-- .LP -->
The i variable can then be used as the argument list count in the widget
create function.
In this example,
<!-- .IN "XtNumber" -->
<function>XtNumber</function>
would return 10, not 2, and therefore is not useful.
<!-- .NT -->
You should not use auto-increment or auto-decrement
within the first argument to
<function>XtSetArg .</function>
As it is currently implemented,
<function>XtSetArg</function>
is a macro that dereferences the first argument twice.
<!-- .NE -->
</para>
<para>
<!-- .LP -->
The third approach is to individually set the elements of the
argument list array:
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .5i -->
<!-- .ta .5i -->
Arg arglist[10];
arglist[0].name  = XtNwidth;
arglist[0].value = (XtArgVal) 400;
arglist[1].name  = XtNheight;
arglist[1].value = (XtArgVal) 300;
</literallayout>
</para>
<para>
<!-- .LP -->
Note that in this example, as in the previous example,
<!-- .IN "XtNumber" -->
<function>XtNumber</function>
would return 10, not 2, and therefore would not be useful.
</para>
<para>
<!-- .LP -->
The fourth approach is to use a mixture of the first and third approaches:
you can statically define the argument list but modify some entries at runtime.
For example:
</para>
<para>
<!-- .LP -->
<literallayout class="monospaced">
<!-- .TA .5i -->
<!-- .ta .5i -->
static Arg arglist[] = {
	{XtNwidth, (XtArgVal) 400},
	{XtNheight, (XtArgVal) NULL},
};
arglist[1].value = (XtArgVal) 300;
</literallayout>
</para>
<para>
<!-- .LP -->
In this example,
<!-- .IN "XtNumber" -->
<function>XtNumber</function>
can be used, as in the first approach, for easier code maintenance.
</para>
</sect4>
</sect3>
</sect2>
<sect2 id="Example_Programs">
<title>Example Programs</title>
<!-- .XS -->
<!-- 	Example Programs -->
<!-- .XE -->
<!-- .IN "examples" -->
<para>
<!-- .LP -->
The best way to understand how to use any programming library is by
trying some simple examples.  A collection of example programs that
introduces each of the widgets in that Athena widget set, as well as many
important toolkit programming concepts, is available in the X11R5 contrib
release as distributed by the X Consortium.  It can be found in the
directory <filename>contrib/examples/Xaw</filename> in the archive
at <ulink url="http://www.x.org/releases/X11R5/contrib-1.tar.Z" />
See the <filename>README</filename> file from that directory for a guide
to the examples.
</para>
</sect2>
</sect1>
</chapter>