1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176
|
/*
Widget Set
This widget set was originally designed for XShipWars.
It may be improved but existing styles should not be changed
without approval from Wolfpack.
*/
#ifndef WIDGETS_H
#define WIDGETS_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <db.h>
extern int errno;
#include <errno.h>
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>
/* File IO. */
#include "fio.h"
/* OS specific definations. */
#include "os.h"
/* Low-level archatecture graphic definations. */
#include "graphics.h"
/* Operating system wrapper. */
#include "osw-x.h"
/* *********************************************************************
*
* Definations for global widget values:
*/
/*
* Color closeness for libXpm:
*/
#ifndef XpmDefaultColorCloseness
#define XpmDefaultColorCloseness 40000
#endif
/* Default window attributes mask. */
#define DEF_WIN_ATTR_MASK \
CWBackPixmap | CWBackPixel | CWBorderPixmap | \
CWBorderPixel | CWBitGravity | CWWinGravity | \
CWBackingStore | CWBackingPlanes | CWBackingPixel | \
CWSaveUnder | CWEventMask | CWColormap | \
CWCursor
/* Surface colors. */
#define CLSP_SURFACE_NORMAL "rgbi:0.03/0.03/0.03"
#define CLSP_SURFACE_SELECTED "rgbi:1.00/0.80/0.98" /* Selected. */
#define CLSP_SURFACE_SHADOW "rgbi:0.001/0.001/0.001"
#define CLSP_SURFACE_HIGHLIGHT "rgbi:0.14/0.14/0.14"
#define CLSP_SURFACE_EDITABLE "rgbi:0.00/0.00/0.00" /* Text areas. */
/* Scroll and scale bar colors. */
#define CLSP_SCROLL_BKG "rgbi:0.00/0.00/0.00"
#define CLSP_SCROLL_FRAME "rgbi:0.80/0.10/0.80"
#define CLSP_SCROLL_BAR "rgbi:1.00/0.40/1.00"
#define CLSP_SCROLL_CURSOR "rgbi:1.00/0.40/1.00"
/* Text colors. */
#define CLSP_TEXT_NORMAL "rgbi:0.75/0.75/0.75"
#define CLSP_TEXT_EDITABLE "rgbi:1.00/0.70/0.95" /* In text areas. */
#define CLSP_TEXT_SELECTED "rgbi:0.00/0.00/0.00" /* Selected text. */
#define CLSP_TEXT_DISABLED "rgbi:0.55/0.55/0.55"
/* Hint window colors. */
#define CLSP_HINT_BKG "rgbi:0.90/0.90/0.54"
#define CLSP_HINT_TEXT "rgbi:0.00/0.00/0.00"
/* Progress bar colors. */
#define CLSP_PBAR_TEXT "rgbi:1.00/0.70/0.85"
/*
* Default double click interval in milliseconds:
*/
#define DEF_DOUBLE_CLICK_INT 500
/*
* Default hint window map delay in milliseconds:
*/
#define DEF_HINTWIN_MAP_DELAY 1500
/*
* Default slow double click for relabeling items
* in milliseconds:
*/
#define DEF_RELABEL_ITEM_DELAY 1500
/*
* Default popup list repeat delay and interval
* in milliseconds:
*/
#define DEF_PULIST_REPEAT_DELAY 8
#define DEF_PULIST_REPEAT_INT 50
/*
* Default prompt scroll repeat delay and interval
* in milliseconds:
*
* These are NOT the key repeat delay and interval,
* that is controlled by the GUI!
*/
#define DEF_PROMPT_REPEAT_DELAY 50
#define DEF_PROMPT_REPEAT_INT 50
/*
* Default scroll bar cursor repeat delay and interval
* in milliseconds:
*/
#define DEF_SB_REPEAT_DELAY 250
#define DEF_SB_REPEAT_INT 50
/*
* Edge scroll delay:
*/
#define DEF_LIST_EDGE_SCROLL_DELAY 300
/*
* Default maximum size for windows, pixmaps, and images:
*/
#define DEF_GRAPHICS_MAX_WIDTH 32767
#define DEF_GRAPHICS_MAX_HEIGHT 32767
/*
* Default maximum pointer cursor size:
*/
#define DEF_CURSOR_MAX_WIDTH 256
#define DEF_CURSOR_MAX_HEIGHT 256
/*
* Widget type codes:
*
* Code to represent widget type, used for the widget
* regeristry.
*/
#define WTYPE_CODE_NONE 0 /* Or unknown. */
#define WTYPE_CODE_PUSHBUTTON 10
#define WTYPE_CODE_COLUMLIST 11
#define WTYPE_CODE_DIALOG 12
#define WTYPE_CODE_FILEBROWSER 13
#define WTYPE_CODE_LIST 14
#define WTYPE_CODE_MENU 15
#define WTYPE_CODE_MENUBAR 16
#define WTYPE_CODE_PAGESTEPPER 17
#define WTYPE_CODE_PROGRESSBAR 18
#define WTYPE_CODE_PROMPT 19
#define WTYPE_CODE_PULIST 20
#define WTYPE_CODE_SCALEBAR 21
#define WTYPE_CODE_SCROLLBAR 22
#define WTYPE_CODE_TOGGLEARRAY 23
#define WTYPE_CODE_TOGGLEBTN 24
#define WTYPE_CODE_VIEWER 25
/*
* Widget color struct:
*/
typedef struct {
u_int8_t a, r, g, b;
} WColorStruct;
/*
* Widget Cursor structure:
*/
typedef struct {
cursor_t cursor;
int x; /* Hot point. */
int y;
unsigned int width;
unsigned int height;
depth_t depth; /* Usually 1. */
WColorStruct color; /* Foreground color. */
} WCursor;
/* *************************************************************************
*
* Global widget values:
*
* These values are used by (almost) all widgets.
* They include text color, selected text color, background pixmap
* etc.
*
* These values are initialized by WidgetInitGlobals();
* And then cleaned up by WidgetDestroyGlobals();
*/
typedef struct {
/* Indicates these global values are initialized. */
char is_init; /* 1 = yes, 0 = no. */
/* Force black and white mode. */
bool_t force_mono;
/* Cursors. */
WCursor *std_arrow_wcr, /* The standard arrow pointer. */
*h_split_wcr, /* Horizontal split. */
*v_split_wcr, /* Vertical split. */
*drag_item_wcr,
*drag_file_wcr,
*text_wcr,
*no_way_wcr; /* Circle with diagonal slash. */
/* Fonts. */
font_t *pbtn_font,
*menu_font,
*prompt_label_font,
*prompt_text_font,
*scale_bar_font,
*std_font;
/* The standard background pixmap (tiled). */
pixmap_t std_bkg_pm,
std_icon_pm; /* For the icon pixmap in
* XSetStandardProperties().
*/
/* Icons used in lists, dialogs and other places. */
image_t *std_bkg_img, /* Standard background. */
*menu_bkg_img,
*hint_bkg_img;
image_t *btn_unarmed_img, /* Button backgrounds. */
*btn_armed_img,
*btn_highlighted_img;
image_t *scalebar_h_img, /* Scalebar handles. */
*scalebar_v_img;
image_t *pulist_map_icon_img; /* Icon image on the map button
* of the popup list widget.
*/
image_t *goto_parent_img;
image_t *browse_files_img; /* Browse files icon. */
image_t *mount_img,
*unmount_img;
image_t *diricon_normal_img,
*diricon_selected_img,
*execicon_normal_img,
*execicon_selected_img,
*fileicon_normal_img,
*fileicon_selected_img,
*linkicon_normal_img,
*linkicon_selected_img,
*pipeicon_normal_img,
*pipeicon_selected_img,
*stditem_normal_img,
*stditem_selected_img;
image_t *toggle_btn_unarmed_img, /* Toggle buttons. */
*toggle_btn_armed_img;
image_t *tab_normal_img, /* Tabs. */
*tab_selected_img;
/* `Surface' edge colors. */
pixel_t surface_normal_pix, /* Overrided by std_bkg. */
surface_editable_pix,
surface_selected_pix,
surface_shadow_pix,
surface_highlight_pix;
/* Scrollbar and scalebar colors. */
pixel_t scroll_bkg_pix,
scroll_frame_pix,
scroll_bar_pix,
scroll_cursor_pix;
/* Text colors. */
pixel_t normal_text_pix,
editable_text_pix,
selected_text_pix,
disabled_text_pix;
/* Hint window colors. */
pixel_t hint_bkg_pix,
hint_text_pix;
/* Progress bar colors.*/
pixel_t pbar_text_pix;
/* Double click interval (in milliseconds). */
time_t double_click_int;
/* Hint window map delay (in milliseconds). */
time_t hintwin_map_delay;
/* Slow double click delay for relabeling items (in milliseconds). */
time_t relabel_item_delay;
/* Popup list repeat delay and interval (in milliseconds). */
time_t pulist_repeat_delay;
time_t pulist_repeat_interval;
/* Prompt repeat delay and interval (in milliseconds). */
time_t prompt_repeat_delay;
time_t prompt_repeat_interval;
/* Scroll bar repeat delay and interval (in milliseconds). */
time_t sb_repeat_delay;
time_t sb_repeat_interval;
/* List edge select scroll delay (in milliseconds). */
time_t list_edge_scroll_delay;
/* Maximum window, pixmap, image, etc size. */
unsigned int max_width, max_height;
} widget_global_struct;
extern widget_global_struct widget_global;
/*
* Hint window:
*
* This small window will be managed by the widget system,
* it displays a short (user set) message about the usage of a
* widget.
*/
typedef struct {
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
time_t next_map; /* Next time to be mapped in ms or 0 for
* none.
*/
win_t toplevel;
pixmap_t toplevel_buf;
win_t ref_win; /* Referance window. */
} hint_win_struct;
extern hint_win_struct hint_win;
/*
* Hint window messages and records:
*/
typedef struct {
win_t ref_win; /* Referance window. */
font_t *font;
char *mesg;
} hint_win_data_struct;
extern hint_win_data_struct **hint_win_data;
extern int total_hint_win_datas;
/* ********************************************************************
*
* Individual Widget Structures
*
*/
/*
* Push Button Widget:
*/
/* Maximum hotkeys. */
#define PBTN_MAX_HOTKEYS 16
/* Alignment codes. */
#define PBTN_TALIGN_CENTER 0
#define PBTN_TALIGN_LEFT 1
#define PBTN_TALIGN_RIGHT 2
/* Push button state codes. */
#define PBTN_UNARMED 0
#define PBTN_ARMED 1
#define PBTN_HIGHLIGHTED 2
typedef struct {
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
char state; /* Button state. */
win_t toplevel;
pixmap_t toplevel_buf;
/* Button background images, these are local (not shared). */
image_t *unarmed_img,
*armed_img,
*highlighted_img;
win_t parent;
char hotkey[PBTN_MAX_HOTKEYS + 1]; /* NULL terminated. */
char *label; /* Can be NULL. */
int label_align; /* Defaults to PBTN_TALIGN_CENTER. */
image_t *image; /* Image to be used as label. */
void *client_data;
int (*func_cb)(void *); /* Callback function, can be NULL. */
} push_button_struct;
/*
* Toggle Button Widget:
*
* Toggle buttons are on/off buttons to indicate a boolean value.
*/
#define TGBTN_DRAW_AMOUNT_COMPLETE 0
#define TGBTN_DRAW_AMOUNT_BUTTON 1
#define TGBTN_DRAW_AMOUNT_LABEL 2
typedef struct
{
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
win_t toplevel;
pixmap_t toplevel_buf;
char *label; /* Label of toggle button. */
bool_t state; /* Toggle button state (not map state). */
} toggle_button_struct;
/*
* Toggle Button Array Widget:
*
* An array of Toggle Button Widgets.
*/
#define TGBTN_ARRAY_ALIGN_VERTICAL 0
#define TGBTN_ARRAY_ALIGN_HORIZONTAL 1
#define TGBTN_ARRAY_ALIGN_CASCADE 2
typedef struct
{
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
win_t toplevel;
toggle_button_struct **tb;
int total_tbs;
int armed_tb;
} toggle_button_array_struct;
/*
* Progress Bar Widget:
*/
#define PBAR_COMPLETION_HOLD 0
#define PBAR_COMPLETION_WRAP 1
#define PBAR_COMPLETION_UNMAP 2
#define PBAR_COMPLETION_FLASH 3
typedef struct
{
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
win_t toplevel;
pixmap_t toplevel_buf;
image_t *image_buf;
/* Progress values. */
double current, /* Current progress. */
min, /* Minimum value. */
max; /* Maximum value. */
char *label; /* Label (optional) */
int completion_action; /* One of PBAR_COMPLETION_*. */
} progress_bar_struct;
/*
* Dialog Widget:
*
* A window parented to root (desktop) which can be resized and moved
* and contain a message with an icon.
*/
typedef struct
{
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
win_t toplevel;
pixmap_t toplevel_buf;
push_button_struct dismiss_btn;
/* Automatic dismiss (not supported yet). */
char auto_dismiss;
long next_auto_dismiss;
/* Message. */
char *mesg;
int len, total_lines, longest_line;
/* Icon. */
image_t *icon_img;
} dialog_win_struct;
/*
* Prompt Widget:
*
* Single line text areas.
*
* NOTE: Do not confuse prompt with dialog windows, they are
* different.
*/
/* Definations of draw amount in PromptDraw(). */
#define PROMPT_DRAW_AMOUNT_COMPLETE 0
#define PROMPT_DRAW_AMOUNT_TEXTONLY 1
#define PROMPT_STYLE_FLUSHED 0
#define PROMPT_STYLE_RAISED 1
#define PROMPT_STYLE_NOBORDER 2
typedef struct
{
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
int style; /* One of PROMPT_STYLE_*. */
win_t toplevel;
pixmap_t toplevel_buf;
win_t text_area;
pixmap_t text_area_buf;
/* Label printed just to the left of the text field window. */
char *name;
/* Main text buffer. */
char *buf;
unsigned int buf_len;
int buf_pos; /* Position of cursor in buf (can be -1). */
int buf_vis_pos; /* Scrolled position in buf, char units. */
int buf_sel_start; /* Start byte of selected text (-1 for none). */
int buf_sel_end; /* End byte of selected text (-1 for none). */
/* History buffer. */
char **hist_buf;
int total_hist_bufs; /* Total number of history buffers. */
int hist_buf_pos; /* Which history buffer we last recalled, */
int (*func_cb)(char *); /* Callback function, can be NULL. */
} prompt_window_struct;
/*
* Scale Bar Widget:
*
* (Not to be confused with scroll bars.)
*/
#define SCALEBAR_ORIENT_HORIZONTAL 0
#define SCALEBAR_ORIENT_VERTICAL 1
#define SCALEBAR_STYLE_STANDARD 0
#define SCALEBAR_STYLE_STANDARD_VALUE 1 /* Value shown. */
#define SCALEBAR_STYLE_FLUSHED 2 /* Simple, similar to scrollbar style. */
#define SCALEBAR_BAR_STANDARD_WIDTH 26
#define SCALEBAR_BAR_FLUSHED_WIDTH 12
typedef struct
{
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
int style; /* One of SCALEBAR_STYLE_* */
int ticks; /* Number of ticks to draw. */
double pos; /* Position in user defined units. */
double pos_min; /* In user defined units. */
double pos_max; /* In user defined units. */
int orientation; /* One of SCALEBAR_ORIENT_* */
bool_t flip_pos; /* Flip position. */
bool_t btn_state; /* Button press state on slide bar. */
win_t toplevel;
pixmap_t toplevel_buf;
pixmap_t bkg_buf;
unsigned int length; /* Length of scalebar in pixels. */
/* Function to call (if not NULL) on select. */
void *client_data;
int (*func_cb)(void *);
} scale_bar_struct;
/*
* Scroll Bar Widget:
*/
#define SCROLLBAR_CURSOR_BTN_WIDTH 16
#define SCROLLBAR_CURSOR_BTN_HEIGHT 16
#define SCROLLBAR_XBAR_HEIGHT 16
#define SCROLLBAR_YBAR_WIDTH 16
#define SCROLLBAR_CURSOR_INC 20
typedef struct
{
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
/* x and y scroll positions. */
int x_win_pos,
y_win_pos;
/* Original ButtonPress deltas to scroll bar position. */
int x_origin_delta,
y_origin_delta;
/* Toplevel, one for each bar. */
win_t x_toplevel,
y_toplevel;
/* Horizontal and vertical scroll bar slide channels. */
win_t x_bar,
y_bar;
pixmap_t x_bar_buf,
y_bar_buf;
bool_t x_bar_button_state,
y_bar_button_state;
/* Cursor buttons. */
win_t x_left,
x_right;
pixmap_t x_left_buf,
x_right_buf;
win_t y_up,
y_down;
pixmap_t y_up_buf,
y_down_buf;
} scroll_bar_struct;
/*
* Popup list:
*
* (Superceeds pull-down list).
*/
#define PULIST_DRAW_AMOUNT_COMPLETE 0
#define PULIST_DRAW_AMOUNT_LABEL 1
#define PULIST_DRAW_AMOUNT_PULIST 2
#define PULIST_POPUP_CENTER 0
#define PULIST_POPUP_UP 1
#define PULIST_POPUP_DOWN 2
typedef struct {
char *name;
bool_t disabled;
} popup_list_item_struct;
typedef struct {
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
/* Selected item label. */
win_t toplevel;
pixmap_t toplevel_buf;
push_button_struct map_btn;
/* Popup list. */
char popup_map_state;
win_t popup_toplevel;
pixmap_t popup_toplevel_buf;
win_t popup_list;
pixmap_t popup_list_buf;
int popup_list_vis_items; /* Items visable on popup list.
* Also determines popup list
* height.
*/
/* Popup list size and scroll position. */
unsigned int list_max_width, list_max_height;
int list_y_pos; /* Scrolled position. */
/* Items. */
popup_list_item_struct **item;
int total_items;
int sel_item, prev_sel_item;
/* Options. */
int direction; /* One of PULIST_POPUP_* */
/* Function to call (if not NULL) on select. */
void *client_data;
int (*func_cb)(void *);
} popup_list_struct;
/*
* List window widget:
*
* (Bulletin board style).
*/
#define LIST_ENTRY_TYPE_NORMAL 0
#define LIST_ENTRY_TYPE_FOLDER 1
#define LIST_ENTRY_TYPE_HR 2 /* Horizontal rule. */
#define LW_CVP_MODE_NONE 0
#define LW_CVP_MODE_RENAME 1
typedef struct
{
/* Type of entry. */
int type;
/* Label name. */
char *name;
/* Pointer to icon image, must be deallocated by client. */
image_t *image;
/* Pointer to client data. */
void *data_ptr;
} list_window_entry_struct; /* List window entry structure. */
typedef struct
{
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
win_t toplevel;
pixmap_t toplevel_buf;
scroll_bar_struct sb;
bool_t allow_drag;
unsigned int char_width, char_height;
unsigned int row_height;
list_window_entry_struct **entry;
int total_entries,
entry_pos; /* Selected entry, can be -1. */
/* Margins (in pixels). */
int left_margin,
top_margin;
/* Drag cursor being used (private). */
WCursor *drag_cursor;
/* Change values prompt. */
prompt_window_struct cv_prompt;
int cv_prompt_mode;
int cv_prompt_entry_pos; /* Modifying values for this entry. */
/* Function to call (if not NULL) on enter or double click . */
void *client_data;
int (*func_cb)(void *);
} list_window_struct;
/*
* Colum list widget:
*/
#define CL_DRAW_AMOUNT_COMPLETE 0
#define CL_DRAW_AMOUNT_LIST 1
#define CL_DRAW_AMOUNT_HEADING 2
typedef struct {
char *label;
font_t *font;
pixel_t pixel;
unsigned int attr;
void *client_data;
} colum_list_item_struct;
typedef struct {
colum_list_item_struct **item;
int total_items;
} colum_list_row_struct;
/* Colum heading structure. */
typedef struct {
char *heading; /* Heading label. */
font_t *font;
pixel_t pixel;
unsigned int attr;
int x_pos; /* In pixels. */
} colum_list_colum_struct;
#define CL_FLAG_ALLOW_DRAG (1 << 0)
#define CL_FLAG_ALLOW_MULTI_SELECT (1 << 1)
typedef struct {
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
unsigned int option;
unsigned int row_height;
win_t toplevel;
/* Heading. */
win_t heading;
pixmap_t heading_buf;
win_t heading_split_bar;
bool_t heading_split_indrag; /* Dragging heading colum? */
int heading_drag_colum; /* Which colum is being dragged or
* which colum split is pointer
* over.
*/
/* List. */
win_t list;
pixmap_t list_buf;
scroll_bar_struct sb; /* For the list. */
/* Colum headings. */
colum_list_colum_struct **colum;
int total_colums;
/* Each row. */
colum_list_row_struct **row;
int total_rows;
/* Selected rows. */
int *sel_row;
int total_sel_rows;
/* Function to call (if not NULL) on enter or double click . */
void *client_data;
int (*func_cb)(void *);
} colum_list_struct;
/*
* Menu:
*/
/* Item type codes. */
#define MENU_ITEM_TYPE_ENTRY 0
#define MENU_ITEM_TYPE_TOGGLEENTRY 1
#define MENU_ITEM_TYPE_FOLDER 2 /* Reffers to another menu. */
#define MENU_ITEM_TYPE_HR 3 /* Horizontal rule. */
#define MENU_ITEM_TYPE_COMMENT 4 /* Does nothing when selected. */
/* Menu items structure. */
typedef struct {
int type; /* One of MENU_ITEM_TYPE_*. */
char *name;
image_t *icon; /* Shared. */
int id_code; /* Client specified code to indenfity
* menu's function.
*/
bool_t state; /* For type MENU_ITEM_TYPE_TOGGLEENTRY. */
} menu_item_struct;
typedef struct {
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
win_t toplevel;
pixmap_t toplevel_buf;
int row_height; /* In pixels, must be 1 or greater. */
int char_width;
menu_item_struct **item;
int selected_item;
int total_items;
/* The function to call (if not NULL) to execute a menu item by
* its ID code. The passed information is the void *client_data
* pointer and then the int id_code.
*/
void *client_data;
int (*func_cb)(void *, int);
} menu_struct;
/*
* Menu Bar:
*/
/* Menu bar item structure. */
#define MENUBAR_ITEM_HOTKEYS_MAX 24
typedef struct {
char *name;
char hotkeys[MENUBAR_ITEM_HOTKEYS_MAX];
int x, y;
unsigned int width, height;
menu_struct *menu;
} menu_bar_item_struct;
typedef struct {
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
win_t toplevel;
pixmap_t toplevel_buf;
menu_bar_item_struct **item;
int total_items;
int sel_item;
int (*func_cb)(void *, int);
void *client_data;
} menu_bar_struct;
/*
* File Browser:
*/
/* Draw amount codes for FBrowserDraw() */
#define FBROWSER_DRAW_COMPLETE 0
#define FBROWSER_DRAW_DIRLIST 1
#define FBROWSER_DRAW_FILELIST 2
#define FBROWSER_DRAW_ALLLISTS 3
#define FBROWSER_DRAW_PROMPT 4
#define FBROWSER_DRAW_BUTTONS 5
#define FBROWSER_DRAW_SCROLLBARS 6
/* Option flags. */
#define FB_FLAG_WRITE_PROTECT (1 << 0)
#define FB_FLAG_CLOSE_ON_OK (1 << 1)
#define FB_FLAG_CLOSE_ON_CANCEL (1 << 2)
#define FB_FLAG_MUST_EXIST (1 << 3)
/* Styles. */
#define FB_STYLE_SPLIT_LIST 0 /* Split dir and file win. */
#define FB_STYLE_SINGLE_LIST 1 /* Single list window. */
/* Filesystem types. */
#define FB_FSTYPE_UNKNOWN 0
#define FB_FSTYPE_SWAP 1 /* Universal swap. */
#define FB_FSTYPE_EXT 2
#define FB_FSTYPE_EXT2 3
#define FB_FSTYPE_PROC 4
#define FB_FSTYPE_MSDOS 5 /* Includes Win9* VFS */
#define FB_FSTYPE_ISO9660 6 /* CDRom. */
#define FB_FSTYPE_MINIX 7
#define FB_FSTYPE_XIAFS 8
#define FB_FSTYPE_HPFS 9
#define FB_FSTYPE_NFS 10
/* File browser object structure. */
typedef struct {
char *name;
int x, y;
unsigned int width, height;
mode_t mode; /* Type and permissions. */
uid_t uid; /* User ID of owner */
gid_t gid; /* Group ID of owner */
off_t size; /* Total size, in blocks. */
time_t atime; /* time of last access. */
time_t ctime; /* time of creation. */
time_t mtime; /* time of last modification. */
} fb_object_struct;
typedef struct {
char *name; /* Friendly name. */
char *dev; /* Device name. */
char *mounted_path; /* Path that it is mounted on. */
int fs_type; /* File system type code. */
bool_t readable,
writeable,
mounted;
} fb_device_struct;
typedef struct {
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
u_int64_t options;
int style;
win_t toplevel;
pixmap_t toplevel_buf;
push_button_struct ok_btn,
cancel_btn,
refresh_btn,
parent_dir_btn,
mount_btn,
unmount_btn;
/* Directory window (for FB_STYLE_SPLIT_LIST). */
win_t dir_win;
pixmap_t dir_win_buf;
scroll_bar_struct dir_win_sb;
/* File window (for FB_STYLE_SPLIT_LIST). */
win_t file_win;
pixmap_t file_win_buf;
scroll_bar_struct file_win_sb;
/* List window (for FB_STYLE_SINGLE_LIST). */
win_t list_win;
pixmap_t list_win_buf;
scroll_bar_struct list_win_sb;
unsigned int list_max_width;
/* Current location prompt. */
prompt_window_struct prompt;
/* Change value prompt. */
prompt_window_struct cv_prompt;
char *cv_prompt_target; /* Target object. */
int cv_prompt_mode;
/* Devices list. */
fb_device_struct **device;
int total_devices;
popup_list_struct devices_pulist;
/* Directories list. */
fb_object_struct **dir_list;
int dir_list_items;
/* Files list. */
fb_object_struct **file_list;
int file_list_items;
/* Selected item positions (can be -1 for none). */
int sel_dir, /* For FB_STYLE_SPLIT_LIST. */
sel_file, /* For FB_STYLE_SPLIT_LIST. */
sel_object; /* For FB_STYLE_SINGLE_LIST. */
/* Function to call when OK button is pressed (can be NULL). */
int (*func_ok)(char *);
/* Function to call when Cancel button is pressed (can be NULL). */
int (*func_cancel)(char *);
} fbrowser_struct;
/*
* File viewer:
*/
#define VIEWER_MODE_ASCII 0
#define VIEWER_MODE_HEX 1
typedef struct {
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
win_t toplevel;
win_t viewer;
pixmap_t viewer_buf;
scroll_bar_struct sb;
unsigned int max_viewer_width;
char *filename; /* Can be NULL. */
char *buf; /* Can be NULL. */
off_t buf_len;
int lines; /* Total number of lines. */
char viewer_mode;
push_button_struct close_btn,
ascii_mode_btn,
hex_mode_btn;
} file_viewer_struct;
/*
* Page Stepper:
*/
typedef struct {
void *w; /* Pointer to allocated widget struct. */
int w_type; /* Widget type. */
char *name; /* Unique name. */
} page_widget_struct;
typedef struct {
int x, y;
font_t *font;
pixel_t pix;
char **text; /* Can be NULL. */
int total_text_lines;
image_t *image; /* Can be NULL. */
} page_stepper_label_struct;
typedef struct {
char map_state;
page_widget_struct **widget; /* Widget. */
int total_widgets;
page_stepper_label_struct **label;
int total_labels;
} page_stepper_page_struct;
typedef struct {
char map_state;
char is_in_focus;
visibility_t visibility_state;
int x, y;
unsigned int width, height;
bool_t disabled;
font_t *font;
void *prev, *next;
win_t toplevel;
pixmap_t toplevel_buf;
win_t parent;
page_stepper_page_struct **page;
int total_pages;
int cur_page;
push_button_struct next_btn,
prev_btn;
/* Panel image (shared) */
image_t *panel_img;
/* Client data and page change callback function. */
void *client_data;
int (*page_change_handler)(void *, int, int);
int (*exit_handler)(void *);
int (*finish_handler)(void *);
} page_stepper_struct;
/*
* Widget Regeristry:
*
* (Needs to be declared after all widget structures)
*/
typedef struct {
void *ptr; /* Shared, do not free. */
int type;
} widget_reg_entry_struct;
typedef struct {
widget_reg_entry_struct **entry;
int total_entries;
} widget_reg_struct;
extern widget_reg_struct widget_reg;
/* *********************************************************************
*
* FUNCTIONS
*
*/
/* In wglobal.c */
extern int WidgetInitGlobals(int argc, char *argv[]);
extern void WidgetDestroyGlobals(void);
extern int WidgetManage(event_t *event);
/* In whintwin.c */
extern int HintWinIsDataAllocated(int n);
extern int HintWinGetNumByWin(win_t ref_win);
extern int HintWinInList(win_t ref_win);
extern int HintWinInit(void);
extern int HintWinDraw(void);
extern int HintWinManage(event_t *event);
extern void HintWinMap(void);
extern void HintWinUnmap(void);
extern void HintWinDestroy(void);
extern int HintWinAddMessage(
win_t ref_win,
win_t parent_win,
int x, int y,
char *mesg
);
extern int HintWinChangeMesg(win_t ref_win, char *mesg);
extern void HintWinDeleteMessage(win_t ref_win);
extern void HintWinDeleteAllMessages(void);
extern int HintWinSetSchedual(
long d_msec,
win_t ref_win
);
extern int HintWinSetSchedualMessage(
long d_msec,
win_t ref_win,
char *mesg
);
/* In wfile.c */
extern image_t *WidgetLoadImageFromTgaFile(char *filename);
extern image_t *WidgetLoadImageFromTgaData(u_int8_t *data);
extern pixmap_t WidgetLoadPixmapFromTgaFile(char *filename);
extern pixmap_t WidgetLoadPixmapFromTgaData(u_int8_t *data);
extern image_t *WidgetLoadImageFromXpmFile(char *filename);
extern image_t *WidgetLoadImageFromXpmData(char **data);
extern pixmap_t WidgetLoadPixmapFromXpmFile(char *filename);
extern pixmap_t WidgetLoadPixmapFromXpmData(char **data);
/* In wutils.c */
extern pixel_t WidgetGetPixel(char *clsp);
extern WCursor *WidgetCreateCursorFromFile(
char *xpmfile,
int hot_x, int hot_y,
WColorStruct color
);
extern WCursor *WidgetCreateCursorFromData(
char **xpmdata,
int hot_x, int hot_y,
WColorStruct color
);
extern void WidgetSetWindowCursor(win_t w, WCursor *wcursor);
extern void WidgetDestroyCursor(WCursor **wcursor);
extern void WidgetSetWindowWMSizeHints(win_t w, sizehints_t sizehints);
#define WidgetCenterWindowToParent 0
#define WidgetCenterWindowToRoot 1
#define WidgetCenterWindowToPointer 2
extern void WidgetCenterWindow(win_t w, int relation);
extern void WidgetMap(void *ptr);
extern void WidgetUnmap(void *ptr);
extern void WidgetDestroy(void *ptr);
extern void WidgetResizeImageBuffer(
depth_t d,
u_int8_t *tar_buf,
u_int8_t *src_buf,
unsigned int tar_width,
unsigned int tar_height,
unsigned int src_width,
unsigned int src_height
);
extern void WidgetPutImageTile(
drawable_t tar_d, image_t *src_img,
unsigned int tar_width, unsigned int tar_height
);
extern void WidgetPutPixmapTile(
drawable_t tar_d, pixmap_t src_pm,
unsigned int tar_width, unsigned int tar_height,
unsigned int src_width, unsigned int src_height
);
extern void WidgetFrameButton(win_t w, bool_t state,
unsigned long fg_pix, unsigned long bg_pix
);
extern void WidgetFrameButtonPixmap(
pixmap_t pixmap,
bool_t state,
unsigned int width, unsigned int height,
unsigned long fg_pix, unsigned long bg_pix
);
extern image_t *WidgetCreateImageText(
char *string,
font_t *font,
unsigned int font_width, unsigned int font_height,
pixel_t fg_pix,
pixel_t bg_pix
);
pixmap_t WidgetPixmapMaskFromImage(image_t *image);
extern void WidgetPutImageNormal(
drawable_t d, /* Target. */
image_t *ximage, /* Source. */
int tar_x, int tar_y,
bool_t allow_transparency
);
extern void WidgetPutImageRaised(
drawable_t d, /* Target. */
image_t *ximage, /* Source. */
int tar_x, int tar_y,
unsigned int altitude
);
extern void WidgetAdjustImageGamma(
image_t *image,
double r, double g, double b
);
/* *********************************************************************
*
* Widget Management Functions
*/
/* In timming.c */
extern long MilliTime(void);
extern long UTime(void);
/* In wbutton.c */
extern void PBtnChangeLabel(
push_button_struct *btn,
unsigned int width,
unsigned int height,
char *label,
char label_align,
image_t *image
);
extern int PBtnInit(
push_button_struct *btn,
win_t parent,
int x, int y,
unsigned int width,
unsigned int height,
char *label,
char label_align,
image_t *image,
void *client_data,
int (*func_cb)(void *)
);
extern int PBtnSetHotKeys(
push_button_struct *btn,
char *hotkeys
);
extern int PBtnSetHintMessage(
push_button_struct *btn,
char *message
);
extern int PBtnDraw(push_button_struct *btn);
extern int PBtnManage(push_button_struct *btn, event_t *event);
extern void PBtnMap(push_button_struct *btn);
extern void PBtnUnmap(push_button_struct *btn);
extern void PBtnDestroy(push_button_struct *btn);
/* In wclist.c */
extern char *CListGetItemLabel(
colum_list_struct *list,
int row_num,
int colum_num
);
extern int CListSetItemLabel(
colum_list_struct *list,
int row_num,
int colum_num,
char *label
);
extern int CListGetFirstSelectedRow(colum_list_struct *list);
extern int CListGetLastSelectedRow(colum_list_struct *list);
extern int CListIsRowSelected(
colum_list_struct *list,
int row_num
);
extern int CListSelectRow(
colum_list_struct *list,
int row_num
);
extern void CListUnselectAllRows(colum_list_struct *list);
extern int CListAddHeading(
colum_list_struct *list,
char *heading,
font_t *font,
pixel_t pixel,
unsigned int attr,
int start_pos /* In pixels. */
);
extern void CListDeleteHeading(
colum_list_struct *list,
int colum_num
);
extern int CListAddRow(
colum_list_struct *list,
int row_num /* Can be -1 for append. */
);
extern void CListDeleteRow(
colum_list_struct *list,
int row_num
);
extern void CListDeleteAllRows(
colum_list_struct *list
);
extern int CListAddItem(
colum_list_struct *list,
char *label,
font_t *font,
pixel_t pixel,
unsigned int attr,
int row_num
);
extern void CListDeleteItem(
colum_list_struct *list,
int row_num, int colum_num
);
extern int CListInit(
colum_list_struct *list,
win_t parent,
int x, int y,
unsigned int width,
unsigned int height,
void *client_data,
int (*func_cb)(void *)
);
extern int CListResize(colum_list_struct *list);
extern int CListDraw(colum_list_struct *list, int amount);
extern int CListManage(colum_list_struct *list, event_t *event);
extern void CListMap(colum_list_struct *list);
extern void CListUnmap(colum_list_struct *list);
extern void CListDestroy(colum_list_struct *list);
/* In wprogressbar.c */
extern int PBarInit(
progress_bar_struct *pb,
win_t parent,
int x, int y,
unsigned int width, unsigned int height,
double start_val,
double min, double max,
char *label,
int completion_action
);
extern int PBarDraw(progress_bar_struct *pb);
extern int PBarManage(progress_bar_struct *pb, event_t *event);
extern void PBarMap(progress_bar_struct *pb);
extern void PBarUnmap(progress_bar_struct *pb);
extern void PBarDestroy(progress_bar_struct *pb);
extern int PBarUpdate(progress_bar_struct *pb, double value, char *label);
/* In wdialog.c */
extern int DialogWinInit(
dialog_win_struct *dw,
win_t parent,
unsigned int width,
unsigned int height,
image_t *icon
);
extern int DialogWinDraw(
dialog_win_struct *dw,
char *mesg
);
extern int DialogWinManage(
dialog_win_struct *dw,
event_t *event
);
extern void DialogWinMap(dialog_win_struct *dw);
extern void DialogWinUnmap(dialog_win_struct *dw);
extern void DialogWinDestroy(
dialog_win_struct *dw
);
extern int printdw(
dialog_win_struct *dw,
char *mesg
);
/* In wfbrowser.c */
extern char *GETCHILD(char *path);
extern char *GETSELECTIONNAME(fbrowser_struct *fb);
extern char *FBrowserGetPathMask(char *path);
extern char *FBrowserGetJustPath(char *path);
extern char *FBrowserGetFileSystemString(int fs_type);
extern int FBrowserGetFileSystemType(char *fs_name);
extern fb_object_struct *FBrowserGetSelObject(fbrowser_struct *fb);
extern int FBrowserDoOK(fbrowser_struct *fb);
extern int FBrowserApplyCVPrompt(fbrowser_struct *fb);
extern int FBrowserChangeDir(
fbrowser_struct *fb,
char *path
);
extern int FBrowserGetDeviceListing(fbrowser_struct *fb);
extern int FBrowserRefreshList(fbrowser_struct *fb);
extern int FBrowserSetOpMesg(
fbrowser_struct *fb,
char *title,
char *ok_btn_name
);
extern int FBrowserDevicesPUListCB(void *ptr);
extern int FBrowserMountPBCB(void *ptr);
extern int FBrowserUnmountPBCB(void *ptr);
extern int FBrowserOKPBCB(void *ptr);
extern int FBrowserCancelPBCB(void *ptr);
extern int FBrowserRefreshPBCB(void *ptr);
extern int FBrowserInit(
fbrowser_struct *fb,
int x, int y,
unsigned int width, unsigned int height,
char *start_dir,
int style, /* One of FB_STYLE_* */
int (*func_ok)(char *),
int (*func_cancel)(char *)
);
extern int FBrowserResize(fbrowser_struct *fb);
extern int FBrowserDraw(fbrowser_struct *fb, int amount);
extern int FBrowserManage(
fbrowser_struct *fb,
event_t *event
);
extern void FBrowserMapCVPrompt(fbrowser_struct *fb, int mode);
extern void FBrowserUnmapCVPrompt(fbrowser_struct *fb);
extern void FBrowserMap(fbrowser_struct *fb);
extern void FBrowserMapPath(fbrowser_struct *fb, char *path);
extern void FBrowserMapSearchMask(fbrowser_struct *fb, char *pattern);
extern void FBrowserUnmap(fbrowser_struct *fb);
extern void FBrowserDestroy(fbrowser_struct *fb);
/* In wpulist.c */
extern int PUListIsItemAllocated(popup_list_struct *list, int n);
extern char *PUListGetSelItemName(popup_list_struct *list);
extern int PUListAddItem(
popup_list_struct *list,
char *name,
bool_t disabled
);
extern void PUListDeleteAllItems(popup_list_struct *list);
extern int PUListInit(
popup_list_struct *list,
win_t parent,
int x, int y,
unsigned int width, unsigned int height,
int popup_list_vis_items,
int direction,
void *client_data,
int (*func_cb)(void *)
);
extern int PUListResize(
popup_list_struct *list,
unsigned int width, unsigned int height,
int popup_list_vis_items
);
extern int PUListDraw(popup_list_struct *list, int amount);
extern int PUListManage(popup_list_struct *list, event_t *event);
extern void PUListMap(popup_list_struct *list);
extern void PUListUnmap(popup_list_struct *list);
extern void PUListMapList(popup_list_struct *list);
extern void PUListUnmapList(popup_list_struct *list);
extern void PUListDestroy(popup_list_struct *list);
extern void PUListRepeatRecordSet(
popup_list_struct *list,
long dsec, int op_code
);
extern void PUListRepeatRecordClear(void);
extern int PUListManageRepeat(event_t *event);
/* In wlist.c */
extern int ListGetItemNumByDataPointer(
list_window_struct *lw,
void *data_ptr
);
extern int ListIsItemAllocated(
list_window_struct *lw,
int n
);
extern int ListAddItem(
list_window_struct *lw,
int type,
char *name,
image_t *image,
int pos, /* -1 for append. */
void *data_ptr
);
extern void ListDeleteItem(list_window_struct *lw, int pos);
extern void ListDeleteAllItems(list_window_struct *lw);
extern int ListWinInit(
list_window_struct *lw,
win_t parent,
int x, int y,
unsigned int width, unsigned int height
);
extern int ListWinResize(list_window_struct *lw);
extern int ListWinDraw(list_window_struct *lw);
extern int ListWinManage(
list_window_struct *lw,
event_t *event
);
extern int ListWinCVPromptApply(list_window_struct *lw);
extern void ListWinMapCVPrompt(list_window_struct *lw, int mode);
extern void ListWinUnmapCVPrompt(list_window_struct *lw);
extern void ListWinMap(list_window_struct *lw);
extern void ListWinUnmap(list_window_struct *lw);
extern void ListWinDestroy(list_window_struct *lw);
extern WCursor *ListWinCreateCursorFromEntry(
list_window_struct *lw,
int entry_num
);
extern void ListWinDoDragStart(
list_window_struct *lw,
int entry_pos, /* Drag started on/for this entry. */
win_t start_w
);
extern void ListWinDoDragStop(list_window_struct *lw);
extern void ListWinRepeatRecordSet(
list_window_struct *lw,
long dsec, int op_code
);
extern void ListWinRepeatRecordClear(void);
extern int ListWinManageRepeat(event_t *event);
/* In wmenu.c. */
extern int MenuIsItemAllocated(menu_struct *menu, int n);
extern int MenuSetItemState(menu_struct *menu, int n, bool_t state);
extern int MenuAddItem(
menu_struct *menu,
char *name,
int type,
image_t *icon,
int id_code,
int pos
);
extern void MenuDeleteAllItems(menu_struct *menu);
extern int MenuInit(
menu_struct *menu,
win_t parent,
int (*func_cb)(void *, int), /* Can be NULL. */
void *client_data /* Can be NULL. */
);
extern int MenuDraw(menu_struct *menu);
extern int MenuManage(
menu_struct *menu,
event_t *event
);
extern int MenuClose(menu_struct *menu);
extern void MenuMap(menu_struct *menu);
extern void MenuMapPos(menu_struct *menu, int x, int y);
extern void MenuUnmap(menu_struct *menu);
extern void MenuDestroy(menu_struct *menu);
/* In wmenubar.c */
extern int MenuBarIsItemAllocated(menu_bar_struct *mb, int n);
extern menu_struct *MenuBarGetMenuFromItem(menu_bar_struct *mb, int n);
extern int MenuBarMatchItemByPos(
menu_bar_struct *mb,
int x, int y
);
extern int MenuBarAddItem(
menu_bar_struct *mb,
int pos, /* Can be -1 for append. */
char *name,
int x, int y,
unsigned int width, unsigned int height
);
extern int MenuBarAddItemMenuItem(
menu_bar_struct *mb,
int n, /* Menu bar item number, must be valid */
char *name,
int type,
image_t *icon, /* Shared. */
int id_code,
int pos /* Can be -1 for append. */
);
extern void MenuBarDeleteItem(menu_bar_struct *mb, int n);
extern int MenuBarInit(
menu_bar_struct *mb,
win_t parent,
int x, int y,
unsigned int width, unsigned int height,
int (*func_cb)(void *, int),
void *client_data
);
extern int MenuBarResize(menu_bar_struct *mb);
extern int MenuBarDraw(menu_bar_struct *mb);
extern int MenuBarManage(menu_bar_struct *mb, event_t *event);
extern void MenuBarMap(menu_bar_struct *mb);
extern void MenuBarUnmap(menu_bar_struct *mb);
extern void MenuBarDestroy(menu_bar_struct *mb);
/* In wprompt.c */
#define PROMPT_POS_CUR 0
#define PROMPT_POS_START 1
#define PROMPT_POS_END 2
extern int PromptMarkBuffer(prompt_window_struct *prompt, int opt);
extern void PromptUnmarkBuffer(prompt_window_struct *prompt, int opt);
extern double PromptGetF(prompt_window_struct *prompt);
extern int PromptGetI(prompt_window_struct *prompt);
extern char *PromptGetS(prompt_window_struct *prompt);
extern void PromptSetF(prompt_window_struct *prompt, double val);
extern void PromptSetI(prompt_window_struct *prompt, int val);
extern void PromptSetS(prompt_window_struct *prompt, char *val);
extern void PromptRepeatRecordSet(
prompt_window_struct *prompt,
long dsec, int op_code
);
extern void PromptRepeatRecordClear(void);
extern void PromptSetNotifyFunction(int (*func_notify)(prompt_window_struct *));
extern int PromptInit(
prompt_window_struct *prompt,
win_t parent,
int x, int y,
unsigned int width, unsigned int height,
int style,
char *name,
unsigned int buf_len,
int hist_bufs,
int (*func_cb)(char *)
);
extern void PromptChangeName(prompt_window_struct *prompt, char *name);
extern void PROMPT_UNMARK_REDRAW_ALL(prompt_window_struct *except_prompt);
extern void PROMPT_UNFOCUS_REDRAW_ALL(prompt_window_struct *except_prompt);
extern int PromptDraw(prompt_window_struct *prompt, int amount);
extern int PromptManage(prompt_window_struct *prompt, event_t *event);
extern void PromptMap(prompt_window_struct *prompt);
extern void PromptClose(prompt_window_struct *prompt);
extern void PromptUnmap(prompt_window_struct *prompt);
extern void PromptDestroy(prompt_window_struct *prompt);
extern int PromptManageRepeat(event_t *event);
/* In wpstepper.c */
extern int PStepperIsPageAllocated(
page_stepper_struct *ps,
int page
);
extern int PStepperGetWidgetPointer(
page_stepper_struct *ps,
char *name,
void **w_ptr,
int *w_type
);
extern double PStepperGetWidgetValue(
page_stepper_struct *ps,
char *name
);
extern void *PStepperGetWidgetValuePtr(
page_stepper_struct *ps,
char *name
);
extern int PStepperPBCB(void *btn);
extern int PStepperPrevPBCB(void *ptr);
extern int PStepperNextPBCB(void *ptr);
extern int PStepperInit(
page_stepper_struct *ps,
win_t parent,
int x, int y,
unsigned int width, unsigned int height,
unsigned int total_pages,
image_t *panel_img,
void *client_data,
int (*page_change_handler)(void *, int, int),
int (*exit_handler)(void *),
int (*finish_handler)(void *)
);
extern int PStepperDraw(
page_stepper_struct *ps,
int amount
);
extern int PStepperManage(
page_stepper_struct *ps,
event_t *event
);
extern void PStepperMap(page_stepper_struct *ps);
extern void PStepperUnmap(page_stepper_struct *ps);
extern void PStepperMapPage(page_stepper_struct *ps, int page);
extern void PStepperUnmapPage(page_stepper_struct *ps, int page);
extern void PStepperDestroy(page_stepper_struct *ps);
extern int PStepperAllocatePage(page_stepper_struct *ps);
extern void PStepperDestroyPage(
page_stepper_struct *ps,
int page
);
extern int PStepperAllocateLabel(
page_stepper_struct *ps,
int page,
char *text,
image_t *image,
font_t *font,
pixel_t pix,
int x, int y
);
extern int PStepperAllocateWidget(
page_stepper_struct *ps,
int page,
char *name,
int w_type,
int x, int y,
unsigned int width, unsigned int height,
int argc, char *argv[]
);
extern void PStepperDestroyWidget(page_widget_struct *pw);
/* In wscalebar.c */
extern int ScaleBarInit(
scale_bar_struct *sb,
win_t parent,
int x, int y,
unsigned int length,
int style,
int ticks,
int orientation,
double pos_min, double pos_max, double pos,
bool_t flip_pos,
void *client_data,
int (*func_cb)(void *)
);
extern int ScaleBarDraw(scale_bar_struct *sb);
extern int ScaleBarManage(
scale_bar_struct *sb,
event_t *event
);
extern void ScaleBarMap(scale_bar_struct *sb);
extern void ScaleBarUnmap(scale_bar_struct *sb);
extern void ScaleBarDestroy(scale_bar_struct *sb);
/* In wscrollbar.c */
extern void SBarRepeatRecordSet(
scroll_bar_struct *sb,
long dsec, int op_code,
int width, int height,
int max_width, int max_height
);
extern void SBarRepeatRecordClear(void);
extern void SBarSetNotifyFunction(int (*func_notify)(scroll_bar_struct *));
extern int SBarInit(
scroll_bar_struct *sb,
win_t parent,
unsigned int width, unsigned int height
);
extern int SBarResize(
scroll_bar_struct *sb,
unsigned int width,
unsigned int height
);
extern int SBarDraw(
scroll_bar_struct *sb,
int width, int height,
int max_width, int max_height
);
extern int SBarManage(
scroll_bar_struct *sb, /* Scrollbar return. */
int width, int height, /* Visibile size of window. */
int max_width, int max_height, /* Total size of window. */
event_t *event
);
extern int SBarManageRepeat(event_t *event);
extern void SBarDestroy(scroll_bar_struct *sb);
/* In wtogglearray.c */
extern int TgBtnArrayInit(
toggle_button_array_struct *tba,
win_t parent,
int x, int y,
unsigned int nbtns,
int start_sel_btn,
char **names,
unsigned int nnames,
int alignment
);
extern int TgBtnSetHintMessage(
toggle_button_struct *tb,
char *message
);
extern int TgBtnArrayManage(
toggle_button_array_struct *tba,
event_t *event
);
extern int TgBtnArrayDraw(
toggle_button_array_struct *tba
);
extern void TgBtnArrayMap(toggle_button_array_struct *tba);
extern void TgBtnArrayUnmap(toggle_button_array_struct *tba);
extern void TgBtnArrayDestroy(toggle_button_array_struct *tba);
/* In wtogglebtn.c */
extern int TgBtnInit(
toggle_button_struct *tb,
win_t parent,
int x, int y,
bool_t state,
char *label
);
extern int TgBtnDraw(toggle_button_struct *tb, int amount);
extern int TgBtnManage(toggle_button_struct *tb, event_t *event);
extern void TgBtnMap(toggle_button_struct *tb);
extern void TgBtnUnmap(toggle_button_struct *tb);
extern void TgBtnDestroy(toggle_button_struct *tb);
/* In wviewer.c */
extern int ViewerLoadFile(
file_viewer_struct *fv,
char *filename
);
extern int ViewerLoadData(
file_viewer_struct *fv,
void *buf,
int buf_len
);
extern void ViewerUnload(file_viewer_struct *fv);
extern int ViewerInit(
file_viewer_struct *fv,
int x, int y,
unsigned int width, unsigned int height
);
extern int ViewerResize(file_viewer_struct *fv);
extern int ViewerDraw(file_viewer_struct *fv);
extern int ViewerManage(file_viewer_struct *fv, event_t *event);
extern void ViewerMap(file_viewer_struct *fv);
extern void ViewerUnmap(file_viewer_struct *fv);
extern void ViewerDestroy(file_viewer_struct *fv);
/* In wreg.c */
extern void WidgetRegReclaim(void);
extern void WidgetRegDeleteAll(void);
extern void *WidgetRegIsRegistered(void *ptr, int type);
extern int WidgetRegAdd(void *ptr, int type);
extern void WidgetRegDelete(void *ptr);
#endif /* WIDGETS_H */
|