1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.agw.customtreectrl
.. highlight:: python
.. _wx.lib.agw.customtreectrl.CustomTreeCtrl:
==========================================================================================================================================
|phoenix_title| **wx.lib.agw.customtreectrl.CustomTreeCtrl**
==========================================================================================================================================
:class:`CustomTreeCtrl` is a class that mimics the behaviour of :class:`TreeCtrl`, with almost the
same base functionalities plus some more enhancements. This class does not rely on
the native control, as it is a full owner-drawn tree control.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>CustomTreeCtrl</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.agw.customtreectrl.CustomTreeCtrl_inheritance.png" alt="Inheritance diagram of CustomTreeCtrl" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="39,5,140,35"/> <area shape="rect" id="node2" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="91,83,201,112"/> <area shape="rect" id="node6" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="86,160,207,189"/> <area shape="rect" id="node3" href="wx.Object.html" title="wx.Object" alt="" coords="164,5,245,35"/> <area shape="rect" id="node4" href="wx.lib.agw.customtreectrl.CustomTreeCtrl.html" title="wx.lib.agw.customtreectrl.CustomTreeCtrl" alt="" coords="5,469,288,499"/> <area shape="rect" id="node5" href="wx.ScrolledWindow.html" title="wx.ScrolledWindow" alt="" coords="77,392,216,421"/> <area shape="rect" id="node7" href="wx.Window.html" title="wx.Window" alt="" coords="102,237,191,267"/> </map>
</p>
|
|appearance| Control Appearance
===============================
|
.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.customtreectrl.customtreectrl.png
:alt: wxMSW
:figclass: floatleft
**wxMSW**
.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
:alt: wxMAC
:figclass: floatright
**wxMAC**
.. figure:: _static/images/widgets/fullsize/wxgtk/wx.lib.agw.customtreectrl.customtreectrl.png
:alt: wxGTK
:figclass: floatcenter
**wxGTK**
|
|super_classes| Known Superclasses
==================================
:class:`wx.ScrolledWindow`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.__init__` Default class constructor.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.AcceptsFocus` Can this window be given focus by mouse click?
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.AddRoot` Adds a root item to the :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.AdjustMyScrollbars` Internal method used to adjust the :class:`ScrolledWindow` scrollbars.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.AppendItem` Appends an item as a last child of its parent.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.AppendSeparator` Appends an horizontal line separator as a last child of its parent.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.AssignButtonsImageList` Assigns the button image list.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.AssignImageList` Assigns the normal image list.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.AssignLeftImageList` Assigns the image list for :class:`CustomTreeCtrl` filled with images to be used on
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.AssignStateImageList` Assigns the state image list.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.AutoCheckChild` Transverses the tree and checks/unchecks the items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.AutoCheckParent` Traverses up the tree and checks/unchecks parent items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.AutoToggleChild` Transverses the tree and toggles the items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.CalculateLevel` Calculates the level of an item inside the tree hierarchy.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.CalculateLineHeight` Calculates the height of a line.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.CalculatePositions` Calculates all the positions of the visible items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.CalculateSize` Calculates overall position and size of an item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.CheckChilds` Programatically check/uncheck item children.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.CheckItem` Actually checks/uncheks an item, sending (eventually) the two
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.CheckItem2` Used internally to avoid ``EVT_TREE_ITEM_CHECKED`` events.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.CheckSameLevel` Uncheck radio items which are on the same level of the checked one.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.ChildrenClosing` We are about to destroy the item children.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.Collapse` Collapse an item, sending a ``EVT_TREE_ITEM_COLLAPSING`` and
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.CollapseAndReset` Collapse the given item and deletes its children.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.Delete` Deletes an item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.DeleteAllItems` Deletes all items in the :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.DeleteChildren` Delete all the item's children.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.DeleteItemWindow` Deletes the window associated to an item (if any).
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.DoGetBestSize` Gets the size which best suits the window: for a control, it would be the
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.DoInsertItem` Actually inserts an item in the tree.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.DoSelectItem` Actually selects/unselects an item, sending ``EVT_TREE_SEL_CHANGING`` and
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.DrawHorizontalGradient` Gradient fill from colour 1 to colour 2 from left to right.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.DrawVerticalGradient` Gradient fill from colour 1 to colour 2 from top to bottom.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.DrawVistaRectangle` Draws the selected item(s) with the Windows Vista style.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.Edit` Internal function. Starts the editing of an item label, sending a
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.EditLabel` Starts editing an item label.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.EnableChildren` Enables/disables the item children.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.EnableItem` Enables/disables an item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.EnableSelectionGradient` Globally enables/disables drawing of gradient selections.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.EnableSelectionVista` Globally enables/disables drawing of Windows Vista selections.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.EnsureVisible` Scrolls and/or expands items to ensure that the given item is visible.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.Expand` Expands an item, sending a ``EVT_TREE_ITEM_EXPANDING`` and
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.ExpandAll` Expands all :class:`CustomTreeCtrl` items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.ExpandAllChildren` Expands all the items children of the input item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.FillArray` Internal function. Used to populate an array of selected items when
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.FindItem` Finds the first item starting with the given prefix after the given parent.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.Freeze` Freeze :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetAGWWindowStyleFlag` Returns the :class:`CustomTreeCtrl` style.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetBackgroundImage` Returns the :class:`CustomTreeCtrl` background image (if any).
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetBorderPen` Returns the pen used to draw the selected item border.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetBoundingRect` Retrieves the rectangle bounding the item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetButtonsImageList` Returns the buttons image list associated with :class:`CustomTreeCtrl` (from
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetChildrenCount` Returns the item children count.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetClassDefaultAttributes` Returns the default font and colours which are used by the control. This is
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetConnectionPen` Returns the pen used to draw the connecting lines between items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetControlBmp` Returns a native looking checkbox or radio button bitmap.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetCount` Returns the global number of items in the tree.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetDisabledColour` Returns the colour for items in a disabled state.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetEditControl` Returns a pointer to the edit :class:`TreeTextCtrl` if the item is being edited or
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetFirstChild` Returns the item's first child and an integer value 'cookie'.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetFirstGradientColour` Returns the first gradient colour for gradient-style selections.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetFirstVisibleItem` Returns the first visible item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetGradientStyle` Returns the gradient style for gradient-style selections.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetHilightFocusColour` Returns the colour used to highlight focused selected items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetHilightNonFocusColour` Returns the colour used to highlight unfocused selected items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetHyperTextFont` Returns the font used to render hypertext items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetHyperTextNewColour` Returns the colour used to render a non-visited hypertext item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetHyperTextVisitedColour` Returns the colour used to render a visited hypertext item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetImageList` Returns the normal image list associated with :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetImageListCheck` Returns the image list used to build the check/radio buttons in :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetIndent` Returns the item indentation, in pixels.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetItem3StateValue` Gets the state of a 3-state checkbox item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetItemBackgroundColour` Returns the item background colour.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetItemFont` Returns the item font.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetItemImage` Returns the item image.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetItemLeftImage` Returns the item leftmost image, i.e. the image associated to the item on the leftmost
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetItemParent` Returns the item parent (can be ``None`` for root items).
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetItemSize` Returns the horizontal space available in :class:`CustomTreeCtrl`, in pixels, to draw this item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetItemText` Returns the item text.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetItemTextColour` Returns the item text colour or separator horizontal line colour.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetItemType` Returns the item type.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetItemVisited` Returns whether an hypertext item was visited.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetItemWindow` Returns the window associated to the item (if any).
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetItemWindowEnabled` Returns whether the window associated to the item is enabled.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetLastChild` Returns the item last child.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetLeftImageList` Returns the image list for :class:`CustomTreeCtrl` filled with images to be used on
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetLineHeight` Returns the line height for the given item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetMaxWidth` Returns the maximum width of the :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetNext` Returns the next item. Only for internal use right now.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetNextActiveItem` Returns the next active item. Used Internally at present.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetNextChild` Returns the item's next child.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetNextExpanded` Returns the next expanded item after the input one.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetNextShown` Returns the next displayed item in the tree. This is either the first
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetNextSibling` Returns the next sibling of an item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetNextVisible` Returns the next visible item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetPrev` Returns the previous item. Only for internal use right now.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetPrevExpanded` Returns the previous expanded item before the input one.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetPrevShown` Returns the previous displayed item in the tree. This is either the
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetPrevSibling` Returns the previous sibling of an item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetPrevVisible` Returns the previous visible item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetPyData` Returns the data associated to an item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetRootItem` Returns the root item, an instance of :class:`GenericTreeItem`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetSecondGradientColour` Returns the second gradient colour for gradient-style selections.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetSelection` Returns the current selection.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetSelections` Returns a list of selected items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetSeparatorColour` Returns the pen colour for separator-type items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetSpacing` Returns the spacing between the start and the text, in pixels.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetStateImageList` Returns the state image list associated with :class:`CustomTreeCtrl` (from which
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.HandleHyperLink` Handles the hyperlink items, sending the ``EVT_TREE_ITEM_HYPERLINK`` event.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.HasAGWFlag` Returns ``True`` if :class:`CustomTreeCtrl` has the `flag` bit set.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.HasButtons` Returns whether :class:`CustomTreeCtrl` has the ``TR_HAS_BUTTONS`` flag set.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.HasChildren` Returns whether an item has children or not.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.HideWindows` Hides the windows associated to the items. Used internally.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.HitTest` Calculates which (if any) item is under the given point, returning the tree item
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.InsertItem` Inserts an item after the given previous.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.InsertItemByIndex` Inserts an item after the given previous.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.InsertItemByItem` Inserts an item after the given previous.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.InsertSeparator` Inserts a separator item after the given previous.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.IsBold` Returns whether the item font is bold or not.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.IsDescendantOf` Checks if the given item is under another one in the tree hierarchy.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.IsExpanded` Returns whether the item is expanded or not.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.IsItalic` Returns whether the item font is italic or not.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.IsItem3State` Returns whether or not the checkbox item is a 3-state checkbox.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.IsItemChecked` Returns whether an item is checked or not.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.IsItemEnabled` Returns whether an item is enabled or disabled.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.IsItemHyperText` Returns whether an item is hypertext or not.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.IsItemSeparator` Returns whether an item is of separator type or not.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.IsSelected` Returns whether the item is selected or not.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.IsVisible` Returns whether the item is visible or not (i.e., its hierarchy is expanded
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.ItemHasChildren` Returns whether the item has children or not.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnAcceptEdit` Called by :class:`TreeTextCtrl`, to accept the changes and to send the
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnCancelEdit` Called by :class:`TreeTextCtrl`, to cancel the changes and to send the
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnCompareItems` Returns whether 2 items have the same text.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnDestroy` Handles the ``wx.EVT_WINDOW_DESTROY`` event for :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnEditTimer` The timer for editing has expired. Start editing.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnEraseBackground` Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnGetToolTip` Process the tooltip event, to speed up event processing. Does not actually
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnInternalIdle` This method is normally only used internally, but sometimes an application
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnKeyDown` Handles the ``wx.EVT_KEY_DOWN`` event for :class:`CustomTreeCtrl`, sending a
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnKillFocus` Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnMouse` Handles a bunch of ``wx.EVT_MOUSE_EVENTS`` events for :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnPaint` Handles the ``wx.EVT_PAINT`` event for :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnSetFocus` Handles the ``wx.EVT_SET_FOCUS`` event for :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.OnSize` Handles the ``wx.EVT_SIZE`` event for :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.PaintItem` Actually draws an item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.PaintLevel` Paint a level in the hierarchy of :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.PrependItem` Prepends an item as a first child of parent.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.PrependSeparator` Prepends a separator item as a first child of parent.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.RecurseOnChildren` Recurses over all the children of the spcified items, calculating their
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.RefreshItemWithWindows` Refreshes the items with which a window is associated.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.RefreshLine` Refreshes a damaged item line.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.RefreshSelected` Refreshes a damaged selected item line.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.RefreshSelectedUnder` Refreshes the selected items under the given item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.RefreshSubtree` Refreshes a damaged subtree of an item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.ResetEditControl` Called by :class:`TreeTextCtrl` when it marks itself for deletion.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.ScrollTo` Scrolls the specified item into view.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SelectAll` Selects all the item in the tree.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SelectAllChildren` Selects all the children of the given item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SelectItem` Selects/deselects an item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SelectItemRange` Selects all the items between `item1` and `item2`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SendDeleteEvent` Actually sends the ``EVT_TREE_DELETE_ITEM`` event.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetAGWWindowStyleFlag` Sets the :class:`CustomTreeCtrl` window style.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetBackgroundColour` Changes the background colour of :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetBackgroundImage` Sets the :class:`CustomTreeCtrl` background image.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetBorderPen` Sets the pen used to draw the selected item border.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetButtonsImageList` Sets the buttons image list for :class:`CustomTreeCtrl` (from which application-defined
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetConnectionPen` Sets the pen used to draw the connecting lines between items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetDisabledColour` Sets the colour for items in a disabled state.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetFirstGradientColour` Sets the first gradient colour for gradient-style selections.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetFont` Sets the :class:`CustomTreeCtrl` font.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetForegroundColour` Changes the foreground colour of :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetGradientStyle` Sets the gradient style for gradient-style selections.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetHilightFocusColour` Sets the colour used to highlight focused selected items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetHilightNonFocusColour` Sets the colour used to highlight unfocused selected items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetHyperTextFont` Sets the font used to render hypertext items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetHyperTextNewColour` Sets the colour used to render a non-visited hypertext item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetHyperTextVisitedColour` Sets the colour used to render a visited hypertext item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetImageList` Sets the normal image list for :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetImageListCheck` Sets the checkbox/radiobutton image list.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetIndent` Sets the indentation for :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItem3State` Sets whether the item has a 3-state value checkbox assigned to it or not.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItem3StateValue` Sets the checkbox item to the given `state`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemBackgroundColour` Sets the item background colour.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemBold` Sets the item font as bold/unbold.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemDropHighlight` Gives the item the visual feedback for drag and drop operations.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemFont` Sets the item font.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemHasChildren` Forces the appearance/disappearance of the button next to the item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemHyperText` Sets whether the item is hypertext or not.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemImage` Sets the item image, depending on the item state.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemItalic` Sets the item font as italic/non-italic.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemLeftImage` Sets the item leftmost image, i.e. the image associated to the item on the leftmost
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemText` Sets the item text.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemTextColour` Sets the item text colour or separator horizontal line colour.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemType` Sets the item type.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemVisited` Sets whether an hypertext item was visited.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemWindow` Sets the window for the given item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetItemWindowEnabled` Enables/disables the window associated to the item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetLeftImageList` Sets the image list for :class:`CustomTreeCtrl` filled with images to be used on
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetPyData` Sets the data associated to an item.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetSecondGradientColour` Sets the second gradient colour for gradient-style selections.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetSeparatorColour` Sets the pen colour for separator-type items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetSpacing` Sets the spacing between items in :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SetStateImageList` Sets the state image list for :class:`CustomTreeCtrl` (from which application-defined
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.ShouldInheritColours` Return ``True`` from here to allow the colours of this window to be
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.SortChildren` Sorts the children of the given item using the :meth:`~CustomTreeCtrl.OnCompareItems` method of
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.TagAllChildrenUntilLast` Used internally.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.TagNextChildren` Used internally.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.Thaw` Thaw :class:`CustomTreeCtrl`.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.TileBackground` Tiles the background image to fill all the available area.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.Toggle` Toggles the item state (collapsed/expanded).
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.ToggleItemSelection` Toggles the item selection.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.UnCheckRadioParent` Used internally to handle radio node parent correctly.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.Unselect` Unselects the current selection.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.UnselectAll` Unselect all the items.
:meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.UnselectAllChildren` Unselects all the children of the given item.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: CustomTreeCtrl(wx.ScrolledWindow)
:class:`CustomTreeCtrl` is a class that mimics the behaviour of :class:`TreeCtrl`, with almost the
same base functionalities plus some more enhancements. This class does not rely on
the native control, as it is a full owner-drawn tree control.
.. method:: __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=TR_DEFAULT_STYLE, validator=wx.DefaultValidator, name="CustomTreeCtrl")
Default class constructor.
:param wx.Window `parent`: parent window. Must not be ``None``;
:param integer `id`: window identifier. A value of -1 indicates a default value;
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
:type `pos`: tuple or :class:`wx.Point`
:param `size`: the control size. A value of (-1, -1) indicates a default size,
chosen by either the windowing system or wxPython, depending on platform;
:type `size`: tuple or :class:`wx.Size`
:param integer `style`: the underlying :class:`ScrolledWindow` style;
:param integer `agwStyle`: the AGW-specific window style for :class:`CustomTreeCtrl`. It can be a
combination of the following bits:
============================== =========== ==================================================
Window Styles Hex Value Description
============================== =========== ==================================================
``TR_NO_BUTTONS`` 0x0 For convenience to document that no buttons are to be drawn.
``TR_SINGLE`` 0x0 For convenience to document that only one item may be selected at a time. Selecting another item causes the current selection, if any, to be deselected. This is the default.
``TR_HAS_BUTTONS`` 0x1 Use this style to show + and - buttons to the left of parent items.
``TR_NO_LINES`` 0x4 Use this style to hide vertical level connectors.
``TR_LINES_AT_ROOT`` 0x8 Use this style to show lines between root nodes. Only applicable if ``TR_HIDE_ROOT`` is set and ``TR_NO_LINES`` is not set.
``TR_DEFAULT_STYLE`` 0x9 The set of flags that are closest to the defaults for the native control for a particular toolkit.
``TR_TWIST_BUTTONS`` 0x10 Use old Mac-twist style buttons.
``TR_MULTIPLE`` 0x20 Use this style to allow a range of items to be selected. If a second range is selected, the current range, if any, is deselected.
``TR_EXTENDED`` 0x40 Use this style to allow disjoint items to be selected. (Only partially implemented; may not work in all cases).
``TR_HAS_VARIABLE_ROW_HEIGHT`` 0x80 Use this style to cause row heights to be just big enough to fit the content. If not set, all rows use the largest row height. The default is that this flag is unset.
``TR_EDIT_LABELS`` 0x200 Use this style if you wish the user to be able to edit labels in the tree control.
``TR_ROW_LINES`` 0x400 Use this style to draw a contrasting border between displayed rows.
``TR_HIDE_ROOT`` 0x800 Use this style to suppress the display of the root node, effectively causing the first-level nodes to appear as a series of root nodes.
``TR_FULL_ROW_HIGHLIGHT`` 0x2000 Use this style to have the background colour and the selection highlight extend over the entire horizontal row of the tree control window.
``TR_AUTO_CHECK_CHILD`` 0x4000 Only meaningful for checkbox-type items: when a parent item is checked/unchecked its children are checked/unchecked as well.
``TR_AUTO_TOGGLE_CHILD`` 0x8000 Only meaningful for checkbox-type items: when a parent item is checked/unchecked its children are toggled accordingly.
``TR_AUTO_CHECK_PARENT`` 0x10000 Only meaningful for checkbox-type items: when a child item is checked/unchecked its parent item is checked/unchecked as well.
``TR_ALIGN_WINDOWS`` 0x20000 Flag used to align windows (in items with windows) at the same horizontal position.
``TR_ALIGN_WINDOWS_RIGHT`` 0x40000 Flag used to align windows (in items with windows) to the rightmost edge of :class:`CustomTreeCtrl`.
``TR_ELLIPSIZE_LONG_ITEMS`` 0x80000 Flag used to ellipsize long items when the horizontal space for :class:`CustomTreeCtrl` is low.
``TR_TOOLTIP_ON_LONG_ITEMS`` 0x100000 Flag used to show tooltips on long items when the horizontal space for :class:`CustomTreeCtrl` is low.
============================== =========== ==================================================
:param wx.Validator `validator`: window validator;
:param string `name`: window name.
.. method:: AcceptsFocus(self)
Can this window be given focus by mouse click?
:note: This method always returns ``True`` as we always accept focus from
mouse click.
:note: Overridden from :class:`ScrolledWindow`.
.. method:: AddRoot(self, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None, on_the_right=True)
Adds a root item to the :class:`CustomTreeCtrl`.
:param string `text`: the item text label;
:param integer `ct_type`: the item type (see :meth:`~CustomTreeCtrl.SetItemType` for a list of valid
item types);
:param `wnd`: if not ``None``, a non-toplevel window to show next to the item,
any subclass of :class:`wx.Window` except top-level windows;
:param integer `image`: an index within the normal image list specifying the image to
use for the item in unselected state;
:param integer `selImage`: an index within the normal image list specifying the image to
use for the item in selected state; if `image` > -1 and `selImage` is -1, the
same image is used for both selected and unselected items;
:param object `data`: associate the given Python object `data` with the item.
:param bool `on_the_right`: ``True`` positions the window on the right of text, ``False``
on the left of text and overlapping the image.
:return: An instance of :class:`GenericTreeItem` upon successful insertion.
:raise: `Exception` in the following cases:
- There already is a root item in the tree;
- The item window is not ``None`` but the ``TR_HAS_VARIABLE_ROW_HEIGHT`` flag has not been
set for :class:`CustomTreeCtrl`;
- The item has multiline text (with line-breaks in it) but the ``TR_HAS_VARIABLE_ROW_HEIGHT``
flag has not been set for :class:`CustomTreeCtrl`;
- The `ct_type` attribute is less than ``0`` or greater than ``2``.
.. warning::
Only one root is allowed to exist in any given instance of :class:`CustomTreeCtrl`.
.. method:: AdjustMyScrollbars(self)
Internal method used to adjust the :class:`ScrolledWindow` scrollbars.
.. method:: AppendItem(self, parentId, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None, on_the_right=True)
Appends an item as a last child of its parent.
:param `parentId`: an instance of :class:`GenericTreeItem` representing the
item's parent;
:param string `text`: the item text label;
:param integer `ct_type`: the item type (see :meth:`~CustomTreeCtrl.SetItemType` for a list of valid
item types);
:param `wnd`: if not ``None``, a non-toplevel window to show next to the item,
any subclass of :class:`wx.Window`;
:param integer `image`: an index within the normal image list specifying the image to
use for the item in unselected state;
:param integer `selImage`: an index within the normal image list specifying the image to
use for the item in selected state; if `image` > -1 and `selImage` is -1, the
same image is used for both selected and unselected items;
:param object `data`: associate the given Python object `data` with the item.
:param bool `on_the_right`: ``True`` positions the window on the right of text, ``False``
on the left of text and overlapping the image.
:return: An instance of :class:`GenericTreeItem` upon successful insertion.
:see: :meth:`~CustomTreeCtrl.DoInsertItem` for possible exceptions generated by this method.
.. method:: AppendSeparator(self, parentId)
Appends an horizontal line separator as a last child of its parent.
:param `parentId`: an instance of :class:`GenericTreeItem` representing the
separator's parent.
:return: An instance of :class:`GenericTreeItem` upon successful insertion.
:see: :meth:`~CustomTreeCtrl.DoInsertItem` for possible exceptions generated by this method.
.. method:: AssignButtonsImageList(self, imageList)
Assigns the button image list.
:param `imageList`: an instance of :class:`wx.ImageList`.
.. method:: AssignImageList(self, imageList)
Assigns the normal image list.
:param `imageList`: an instance of :class:`wx.ImageList`.
.. method:: AssignLeftImageList(self, imageList)
Assigns the image list for :class:`CustomTreeCtrl` filled with images to be used on
the leftmost part of the client area. Any item can have a leftmost image associated
with it.
:param `imageList`: an instance of :class:`wx.ImageList`.
.. method:: AssignStateImageList(self, imageList)
Assigns the state image list.
:param `imageList`: an instance of :class:`wx.ImageList`.
.. method:: AutoCheckChild(self, item, checked)
Transverses the tree and checks/unchecks the items.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `checked`: ``True`` to check an item, ``False`` to uncheck it.
:note: This method is meaningful only for checkbox-like and radiobutton-like items.
.. method:: AutoCheckParent(self, item, checked)
Traverses up the tree and checks/unchecks parent items.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `checked`: ``True`` to check an item, ``False`` to uncheck it.
:note: This method is meaningful only for checkbox-like and radiobutton-like items.
.. method:: AutoToggleChild(self, item)
Transverses the tree and toggles the items.
:param `item`: an instance of :class:`GenericTreeItem`.
:note: This method is meaningful only for checkbox-like and radiobutton-like items.
.. method:: CalculateLevel(self, item, dc, level, y, align=0)
Calculates the level of an item inside the tree hierarchy.
:param `item`: an instance of :class:`GenericTreeItem`;
:param `dc`: an instance of :class:`wx.DC`;
:param integer `level`: the item level in the tree hierarchy;
:param integer `y`: the current vertical position inside the :class:`ScrolledWindow`;
:param integer `align`: an integer specifying the alignment type:
=============== =========================================
`align` Value Description
=============== =========================================
0 No horizontal alignment of windows (in items with windows).
1 Windows (in items with windows) are aligned at the same horizontal position.
2 Windows (in items with windows) are aligned at the rightmost edge of :class:`CustomTreeCtrl`.
=============== =========================================
:return: The new `y` vertical position inside the :class:`ScrolledWindow`.
.. method:: CalculateLineHeight(self)
Calculates the height of a line.
.. method:: CalculatePositions(self)
Calculates all the positions of the visible items.
.. method:: CalculateSize(self, item, dc, level=-1, align=0)
Calculates overall position and size of an item.
:param `item`: an instance of :class:`GenericTreeItem`;
:param `dc`: an instance of :class:`wx.DC`;
:param integer `level`: the item level in the tree hierarchy;
:param integer `align`: an integer specifying the alignment type:
=============== =========================================
`align` Value Description
=============== =========================================
0 No horizontal alignment of windows (in items with windows).
1 Windows (in items with windows) are aligned at the same horizontal position.
2 Windows (in items with windows) are aligned at the rightmost edge of :class:`CustomTreeCtrl`.
=============== =========================================
.. method:: CheckChilds(self, item, checked=True)
Programatically check/uncheck item children.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `checked`: ``True`` to check an item, ``False`` to uncheck it.
:note: This method is meaningful only for checkbox-like and radiobutton-like items.
:note: This method does not generate ``EVT_TREE_ITEM_CHECKING`` and
``EVT_TREE_ITEM_CHECKED`` events.
.. method:: CheckItem(self, item, checked=True)
Actually checks/uncheks an item, sending (eventually) the two
events ``EVT_TREE_ITEM_CHECKING`` and ``EVT_TREE_ITEM_CHECKED``.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `checked`: for a radiobutton-type item, ``True`` to check it, ``False``
to uncheck it. For a checkbox-type item, it can be one of ``wx.CHK_UNCHECKED``
when the checkbox is unchecked, ``wx.CHK_CHECKED`` when it is checked and
``wx.CHK_UNDETERMINED`` when it's in the undetermined state.
.. method:: CheckItem2(self, item, checked=True, torefresh=False)
Used internally to avoid ``EVT_TREE_ITEM_CHECKED`` events.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `checked`: ``True`` to check an item, ``False`` to uncheck it;
:param bool `torefresh`: whether to redraw the item or not.
.. method:: CheckSameLevel(self, item, checked=False)
Uncheck radio items which are on the same level of the checked one.
Used internally.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `checked`: ``True`` to check an item, ``False`` to uncheck it.
:note: This method is meaningful only for radiobutton-like items.
.. method:: ChildrenClosing(self, item)
We are about to destroy the item children.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: Collapse(self, item)
Collapse an item, sending a ``EVT_TREE_ITEM_COLLAPSING`` and
``EVT_TREE_ITEM_COLLAPSED`` events.
:param `item`: an instance of :class:`GenericTreeItem`.
:raise: `Exception` if you try to collapse a hidden root (i.e., when the ``TR_HIDE_ROOT``
style is set for :class:`CustomTreeCtrl`).
.. method:: CollapseAndReset(self, item)
Collapse the given item and deletes its children.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: Delete(self, item)
Deletes an item.
:param `item`: an instance of :class:`GenericTreeItem`.
:note: This method sends the ``EVT_TREE_DELETE_ITEM`` event.
.. method:: DeleteAllItems(self)
Deletes all items in the :class:`CustomTreeCtrl`.
.. method:: DeleteChildren(self, item)
Delete all the item's children.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: DeleteItemWindow(self, item)
Deletes the window associated to an item (if any).
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: DoGetBestSize(self)
Gets the size which best suits the window: for a control, it would be the
minimal size which doesn't truncate the control, for a panel - the same size
as it would have after a call to `Fit()`.
:return: An instance of :class:`wx.Size`.
:note: Overridden from :class:`ScrolledWindow`.
.. method:: DoInsertItem(self, parentId, previous, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None, separator=False, on_the_right=True)
Actually inserts an item in the tree.
:param `parentId`: an instance of :class:`GenericTreeItem` representing the
item's parent;
:param integer `previous`: the index at which we should insert the item;
:param string `text`: the item text label;
:param integer `ct_type`: the item type (see :meth:`~CustomTreeCtrl.SetItemType` for a list of valid
item types);
:param `wnd`: if not ``None``, a non-toplevel window to show next to the item, any
subclass of :class:`wx.Window` except top-level windows;
:param integer `image`: an index within the normal image list specifying the image to
use for the item in unselected state;
:param integer `selImage`: an index within the normal image list specifying the image to
use for the item in selected state; if `image` > -1 and `selImage` is -1, the
same image is used for both selected and unselected items;
:param object `data`: associate the given Python object `data` with the item;
:param bool `separator`: ``True`` if the item is a separator, ``False`` otherwise.
:param bool `on_the_right`: ``True`` positions the window on the right of text, ``False``
on the left of text and overlapping the image.
:return: An instance of :class:`GenericTreeItem` upon successful insertion.
:raise: `Exception` in the following cases:
- The item window is not ``None`` but the ``TR_HAS_VARIABLE_ROW_HEIGHT`` flag has not been
set for :class:`CustomTreeCtrl`;
- The item has multiline text (with line-breaks in it) but the ``TR_HAS_VARIABLE_ROW_HEIGHT``
flag has not been set for :class:`CustomTreeCtrl`;
- The `ct_type` attribute is less than ``0`` or greater than ``2``;
- The parent item is a separator;
- The item is a separator but it has text or an associated window.
:note: Separator items should not have children, text labels or an associated window.
.. method:: DoSelectItem(self, item, unselect_others=True, extended_select=False, from_key=False)
Actually selects/unselects an item, sending ``EVT_TREE_SEL_CHANGING`` and
``EVT_TREE_SEL_CHANGED`` events.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `unselect_others`: if ``True``, all the other selected items are
unselected.
:param bool `extended_select`: ``True`` if the :class:`CustomTreeCtrl` is using the
``TR_EXTENDED`` style;
:param bool `from_key`: ``True`` to indicate that the selection was made via a keyboard
key, ``False`` if it was a mouse selection.
.. method:: DrawHorizontalGradient(self, dc, rect, hasfocus)
Gradient fill from colour 1 to colour 2 from left to right.
:param `dc`: an instance of :class:`wx.DC`;
:param wx.Rect `rect`: the rectangle to be filled with the gradient shading;
:param bool `hasfocus`: ``True`` if the main :class:`CustomTreeCtrl` has focus, ``False``
otherwise.
.. method:: DrawVerticalGradient(self, dc, rect, hasfocus)
Gradient fill from colour 1 to colour 2 from top to bottom.
:param `dc`: an instance of :class:`wx.DC`;
:param wx.Rect `rect`: the rectangle to be filled with the gradient shading;
:param bool `hasfocus`: ``True`` if the main :class:`CustomTreeCtrl` has focus, ``False``
otherwise.
.. method:: DrawVistaRectangle(self, dc, rect, hasfocus)
Draws the selected item(s) with the Windows Vista style.
:param `dc`: an instance of :class:`wx.DC`;
:param wx.Rect `rect`: the rectangle to be filled with the gradient shading;
:param bool `hasfocus`: ``True`` if the main :class:`CustomTreeCtrl` has focus, ``False``
otherwise.
.. method:: Edit(self, item)
Internal function. Starts the editing of an item label, sending a
``EVT_TREE_BEGIN_LABEL_EDIT`` event.
:param `item`: an instance of :class:`GenericTreeItem`.
.. warning:: Separator-type items can not be edited.
.. method:: EditLabel(self, item)
Starts editing an item label.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: EnableChildren(self, item, enable=True)
Enables/disables the item children.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `enable`: ``True`` to enable the children, ``False`` to disable them.
:note: This method is used internally.
.. method:: EnableItem(self, item, enable=True, torefresh=True)
Enables/disables an item.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `enable`: ``True`` to enable the item, ``False`` to disable it;
:param bool `torefresh`: whether to redraw the item or not.
.. method:: EnableSelectionGradient(self, enable=True)
Globally enables/disables drawing of gradient selections.
:param bool `enable`: ``True`` to enable gradient-style selections, ``False``
to disable it.
:note: Calling this method disables any Vista-style selection previously
enabled.
.. method:: EnableSelectionVista(self, enable=True)
Globally enables/disables drawing of Windows Vista selections.
:param bool `enable`: ``True`` to enable Vista-style selections, ``False`` to
disable it.
:note: Calling this method disables any gradient-style selection previously
enabled.
.. method:: EnsureVisible(self, item)
Scrolls and/or expands items to ensure that the given item is visible.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: Expand(self, item)
Expands an item, sending a ``EVT_TREE_ITEM_EXPANDING`` and
``EVT_TREE_ITEM_EXPANDED`` events.
:param `item`: an instance of :class:`GenericTreeItem`.
:raise: `Exception` if you try to expand a hidden root (i.e., when the ``TR_HIDE_ROOT``
style is set for :class:`CustomTreeCtrl`).
.. method:: ExpandAll(self)
Expands all :class:`CustomTreeCtrl` items.
:note: This method suppresses the ``EVT_TREE_ITEM_EXPANDING`` and
``EVT_TREE_ITEM_EXPANDED`` events because expanding many items int the
control would be too slow then.
.. method:: ExpandAllChildren(self, item)
Expands all the items children of the input item.
:param `item`: an instance of :class:`GenericTreeItem`.
:note: This method suppresses the ``EVT_TREE_ITEM_EXPANDING`` and
``EVT_TREE_ITEM_EXPANDED`` events because expanding many items int the
control would be too slow then.
.. method:: FillArray(self, item, array=[])
Internal function. Used to populate an array of selected items when
the style ``TR_MULTIPLE`` is used.
:param `item`: an instance of :class:`GenericTreeItem`;
:param list `array`: a Python list containing the selected items.
:return: A Python list containing the selected items.
.. method:: FindItem(self, idParent, prefixOrig)
Finds the first item starting with the given prefix after the given parent.
:param integer `idParent`: an instance of :class:`GenericTreeItem`;
:param string `prefixOrig`: a string containing the item text prefix.
:return: An instance of :class:`GenericTreeItem` or ``None`` if no item has been found.
.. method:: Freeze(self)
Freeze :class:`CustomTreeCtrl`.
Freezes the window or, in other words, prevents any updates from taking place
on screen, the window is not redrawn at all. :meth:`~Thaw` must be called to reenable
window redrawing. Calls to these two functions may be nested.
:note: This method is useful for visual appearance optimization (for example,
it is a good idea to use it before doing many large text insertions in a row
into a :class:`TextCtrl` under wxGTK) but is not implemented on all platforms nor
for all controls so it is mostly just a hint to wxWidgets and not a mandatory
directive.
.. method:: GetAGWWindowStyleFlag(self)
Returns the :class:`CustomTreeCtrl` style.
:see: The :meth:`~CustomTreeCtrl.__init__` method for a list of possible style flags.
.. method:: GetBackgroundImage(self)
Returns the :class:`CustomTreeCtrl` background image (if any).
:return: An instance of :class:`wx.Bitmap` if a background image is present, ``None`` otherwise.
:note: At present, the background image can only be used in "tile" mode.
.. todo:: Support background images also in stretch and centered modes.
.. method:: GetBorderPen(self)
Returns the pen used to draw the selected item border.
:return: An instance of :class:`wx.Pen`.
:note: The border pen is not used if the Windows Vista selection style is applied.
.. method:: GetBoundingRect(self, item, textOnly=False)
Retrieves the rectangle bounding the item.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `textOnly`: if ``True``, only the rectangle around the item's label will
be returned, otherwise the item's image is also taken into account.
:return: An instance of :class:`wx.Rect`.
:note: The rectangle coordinates are logical, not physical ones. So, for example,
the `x` coordinate may be negative if the tree has a horizontal scrollbar and its
position is not ``0``.
.. method:: GetButtonsImageList(self)
Returns the buttons image list associated with :class:`CustomTreeCtrl` (from
which application-defined button images are taken).
:return: An instance of :class:`wx.ImageList`.
.. method:: GetChildrenCount(self, item, recursively=True)
Returns the item children count.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `recursively`: if ``True``, returns the total number of descendants,
otherwise only one level of children is counted.
.. classmethod:: GetClassDefaultAttributes(self)
Returns the default font and colours which are used by the control. This is
useful if you want to use the same font or colour in your own control as in
a standard control -- which is a much better idea than hard coding specific
colours or fonts which might look completely out of place on the users system,
especially if it uses themes.
This static method is "overridden'' in many derived classes and so calling,
for example, :meth:`Button.GetClassDefaultAttributes` () will typically return the
values appropriate for a button which will be normally different from those
returned by, say, :meth:`ListCtrl.GetClassDefaultAttributes` ().
:return: An instance of :class:`VisualAttributes`.
:note: The :class:`VisualAttributes` structure has at least the fields `font`,
`colFg` and `colBg`. All of them may be invalid if it was not possible to
determine the default control appearance or, especially for the background
colour, if the field doesn't make sense as is the case for `colBg` for the
controls with themed background.
:note: Overridden from :class:`wx.Control`.
.. method:: GetConnectionPen(self)
Returns the pen used to draw the connecting lines between items.
:return: An instance of :class:`wx.Pen`.
.. method:: GetControlBmp(self, checkbox=True, checked=False, enabled=True, x=16, y=16)
Returns a native looking checkbox or radio button bitmap.
:param bool `checkbox`: ``True`` to get a checkbox image, ``False`` for a radiobutton one;
:param bool `checked`: ``True`` if the control is marked, ``False`` if it is not;
:param bool `enabled`: ``True`` if the control is enabled, ``False`` if it is not;
:param integer `x`: the width of the bitmap;
:param integer `y`: the height of the bitmap.
:return: An instance of :class:`wx.Bitmap`, representing a native looking checkbox or radiobutton.
.. method:: GetCount(self)
Returns the global number of items in the tree.
.. method:: GetDisabledColour(self)
Returns the colour for items in a disabled state.
:return: An instance of :class:`wx.Colour`.
.. method:: GetEditControl(self)
Returns a pointer to the edit :class:`TreeTextCtrl` if the item is being edited or
``None`` otherwise (it is assumed that no more than one item may be edited
simultaneously).
.. method:: GetFirstChild(self, item)
Returns the item's first child and an integer value 'cookie'.
Call :meth:`~CustomTreeCtrl.GetNextChild` for the next child using this very 'cookie' return
value as an input.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: A tuple with the first value being an instance of :class:`GenericTreeItem` or ``None`` if there are no
further children, and as second value an integer parameter 'cookie'.
:note: This method returns ``None`` if there are no further children.
.. method:: GetFirstGradientColour(self)
Returns the first gradient colour for gradient-style selections.
:return: An instance of :class:`wx.Colour`.
.. method:: GetFirstVisibleItem(self)
Returns the first visible item.
:return: An instance of :class:`GenericTreeItem` or ``None`` if there are no
visible items.
.. method:: GetGradientStyle(self)
Returns the gradient style for gradient-style selections.
:return: ``0`` for horizontal gradient-style selections, ``1`` for vertical
gradient-style selections.
.. method:: GetHilightFocusColour(self)
Returns the colour used to highlight focused selected items.
:return: An instance of :class:`wx.Colour`.
:note: This is used only if gradient and Windows Vista selection
styles are disabled.
.. method:: GetHilightNonFocusColour(self)
Returns the colour used to highlight unfocused selected items.
:return: An instance of :class:`wx.Colour`.
:note: This is used only if gradient and Windows Vista selection
styles are disabled.
.. method:: GetHyperTextFont(self)
Returns the font used to render hypertext items.
:return: An instance of :class:`wx.Font`.
:note: This method is meaningful only for hypertext-like items.
.. method:: GetHyperTextNewColour(self)
Returns the colour used to render a non-visited hypertext item.
:return: An instance of :class:`wx.Colour`.
:note: This method is meaningful only for hypertext-like items.
.. method:: GetHyperTextVisitedColour(self)
Returns the colour used to render a visited hypertext item.
:return: An instance of :class:`wx.Colour`.
:note: This method is meaningful only for hypertext-like items.
.. method:: GetImageList(self)
Returns the normal image list associated with :class:`CustomTreeCtrl`.
:return: An instance of :class:`wx.ImageList`.
.. method:: GetImageListCheck(self)
Returns the image list used to build the check/radio buttons in :class:`CustomTreeCtrl`.
:return: An instance of :class:`wx.ImageList`.
.. method:: GetIndent(self)
Returns the item indentation, in pixels.
.. method:: GetItem3StateValue(self, item)
Gets the state of a 3-state checkbox item.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: ``wx.CHK_UNCHECKED`` when the checkbox is unchecked, ``wx.CHK_CHECKED``
when it is checked and ``wx.CHK_UNDETERMINED`` when it's in the undetermined
state.
:note: This method raises an exception when the function is used with a 2-state
checkbox item.
:note: This method is meaningful only for checkbox-like items.
.. method:: GetItemBackgroundColour(self, item)
Returns the item background colour.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: An instance of :class:`wx.Colour`.
.. method:: GetItemFont(self, item)
Returns the item font.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: An instance of :class:`wx.Font`.
.. method:: GetItemImage(self, item, which=TreeItemIcon_Normal)
Returns the item image.
:param `item`: an instance of :class:`GenericTreeItem`;
:param integer `which`: can be one of the following bits:
================================= ========================
Item State Description
================================= ========================
``TreeItemIcon_Normal`` To get the normal item image
``TreeItemIcon_Selected`` To get the selected item image (i.e. the image which is shown when the item is currently selected)
``TreeItemIcon_Expanded`` To get the expanded image (this only makes sense for items which have children - then this image is shown when the item is expanded and the normal image is shown when it is collapsed)
``TreeItemIcon_SelectedExpanded`` To get the selected expanded image (which is shown when an expanded item is currently selected)
================================= ========================
:return: An integer index that can be used to retrieve the item image inside
a :class:`wx.ImageList`.
.. method:: GetItemLeftImage(self, item)
Returns the item leftmost image, i.e. the image associated to the item on the leftmost
part of the :class:`CustomTreeCtrl` client area.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: An integer index that can be used to retrieve the item leftmost image inside
a :class:`wx.ImageList`.
.. method:: GetItemParent(self, item)
Returns the item parent (can be ``None`` for root items).
:param `item`: an instance of :class:`GenericTreeItem`.
:return: An instance of :class:`GenericTreeItem` or ``None`` for root items.
.. method:: GetItemSize(self, item)
Returns the horizontal space available in :class:`CustomTreeCtrl`, in pixels, to draw this item.
:param `item`: an instance of :class:`GenericTreeItem`.
.. versionadded:: 0.9.3
.. method:: GetItemText(self, item)
Returns the item text.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: GetItemTextColour(self, item)
Returns the item text colour or separator horizontal line colour.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: An instance of :class:`wx.Colour`.
.. method:: GetItemType(self, item)
Returns the item type.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: An integer representing the item type.
:see: :meth:`~CustomTreeCtrl.SetItemType` for a description of valid item types.
.. method:: GetItemVisited(self, item)
Returns whether an hypertext item was visited.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: ``True`` if the hypertext item has been visited, ``False`` otherwise.
:note: This method is meaningful only for hypertext-like items.
.. method:: GetItemWindow(self, item)
Returns the window associated to the item (if any).
:param `item`: an instance of :class:`GenericTreeItem`.
:return: An instance of :class:`wx.Window` if the item has an associated window, ``None`` otherwise.
.. method:: GetItemWindowEnabled(self, item)
Returns whether the window associated to the item is enabled.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: ``True`` if the item has an associated window and this window is
enabled, ``False`` in all other cases.
.. method:: GetLastChild(self, item)
Returns the item last child.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: An instance of :class:`GenericTreeItem` or ``None`` if there are no
further children.
.. method:: GetLeftImageList(self)
Returns the image list for :class:`CustomTreeCtrl` filled with images to be used on
the leftmost part of the client area. Any item can have a leftmost image associated
with it.
:return: An instance of :class:`wx.ImageList`.
.. method:: GetLineHeight(self, item)
Returns the line height for the given item.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: the item height, in pixels.
.. method:: GetMaxWidth(self, respect_expansion_state=True)
Returns the maximum width of the :class:`CustomTreeCtrl`.
:param bool `respect_expansion_state`: if ``True``, only the expanded items (and their
children) will be measured. Otherwise all the items are expanded and
their width measured.
:return: the maximum width of :class:`CustomTreeCtrl`, in pixels.
.. method:: GetNext(self, item)
Returns the next item. Only for internal use right now.
:return: An instance of :class:`GenericTreeItem` or ``None`` if there are no
further items.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: GetNextActiveItem(self, item, down=True)
Returns the next active item. Used Internally at present.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `down`: ``True`` to search downwards in the hierarchy for an active item,
``False`` to search upwards.
:return: An instance of :class:`GenericTreeItem` if an active item has been found or
``None`` if none has been found.
.. method:: GetNextChild(self, item, cookie)
Returns the item's next child.
:param `item`: an instance of :class:`GenericTreeItem`;
:param `cookie`: a parameter which is opaque for the application but is necessary
for the library to make these functions reentrant (i.e. allow more than one
enumeration on one and the same object simultaneously).
:return: A tuple with the first value being an instance of :class:`GenericTreeItem` or ``None`` if there are no
further children, and as second value an integer parameter 'cookie'.
:note: This method returns ``None`` if there are no further children.
.. method:: GetNextExpanded(self, item)
Returns the next expanded item after the input one.
:param `item`: an instance of :class:`TreeListItem`.
.. method:: GetNextShown(self, item)
Returns the next displayed item in the tree. This is either the first
child of the item (if it is expanded and has children) or its next
sibling. If there is no next sibling the tree is walked backwards
until a next sibling for one of its parents is found.
:param `item`: an instance of :class:`GenericTreeItem`;
:return: An instance of :class:`GenericTreeItem` or ``None`` if no item follows this one.
.. method:: GetNextSibling(self, item)
Returns the next sibling of an item.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: An instance of :class:`GenericTreeItem` or ``None`` if there are no
further siblings.
:note: This method returns ``None`` if there are no further siblings.
.. method:: GetNextVisible(self, item)
Returns the next visible item.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: An instance of :class:`GenericTreeItem` or ``None`` if there are no
next visible items.
.. method:: GetPrev(self, item)
Returns the previous item. Only for internal use right now.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: An instance of :class:`GenericTreeItem`
.. method:: GetPrevExpanded(self, item)
Returns the previous expanded item before the input one.
:param `item`: an instance of :class:`TreeListItem`.
.. method:: GetPrevShown(self, item)
Returns the previous displayed item in the tree. This is either the
last displayed child of its previous sibling, or its parent item.
:param `item`: an instance of :class:`GenericTreeItem`;
:return: An instance of :class:`GenericTreeItem` or ``None`` if no previous item found (root).
.. method:: GetPrevSibling(self, item)
Returns the previous sibling of an item.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: An instance of :class:`GenericTreeItem` or ``None`` if there are no
further siblings.
:note: This method returns ``None`` if there are no further siblings.
.. method:: GetPrevVisible(self, item)
Returns the previous visible item.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: An instance of :class:`GenericTreeItem` or ``None`` if there are no
previous visible items.
.. method:: GetPyData(self, item)
Returns the data associated to an item.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: A Python object representing the item data, or ``None`` if no data
has been assigned to this item.
.. method:: GetRootItem(self)
Returns the root item, an instance of :class:`GenericTreeItem`.
.. method:: GetSecondGradientColour(self)
Returns the second gradient colour for gradient-style selections.
:return: An instance of :class:`wx.Colour`.
.. method:: GetSelection(self)
Returns the current selection.
:return: An instance of :class:`GenericTreeItem`.
:note:
This method is valid only with the style ``TR_SINGLE`` set. Use
:meth:`~CustomTreeCtrl.GetSelections` for multiple-selections trees.
.. method:: GetSelections(self)
Returns a list of selected items.
:note: This method can be used only if :class:`CustomTreeCtrl` has the ``TR_MULTIPLE`` or ``TR_EXTENDED``
style set.
:return: A Python list containing the selected items, all instances of :class:`GenericTreeItem`.
.. method:: GetSeparatorColour(self, colour)
Returns the pen colour for separator-type items.
:return: An instance of :class:`wx.Colour` representing the separator pen colour.
.. method:: GetSpacing(self)
Returns the spacing between the start and the text, in pixels.
.. method:: GetStateImageList(self)
Returns the state image list associated with :class:`CustomTreeCtrl` (from which
application-defined state images are taken).
:return: An instance of :class:`wx.ImageList`.
.. method:: HandleHyperLink(self, item)
Handles the hyperlink items, sending the ``EVT_TREE_ITEM_HYPERLINK`` event.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: HasAGWFlag(self, flag)
Returns ``True`` if :class:`CustomTreeCtrl` has the `flag` bit set.
:param integer `flag`: any possible window style for :class:`CustomTreeCtrl`.
:see: The :meth:`~CustomTreeCtrl.__init__` method for the `flag` parameter description.
.. method:: HasButtons(self)
Returns whether :class:`CustomTreeCtrl` has the ``TR_HAS_BUTTONS`` flag set.
:return: ``True`` if :class:`CustomTreeCtrl` has the ``TR_HAS_BUTTONS`` flag set,
``False`` otherwise.
.. method:: HasChildren(self, item)
Returns whether an item has children or not.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: HideWindows(self)
Hides the windows associated to the items. Used internally.
.. method:: HitTest(self, point, flags=0)
Calculates which (if any) item is under the given point, returning the tree item
at this point plus extra information flags.
:param `point`: an instance of :class:`wx.Point`, a point to test for hits;
:param integer `flags`: a bitlist of the following values:
================================== =============== =================================
HitTest Flags Hex Value Description
================================== =============== =================================
``TREE_HITTEST_ABOVE`` 0x1 Above the client area
``TREE_HITTEST_BELOW`` 0x2 Below the client area
``TREE_HITTEST_NOWHERE`` 0x4 No item has been hit
``TREE_HITTEST_ONITEMBUTTON`` 0x8 On the button associated to an item
``TREE_HITTEST_ONITEMICON`` 0x10 On the icon associated to an item
``TREE_HITTEST_ONITEMINDENT`` 0x20 On the indent associated to an item
``TREE_HITTEST_ONITEMLABEL`` 0x40 On the label (string) associated to an item
``TREE_HITTEST_ONITEM`` 0x50 Anywhere on the item
``TREE_HITTEST_ONITEMRIGHT`` 0x80 On the right of the label associated to an item
``TREE_HITTEST_TOLEFT`` 0x200 On the left of the client area
``TREE_HITTEST_TORIGHT`` 0x400 On the right of the client area
``TREE_HITTEST_ONITEMUPPERPART`` 0x800 On the upper part (first half) of the item
``TREE_HITTEST_ONITEMLOWERPART`` 0x1000 On the lower part (second half) of the item
``TREE_HITTEST_ONITEMCHECKICON`` 0x2000 On the check/radio icon, if present
================================== =============== =================================
:return: A tuple with the first value being an instance of :class:`GenericTreeItem` or ``None`` if
no item has been hit-tested, and as second value an integer parameter `flag`.
:note: both the item (if any, ``None`` otherwise) and the `flags` are always returned as a tuple.
.. method:: InsertItem(self, parentId, input, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None, separator=False, on_the_right=True)
Inserts an item after the given previous.
:return: An instance of :class:`GenericTreeItem` upon successful insertion.
:see: :meth:`~CustomTreeCtrl.InsertItemByIndex` and :meth:`~CustomTreeCtrl.InsertItemByItem` for an explanation of
the input parameters.
:see: :meth:`~CustomTreeCtrl.DoInsertItem` for possible exceptions generated by this method.
.. method:: InsertItemByIndex(self, parentId, idPrevious, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None, separator=False, on_the_right=True)
Inserts an item after the given previous.
:param `parentId`: an instance of :class:`GenericTreeItem` representing the
item's parent;
:param `idPrevious`: the index at which we should insert the new item;
:param string `text`: the item text label;
:param integer `ct_type`: the item type (see :meth:`~CustomTreeCtrl.SetItemType` for a list of valid
item types);
:param `wnd`: if not ``None``, a non-toplevel window to show next to the item,
any subclass of :class:`wx.Window`;
:param integer `image`: an index within the normal image list specifying the image to
use for the item in unselected state;
:param integer `selImage`: an index within the normal image list specifying the image to
use for the item in selected state; if `image` > -1 and `selImage` is -1, the
same image is used for both selected and unselected items;
:param object `data`: associate the given Python object `data` with the item;
:param bool `separator`: ``True`` if the item is a separator, ``False`` otherwise.
:param bool `on_the_right`: ``True`` positions the window on the right of text, ``False``
on the left of text and overlapping the image.
:return: An instance of :class:`GenericTreeItem` upon successful insertion.
:see: :meth:`~CustomTreeCtrl.DoInsertItem` for possible exceptions generated by this method.
.. method:: InsertItemByItem(self, parentId, idPrevious, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None, separator=False, on_the_right=True)
Inserts an item after the given previous.
:param `parentId`: an instance of :class:`GenericTreeItem` representing the
item's parent;
:param `idPrevious`: an instance of :class:`GenericTreeItem` representing the
previous item;
:param string `text`: the item text label;
:param integer `ct_type`: the item type (see :meth:`~CustomTreeCtrl.SetItemType` for a list of valid
item types);
:param `wnd`: if not ``None``, a non-toplevel window to show next to the item,
any subclass of :class:`wx.Window`;
:param integer `image`: an index within the normal image list specifying the image to
use for the item in unselected state;
:param integer `selImage`: an index within the normal image list specifying the image to
use for the item in selected state; if `image` > -1 and `selImage` is -1, the
same image is used for both selected and unselected items;
:param object `data`: associate the given Python object `data` with the item;
:param bool `separator`: ``True`` if the item is a separator, ``False`` otherwise.
:param bool `on_the_right`: ``True`` positions the window on the right of text, ``False``
on the left of text and overlapping the image.
:return: An instance of :class:`GenericTreeItem` upon successful insertion.
:raise: `Exception` if the previous item is not a sibling.
:see: :meth:`~CustomTreeCtrl.DoInsertItem` for other possible exceptions generated by this method.
.. method:: InsertSeparator(self, parentId, input)
Inserts a separator item after the given previous.
:return: An instance of :class:`GenericTreeItem` upon successful insertion.
:see: :meth:`~CustomTreeCtrl.InsertItemByIndex` and :meth:`~CustomTreeCtrl.InsertItemByItem` for an explanation of
the input parameters.
:see: :meth:`~CustomTreeCtrl.DoInsertItem` for possible exceptions generated by this method.
.. method:: IsBold(self, item)
Returns whether the item font is bold or not.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: ``True`` if the item has bold text, ``False`` otherwise.
.. method:: IsDescendantOf(self, parent, item)
Checks if the given item is under another one in the tree hierarchy.
:param `parent`: an instance of :class:`GenericTreeItem`, representing the possible
parent of `item`;
:param `item`: another instance of :class:`GenericTreeItem`.
:return: ``True`` if `item` is a descendant of `parent`, ``False`` otherwise.
.. method:: IsExpanded(self, item)
Returns whether the item is expanded or not.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: ``True`` if the item is expanded, ``False`` if it is collapsed.
.. method:: IsItalic(self, item)
Returns whether the item font is italic or not.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: ``True`` if the item has italic text, ``False`` otherwise.
.. method:: IsItem3State(self, item)
Returns whether or not the checkbox item is a 3-state checkbox.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: ``True`` if this checkbox is a 3-state checkbox, ``False`` if it's a
2-state checkbox item.
:note: This method is meaningful only for checkbox-like items.
.. method:: IsItemChecked(self, item)
Returns whether an item is checked or not.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: ``True`` if the item is in a 'checked' state, ``False`` otherwise.
:note: This method is meaningful only for checkbox-like and radiobutton-like items.
.. method:: IsItemEnabled(self, item)
Returns whether an item is enabled or disabled.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: IsItemHyperText(self, item)
Returns whether an item is hypertext or not.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: ``True`` if the item is hypertext-like, ``False`` otherwise.
.. method:: IsItemSeparator(self, item)
Returns whether an item is of separator type or not.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: IsSelected(self, item)
Returns whether the item is selected or not.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: ``True`` if the item is selected, ``False`` otherwise.
.. method:: IsVisible(self, item)
Returns whether the item is visible or not (i.e., its hierarchy is expanded
enough to show the item).
:param `item`: an instance of :class:`GenericTreeItem`.
:return: ``True`` if the item is visible, ``False`` if it is hidden.
.. method:: ItemHasChildren(self, item)
Returns whether the item has children or not.
:param `item`: an instance of :class:`GenericTreeItem`.
:return: ``True`` if the item has children, ``False`` otherwise.
.. method:: OnAcceptEdit(self, item, value)
Called by :class:`TreeTextCtrl`, to accept the changes and to send the
``EVT_TREE_END_LABEL_EDIT`` event.
:param `item`: an instance of :class:`GenericTreeItem`;
:param string `value`: the new value of the item label.
:return: ``True`` if the editing has not been vetoed, ``False`` otherwise.
.. method:: OnCancelEdit(self, item)
Called by :class:`TreeTextCtrl`, to cancel the changes and to send the
``EVT_TREE_END_LABEL_EDIT`` event.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: OnCompareItems(self, item1, item2)
Returns whether 2 items have the same text.
Override this function in the derived class to change the sort order of the items
in the :class:`CustomTreeCtrl`. The function should return a negative, zero or positive
value if the first item is less than, equal to or greater than the second one.
:param `item1`: an instance of :class:`GenericTreeItem`;
:param `item2`: another instance of :class:`GenericTreeItem`.
:return: The return value is negative if `item1` < `item2`, zero if `item1` == `item2`
and strictly positive if `item1` < `item2`.
:note: The base class version compares items alphabetically.
.. method:: OnDestroy(self, event)
Handles the ``wx.EVT_WINDOW_DESTROY`` event for :class:`CustomTreeCtrl`.
:param `event`: a :class:`wx.WindowDestroyEvent` event to be processed.
.. method:: OnEditTimer(self)
The timer for editing has expired. Start editing.
.. method:: OnEraseBackground(self, event)
Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`CustomTreeCtrl`.
:param `event`: a :class:`EraseEvent` event to be processed.
.. method:: OnGetToolTip(self, event)
Process the tooltip event, to speed up event processing. Does not actually
get a tooltip.
:param `event`: a :class:`CommandTreeEvent` event to be processed.
.. method:: OnInternalIdle(self)
This method is normally only used internally, but sometimes an application
may need it to implement functionality that should not be disabled by an
application defining an `OnIdle` handler in a derived class.
This method may be used to do delayed painting, for example, and most
implementations call :meth:`wx.Window.UpdateWindowUI` in order to send update events
to the window in idle time.
.. method:: OnKeyDown(self, event)
Handles the ``wx.EVT_KEY_DOWN`` event for :class:`CustomTreeCtrl`, sending a
``EVT_TREE_KEY_DOWN`` event.
:param `event`: a :class:`KeyEvent` event to be processed.
.. method:: OnKillFocus(self, event)
Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`CustomTreeCtrl`.
:param `event`: a :class:`FocusEvent` event to be processed.
.. method:: OnMouse(self, event)
Handles a bunch of ``wx.EVT_MOUSE_EVENTS`` events for :class:`CustomTreeCtrl`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnPaint(self, event)
Handles the ``wx.EVT_PAINT`` event for :class:`CustomTreeCtrl`.
:param `event`: a :class:`PaintEvent` event to be processed.
.. method:: OnSetFocus(self, event)
Handles the ``wx.EVT_SET_FOCUS`` event for :class:`CustomTreeCtrl`.
:param `event`: a :class:`FocusEvent` event to be processed.
.. method:: OnSize(self, event)
Handles the ``wx.EVT_SIZE`` event for :class:`CustomTreeCtrl`.
:param `event`: a :class:`wx.SizeEvent` event to be processed.
.. method:: PaintItem(self, item, dc, level, align)
Actually draws an item.
:param `item`: an instance of :class:`GenericTreeItem`;
:param `dc`: an instance of :class:`wx.DC`;
:param integer `level`: the item level in the tree hierarchy;
:param integer `align`: an integer specifying the alignment type:
=============== =========================================
`align` Value Description
=============== =========================================
0 No horizontal alignment of windows (in items with windows).
1 Windows (in items with windows) are aligned at the same horizontal position.
2 Windows (in items with windows) are aligned at the rightmost edge of :class:`CustomTreeCtrl`.
=============== =========================================
.. method:: PaintLevel(self, item, dc, level, y, align)
Paint a level in the hierarchy of :class:`CustomTreeCtrl`.
:param `item`: an instance of :class:`GenericTreeItem`;
:param `dc`: an instance of :class:`wx.DC`;
:param integer `level`: the item level in the tree hierarchy;
:param integer `y`: the current vertical position in the :class:`ScrolledWindow`;
:param integer `align`: an integer specifying the alignment type:
=============== =========================================
`align` Value Description
=============== =========================================
0 No horizontal alignment of windows (in items with windows).
1 Windows (in items with windows) are aligned at the same horizontal position.
2 Windows (in items with windows) are aligned at the rightmost edge of :class:`CustomTreeCtrl`.
=============== =========================================
.. method:: PrependItem(self, parent, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None, separator=False, on_the_right=True)
Prepends an item as a first child of parent.
:param `parent`: an instance of :class:`GenericTreeItem` representing the
item's parent;
:param string `text`: the item text label;
:param integer `ct_type`: the item type (see :meth:`~CustomTreeCtrl.SetItemType` for a list of valid
item types);
:param `wnd`: if not ``None``, a non-toplevel window to show next to the item, any
subclass of :class:`wx.Window` except top-level windows;
:param integer `image`: an index within the normal image list specifying the image to
use for the item in unselected state;
:param integer `selImage`: an index within the normal image list specifying the image to
use for the item in selected state; if `image` > -1 and `selImage` is -1, the
same image is used for both selected and unselected items;
:param object `data`: associate the given Python object `data` with the item;
:param bool `separator`: ``True`` if the item is a separator, ``False`` otherwise.
:param bool `on_the_right`: ``True`` positions the window on the right of text, ``False``
on the left of text and overlapping the image.
:return: An instance of :class:`GenericTreeItem` upon successful insertion.
:see: :meth:`~CustomTreeCtrl.DoInsertItem` for possible exceptions generated by this method.
.. method:: PrependSeparator(self, parent)
Prepends a separator item as a first child of parent.
:param `parent`: an instance of :class:`GenericTreeItem` representing the
item's parent.
:return: An instance of :class:`GenericTreeItem` upon successful insertion.
:see: :meth:`~CustomTreeCtrl.DoInsertItem` for possible exceptions generated by this method.
.. method:: RecurseOnChildren(self, item, maxwidth, respect_expansion_state)
Recurses over all the children of the spcified items, calculating their
maximum width.
:param `item`: an instance of :class:`GenericTreeItem`;
:param integer `maxwidth`: the current maximum width for :class:`CustomTreeCtrl`, in pixels;
:param bool `respect_expansion_state`: if ``True``, only the expanded items (and their
children) will be measured. Otherwise all the items are expanded and
their width measured.
:return: A tuple containing the maximum width and item height, in pixels.
.. method:: RefreshItemWithWindows(self, item=None)
Refreshes the items with which a window is associated.
:param `item`: an instance of :class:`GenericTreeItem`. If `item` is ``None``, then the
recursive refresh starts from the root node.
:note: This method is called only if the style ``TR_ALIGN_WINDOWS_RIGHT`` is used.
.. method:: RefreshLine(self, item)
Refreshes a damaged item line.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: RefreshSelected(self)
Refreshes a damaged selected item line.
.. method:: RefreshSelectedUnder(self, item)
Refreshes the selected items under the given item.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: RefreshSubtree(self, item)
Refreshes a damaged subtree of an item.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: ResetEditControl(self)
Called by :class:`TreeTextCtrl` when it marks itself for deletion.
.. method:: ScrollTo(self, item)
Scrolls the specified item into view.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: SelectAll(self)
Selects all the item in the tree.
:raise: `Exception` if used without the ``TR_EXTENDED`` or ``TR_MULTIPLE`` style set.
:note: This method can be used only if :class:`CustomTreeCtrl` has the ``TR_MULTIPLE`` or ``TR_EXTENDED``
style set.
.. method:: SelectAllChildren(self, item)
Selects all the children of the given item.
:param `item`: an instance of :class:`GenericTreeItem`.
:raise: `Exception` if used without the ``TR_EXTENDED`` or ``TR_MULTIPLE`` style set.
:note: This method can be used only if :class:`CustomTreeCtrl` has the ``TR_MULTIPLE`` or ``TR_EXTENDED``
style set.
.. method:: SelectItem(self, item, select=True)
Selects/deselects an item.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `select`: ``True`` to select an item, ``False`` to deselect it.
:note: If TR_MULTIPLE is set, this actually toggles selection when select=True.
.. method:: SelectItemRange(self, item1, item2)
Selects all the items between `item1` and `item2`.
:param `item1`: an instance of :class:`GenericTreeItem`, representing the first
item in the range to select;
:param `item2`: an instance of :class:`GenericTreeItem`, representing the last
item in the range to select.
:raise: `Exception` if used without the ``TR_EXTENDED`` or ``TR_MULTIPLE`` style set.
:note: This method can be used only if :class:`CustomTreeCtrl` has the ``TR_MULTIPLE`` or ``TR_EXTENDED``
style set.
.. method:: SendDeleteEvent(self, item)
Actually sends the ``EVT_TREE_DELETE_ITEM`` event.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: SetAGWWindowStyleFlag(self, agwStyle)
Sets the :class:`CustomTreeCtrl` window style.
:param integer `agwStyle`: the new :class:`CustomTreeCtrl` window style.
:see: The :meth:`~CustomTreeCtrl.__init__` method for the `agwStyle` parameter description.
.. method:: SetBackgroundColour(self, colour)
Changes the background colour of :class:`CustomTreeCtrl`.
:param `colour`: the colour to be used as the background colour, pass
:class:`NullColour` to reset to the default colour.
:return: ``False`` if the underlying :class:`ScrolledWindow` does not accept
the new colour, ``True`` otherwise.
:note: The background colour is usually painted by the default :class:`EraseEvent`
event handler function under Windows and automatically under GTK.
:note: Setting the background colour does not cause an immediate refresh, so
you may wish to call :meth:`wx.Window.ClearBackground` or :meth:`wx.Window.Refresh` after
calling this function.
:note: Overridden from :class:`ScrolledWindow`.
.. method:: SetBackgroundImage(self, image)
Sets the :class:`CustomTreeCtrl` background image.
:param `image`: if not ``None``, an instance of :class:`wx.Bitmap`.
:note: At present, the background image can only be used in "tile" mode.
.. todo:: Support background images also in stretch and centered modes.
.. method:: SetBorderPen(self, pen)
Sets the pen used to draw the selected item border.
:param `pen`: an instance of :class:`wx.Pen`.
:note: The border pen is not used if the Windows Vista selection style is applied.
.. method:: SetButtonsImageList(self, imageList)
Sets the buttons image list for :class:`CustomTreeCtrl` (from which application-defined
button images are taken).
:param `imageList`: an instance of :class:`wx.ImageList`.
.. method:: SetConnectionPen(self, pen)
Sets the pen used to draw the connecting lines between items.
:param `pen`: an instance of :class:`wx.Pen`.
.. method:: SetDisabledColour(self, colour)
Sets the colour for items in a disabled state.
:param `colour`: a valid :class:`wx.Colour` instance.
.. method:: SetFirstGradientColour(self, colour=None)
Sets the first gradient colour for gradient-style selections.
:param `colour`: if not ``None``, a valid :class:`wx.Colour` instance. Otherwise,
the colour is taken from the system value ``wx.SYS_COLOUR_HIGHLIGHT``.
.. method:: SetFont(self, font)
Sets the :class:`CustomTreeCtrl` font.
:param `font`: a valid :class:`wx.Font` instance.
:note: Overridden from :class:`ScrolledWindow`.
.. method:: SetForegroundColour(self, colour)
Changes the foreground colour of :class:`CustomTreeCtrl`.
:param `colour`: the colour to be used as the foreground colour, pass
:class:`NullColour` to reset to the default colour.
:return: ``False`` if the underlying :class:`ScrolledWindow` does not accept
the new colour, ``True`` otherwise.
:note: Overridden from :class:`ScrolledWindow`.
.. method:: SetGradientStyle(self, vertical=0)
Sets the gradient style for gradient-style selections.
:param integer `vertical`: ``0`` for horizontal gradient-style selections, ``1`` for vertical
gradient-style selections.
.. method:: SetHilightFocusColour(self, colour)
Sets the colour used to highlight focused selected items.
:param `colour`: a valid :class:`wx.Colour` instance.
:note: This is applied only if gradient and Windows Vista selection
styles are disabled.
.. method:: SetHilightNonFocusColour(self, colour)
Sets the colour used to highlight unfocused selected items.
:param `colour`: a valid :class:`wx.Colour` instance.
:note: This is applied only if gradient and Windows Vista selection
styles are disabled.
.. method:: SetHyperTextFont(self, font)
Sets the font used to render hypertext items.
:param `font`: a valid :class:`wx.Font` instance.
:note: This method is meaningful only for hypertext-like items.
.. method:: SetHyperTextNewColour(self, colour)
Sets the colour used to render a non-visited hypertext item.
:param `colour`: a valid :class:`wx.Colour` instance.
:note: This method is meaningful only for hypertext-like items.
.. method:: SetHyperTextVisitedColour(self, colour)
Sets the colour used to render a visited hypertext item.
:param `colour`: a valid :class:`wx.Colour` instance.
:note: This method is meaningful only for hypertext-like items.
.. method:: SetImageList(self, imageList)
Sets the normal image list for :class:`CustomTreeCtrl`.
:param `imageList`: an instance of :class:`wx.ImageList`.
.. method:: SetImageListCheck(self, sizex, sizey, imglist=None)
Sets the checkbox/radiobutton image list.
:param integer `sizex`: the width of the bitmaps in the `imglist`, in pixels;
:param integer `sizey`: the height of the bitmaps in the `imglist`, in pixels;
:param `imglist`: an instance of :class:`wx.ImageList`.
.. method:: SetIndent(self, indent)
Sets the indentation for :class:`CustomTreeCtrl`.
:param integer `indent`: an integer representing the indentation for the items in the tree.
.. method:: SetItem3State(self, item, allow)
Sets whether the item has a 3-state value checkbox assigned to it or not.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `allow`: ``True`` to set an item as a 3-state checkbox, ``False`` to set it
to a 2-state checkbox.
:return: ``True`` if the change was successful, ``False`` otherwise.
:note: This method is meaningful only for checkbox-like items.
.. method:: SetItem3StateValue(self, item, state)
Sets the checkbox item to the given `state`.
:param `item`: an instance of :class:`GenericTreeItem`;
:param integer `state`: can be one of: ``wx.CHK_UNCHECKED`` (check is off), ``wx.CHK_CHECKED``
(check is on) or ``wx.CHK_UNDETERMINED`` (check is mixed).
:note: This method raises an exception when the checkbox item is a 2-state checkbox
and setting the state to ``wx.CHK_UNDETERMINED``.
:note: This method is meaningful only for checkbox-like items.
.. method:: SetItemBackgroundColour(self, item, colour)
Sets the item background colour.
:param `item`: an instance of :class:`GenericTreeItem`;
:param `colour`: a valid :class:`wx.Colour` instance.
.. method:: SetItemBold(self, item, bold=True)
Sets the item font as bold/unbold.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `bold`: ``True`` to set the item font as bold, ``False`` otherwise.
.. method:: SetItemDropHighlight(self, item, highlight=True)
Gives the item the visual feedback for drag and drop operations.
This is useful when something is dragged from outside the :class:`CustomTreeCtrl`.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `highlight`: ``True`` to highlight the dragged items, ``False`` otherwise.
.. method:: SetItemFont(self, item, font)
Sets the item font.
:param `item`: an instance of :class:`GenericTreeItem`;
:param `font`: a valid :class:`wx.Font` instance.
.. method:: SetItemHasChildren(self, item, has=True)
Forces the appearance/disappearance of the button next to the item.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `has`: ``True`` to have a button next to an item, ``False`` otherwise.
.. method:: SetItemHyperText(self, item, hyper=True)
Sets whether the item is hypertext or not.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `hyper`: ``True`` to have an item with hypertext behaviour, ``False`` otherwise.
.. method:: SetItemImage(self, item, image, which=TreeItemIcon_Normal)
Sets the item image, depending on the item state.
:param `item`: an instance of :class:`GenericTreeItem`;
:param integer `image`: an index within the normal image list specifying the image to
use for the item in the state specified by the `which` parameter;
:param integer `which`: the item state.
:see: :meth:`~CustomTreeCtrl.GetItemImage` for an explanation of the `which` parameter.
.. method:: SetItemItalic(self, item, italic=True)
Sets the item font as italic/non-italic.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `italic`: ``True`` to set the item font as italic, ``False`` otherwise.
.. method:: SetItemLeftImage(self, item, image)
Sets the item leftmost image, i.e. the image associated to the item on the leftmost
part of the :class:`CustomTreeCtrl` client area.
:param `item`: an instance of :class:`GenericTreeItem`;
:param integer `image`: an index within the left image list specifying the image to
use for the item in the leftmost part of the client area.
.. method:: SetItemText(self, item, text)
Sets the item text.
:param `item`: an instance of :class:`GenericTreeItem`;
:param string `text`: the new item label.
:raise: `Exception` if the input `item` is a separator.
.. method:: SetItemTextColour(self, item, colour)
Sets the item text colour or separator horizontal line colour.
:param `item`: an instance of :class:`GenericTreeItem`;
:param `colour`: a valid :class:`wx.Colour` instance.
.. method:: SetItemType(self, item, ct_type)
Sets the item type.
:param `item`: an instance of :class:`GenericTreeItem`;
:param integer `ct_type`: may be one of the following integers:
=============== =========================================
`ct_type` Value Description
=============== =========================================
0 A normal item
1 A checkbox-like item
2 A radiobutton-type item
=============== =========================================
:note: Regarding radiobutton-type items (with `ct_type` = 2), the following
approach is used:
- All peer-nodes that are radiobuttons will be mutually exclusive. In other words,
only one of a set of radiobuttons that share a common parent can be checked at
once. If a radiobutton node becomes checked, then all of its peer radiobuttons
must be unchecked.
- If a radiobutton node becomes unchecked, then all of its child nodes will become
inactive.
.. method:: SetItemVisited(self, item, visited=True)
Sets whether an hypertext item was visited.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `visited`: ``True`` to mark an hypertext item as visited, ``False`` otherwise.
:note: This method is meaningful only for hypertext-like items.
.. method:: SetItemWindow(self, item, wnd, on_the_right=True)
Sets the window for the given item.
:param `item`: an instance of :class:`GenericTreeItem`;
:param `wnd`: if not ``None``, a non-toplevel window to be displayed next to
the item.
:param bool `on_the_right`: ``True`` positions the window on the right of text, ``False``
on the left of text and overlapping the image. New in wxPython 4.0.4.
:raise: `Exception` if the input `item` is a separator and `wnd` is not ``None``.
.. method:: SetItemWindowEnabled(self, item, enable=True)
Enables/disables the window associated to the item.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `enable`: ``True`` to enable the associated window, ``False`` to
disable it.
.. method:: SetLeftImageList(self, imageList)
Sets the image list for :class:`CustomTreeCtrl` filled with images to be used on
the leftmost part of the client area. Any item can have a leftmost image associated
with it.
:param `imageList`: an instance of :class:`wx.ImageList`.
.. method:: SetPyData(self, item, data)
Sets the data associated to an item.
:param `item`: an instance of :class:`GenericTreeItem`;
:param object `data`: can be any Python object.
.. method:: SetSecondGradientColour(self, colour=None)
Sets the second gradient colour for gradient-style selections.
:param `colour`: if not ``None``, a valid :class:`wx.Colour` instance. Otherwise,
the colour generated is a slightly darker version of the :class:`CustomTreeCtrl`
background colour.
.. method:: SetSeparatorColour(self, colour)
Sets the pen colour for separator-type items.
:param `colour`: a valid instance of :class:`wx.Colour`.
.. method:: SetSpacing(self, spacing)
Sets the spacing between items in :class:`CustomTreeCtrl`.
:param integer `spacing`: an integer representing the spacing between items in the tree.
.. method:: SetStateImageList(self, imageList)
Sets the state image list for :class:`CustomTreeCtrl` (from which application-defined
state images are taken).
:param `imageList`: an instance of :class:`wx.ImageList`.
.. method:: ShouldInheritColours(self)
Return ``True`` from here to allow the colours of this window to be
changed by `InheritAttributes`, returning ``False`` forbids inheriting them
from the parent window.
The base class version returns ``False``, but this method is overridden in
:class:`wx.Control` where it returns ``True``.
:class:`CustomTreeCtrl` does not inherit colours from anyone.
.. method:: SortChildren(self, item)
Sorts the children of the given item using the :meth:`~CustomTreeCtrl.OnCompareItems` method of
:class:`CustomTreeCtrl`.
:param `item`: an instance of :class:`GenericTreeItem`.
:note: You should override the :meth:`~CustomTreeCtrl.OnCompareItems` method in your derived class to change
the sort order (the default is ascending case-sensitive alphabetical order).
.. method:: TagAllChildrenUntilLast(self, crt_item, last_item, select)
Used internally.
.. method:: TagNextChildren(self, crt_item, last_item, select)
Used internally.
.. method:: Thaw(self)
Thaw :class:`CustomTreeCtrl`.
Reenables window updating after a previous call to :meth:`~Freeze`. To really thaw the
control, it must be called exactly the same number of times as :meth:`~Freeze`.
:raise: `Exception` if :meth:`~Thaw` has been called without an un-matching :meth:`~Freeze`.
.. method:: TileBackground(self, dc)
Tiles the background image to fill all the available area.
:param `dc`: an instance of :class:`wx.DC`.
.. todo:: Support background images also in stretch and centered modes.
.. method:: Toggle(self, item)
Toggles the item state (collapsed/expanded).
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: ToggleItemSelection(self, item)
Toggles the item selection.
:param `item`: an instance of :class:`GenericTreeItem`.
.. method:: UnCheckRadioParent(self, item, checked=False)
Used internally to handle radio node parent correctly.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `checked`: ``True`` to check an item, ``False`` to uncheck it.
.. method:: Unselect(self)
Unselects the current selection.
.. method:: UnselectAll(self)
Unselect all the items.
.. method:: UnselectAllChildren(self, item)
Unselects all the children of the given item.
:param `item`: an instance of :class:`GenericTreeItem`.
|