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
|
/*
* Motif
*
* Copyright (c) 1987-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these librararies and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
#ifdef REV_INFO
#ifndef lint
static char rcsid[] = "$TOG: RepType.c /main/17 1997/09/15 10:10:39 cshi $"
#endif
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "RepTypeI.h"
#include "MessagesI.h"
#include <Xm/XmosP.h> /* for (indirectly) atoi() */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "XmI.h"
#define MESSAGE0 _XmMMsgRepType_0000
#define MESSAGE1 _XmMMsgRepType_0001
#define MESSAGE2 _XmMMsgRepType_0002
/* INSTRUCTIONS to add a statically-stored representation type:
* (For dynamically allocated/created representation types, see the
* man page for XmRepTypeRegister).
*
* 1) Determine whether or not the numerical values of the representation
* type can be enumerated with consecutive numerical values beginning
* with value zero. If this is the case, continue with step 2).
*
* If this is not the case, the representation type needs an extra
* array in the data structure to map the numerical resource value to
* the array position of the value name in the representation type data
* structures. If the representation type must be mapped in this way,
* go to step 2M).
*
* 2) Define a static array of the names of the values for the
* representation type in RepType.c. Use the representation type name,
* plus the suffix "Names" for the name of the array (see existing name
* arrays for an example). The ordering of the value names in this
* array determines the numerical value of each name, beginning with
* zero and incrementing consecutively.
*
* 3) Add an enumeration symbol for the ID number of the representation
* type in the enum statement in the RepTypeI.h module.
* Keep the enum alphabetically sorted.
*
* Note: if the numerical value is int sized or will be put into an
* int sized field, then the ID number of representation type
* needs to also be added to the "special case for int
* sized fields" clause in the ConvertRepType function below.
*
* 4) Add an element to the static array of representation type data
* structures named "_XmStandardRepTypes". Use the same format as the
* other elements in the array; the fields which are initialized with
* FALSE and NULL should be the same for all elements of the array.
* Always add the new entry sorted in the array.
*
* 5) You're done. A generic "string to representation type" converter
* for the representation type that you just added will be automatically
* registered when all other Xm converters are registered.
*
******** For "mapped" representation types: ********
*
* 2M) Define a static array of the numerical values for the
* representation type in RepType.c. Use the enumerated symbols
* (generally defined in Xm.h) to initialize the array of numerical
* values. Use the representation type name, plus the suffix "Map"
* for the name of the array (see existing map arrays for an example).
*
* 3M) Go to 2).
*
*************************************************************************
*
* NOTE: We have decided to use the reptype mechanism for action parameter
* symbolic names. In order to capture the name of the widget class, the
* name of the action the parameters apply to and the fact that this reptype
* is for parameters to an action, the names tend to be rather long. This
* is a feature not a bug. Furthermore, we decided not to create new
* XmR types for each reptype which serves that purpose. To that end, I
* have hardcoded strings in the reptype table where the XmR value would
* normally go.
*/
/******** Static Function Declarations ********/
static String * CopyStringArray(
String *StrArray,
unsigned char NumEntries,
Boolean UppercaseFormat) ;
static void CopyRecord(
XmRepTypeEntry OutputEntry,
String rep_type_name,
String *value_names,
unsigned char *values,
unsigned char num_values,
Boolean reverse_installed,
XmRepTypeId rep_type_id,
Boolean copy_in) ;
static Boolean ValuesConsecutiveStartingAtZero(
unsigned char *values,
unsigned char num_values) ;
static XmRepTypeEntry GetRepTypeRecord(
XmRepTypeId rep_type_id) ;
static Boolean ConvertRepType(
Display *disp,
XrmValue *args,
Cardinal *n_args,
XrmValue *from,
XrmValue *to,
XtPointer *converter_data) ;
static Boolean ReverseConvertRepType(
Display *disp,
XrmValue *args,
Cardinal *n_args,
XrmValue *from,
XrmValue *to,
XtPointer *converter_data) ;
/******** End Static Function Declarations ********/
/*** For consistency with the enum and array declaration, keep these
declarations sorted. Put the map array right after the string
array if any. ***/
static XmConst char *XmConst AlignmentNames[] =
{ "alignment_beginning", "alignment_center", "alignment_end"
} ;
static XmConst char *XmConst AnimationStyleNames[] =
{ "drag_under_none", "drag_under_pixmap", "drag_under_shadow_in",
"drag_under_shadow_out", "drag_under_highlight"
};
static XmConst char *XmConst ArrowDirectionNames[] =
{ "arrow_up", "arrow_down", "arrow_left", "arrow_right"
} ;
static XmConst char *XmConst ArrowLayoutNames[] =
{
"arrows_end",
"arrows_beginning",
"arrows_split",
"arrows_flat_end",
"arrows_flat_beginning"
};
static XmConst char *XmConst ArrowOrientationNames[] =
{
"arrows_vertical",
"arrows_horizontal"
};
static XmConst char *XmConst ArrowSensitivityNames[] =
{
"arrows_insensitive", /* 0b000 */
"arrows_increment_sensitive", /* 0b001 */
"arrows_decrement_sensitive", /* 0b010 */
"arrows_sensitive", /* 0b011 */
"arrows_default_sensitivity" /* 0b100 Inherit */
};
static XmConst char *XmConst AttachmentNames[] =
{ "attach_none", "attach_form", "attach_opposite_form", "attach_widget",
"attach_opposite_widget", "attach_position", "attach_self"
} ;
static XmConst char *XmConst AudibleWarningNames[] =
{ "none", "bell"
} ;
static XmConst char *XmConst AutoDragModelNames[] =
{ "auto_drag_enabled", "auto_drag_disabled",
} ;
static XmConst char *XmConst AutomaticSelectionNames[] =
{ "no_auto_select", "auto_select",
XtEoff, XtEfalse, XtEno, "0",
XtEon, XtEtrue, XtEyes, "1"
} ;
static XmConst unsigned char AutomaticSelectionMap[] =
{ XmNO_AUTO_SELECT, XmAUTO_SELECT,
XmNO_AUTO_SELECT, XmNO_AUTO_SELECT, XmNO_AUTO_SELECT, XmNO_AUTO_SELECT,
XmAUTO_SELECT, XmAUTO_SELECT, XmAUTO_SELECT, XmAUTO_SELECT
} ;
static XmConst char *XmConst BindingTypeNames[] =
{ "none", "pixmap", "solid", "spiral", "pixmap_overlap_only"
} ;
static XmConst char *XmConst BitmapConversionModelNames[] =
{ "match_depth", "dynamic_depth"
} ;
static XmConst char *XmConst BlendModelNames[] =
{ "blend_all", "blend_state_source", "blend_just_source", "blend_none"
} ;
#define ChildHorizontalAlignmentNames AlignmentNames
static XmConst char *XmConst ChildPlacementNames[] =
{ "place_top", "place_above_selection", "place_below_selection"
} ;
static XmConst char *XmConst ChildTypeNames[] =
{ "frame_generic_child", "frame_workarea_child", "frame_title_child"
} ;
static XmConst char *XmConst ChildVerticalAlignmentNames[] =
{ "alignment_baseline_top", "alignment_center",
"alignment_baseline_bottom",
"alignment_widget_top", "alignment_widget_bottom",
"alignment_child_top", "alignment_child_bottom"
} ;
static XmConst unsigned char ChildVerticalAlignmentMap[] =
{ XmALIGNMENT_BASELINE_TOP, XmALIGNMENT_CENTER,
XmALIGNMENT_BASELINE_BOTTOM,
XmALIGNMENT_WIDGET_TOP, XmALIGNMENT_WIDGET_BOTTOM,
XmALIGNMENT_CHILD_TOP, XmALIGNMENT_CHILD_BOTTOM
} ;
static XmConst char *XmConst ComboBoxListActionActionParamNames[] =
{
"up", "down", "listprevpage", "listnextpage", "listbegindata",
"listenddata"
} ;
static XmConst char *XmConst ComboBoxTypeNames[] =
{ "combo_box", "drop_down_combo_box", "drop_down_list"
} ;
static XmConst char *XmConst CommandSelectionBoxUpOrDownActionParamNames[] =
{ "previous", "next", "first", "last"
} ;
static XmConst char *XmConst CommandWindowLocationNames[] =
{ "command_above_workspace", "command_below_workspace"
} ;
static XmConst char *XmConst ContainerCursorActionParamNames[] =
{
"left", "right", "up", "down", "first", "last"
} ;
static XmConst char *XmConst ContainerExpandCollapseActionParamNames[] =
{
"left", "right", "collapse", "expand"
} ;
static XmConst char *XmConst ContainerStartTransferActionParamNames[] =
{
"link", "move", "copy"
} ;
static XmConst char *XmConst DefaultButtonEmphasisNames[] =
{
"external_highlight", "internal_highlight"
} ;
static XmConst char *XmConst DefaultButtonTypeNames[] =
{ "dialog_none", "dialog_cancel_button", "dialog_ok_button",
"dialog_help_button"
} ;
static XmConst unsigned char DefaultButtonTypeMap[] =
{ XmDIALOG_NONE, XmDIALOG_CANCEL_BUTTON, XmDIALOG_OK_BUTTON,
XmDIALOG_HELP_BUTTON
} ;
static XmConst char *XmConst DeleteResponseNames[] =
{ "destroy", "unmap", "do_nothing"
} ;
static XmConst char *XmConst DialogStyleNames[] =
{ "dialog_modeless", "dialog_work_area", "dialog_primary_application_modal",
"dialog_application_modal", "dialog_full_application_modal",
"dialog_system_modal"
} ;
static XmConst unsigned char DialogStyleMap[] =
{ XmDIALOG_MODELESS, XmDIALOG_WORK_AREA, XmDIALOG_PRIMARY_APPLICATION_MODAL,
XmDIALOG_APPLICATION_MODAL, XmDIALOG_FULL_APPLICATION_MODAL,
XmDIALOG_SYSTEM_MODAL
} ;
static XmConst char *XmConst DialogTypeNames[] =
{ "dialog_template", "dialog_error", "dialog_information", "dialog_message",
"dialog_question", "dialog_warning", "dialog_working"
} ;
static XmConst char *XmConst DirectionNames[] =
{ "left_to_right", "right_to_left",
"left_to_right_top_to_bottom", "right_to_left_top_to_bottom",
"left_to_right_bottom_to_top", "right_to_left_bottom_to_top",
"top_to_bottom_left_to_right", "top_to_bottom_right_to_left",
"bottom_to_top_left_to_right", "bottom_to_top_right_to_left"
} ;
static XmConst unsigned char DirectionMap[] =
{ XmLEFT_TO_RIGHT, XmRIGHT_TO_LEFT,
XmLEFT_TO_RIGHT_TOP_TO_BOTTOM, XmRIGHT_TO_LEFT_TOP_TO_BOTTOM,
XmLEFT_TO_RIGHT_BOTTOM_TO_TOP, XmRIGHT_TO_LEFT_BOTTOM_TO_TOP,
XmTOP_TO_BOTTOM_LEFT_TO_RIGHT, XmTOP_TO_BOTTOM_RIGHT_TO_LEFT,
XmBOTTOM_TO_TOP_LEFT_TO_RIGHT, XmBOTTOM_TO_TOP_RIGHT_TO_LEFT
};
static XmConst char *XmConst DragInitiatorProtocolStyleNames[] =
{ "drag_none", "drag_drop_only", "drag_prefer_preregister",
"drag_preregister", "drag_prefer_dynamic", "drag_dynamic",
"drag_prefer_receiver"
};
static XmConst char *XmConst DragReceiverProtocolStyleNames[] =
{ "drag_none", "drag_drop_only", "drag_prefer_preregister",
"drag_preregister", "drag_prefer_dynamic", "drag_dynamic"
};
static XmConst char *XmConst DropSiteActivityNames[] =
{ "drop_site_active", "drop_site_inactive", "drop_site_ignore"
};
static XmConst char *XmConst DropSiteTypeNames[] =
{ "drop_site_simple", "drop_site_composite"
};
static XmConst char *XmConst EditModeNames[] =
{ "multi_line_edit", "single_line_edit"
} ;
static XmConst char *XmConst EnableBtn1Names[] =
{ XtEfalse, XtEtrue, XtEoff, "button2_adjust", "button2_transfer" };
static XmConst unsigned char EnableBtn1Map[] =
{ XmOFF, XmBUTTON2_ADJUST, XmOFF, XmBUTTON2_ADJUST, XmBUTTON2_TRANSFER };
static XmConst char *XmConst EnableWarpNames[] =
{ "enable_warp_on", "enable_warp_off",
} ;
static XmConst char *XmConst EntryViewTypeNames[] =
{ "large_icon", "small_icon", "any_icon"
} ;
static XmConst char *XmConst FileFilterStyleNames[] =
{ "filter_none", "filter_hidden_files"
} ;
static XmConst char *XmConst FileSelectionBoxUpOrDownActionParamNames[] =
{ "previous", "next", "first", "last"
} ;
static XmConst char *XmConst FileTypeMaskNames[] =
{ "file_directory", "file_regular", "file_any_type"
} ;
static XmConst unsigned char FileTypeMaskMap[] =
{ XmFILE_DIRECTORY, XmFILE_REGULAR, XmFILE_ANY_TYPE
} ;
static XmConst char *XmConst FontTypeNames[] =
{ "font_is_font", "font_is_fontset", "as_is", "font_is_xft"
} ;
static XmConst unsigned char FontTypeMap[] =
{ XmFONT_IS_FONT, XmFONT_IS_FONTSET, XmAS_IS, XmFONT_IS_XFT
} ;
static XmConst char *XmConst IconAttachmentNames[] =
{ "attach_north_west", "attach_north", "attach_north_east", "attach_east",
"attach_south_east", "attach_south", "attach_south_west", "attach_west",
"attach_center", "attach_hot"
} ;
static XmConst char *XmConst IndicatorOnNames[] =
{
"indicator_none", "indicator_fill", "indicator_box", "indicator_check",
"indicator_check_box", "indicator_cross", "indicator_cross_box",
XtEoff, XtEfalse, XtEno,
XtEon, XtEtrue, XtEyes
};
static XmConst unsigned char IndicatorOnMap[] =
{
XmINDICATOR_NONE, XmINDICATOR_FILL, XmINDICATOR_BOX, XmINDICATOR_CHECK,
XmINDICATOR_CHECK_BOX, XmINDICATOR_CROSS, XmINDICATOR_CROSS_BOX,
XmINDICATOR_NONE, XmINDICATOR_NONE, XmINDICATOR_NONE,
XmINDICATOR_FILL, XmINDICATOR_FILL, XmINDICATOR_FILL
};
static XmConst char *XmConst IndicatorTypeNames[] =
{ "n_of_many", "one_of_many", "one_of_many_round", "one_of_many_diamond"
} ;
static XmConst unsigned char IndicatorTypeMap[] =
{ XmN_OF_MANY, XmONE_OF_MANY, XmONE_OF_MANY_ROUND, XmONE_OF_MANY_DIAMOND
} ;
static XmConst char *XmConst InputPolicyNames[] =
{ "per_shell", "per_widget"
} ;
static XmConst char *XmConst KeyboardFocusPolicyNames[] =
{ "explicit", "pointer"
} ;
static XmConst char *XmConst LabelTypeNames[] =
{ "pixmap", "string", "pixmap_and_string"
} ;
static XmConst unsigned char LabelTypeMap[] =
{ XmPIXMAP, XmSTRING, XmPIXMAP_AND_STRING
} ;
static XmConst char *XmConst LayoutTypeNames[] =
{ "outline", "spatial", "detail"
} ;
static XmConst char *XmConst LineStyleNames[] =
{ "no_line", "single"
} ;
static XmConst char *XmConst LineTypeNames[] =
{ "no_line", "single_line", "double_line",
"single_dashed_line", "double_dashed_line", "as_is"
} ;
static XmConst unsigned char LineTypeMap[] =
{ XmNO_LINE, XmSINGLE_LINE, XmDOUBLE_LINE,
XmSINGLE_DASHED_LINE, XmDOUBLE_DASHED_LINE, XmAS_IS
} ;
static XmConst char *XmConst ListSizePolicyNames[] =
{ "variable", "constant", "resize_if_possible"
} ;
static XmConst char *XmConst LoadModelNames[] =
{ "load_deferred", "load_immediate", "as_is"
} ;
static XmConst unsigned char LoadModelMap[] =
{ XmLOAD_DEFERRED, XmLOAD_IMMEDIATE, XmAS_IS
} ;
static XmConst char *XmConst MatchBehaviorNames[] =
{ "none", "quick_navigate"
} ;
static XmConst char *XmConst MultiClickNames[] =
{ "multiclick_discard", "multiclick_keep"
} ;
static XmConst char *XmConst NavigationTypeNames[] =
{ "none", "tab_group", "sticky_tab_group", "exclusive_tab_group"
} ;
static XmConst char *XmConst NotebookChildTypeNames[] =
{ "none", "page", "major_tab", "minor_tab", "status_area", "page_scroller"
} ;
static XmConst char *XmConst NotebookTraverseTabActionParamNames[] =
{ "home", "end", "next", "previous"
} ;
static XmConst char *XmConst OrientationNames[] =
{ XtEvertical, XtEhorizontal
} ;
static XmConst unsigned char OrientationMap[] =
{ XmVERTICAL, XmHORIZONTAL
} ;
static XmConst char *XmConst OutlineButtonPolicyNames[] =
{ "outline_button_present", "outline_button_absent"
} ;
static XmConst char *XmConst OutlineStateNames[] =
{ "collapsed", "expanded"
} ;
static XmConst char *XmConst PackingNames[] =
{ "pack_tight", "pack_column", "pack_none"
} ;
static XmConst unsigned char PackingMap[] =
{ XmPACK_TIGHT, XmPACK_COLUMN, XmPACK_NONE
} ;
static XmConst char *XmConst PanedWindowSashActionParamNames[] =
{
"start", "move", "commit", "key"
};
static XmConst char *XmConst PanedWindowSashDirectionActionParamNames[] =
{
"up", "down", "right", "left", "first", "last"
};
static XmConst char *XmConst PanedWindowSashIncrementActionParamNames[] =
{
"defaultincr", "largeincr"
};
static XmConst char *XmConst PathModeNames[] =
{ "path_mode_full", "path_mode_relative"
} ;
static XmConst char *XmConst PositionModeNames[] =
{
"zero_based", "one_based"
};
static XmConst char *XmConst PositionTypeNames[] =
{
"position_index",
"position_value"
};
static XmConst char *XmConst PrimaryOwnershipNames[] =
{ "own_never", "own_always", "own_multiple", "own_possible_multiple"
} ;
static XmConst char *XmConst ProcessingDirectionNames[] =
{ "max_on_top", "max_on_bottom", "max_on_left", "max_on_right"
} ;
static XmConst char *XmConst ResizePolicyNames[] =
{ "resize_none", "resize_grow", "resize_any"
} ;
static XmConst char *XmConst RowColumnTypeNames[] =
{ "work_area", "menu_bar", "menu_pulldown", "menu_popup", "menu_option"
} ;
static XmConst char *XmConst ScrollBarDisplayPolicyNames[] =
{ "static", "as_needed"
} ;
static XmConst char *XmConst ScrollBarIncrementDownOrRightActionParamNames[] =
{ "down", "right"
} ;
static XmConst char *XmConst ScrollBarIncrementUpOrLeftActionParamNames[] =
{ "up", "left"
} ;
static XmConst char *XmConst ScrollBarPageDownOrRightActionParamNames[] =
{ "down", "right"
} ;
static XmConst char *XmConst ScrollBarPageUpOrLeftActionParamNames[] =
{ "up", "left"
} ;
static XmConst char *XmConst ScrollBarPlacementNames[] =
{ "bottom_right", "top_right", "bottom_left", "top_left"
} ;
/* NOTE: work_area, menu_bar and separator have to match the existing ones */
static XmConst char *XmConst ScrolledWindowChildTypeNames[] =
{ "work_area", "menu_bar",
"hor_scrollbar", "vert_scrollbar",
"command_window",
"separator", "message_window",
"scroll_hor", "scroll_vert", "no_scroll",
"clip_window", "generic_child"
} ;
static XmConst char *XmConst ScrollingPolicyNames[] =
{ "automatic", "application_defined"
} ;
static XmConst char *XmConst SelectionBoxUpOrDownActionParamNames[] =
{ "previous", "next", "first", "last"
} ;
static XmConst char *XmConst SelectionModeNames[] =
{ "normal_mode", "add_mode"
} ;
static XmConst char *XmConst SelectionPolicyNames[] =
{ "single_select", "multiple_select", "extended_select", "browse_select"
} ;
static XmConst char *XmConst SelectionTechniqueNames[] =
{ "marquee", "marquee_extend_start", "marquee_extend_both",
"touch_only", "touch_over"
} ;
static XmConst char *XmConst SelectionTypeNames[] =
{ "dialog_work_area", "dialog_prompt", "dialog_selection", "dialog_command",
"dialog_file_selection"
} ;
static XmConst char *XmConst SeparatorTypeNames[] =
{ "no_line", "single_line", "double_line", "single_dashed_line",
"double_dashed_line", "shadow_etched_in", "shadow_etched_out",
"shadow_etched_in_dash", "shadow_etched_out_dash"
} ;
static XmConst char *XmConst SetNames[] =
{ "unset", "set", "indeterminate",
XtEoff, XtEfalse, XtEno, "0",
XtEon, XtEtrue, XtEyes, "1"
} ;
static XmConst unsigned char SetMap[] =
{ XmUNSET, XmSET, XmINDETERMINATE,
XmUNSET, XmUNSET, XmUNSET, XmUNSET,
XmSET, XmSET, XmSET, XmSET
} ;
static XmConst char *XmConst ShadowTypeNames[] =
{ "shadow_etched_in", "shadow_etched_out", "shadow_in", "shadow_out"
} ;
static XmConst unsigned char ShadowTypeMap[] =
{ XmSHADOW_ETCHED_IN, XmSHADOW_ETCHED_OUT, XmSHADOW_IN, XmSHADOW_OUT
} ;
static XmConst char *XmConst ShowArrowsNames[] =
{ "each_side", XtEtrue, XtEyes, XtEon, "1",
"max_side", "min_side",
"none", XtEfalse, XtEno, XtEoff, "0"
} ;
static XmConst unsigned char ShowArrowsMap[] =
{ 1,1,1,1,1,
XmMAX_SIDE, XmMIN_SIDE,
0,0,0,0,0
} ;
static XmConst char *XmConst ShowValueNames[] =
{ "near_slider", XtEtrue, XtEyes, XtEon, "1",
"near_border",
"none", XtEfalse, XtEno, XtEoff, "0"
} ;
static XmConst unsigned char ShowValueMap[] =
{ 1,1,1,1,1,
XmNEAR_BORDER,
0,0,0,0,0
} ;
static XmConst char *XmConst SliderMarkNames[] =
{ "none", "etched_line", "thumb_mark", "round_mark"
} ;
static XmConst char *XmConst SliderVisualNames[] =
{ "background", "foreground", "trough_color", "shadowed_background"
} ;
static XmConst char *XmConst SlidingModeNames[] =
{ "slider", "thermometer",
} ;
static XmConst char *XmConst SpatialIncludeModelNames[] =
{ "append", "closest", "first_fit"
} ;
static XmConst char *XmConst SpatialResizeModelNames[] =
{ "grow_minor", "grow_major", "grow_balanced"
} ;
static XmConst char *XmConst SpatialSnapModelNames[] =
{ "none", "snap_to_grid", "center"
} ;
static XmConst char *XmConst SpatialStyleNames[] =
{ "none", "grid", "cells"
} ;
static XmConst char *XmConst SpinBoxChildTypeNames[] =
{
"string",
"numeric",
};
static XmConst unsigned char SpinBoxChildTypeMap[] =
{
(unsigned char) XmSTRING,
(unsigned char) XmNUMERIC,
};
static XmConst char *XmConst StringDirectionNames[] =
{ "string_direction_l_to_r", "string_direction_r_to_l"
} ;
static XmConst char *XmConst TearOffModelNames[] =
{ "tear_off_enabled", "tear_off_disabled"
} ;
static XmConst char *XmConst TextExtendMovementActionParamNames[] =
{ "extend"
} ;
static XmConst char *XmConst TextFieldExtendMovementActionParamNames[] =
{ "extend"
} ;
static XmConst char *XmConst TextFieldDirectionActionParamNames[] =
{ "right", "left"
} ;
static XmConst char *XmConst TextHorizontalDirectionActionParamNames[] =
{ "right", "left"
} ;
static XmConst char *XmConst TextVerticalDirectionActionParamNames[] =
{ "up", "down"
} ;
static XmConst char *XmConst ToggleModeNames[] =
{ "toggle_boolean", "toggle_indeterminate"
} ;
static XmConst char *XmConst UnitTypeNames[] =
{ "pixels", "100th_millimeters", "1000th_inches", "100th_points",
"100th_font_units", "inches", "centimeters", "millimeters",
"points", "font_units"
} ;
static XmConst char *XmConst UnpostBehaviorNames[] =
{ "unpost", "unpost_and_replay"
} ;
static XmConst char *XmConst VerticalAlignmentNames[] =
{ "alignment_baseline_top", "alignment_center", "alignment_baseline_bottom",
"alignment_contents_top", "alignment_contents_bottom"
} ;
static XmConst char *XmConst ViewTypeNames[] =
{ "large_icon", "small_icon"
} ;
static XmConst char *XmConst VisualEmphasisNames[] =
{ "selected", "not_selected"
};
static XmConst char *XmConst VisualPolicyNames[] =
{ "variable", "constant"
} ;
static XmConst char *XmConst WhichButtonNames[] =
{ "button1", "1", "button2", "2", "button3", "3", "button4", "4",
"button5", "5"
} ;
static XmConst unsigned char WhichButtonMap[] =
{ Button1, Button1, Button2, Button2, Button3, Button3, Button4, Button4,
Button5, Button5
} ;
static XmConst char *XmConst PixmapPlacementNames[] =
{ "top", "bottom", "left", "right"
} ;
static XmConst unsigned char PixmapPlacementMap[] =
{ XmPIXMAP_TOP, XmPIXMAP_BOTTOM, XmPIXMAP_LEFT, XmPIXMAP_RIGHT
} ;
/* Note that this array does not initialize rep_type_id fields,
* for this field is useless. It always matches the index of the
* entry in the array. We have to keep the field since the structure
* is public. For the API, rep_type_id is set on query.
*/
static XmRepTypeEntryRec StandardRepTypes[] = {
{
XmRAlignment, (String*)AlignmentNames, NULL,
XtNumber(AlignmentNames), FALSE,
},
{
XmRAnimationStyle, (String*)AnimationStyleNames, NULL,
XtNumber(AnimationStyleNames), FALSE,
},
{
XmRArrowDirection, (String*)ArrowDirectionNames, NULL,
XtNumber(ArrowDirectionNames), FALSE,
},
{
XmRArrowLayout, (String*)ArrowLayoutNames, NULL,
XtNumber(ArrowLayoutNames), FALSE,
},
{
XmRArrowOrientation, (String*)ArrowOrientationNames, NULL,
XtNumber(ArrowOrientationNames), FALSE,
},
{
XmRArrowSensitivity, (String*)ArrowSensitivityNames, NULL,
XtNumber(ArrowSensitivityNames), FALSE,
},
{
XmRAttachment, (String*)AttachmentNames, NULL,
XtNumber(AttachmentNames), FALSE,
},
{
XmRAudibleWarning, (String*)AudibleWarningNames, NULL,
XtNumber(AudibleWarningNames), FALSE,
},
{
XmRAutoDragModel, (String*)AutoDragModelNames, NULL,
XtNumber(AutoDragModelNames), FALSE,
},
{
XmRAutomaticSelection, (String*)AutomaticSelectionNames,
(unsigned char *)AutomaticSelectionMap,
XtNumber(AutomaticSelectionNames), FALSE,
},
{
XmRBindingType, (String*)BindingTypeNames, NULL,
XtNumber(BindingTypeNames), FALSE,
},
{
XmRBitmapConversionModel, (String*)BitmapConversionModelNames, NULL,
XtNumber(BitmapConversionModelNames), FALSE,
},
{
XmRBlendModel, (String*)BlendModelNames, NULL,
XtNumber(BlendModelNames), FALSE,
},
{
XmRChildHorizontalAlignment, (String*)ChildHorizontalAlignmentNames, NULL,
XtNumber(ChildHorizontalAlignmentNames), FALSE,
},
{
XmRChildPlacement, (String*)ChildPlacementNames, NULL,
XtNumber(ChildPlacementNames), FALSE,
},
{
XmRChildType, (String*)ChildTypeNames, NULL,
XtNumber(ChildTypeNames), FALSE,
},
{
XmRChildVerticalAlignment, (String*)ChildVerticalAlignmentNames,
(unsigned char *)ChildVerticalAlignmentMap,
XtNumber(ChildVerticalAlignmentNames), FALSE,
},
{
"ComboBoxListActionActionParam", /* See instructions above. */
(String*)ComboBoxListActionActionParamNames, NULL,
XtNumber(ComboBoxListActionActionParamNames), TRUE,
},
{
XmRComboBoxType, (String*)ComboBoxTypeNames, NULL,
XtNumber(ComboBoxTypeNames), FALSE,
},
{
"CommandSelectionBoxUpOrDownActionParam",
(String*)CommandSelectionBoxUpOrDownActionParamNames, NULL,
XtNumber(CommandSelectionBoxUpOrDownActionParamNames), TRUE,
},
{
XmRCommandWindowLocation, (String*)CommandWindowLocationNames, NULL,
XtNumber(CommandWindowLocationNames), FALSE,
},
{
"ContainerCursorActionParam", /* See instructions above. */
(String*)ContainerCursorActionParamNames,
NULL, XtNumber(ContainerCursorActionParamNames), TRUE,
},
{
"ContainerExpandCollapseActionParamName", /* See instructions above. */
(String*)ContainerExpandCollapseActionParamNames,
NULL, XtNumber(ContainerExpandCollapseActionParamNames), TRUE,
},
{
"ContainerStartTransferActionParam", /* See instructions above. */
(String*)ContainerStartTransferActionParamNames,
NULL, XtNumber(ContainerStartTransferActionParamNames), TRUE,
},
{
XmRDefaultButtonEmphasis, (String*)DefaultButtonEmphasisNames, NULL,
XtNumber(DefaultButtonEmphasisNames), FALSE,
},
{
XmRDefaultButtonType, (String*)DefaultButtonTypeNames,
(unsigned char *)DefaultButtonTypeMap,
XtNumber(DefaultButtonTypeNames), FALSE,
},
{
XmRDeleteResponse, (String*)DeleteResponseNames, NULL,
XtNumber(DeleteResponseNames), FALSE,
},
{
XmRDialogStyle, (String*)DialogStyleNames, (unsigned char *)DialogStyleMap,
XtNumber(DialogStyleNames), FALSE,
},
{
XmRDialogType, (String*)DialogTypeNames, NULL,
XtNumber(DialogTypeNames), FALSE,
},
{
XmRDirection, (String*)DirectionNames, (unsigned char *)DirectionMap,
XtNumber(DirectionNames), FALSE,
},
{
XmRDragInitiatorProtocolStyle, (String*)DragInitiatorProtocolStyleNames, NULL,
XtNumber(DragInitiatorProtocolStyleNames), FALSE,
},
{
XmRDragReceiverProtocolStyle, (String*)DragReceiverProtocolStyleNames, NULL,
XtNumber(DragReceiverProtocolStyleNames), FALSE,
},
{
XmRDropSiteActivity, (String*)DropSiteActivityNames, NULL,
XtNumber(DropSiteActivityNames), FALSE,
},
{
XmRDropSiteType, (String*)DropSiteTypeNames, NULL,
XtNumber(DropSiteTypeNames), FALSE,
},
{
XmREditMode, (String*)EditModeNames, NULL,
XtNumber(EditModeNames), FALSE,
},
{
XmREnableBtn1Transfer, (String*)EnableBtn1Names,
(unsigned char *) EnableBtn1Map,
XtNumber(EnableBtn1Names), FALSE
},
{
XmREnableWarp, (String*)EnableWarpNames, NULL,
XtNumber(EnableWarpNames), FALSE,
},
{
XmREntryViewType, (String*)EntryViewTypeNames, NULL,
XtNumber(EntryViewTypeNames), FALSE,
},
{
XmRFileFilterStyle, (String*)FileFilterStyleNames, NULL,
XtNumber(FileFilterStyleNames), FALSE,
},
{
"FileSelectionBoxUpOrDownActionParam", /* See instructions above. */
(String*)FileSelectionBoxUpOrDownActionParamNames,
NULL, XtNumber(FileSelectionBoxUpOrDownActionParamNames), TRUE,
},
{
XmRFileTypeMask, (String*)FileTypeMaskNames,
(unsigned char *)FileTypeMaskMap,
XtNumber(FileTypeMaskNames), FALSE,
},
{
XmRFontType, (String*)FontTypeNames, (unsigned char *)FontTypeMap,
XtNumber(FontTypeNames), FALSE,
},
{
XmRIconAttachment, (String*)IconAttachmentNames, NULL,
XtNumber(IconAttachmentNames), FALSE,
},
{
XmRIndicatorOn, (String*)IndicatorOnNames, (unsigned char *)IndicatorOnMap,
XtNumber(IndicatorOnNames), FALSE,
},
{
XmRIndicatorType, (String*)IndicatorTypeNames,
(unsigned char *)IndicatorTypeMap,
XtNumber(IndicatorTypeNames), FALSE,
},
{
XmRInputPolicy, (String*)InputPolicyNames, NULL,
XtNumber(InputPolicyNames), FALSE,
},
{
XmRKeyboardFocusPolicy, (String*)KeyboardFocusPolicyNames, NULL,
XtNumber(KeyboardFocusPolicyNames), FALSE,
},
{
XmRLabelType, (String*)LabelTypeNames, (unsigned char *)LabelTypeMap,
XtNumber(LabelTypeNames), FALSE,
},
{
XmRLayoutType, (String*)LayoutTypeNames, NULL,
XtNumber(LayoutTypeNames), FALSE,
},
{
XmRLineStyle, (String*)LineStyleNames, NULL,
XtNumber(LineStyleNames), FALSE,
},
{
XmRLineType, (String*)LineTypeNames, (unsigned char *)LineTypeMap,
XtNumber(LineTypeNames), FALSE,
},
{
XmRListSizePolicy, (String*)ListSizePolicyNames, NULL,
XtNumber(ListSizePolicyNames), FALSE,
},
{
XmRLoadModel, (String*)LoadModelNames, (unsigned char *)LoadModelMap,
XtNumber(LoadModelNames), FALSE,
},
{
XmRMatchBehavior, (String*)MatchBehaviorNames, NULL,
XtNumber(MatchBehaviorNames), FALSE,
},
{
XmRMultiClick, (String*)MultiClickNames, NULL,
XtNumber(MultiClickNames), FALSE,
},
{
XmRNavigationType, (String*)NavigationTypeNames, NULL,
XtNumber(NavigationTypeNames), FALSE,
},
{
XmRNotebookChildType, (String*)NotebookChildTypeNames, NULL,
XtNumber(NotebookChildTypeNames), FALSE,
},
{
"NotebookTraverseTabActionParam", /* See instructions above. */
(String*)NotebookTraverseTabActionParamNames, NULL,
XtNumber(NotebookTraverseTabActionParamNames ), TRUE,
},
{
XmROrientation, (String*)OrientationNames, (unsigned char *)OrientationMap,
XtNumber(OrientationNames), FALSE,
},
{
XmROutlineButtonPolicy, (String*)OutlineButtonPolicyNames, NULL,
XtNumber(OutlineButtonPolicyNames), FALSE,
},
{
XmROutlineState, (String*)OutlineStateNames, NULL,
XtNumber(OutlineStateNames), FALSE,
},
{
XmRPacking, (String*)PackingNames, (unsigned char *)PackingMap,
XtNumber(PackingNames), FALSE,
},
{
"PanedWindowSashActionParam", /* See instructions above. */
(String*)PanedWindowSashActionParamNames, NULL,
XtNumber(PanedWindowSashActionParamNames ), TRUE,
},
{
"PanedWindowSashDirectionActionParam", /* See instructions above. */
(String*)PanedWindowSashDirectionActionParamNames, NULL,
XtNumber(PanedWindowSashDirectionActionParamNames ), TRUE,
},
{
"PanedWindowSashIncrementActionParam", /* See instructions above. */
(String*)PanedWindowSashIncrementActionParamNames, NULL,
XtNumber(PanedWindowSashIncrementActionParamNames ), TRUE,
},
{
XmRPathMode, (String*)PathModeNames, NULL,
XtNumber(PathModeNames), FALSE,
},
{
XmRPositionMode, (String*)PositionModeNames, NULL,
XtNumber(PositionModeNames), FALSE,
},
{
XmRPositionType, (String*)PositionTypeNames, NULL,
XtNumber(PositionTypeNames), FALSE,
},
{
XmRPrimaryOwnership, (String*)PrimaryOwnershipNames, NULL,
XtNumber(PrimaryOwnershipNames), FALSE,
},
{
XmRProcessingDirection, (String*)ProcessingDirectionNames, NULL,
XtNumber(ProcessingDirectionNames), FALSE,
},
{
XmRResizePolicy, (String*)ResizePolicyNames, NULL,
XtNumber(ResizePolicyNames), FALSE,
},
{
XmRRowColumnType, (String*)RowColumnTypeNames, NULL,
XtNumber(RowColumnTypeNames), FALSE,
},
{
XmRScrollBarDisplayPolicy, (String*)ScrollBarDisplayPolicyNames, NULL,
XtNumber(ScrollBarDisplayPolicyNames), FALSE,
},
{
"ScrollBarIncrementDownOrRightActionParam", /* See instructions above. */
(String*)ScrollBarIncrementDownOrRightActionParamNames,
NULL, XtNumber(ScrollBarIncrementDownOrRightActionParamNames), TRUE,
},
{
"ScrollBarIncrementUpOrLeftActionParam", /* See instructions above. */
(String*)ScrollBarIncrementUpOrLeftActionParamNames,
NULL, XtNumber(ScrollBarIncrementUpOrLeftActionParamNames), TRUE,
},
{
"ScrollBarPageDownOrRightActionParam", /* See instructions above. */
(String*)ScrollBarPageDownOrRightActionParamNames,
NULL, XtNumber(ScrollBarPageDownOrRightActionParamNames), TRUE,
},
{
"ScrollBarPageUpOrLeftActionParam", /* See instructions above. */
(String*)ScrollBarPageUpOrLeftActionParamNames,
NULL, XtNumber(ScrollBarPageUpOrLeftActionParamNames), TRUE,
},
{
XmRScrollBarPlacement, (String*)ScrollBarPlacementNames, NULL,
XtNumber(ScrollBarPlacementNames), FALSE,
},
{
XmRScrolledWindowChildType, (String*)ScrolledWindowChildTypeNames, NULL,
XtNumber(ScrolledWindowChildTypeNames), FALSE,
},
{
XmRScrollingPolicy, (String*)ScrollingPolicyNames, NULL,
XtNumber(ScrollingPolicyNames), FALSE,
},
{
"SelectionBoxUpOrDownActionParam", /* See instructions above. */
(String*)SelectionBoxUpOrDownActionParamNames,
NULL, XtNumber(SelectionBoxUpOrDownActionParamNames), TRUE,
},
{
XmRSelectionMode, (String*)SelectionModeNames, NULL,
XtNumber(SelectionModeNames), FALSE,
},
{
XmRSelectionPolicy, (String*)SelectionPolicyNames, NULL,
XtNumber(SelectionPolicyNames), FALSE,
},
{
XmRSelectionTechnique, (String*)SelectionTechniqueNames, NULL,
XtNumber(SelectionTechniqueNames), FALSE,
},
{
XmRSelectionType, (String*)SelectionTypeNames, NULL,
XtNumber(SelectionTypeNames), FALSE,
},
{
XmRSeparatorType, (String*)SeparatorTypeNames, NULL,
XtNumber(SeparatorTypeNames), FALSE,
},
{
XmRSet, (String*)SetNames, (unsigned char *)SetMap,
XtNumber(SetNames), FALSE,
},
{
XmRShadowType, (String*)ShadowTypeNames, (unsigned char *)ShadowTypeMap,
XtNumber(ShadowTypeNames), FALSE,
},
{
XmRShowArrows, (String*)ShowArrowsNames, (unsigned char *)ShowArrowsMap,
XtNumber(ShowArrowsNames), FALSE,
},
{
XmRShowValue, (String*)ShowValueNames, (unsigned char *)ShowValueMap,
XtNumber(ShowValueNames), FALSE,
},
{
XmRSliderMark, (String*)SliderMarkNames, NULL,
XtNumber(SliderMarkNames), FALSE,
},
{
XmRSliderVisual, (String*)SliderVisualNames, NULL,
XtNumber(SliderVisualNames), FALSE,
},
{
XmRSlidingMode, (String*)SlidingModeNames, NULL,
XtNumber(SlidingModeNames), FALSE,
},
{
XmRSpatialIncludeModel, (String*)SpatialIncludeModelNames, NULL,
XtNumber(SpatialIncludeModelNames), FALSE,
},
{
XmRSpatialResizeModel, (String*)SpatialResizeModelNames, NULL,
XtNumber(SpatialResizeModelNames), FALSE,
},
{
XmRSpatialSnapModel, (String*)SpatialSnapModelNames, NULL,
XtNumber(SpatialSnapModelNames), FALSE,
},
{
XmRSpatialStyle, (String*)SpatialStyleNames, NULL,
XtNumber(SpatialStyleNames), FALSE,
},
{
XmRSpinBoxChildType, (String*)SpinBoxChildTypeNames,
(unsigned char *)SpinBoxChildTypeMap,
XtNumber(SpinBoxChildTypeNames), FALSE,
},
{
XmRStringDirection, (String*)StringDirectionNames, NULL,
XtNumber(StringDirectionNames), FALSE,
},
{
XmRTearOffModel, (String*)TearOffModelNames, NULL,
XtNumber(TearOffModelNames), FALSE,
},
{
"TextExtendMovementActionParam", /* See instructions above. */
(String*)TextExtendMovementActionParamNames, NULL,
XtNumber(TextExtendMovementActionParamNames ), TRUE,
},
{
"TextFieldDirectionActionParam", /* See instructions above. */
(String*)TextFieldDirectionActionParamNames, NULL,
XtNumber(TextFieldDirectionActionParamNames ), TRUE,
},
{
"TextFieldExtendMovementActionParam", /* See instructions above. */
(String*)TextFieldExtendMovementActionParamNames, NULL,
XtNumber(TextFieldExtendMovementActionParamNames ), FALSE,
},
{
"TextHorizontalDirectionActionParam", /* See instructions above. */
(String*)TextHorizontalDirectionActionParamNames, NULL,
XtNumber(TextHorizontalDirectionActionParamNames ), TRUE,
},
{
"TextVerticalDirectionActionParam", /* See instructions above. */
(String*)TextVerticalDirectionActionParamNames, NULL,
XtNumber(TextVerticalDirectionActionParamNames ), TRUE,
},
{
XmRToggleMode, (String*)ToggleModeNames, NULL,
XtNumber(ToggleModeNames), FALSE,
},
{
XmRUnitType, (String*)UnitTypeNames, NULL,
XtNumber(UnitTypeNames), FALSE,
},
{
XmRUnpostBehavior, (String*)UnpostBehaviorNames, NULL,
XtNumber(UnpostBehaviorNames), FALSE,
},
{
XmRVerticalAlignment, (String*)VerticalAlignmentNames, NULL,
XtNumber(VerticalAlignmentNames), FALSE,
},
{
XmRViewType, (String*)ViewTypeNames, NULL,
XtNumber(ViewTypeNames), FALSE,
},
{
XmRVisualEmphasis, (String*)VisualEmphasisNames, NULL,
XtNumber(VisualEmphasisNames), FALSE,
},
{
XmRVisualPolicy, (String*)VisualPolicyNames, NULL,
XtNumber(VisualPolicyNames), FALSE,
},
{
XmRWhichButton, (String*)WhichButtonNames, (unsigned char *)WhichButtonMap,
XtNumber(WhichButtonNames), FALSE,
},
{
XmRPixmapPlacement, (String*)PixmapPlacementNames, (unsigned char *)PixmapPlacementMap,
XtNumber(PixmapPlacementNames), FALSE,
}
} ;
static XmConst Cardinal StandardNumRecs = XtNumber( StandardRepTypes );
static XmRepTypeEntryRec *DynamicRepTypes = NULL;
static Cardinal DynamicRepTypeNumRecords = 0;
static String *
CopyStringArray(
String *StrArray,
unsigned char NumEntries,
Boolean UppercaseFormat)
{
unsigned int Index ;
String * TmpStr ;
int PrefixSize = 0 ;
TmpStr = (String *) XtMalloc((NumEntries + 1) * sizeof(String));
TmpStr[NumEntries] = NULL ;
if (UppercaseFormat) PrefixSize = 2 ;
Index = 0 ;
while(Index < NumEntries)
{
TmpStr[Index] = XtMalloc(PrefixSize + strlen(StrArray[Index]) + 1);
strcpy(TmpStr[Index] + PrefixSize, StrArray[Index]);
Index ++ ;
}
if (UppercaseFormat) {
Index = 0 ;
while( Index < NumEntries)
{
Cardinal i ;
TmpStr[Index][0] = 'X' ;
TmpStr[Index][1] = 'm' ;
i = 2 ;
while (TmpStr[Index][i]) {
if (islower(TmpStr[Index][i]))
TmpStr[Index][i] = toupper(TmpStr[Index][i]);
i++;
}
++Index ;
}
}
return( TmpStr) ;
}
static void
CopyRecord(
XmRepTypeEntry OutputEntry,
String rep_type_name,
String *value_names,
unsigned char *values,
unsigned char num_values,
Boolean reverse_installed,
XmRepTypeId rep_type_id,
Boolean copy_in)
{
OutputEntry->rep_type_name = XtNewString(rep_type_name) ;
OutputEntry->value_names = CopyStringArray(value_names, num_values,
False);
/* only when the record is copied out to the app we want to
create a array of consecutive values */
if (values || !copy_in)
OutputEntry->values = (unsigned char *)
XtMalloc(sizeof(unsigned char)*num_values);
else
OutputEntry->values = NULL;
if (values) {
memcpy(OutputEntry->values, values, (size_t)num_values);
} else if (!copy_in) {
Cardinal i ;
for (i=0; i<num_values;i++) OutputEntry->values[i] = i ;
}
OutputEntry->num_values = num_values ;
OutputEntry->reverse_installed = reverse_installed ;
OutputEntry->rep_type_id = rep_type_id ;
}
static Boolean
ValuesConsecutiveStartingAtZero(
unsigned char *values,
unsigned char num_values)
{
if( values )
{ while( num_values-- )
{ if( num_values != values[num_values] )
{ return( FALSE) ;
}
}
}
return( TRUE) ;
}
static XmRepTypeEntry
GetRepTypeRecord(
XmRepTypeId rep_type_id)
{
if (rep_type_id < StandardNumRecs) {
return (XmRepTypeEntry) &StandardRepTypes[rep_type_id];
}
if (rep_type_id < DynamicRepTypeNumRecords + StandardNumRecs) {
return &DynamicRepTypes[rep_type_id - StandardNumRecs];
}
return (XmRepTypeEntry)NULL ;
}
XmRepTypeId
XmRepTypeRegister(
String rep_type_name,
String *value_names,
unsigned char *values,
#if NeedWidePrototypes
unsigned int num_values)
#else
unsigned char num_values)
#endif /* NeedWidePrototypes */
{
XmRepTypeEntry NewRecord ;
XtConvertArgRec convertArg;
XmRepTypeId reptype_id;
if (!num_values || !rep_type_name || !value_names)
return( XmREP_TYPE_INVALID) ;
_XmProcessLock();
/** expand the dynamic table */
DynamicRepTypes = (XmRepTypeList)
XtRealloc( (char *) DynamicRepTypes, (sizeof(XmRepTypeEntryRec)
* (DynamicRepTypeNumRecords + 1))) ;
/** fill in the new record */
NewRecord = &DynamicRepTypes[DynamicRepTypeNumRecords] ;
/* the new reptype ID values are located after the standard ones */
CopyRecord(NewRecord,
rep_type_name, value_names,
(ValuesConsecutiveStartingAtZero( values, num_values)) ?
NULL:values,
num_values, False,
DynamicRepTypeNumRecords + StandardNumRecs,
True);
/** register the converter to Xt */
convertArg.address_mode = XtImmediate;
convertArg.address_id = (XPointer)(long)NewRecord->rep_type_id;
convertArg.size = sizeof(convertArg.address_id);
XtSetTypeConverter( XmRString, NewRecord->rep_type_name, ConvertRepType,
&convertArg, 1, XtCacheNone, NULL) ;
DynamicRepTypeNumRecords++ ;
reptype_id = NewRecord->rep_type_id;
_XmProcessUnlock();
/*XmRepTypeAddReverse(reptype_id);*/
return reptype_id;
}
void
XmRepTypeAddReverse(
#if NeedWidePrototypes
int rep_type_id)
#else
XmRepTypeId rep_type_id)
#endif
{
XtConvertArgRec convertArg;
XmRepTypeEntry Record;
_XmProcessLock();
Record = GetRepTypeRecord( rep_type_id);
if( Record && !Record->reverse_installed )
{
convertArg.address_mode = XtImmediate;
convertArg.address_id = (XPointer)(long)rep_type_id;
convertArg.size = sizeof(convertArg.address_id);
XtSetTypeConverter( Record->rep_type_name, XmRString,
ReverseConvertRepType, &convertArg,
1, XtCacheNone, NULL) ;
Record->reverse_installed = TRUE ;
}
_XmProcessUnlock();
return ;
}
Boolean
XmRepTypeValidValue(
#if NeedWidePrototypes
int rep_type_id,
unsigned int test_value,
#else
XmRepTypeId rep_type_id,
unsigned char test_value,
#endif
Widget enable_default_warning)
{
XmRepTypeEntry Record;
_XmProcessLock();
Record = GetRepTypeRecord( rep_type_id);
if (!Record) {
_XmProcessUnlock();
if (enable_default_warning) {
XmeWarning(enable_default_warning, MESSAGE1);
}
return FALSE;
} else {
if (Record->values) {
unsigned int Index;
for (Index=0; Index < Record->num_values; Index++ ) {
if (Record->values[Index] == test_value) {
_XmProcessUnlock();
return(TRUE) ;
}
}
} else if (test_value < Record->num_values) {
_XmProcessUnlock();
return (TRUE) ;
}
if (enable_default_warning) {
char *params[2];
params[0] = (char *)(long)test_value;
params[1] = Record->rep_type_name;
_XmProcessUnlock();
_XmWarningMsg(enable_default_warning, "illegalRepTypeValue",
MESSAGE2, params, 2) ;
return FALSE;
}
}
_XmProcessUnlock();
return FALSE ;
}
XmRepTypeList
XmRepTypeGetRegistered( void )
{
unsigned int TotalEntries ;
XmRepTypeList OutputList ;
unsigned int Index ;
/* Total up the data sizes of the static and run-time lists. */
_XmProcessLock();
TotalEntries = StandardNumRecs + DynamicRepTypeNumRecords ;
OutputList = (XmRepTypeList)
XtMalloc((TotalEntries + 1) * sizeof(XmRepTypeEntryRec)) ;
for ( Index = 0; Index < StandardNumRecs; Index++ )
{
XmRepTypeEntry Record = (XmRepTypeEntry) &(StandardRepTypes[Index]);
CopyRecord(&(OutputList[Index]),
Record->rep_type_name, Record->value_names,
Record->values, Record->num_values,
Record->reverse_installed, Index,
False) ;
}
for ( Index = 0; Index < DynamicRepTypeNumRecords; Index++ )
{
XmRepTypeEntry Record = &(DynamicRepTypes[Index]) ;
CopyRecord(&(OutputList[StandardNumRecs + Index]),
Record->rep_type_name, Record->value_names,
Record->values, Record->num_values,
Record->reverse_installed, Index + StandardNumRecs,
False) ;
}
OutputList[TotalEntries].rep_type_name = NULL ;
_XmProcessUnlock();
return(OutputList) ;
}
XmRepTypeEntry
XmRepTypeGetRecord(
#if NeedWidePrototypes
int rep_type_id)
#else
XmRepTypeId rep_type_id)
#endif
{
XmRepTypeEntry Record;
XmRepTypeEntry OutputRecord ;
_XmProcessLock();
Record = GetRepTypeRecord( rep_type_id);
if( Record )
{
OutputRecord = (XmRepTypeEntry)
XtMalloc(sizeof( XmRepTypeEntryRec)) ;
CopyRecord(OutputRecord,
Record->rep_type_name, Record->value_names,
Record->values, Record->num_values,
Record->reverse_installed, rep_type_id,
False) ;
_XmProcessUnlock();
return( OutputRecord) ;
}
_XmProcessUnlock();
return( NULL) ;
}
XmRepTypeId
XmRepTypeGetId(
String rep_type_name)
{
Cardinal Index ;
_XmProcessLock();
/* First look in the statically defined lists */
/* Just an ordered search, could do better, but this routine
is probably not be worth it */
for ( Index = 0; Index < StandardNumRecs ; Index++ ) {
int compare_name = strcmp(rep_type_name,
StandardRepTypes[Index].rep_type_name ) ;
if(compare_name == 0) {
_XmProcessUnlock();
return Index;
}
else if (compare_name < 0) break ;
}
/* Not in the static list; look in the run-time list. */
/* This one is not ordered: have to go thru */
for ( Index = 0; Index < DynamicRepTypeNumRecords; Index++ ) {
if( !strcmp( rep_type_name,
DynamicRepTypes[Index].rep_type_name )) {
_XmProcessUnlock();
return Index + StandardNumRecs ;
}
}
_XmProcessUnlock();
return( XmREP_TYPE_INVALID) ;
}
String *
XmRepTypeGetNameList(
#if NeedWidePrototypes
int rep_type_id,
int use_uppercase_format)
#else
XmRepTypeId rep_type_id,
Boolean use_uppercase_format)
#endif /* NeedWidePrototypes */
{
XmRepTypeEntry Record;
String *name_list = NULL;
_XmProcessLock();
Record = GetRepTypeRecord( rep_type_id);
if(Record) {
name_list = CopyStringArray(Record->value_names, Record->num_values,
use_uppercase_format);
}
_XmProcessUnlock();
return name_list;
}
/*ARGSUSED*/
static Boolean
ConvertRepType(
Display *disp,
XrmValue *args,
Cardinal *n_args, /* unused */
XrmValue *from,
XrmValue *to,
XtPointer *converter_data) /* unused */
{
char *in_str = (char *) (from->addr) ;
XtPointer argvalue = *((XtPointer*)args[0].addr);
XmRepTypeId RepTypeID = (XmRepTypeId)(long)argvalue;
XmRepTypeEntry Record;
Cardinal Index = 0 ;
_XmProcessLock();
Record = GetRepTypeRecord( RepTypeID);
while(Index < Record->num_values) {
if(XmeNamesAreEqual( in_str, Record->value_names[Index])) {
if ((RepTypeID == XmRID_EDIT_MODE) ||
(RepTypeID == XmRID_WHICH_BUTTON) ||
(RepTypeID == XmRID_FONT_TYPE))
{
/* special case for int sized fields */
int conversion_buffer ;
conversion_buffer = (int)
((Record->values) ? Record->values[Index] : Index) ;
_XmProcessUnlock();
_XM_CONVERTER_DONE (to, int, conversion_buffer, ;)
} else {
unsigned char conversion_buffer ;
conversion_buffer = (unsigned char)
((Record->values) ? Record->values[Index] : Index) ;
_XmProcessUnlock();
_XM_CONVERTER_DONE (to, unsigned char, conversion_buffer, ;)
}
}
++Index ;
}
_XmProcessUnlock();
XtDisplayStringConversionWarning( disp, in_str, Record->rep_type_name);
return( FALSE) ;
}
/*ARGSUSED*/
static Boolean
ReverseConvertRepType(
Display *disp,
XrmValue *args,
Cardinal *n_args, /* unused */
XrmValue *from,
XrmValue *to,
XtPointer *converter_data) /* unused */
{
XtPointer argvalue = *(XtPointer *)args[0].addr;
XmRepTypeId RepTypeID = (XmRepTypeId)(long)argvalue;
XmRepTypeEntry Record;
unsigned char in_value = *(unsigned char *) from->addr ;
unsigned short NumValues;
char **OutValue = NULL ;
String in_str ;
String reverse_message = MESSAGE0 ;
_XmProcessLock();
Record = GetRepTypeRecord( RepTypeID);
NumValues = Record->num_values;
if(Record->values) { /* mapped type */
unsigned short Index = 0 ;
while(Index < NumValues ) {
if(in_value == Record->values[Index] )
{
OutValue = (char **) &Record->value_names[Index] ;
break ;
}
++Index ;
}
} else {
if( in_value < NumValues )
{
OutValue = (char **) &Record->value_names[in_value] ;
}
}
_XmProcessUnlock();
#if 0
if (OutValue) _XM_CONVERTER_DONE (to, String, *OutValue, ;)
#else
if (OutValue)
{
if (to->addr)
{
if (to->size < sizeof(String))
{
to->size = sizeof(String);
return(False);
}
else
{
to->addr = (XtPointer)*OutValue;
}
}
else
{
to->addr = (XtPointer)OutValue;
}
to->size = sizeof(String);
return(True);
}
#endif
/** generate a message and display it */
in_str = (char *) XtMalloc (strlen(reverse_message) + 10) ;
sprintf(in_str, "%s %d", reverse_message, in_value);
XtDisplayStringConversionWarning( disp, in_str, Record->rep_type_name) ;
return( FALSE) ;
}
void
_XmRepTypeInstallConverters( void )
{
unsigned short Index = XmRID_UNIT_TYPE ;
XtConvertArgRec convertArg;
/* in order to be able to implement the XmCvtStringToUnitType
converter as using the native code in RepType, we must
have a different unit type converter name to refer to from
ResConvert.c when calling XtConvertAndStore */
convertArg.address_mode = XtImmediate;
convertArg.address_id = (XPointer)(long)Index;
convertArg.size = sizeof(convertArg.address_id);
XtSetTypeConverter(XmRString,
REAL_UNIT_TYPE_NAME,
ConvertRepType, &convertArg, 1,
XtCacheNone, NULL) ;
/* Install the static consecutive-valued converters. */
for ( Index = 0; Index < StandardNumRecs; Index ++ ) {
/* Special case the record used for the action param, where
we don't need to install the converter. For these, we
have used the reverse_installed field set to True to
notify this routine not to install them */
if (StandardRepTypes[Index].reverse_installed) continue ;
/* only update the index data, the other field are already good */
convertArg.address_id = (XPointer)(long)Index;
XtSetTypeConverter(XmRString,
StandardRepTypes[Index].rep_type_name,
ConvertRepType, &convertArg, 1,
XtCacheNone, NULL) ;
XmRepTypeAddReverse(Index);
}
}
void
XmRepTypeInstallTearOffModelConverter( void )
{
/* Obsolete, we now do this by default */
}
/*
* Given a rep_type_id and a string parameter, this function tries to
* find the reptype value for that string. The resulting reptype value is
* returned in result. For backwards compatibility, the string parameter
* for some actions could be a numeric rather than an alphabetic string
* (i.e. "0"). If an action parameter reptype is able to accept a
* numeric, then pass True for the can_be_numeric parameter. This will
* cause the function to first parse the string as a numeric. If it
* succeeds in doing so, it checks to verify that the value is a valid
* value for the given reptype. If it can't parse the string as a
* numeric, it tries to do the rep type lookup. If both fail, it returns
* False and does not set result. If either succeeds, it returns True and
* sets the result parameter to be the resulting numeric value. The
* widget parameter is used by various warning message functions so any
* widget may be passed.
*/
Boolean
_XmConvertActionParamToRepTypeId(Widget widget, XmRepTypeId rep_type_id,
char *parameter, Boolean can_be_numeric,
int *result)
{
int value, i;
XtPointer aligned_value;
XrmValue args, from, to;
/* If the parameter can be numeric (for backward compatibility) then
try to convert the parameter to a number */
if (can_be_numeric)
{
value = i = 0;
while (isspace(parameter[i])) ++i; /* skip leading white space */
if (isdigit(parameter[i]))
{
value = atoi(parameter + i);
/* If the number was converted, verify that it is a valid value
for the reptype. If so return it in the result argument and
return True. Otherwise, don't set the result argument and
return False. */
if (XmRepTypeValidValue(rep_type_id, value, widget))
{
*result = value;
return(True);
}
return(False);
}
}
/* If we made it this far, then the parameter can't be numeric or can
be numeric but we were unable to parse it as such. Try to convert
the parameter via the rep type converters. */
args.size = sizeof(rep_type_id);
aligned_value = (XtPointer)(long)(rep_type_id);
args.addr = (char*)(&aligned_value);
from.size = sizeof(char *);
from.addr = parameter;
to.size = sizeof(unsigned char);
to.addr = (XPointer) &value;
if (ConvertRepType(XtDisplay(widget), &args, NULL, &from, &to, NULL))
{
/* We converted okay. Set up result and return True. */
*result = *((unsigned char *)(to.addr));
return(True);
}
/* All conversions failed. Just return False. */
return(False);
}
#ifdef DEBUG
void _XmCheckStandardNumRecs() {
Cardinal Index ;
XmRepTypeEntry Record, PrevRecord = NULL ;
for ( Index = 0; Index < StandardNumRecs; Index++ )
{
Record = &(StandardRepTypes[Index]) ;
printf("Record[%d]: %s", Index, Record->rep_type_name) ;
if (PrevRecord)
if (strcmp(Record->rep_type_name,
PrevRecord->rep_type_name) <= 0)
printf(" ** UNSORTED ENTRY **");
printf("\n");
PrevRecord = Record ;
}
}
#endif
|