/usr/include/d/gtkd-3/gtk/Window.d is in libgtkd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 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 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module gtk.Window;
private import gdk.Screen;
private import gdkpixbuf.Pixbuf;
private import glib.ConstructionException;
private import glib.ErrorG;
private import glib.GException;
private import glib.ListG;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Signals;
private import gtk.AccelGroup;
private import gtk.Application;
private import gtk.Bin;
private import gtk.Widget;
private import gtk.WindowGroup;
private import gtk.c.functions;
public import gtk.c.types;
public import gtkc.gtktypes;
private import std.algorithm;
/**
* A GtkWindow is a toplevel window which can contain other widgets.
* Windows normally have decorations that are under the control
* of the windowing system and allow the user to manipulate the window
* (resize it, move it, close it,...).
*
* # GtkWindow as GtkBuildable
*
* The GtkWindow implementation of the GtkBuildable interface supports a
* custom <accel-groups> element, which supports any number of <group>
* elements representing the #GtkAccelGroup objects you want to add to
* your window (synonymous with gtk_window_add_accel_group().
*
* It also supports the <initial-focus> element, whose name property names
* the widget to receive the focus when the window is mapped.
*
* An example of a UI definition fragment with accel groups:
* |[
* <object class="GtkWindow">
* <accel-groups>
* <group name="accelgroup1"/>
* </accel-groups>
* <initial-focus name="thunderclap"/>
* </object>
*
* ...
*
* <object class="GtkAccelGroup" id="accelgroup1"/>
* ]|
*
* The GtkWindow implementation of the GtkBuildable interface supports
* setting a child as the titlebar by specifying “titlebar” as the “type”
* attribute of a <child> element.
*
* # CSS nodes
*
* |[<!-- language="plain" -->
* window.background
* ├── decoration
* ├── <titlebar child>.titlebar [.default-decoration]
* ╰── <child>
* ]|
*
* GtkWindow has a main CSS node with name window and style class .background,
* and a subnode with name decoration.
*
* Style classes that are typically used with the main CSS node are .csd (when
* client-side decorations are in use), .solid-csd (for client-side decorations
* without invisible borders), .ssd (used by mutter when rendering server-side
* decorations). GtkWindow also represents window states with the following
* style classes on the main node: .tiled, .maximized, .fullscreen. Specialized
* types of window often add their own discriminating style classes, such as
* .popup or .tooltip.
*
* GtkWindow adds the .titlebar and .default-decoration style classes to the
* widget that is added as a titlebar child.
*/
public class Window : Bin
{
/** the main Gtk struct */
protected GtkWindow* gtkWindow;
/** Get the main Gtk struct */
public GtkWindow* getWindowStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gtkWindow;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gtkWindow;
}
protected override void setStruct(GObject* obj)
{
gtkWindow = cast(GtkWindow*)obj;
super.setStruct(obj);
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GtkWindow* gtkWindow, bool ownedRef = false)
{
this.gtkWindow = gtkWindow;
super(cast(GtkBin*)gtkWindow, ownedRef);
}
/**
* Creates a top level window with a title
* Params:
* title = The Window title
*/
public this(string title)
{
this(GtkWindowType.TOPLEVEL);
setTitle(title);
}
/**
* Move the window to an absolute position.
* just calls move(int, int).
* convinience because GdkEvent structs return the position coords as doubles
*/
public void move(double x, double y)
{
move(cast(int)x, cast(int)y);
}
/**
*/
/** */
public static GType getType()
{
return gtk_window_get_type();
}
/**
* Creates a new #GtkWindow, which is a toplevel window that can
* contain other widgets. Nearly always, the type of the window should
* be #GTK_WINDOW_TOPLEVEL. If you’re implementing something like a
* popup menu from scratch (which is a bad idea, just use #GtkMenu),
* you might use #GTK_WINDOW_POPUP. #GTK_WINDOW_POPUP is not for
* dialogs, though in some other toolkits dialogs are called “popups”.
* In GTK+, #GTK_WINDOW_POPUP means a pop-up menu or pop-up tooltip.
* On X11, popup windows are not controlled by the
* [window manager][gtk-X11-arch].
*
* If you simply want an undecorated window (no window borders), use
* gtk_window_set_decorated(), don’t use #GTK_WINDOW_POPUP.
*
* All top-level windows created by gtk_window_new() are stored in
* an internal top-level window list. This list can be obtained from
* gtk_window_list_toplevels(). Due to Gtk+ keeping a reference to
* the window internally, gtk_window_new() does not return a reference
* to the caller.
*
* To delete a #GtkWindow, call gtk_widget_destroy().
*
* Params:
* type = type of window
*
* Returns: a new #GtkWindow.
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this(GtkWindowType type)
{
auto p = gtk_window_new(type);
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GtkWindow*) p);
}
/**
* Gets the value set by gtk_window_set_default_icon_list().
* The list is a copy and should be freed with g_list_free(),
* but the pixbufs in the list have not had their reference count
* incremented.
*
* Returns: copy of default icon list
*/
public static ListG getDefaultIconList()
{
auto p = gtk_window_get_default_icon_list();
if(p is null)
{
return null;
}
return new ListG(cast(GList*) p);
}
/**
* Returns the fallback icon name for windows that has been set
* with gtk_window_set_default_icon_name(). The returned
* string is owned by GTK+ and should not be modified. It
* is only valid until the next call to
* gtk_window_set_default_icon_name().
*
* Returns: the fallback icon name for windows
*
* Since: 2.16
*/
public static string getDefaultIconName()
{
return Str.toString(gtk_window_get_default_icon_name());
}
/**
* Returns a list of all existing toplevel windows. The widgets
* in the list are not individually referenced. If you want
* to iterate through the list and perform actions involving
* callbacks that might destroy the widgets, you must call
* `g_list_foreach (result, (GFunc)g_object_ref, NULL)` first, and
* then unref all the widgets afterwards.
*
* Returns: list of toplevel widgets
*/
public static ListG listToplevels()
{
auto p = gtk_window_list_toplevels();
if(p is null)
{
return null;
}
return new ListG(cast(GList*) p);
}
/**
* By default, after showing the first #GtkWindow, GTK+ calls
* gdk_notify_startup_complete(). Call this function to disable
* the automatic startup notification. You might do this if your
* first window is a splash screen, and you want to delay notification
* until after your real main window has been shown, for example.
*
* In that example, you would disable startup notification
* temporarily, show your splash screen, then re-enable it so that
* showing the main window would automatically result in notification.
*
* Params:
* setting = %TRUE to automatically do startup notification
*
* Since: 2.2
*/
public static void setAutoStartupNotification(bool setting)
{
gtk_window_set_auto_startup_notification(setting);
}
/**
* Sets an icon to be used as fallback for windows that haven't
* had gtk_window_set_icon() called on them from a pixbuf.
*
* Params:
* icon = the icon
*
* Since: 2.4
*/
public static void setDefaultIcon(Pixbuf icon)
{
gtk_window_set_default_icon((icon is null) ? null : icon.getPixbufStruct());
}
/**
* Sets an icon to be used as fallback for windows that haven't
* had gtk_window_set_icon_list() called on them from a file
* on disk. Warns on failure if @err is %NULL.
*
* Params:
* filename = location of icon file
*
* Returns: %TRUE if setting the icon succeeded.
*
* Since: 2.2
*
* Throws: GException on failure.
*/
public static bool setDefaultIconFromFile(string filename)
{
GError* err = null;
auto p = gtk_window_set_default_icon_from_file(Str.toStringz(filename), &err) != 0;
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
return p;
}
/**
* Sets an icon list to be used as fallback for windows that haven't
* had gtk_window_set_icon_list() called on them to set up a
* window-specific icon list. This function allows you to set up the
* icon for all windows in your app at once.
*
* See gtk_window_set_icon_list() for more details.
*
* Params:
* list = a list of #GdkPixbuf
*/
public static void setDefaultIconList(ListG list)
{
gtk_window_set_default_icon_list((list is null) ? null : list.getListGStruct());
}
/**
* Sets an icon to be used as fallback for windows that haven't
* had gtk_window_set_icon_list() called on them from a named
* themed icon, see gtk_window_set_icon_name().
*
* Params:
* name = the name of the themed icon
*
* Since: 2.6
*/
public static void setDefaultIconName(string name)
{
gtk_window_set_default_icon_name(Str.toStringz(name));
}
/**
* Opens or closes the [interactive debugger][interactive-debugging],
* which offers access to the widget hierarchy of the application
* and to useful debugging tools.
*
* Params:
* enable = %TRUE to enable interactive debugging
*
* Since: 3.14
*/
public static void setInteractiveDebugging(bool enable)
{
gtk_window_set_interactive_debugging(enable);
}
/**
* Activates the default widget for the window, unless the current
* focused widget has been configured to receive the default action
* (see gtk_widget_set_receives_default()), in which case the
* focused widget is activated.
*
* Returns: %TRUE if a widget got activated.
*/
public bool activateDefault()
{
return gtk_window_activate_default(gtkWindow) != 0;
}
/**
* Activates the current focused widget within the window.
*
* Returns: %TRUE if a widget got activated.
*/
public bool activateFocus()
{
return gtk_window_activate_focus(gtkWindow) != 0;
}
/**
* Activates mnemonics and accelerators for this #GtkWindow. This is normally
* called by the default ::key_press_event handler for toplevel windows,
* however in some cases it may be useful to call this directly when
* overriding the standard key handling for a toplevel window.
*
* Params:
* event = a #GdkEventKey
*
* Returns: %TRUE if a mnemonic or accelerator was found and activated.
*
* Since: 2.4
*/
public bool activateKey(GdkEventKey* event)
{
return gtk_window_activate_key(gtkWindow, event) != 0;
}
/**
* Associate @accel_group with @window, such that calling
* gtk_accel_groups_activate() on @window will activate accelerators
* in @accel_group.
*
* Params:
* accelGroup = a #GtkAccelGroup
*/
public void addAccelGroup(AccelGroup accelGroup)
{
gtk_window_add_accel_group(gtkWindow, (accelGroup is null) ? null : accelGroup.getAccelGroupStruct());
}
/**
* Adds a mnemonic to this window.
*
* Params:
* keyval = the mnemonic
* target = the widget that gets activated by the mnemonic
*/
public void addMnemonic(uint keyval, Widget target)
{
gtk_window_add_mnemonic(gtkWindow, keyval, (target is null) ? null : target.getWidgetStruct());
}
/**
* Starts moving a window. This function is used if an application has
* window movement grips. When GDK can support it, the window movement
* will be done using the standard mechanism for the
* [window manager][gtk-X11-arch] or windowing
* system. Otherwise, GDK will try to emulate window movement,
* potentially not all that well, depending on the windowing system.
*
* Params:
* button = mouse button that initiated the drag
* rootX = X position where the user clicked to initiate the drag, in root window coordinates
* rootY = Y position where the user clicked to initiate the drag
* timestamp = timestamp from the click event that initiated the drag
*/
public void beginMoveDrag(int button, int rootX, int rootY, uint timestamp)
{
gtk_window_begin_move_drag(gtkWindow, button, rootX, rootY, timestamp);
}
/**
* Starts resizing a window. This function is used if an application
* has window resizing controls. When GDK can support it, the resize
* will be done using the standard mechanism for the
* [window manager][gtk-X11-arch] or windowing
* system. Otherwise, GDK will try to emulate window resizing,
* potentially not all that well, depending on the windowing system.
*
* Params:
* edge = position of the resize control
* button = mouse button that initiated the drag
* rootX = X position where the user clicked to initiate the drag, in root window coordinates
* rootY = Y position where the user clicked to initiate the drag
* timestamp = timestamp from the click event that initiated the drag
*/
public void beginResizeDrag(GdkWindowEdge edge, int button, int rootX, int rootY, uint timestamp)
{
gtk_window_begin_resize_drag(gtkWindow, edge, button, rootX, rootY, timestamp);
}
/**
* Requests that the window is closed, similar to what happens
* when a window manager close button is clicked.
*
* This function can be used with close buttons in custom
* titlebars.
*
* Since: 3.10
*/
public void close()
{
gtk_window_close(gtkWindow);
}
/**
* Asks to deiconify (i.e. unminimize) the specified @window. Note
* that you shouldn’t assume the window is definitely deiconified
* afterward, because other entities (e.g. the user or
* [window manager][gtk-X11-arch])) could iconify it
* again before your code which assumes deiconification gets to run.
*
* You can track iconification via the “window-state-event” signal
* on #GtkWidget.
*/
public void deiconify()
{
gtk_window_deiconify(gtkWindow);
}
/**
* Asks to place @window in the fullscreen state. Note that you
* shouldn’t assume the window is definitely full screen afterward,
* because other entities (e.g. the user or
* [window manager][gtk-X11-arch]) could unfullscreen it
* again, and not all window managers honor requests to fullscreen
* windows. But normally the window will end up fullscreen. Just
* don’t write code that crashes if not.
*
* You can track the fullscreen state via the “window-state-event” signal
* on #GtkWidget.
*
* Since: 2.2
*/
public void fullscreen()
{
gtk_window_fullscreen(gtkWindow);
}
/**
* Asks to place @window in the fullscreen state. Note that you shouldn't assume
* the window is definitely full screen afterward.
*
* You can track the fullscreen state via the "window-state-event" signal
* on #GtkWidget.
*
* Params:
* screen = a #GdkScreen to draw to
* monitor = which monitor to go fullscreen on
*
* Since: 3.18
*/
public void fullscreenOnMonitor(Screen screen, int monitor)
{
gtk_window_fullscreen_on_monitor(gtkWindow, (screen is null) ? null : screen.getScreenStruct(), monitor);
}
/**
* Gets the value set by gtk_window_set_accept_focus().
*
* Returns: %TRUE if window should receive the input focus
*
* Since: 2.4
*/
public bool getAcceptFocus()
{
return gtk_window_get_accept_focus(gtkWindow) != 0;
}
/**
* Gets the #GtkApplication associated with the window (if any).
*
* Returns: a #GtkApplication, or %NULL
*
* Since: 3.0
*/
public Application getApplication()
{
auto p = gtk_window_get_application(gtkWindow);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Application)(cast(GtkApplication*) p);
}
/**
* Fetches the attach widget for this window. See
* gtk_window_set_attached_to().
*
* Returns: the widget where the window
* is attached, or %NULL if the window is not attached to any widget.
*
* Since: 3.4
*/
public Widget getAttachedTo()
{
auto p = gtk_window_get_attached_to(gtkWindow);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
}
/**
* Returns whether the window has been set to have decorations
* such as a title bar via gtk_window_set_decorated().
*
* Returns: %TRUE if the window has been set to have decorations
*/
public bool getDecorated()
{
return gtk_window_get_decorated(gtkWindow) != 0;
}
/**
* Gets the default size of the window. A value of -1 for the width or
* height indicates that a default size has not been explicitly set
* for that dimension, so the “natural” size of the window will be
* used.
*
* Params:
* width = location to store the default width, or %NULL
* height = location to store the default height, or %NULL
*/
public void getDefaultSize(out int width, out int height)
{
gtk_window_get_default_size(gtkWindow, &width, &height);
}
/**
* Returns the default widget for @window. See
* gtk_window_set_default() for more details.
*
* Returns: the default widget, or %NULL
* if there is none.
*
* Since: 2.14
*/
public Widget getDefaultWidget()
{
auto p = gtk_window_get_default_widget(gtkWindow);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
}
/**
* Returns whether the window has been set to have a close button
* via gtk_window_set_deletable().
*
* Returns: %TRUE if the window has been set to have a close button
*
* Since: 2.10
*/
public bool getDeletable()
{
return gtk_window_get_deletable(gtkWindow) != 0;
}
/**
* Returns whether the window will be destroyed with its transient parent. See
* gtk_window_set_destroy_with_parent ().
*
* Returns: %TRUE if the window will be destroyed with its transient parent.
*/
public bool getDestroyWithParent()
{
return gtk_window_get_destroy_with_parent(gtkWindow) != 0;
}
/**
* Retrieves the current focused widget within the window.
* Note that this is the widget that would have the focus
* if the toplevel window focused; if the toplevel window
* is not focused then `gtk_widget_has_focus (widget)` will
* not be %TRUE for the widget.
*
* Returns: the currently focused widget,
* or %NULL if there is none.
*/
public Widget getFocus()
{
auto p = gtk_window_get_focus(gtkWindow);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
}
/**
* Gets the value set by gtk_window_set_focus_on_map().
*
* Returns: %TRUE if window should receive the input focus when
* mapped.
*
* Since: 2.6
*/
public bool getFocusOnMap()
{
return gtk_window_get_focus_on_map(gtkWindow) != 0;
}
/**
* Gets the value of the #GtkWindow:focus-visible property.
*
* Returns: %TRUE if “focus rectangles” are supposed to be visible
* in this window.
*
* Since: 3.2
*/
public bool getFocusVisible()
{
return gtk_window_get_focus_visible(gtkWindow) != 0;
}
/**
* Gets the value set by gtk_window_set_gravity().
*
* Returns: window gravity
*/
public GdkGravity getGravity()
{
return gtk_window_get_gravity(gtkWindow);
}
/**
* Returns the group for @window or the default group, if
* @window is %NULL or if @window does not have an explicit
* window group.
*
* Returns: the #GtkWindowGroup for a window or the default group
*
* Since: 2.10
*/
public WindowGroup getGroup()
{
auto p = gtk_window_get_group(gtkWindow);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(WindowGroup)(cast(GtkWindowGroup*) p);
}
/**
* Determines whether the window may have a resize grip.
*
* Deprecated: Resize grips have been removed.
*
* Returns: %TRUE if the window has a resize grip
*
* Since: 3.0
*/
public bool getHasResizeGrip()
{
return gtk_window_get_has_resize_grip(gtkWindow) != 0;
}
/**
* Returns whether the window has requested to have its titlebar hidden
* when maximized. See gtk_window_set_hide_titlebar_when_maximized ().
*
* Returns: %TRUE if the window has requested to have its titlebar
* hidden when maximized
*
* Since: 3.4
*/
public bool getHideTitlebarWhenMaximized()
{
return gtk_window_get_hide_titlebar_when_maximized(gtkWindow) != 0;
}
/**
* Gets the value set by gtk_window_set_icon() (or if you've
* called gtk_window_set_icon_list(), gets the first icon in
* the icon list).
*
* Returns: icon for window
*/
public Pixbuf getIcon()
{
auto p = gtk_window_get_icon(gtkWindow);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
}
/**
* Retrieves the list of icons set by gtk_window_set_icon_list().
* The list is copied, but the reference count on each
* member won’t be incremented.
*
* Returns: copy of window’s icon list
*/
public ListG getIconList()
{
auto p = gtk_window_get_icon_list(gtkWindow);
if(p is null)
{
return null;
}
return new ListG(cast(GList*) p);
}
/**
* Returns the name of the themed icon for the window,
* see gtk_window_set_icon_name().
*
* Returns: the icon name or %NULL if the window has
* no themed icon
*
* Since: 2.6
*/
public string getIconName()
{
return Str.toString(gtk_window_get_icon_name(gtkWindow));
}
/**
* Returns the mnemonic modifier for this window. See
* gtk_window_set_mnemonic_modifier().
*
* Returns: the modifier mask used to activate
* mnemonics on this window.
*/
public GdkModifierType getMnemonicModifier()
{
return gtk_window_get_mnemonic_modifier(gtkWindow);
}
/**
* Gets the value of the #GtkWindow:mnemonics-visible property.
*
* Returns: %TRUE if mnemonics are supposed to be visible
* in this window.
*
* Since: 2.20
*/
public bool getMnemonicsVisible()
{
return gtk_window_get_mnemonics_visible(gtkWindow) != 0;
}
/**
* Returns whether the window is modal. See gtk_window_set_modal().
*
* Returns: %TRUE if the window is set to be modal and
* establishes a grab when shown
*/
public bool getModal()
{
return gtk_window_get_modal(gtkWindow) != 0;
}
/**
* Fetches the requested opacity for this window. See
* gtk_window_set_opacity().
*
* Deprecated: Use gtk_widget_get_opacity instead.
*
* Returns: the requested opacity for this window.
*
* Since: 2.12
*/
public override double getOpacity()
{
return gtk_window_get_opacity(gtkWindow);
}
/**
* This function returns the position you need to pass to
* gtk_window_move() to keep @window in its current position.
* This means that the meaning of the returned value varies with
* window gravity. See gtk_window_move() for more details.
*
* The reliability of this function depends on the windowing system
* currently in use. Some windowing systems, such as Wayland, do not
* support a global coordinate system, and thus the position of the
* window will always be (0, 0). Others, like X11, do not have a reliable
* way to obtain the geometry of the decorations of a window if they are
* provided by the window manager. Additionally, on X11, window manager
* have been known to mismanage window gravity, which result in windows
* moving even if you use the coordinates of the current position as
* returned by this function.
*
* If you haven’t changed the window gravity, its gravity will be
* #GDK_GRAVITY_NORTH_WEST. This means that gtk_window_get_position()
* gets the position of the top-left corner of the window manager
* frame for the window. gtk_window_move() sets the position of this
* same top-left corner.
*
* If a window has gravity #GDK_GRAVITY_STATIC the window manager
* frame is not relevant, and thus gtk_window_get_position() will
* always produce accurate results. However you can’t use static
* gravity to do things like place a window in a corner of the screen,
* because static gravity ignores the window manager decorations.
*
* Ideally, this function should return appropriate values if the
* window has client side decorations, assuming that the windowing
* system supports global coordinates.
*
* In practice, saving the window position should not be left to
* applications, as they lack enough knowledge of the windowing
* system and the window manager state to effectively do so. The
* appropriate way to implement saving the window position is to
* use a platform-specific protocol, wherever that is available.
*
* Params:
* rootX = return location for X coordinate of
* gravity-determined reference point, or %NULL
* rootY = return location for Y coordinate of
* gravity-determined reference point, or %NULL
*/
public void getPosition(out int rootX, out int rootY)
{
gtk_window_get_position(gtkWindow, &rootX, &rootY);
}
/**
* Gets the value set by gtk_window_set_resizable().
*
* Returns: %TRUE if the user can resize the window
*/
public bool getResizable()
{
return gtk_window_get_resizable(gtkWindow) != 0;
}
/**
* If a window has a resize grip, this will retrieve the grip
* position, width and height into the specified #GdkRectangle.
*
* Deprecated: Resize grips have been removed.
*
* Params:
* rect = a pointer to a #GdkRectangle which we should store
* the resize grip area
*
* Returns: %TRUE if the resize grip’s area was retrieved
*
* Since: 3.0
*/
public bool getResizeGripArea(out GdkRectangle rect)
{
return gtk_window_get_resize_grip_area(gtkWindow, &rect) != 0;
}
/**
* Returns the role of the window. See gtk_window_set_role() for
* further explanation.
*
* Returns: the role of the window if set, or %NULL. The
* returned is owned by the widget and must not be modified or freed.
*/
public string getRole()
{
return Str.toString(gtk_window_get_role(gtkWindow));
}
/**
* Returns the #GdkScreen associated with @window.
*
* Returns: a #GdkScreen.
*
* Since: 2.2
*/
public override Screen getScreen()
{
auto p = gtk_window_get_screen(gtkWindow);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p);
}
/**
* Obtains the current size of @window.
*
* If @window is not visible on screen, this function return the size GTK+
* will suggest to the [window manager][gtk-X11-arch] for the initial window
* size (but this is not reliably the same as the size the window manager
* will actually select). See: gtk_window_set_default_size().
*
* Depending on the windowing system and the window manager constraints,
* the size returned by this function may not match the size set using
* gtk_window_resize(); additionally, since gtk_window_resize() may be
* implemented as an asynchronous operation, GTK+ cannot guarantee in any
* way that this code:
*
* |[<!-- language="C" -->
* // width and height are set elsewhere
* gtk_window_resize (window, width, height);
*
* int new_width, new_height;
* gtk_window_get_size (window, &new_width, &new_height);
* ]|
*
* will result in `new_width` and `new_height` matching `width` and
* `height`, respectively.
*
* This function will return the logical size of the #GtkWindow,
* excluding the widgets used in client side decorations; there is,
* however, no guarantee that the result will be completely accurate
* because client side decoration may include widgets that depend on
* the user preferences and that may not be visibile at the time you
* call this function.
*
* The dimensions returned by this function are suitable for being
* stored across sessions; use gtk_window_set_default_size() to
* restore them when before showing the window.
*
* To avoid potential race conditions, you should only call this
* function in response to a size change notification, for instance
* inside a handler for the #GtkWidget::size-allocate signal, or
* inside a handler for the #GtkWidget::configure-event signal:
*
* |[<!-- language="C" -->
* static void
* on_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
* {
* int new_width, new_height;
*
* gtk_window_get_size (GTK_WINDOW (widget), &new_width, &new_height);
*
* ...
* }
* ]|
*
* Note that, if you connect to the #GtkWidget::size-allocate signal,
* you should not use the dimensions of the #GtkAllocation passed to
* the signal handler, as the allocation may contain client side
* decorations added by GTK+, depending on the windowing system in
* use.
*
* If you are getting a window size in order to position the window
* on the screen, you should, instead, simply set the window’s semantic
* type with gtk_window_set_type_hint(), which allows the window manager
* to e.g. center dialogs. Also, if you set the transient parent of
* dialogs with gtk_window_set_transient_for() window managers will
* often center the dialog over its parent window. It's much preferred
* to let the window manager handle these cases rather than doing it
* yourself, because all apps will behave consistently and according to
* user or system preferences, if the window manager handles it. Also,
* the window manager can take into account the size of the window
* decorations and border that it may add, and of which GTK+ has no
* knowledge. Additionally, positioning windows in global screen coordinates
* may not be allowed by the windowing system. For more information,
* see: gtk_window_set_position().
*
* Params:
* width = return location for width, or %NULL
* height = return location for height, or %NULL
*/
public void getSize(out int width, out int height)
{
gtk_window_get_size(gtkWindow, &width, &height);
}
/**
* Gets the value set by gtk_window_set_skip_pager_hint().
*
* Returns: %TRUE if window shouldn’t be in pager
*
* Since: 2.2
*/
public bool getSkipPagerHint()
{
return gtk_window_get_skip_pager_hint(gtkWindow) != 0;
}
/**
* Gets the value set by gtk_window_set_skip_taskbar_hint()
*
* Returns: %TRUE if window shouldn’t be in taskbar
*
* Since: 2.2
*/
public bool getSkipTaskbarHint()
{
return gtk_window_get_skip_taskbar_hint(gtkWindow) != 0;
}
/**
* Retrieves the title of the window. See gtk_window_set_title().
*
* Returns: the title of the window, or %NULL if none has
* been set explicitly. The returned string is owned by the widget
* and must not be modified or freed.
*/
public string getTitle()
{
return Str.toString(gtk_window_get_title(gtkWindow));
}
/**
* Returns the custom titlebar that has been set with
* gtk_window_set_titlebar().
*
* Returns: the custom titlebar, or %NULL
*
* Since: 3.16
*/
public Widget getTitlebar()
{
auto p = gtk_window_get_titlebar(gtkWindow);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
}
/**
* Fetches the transient parent for this window. See
* gtk_window_set_transient_for().
*
* Returns: the transient parent for this
* window, or %NULL if no transient parent has been set.
*/
public Window getTransientFor()
{
auto p = gtk_window_get_transient_for(gtkWindow);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Window)(cast(GtkWindow*) p);
}
/**
* Gets the type hint for this window. See gtk_window_set_type_hint().
*
* Returns: the type hint for @window.
*/
public GdkWindowTypeHint getTypeHint()
{
return gtk_window_get_type_hint(gtkWindow);
}
/**
* Gets the value set by gtk_window_set_urgency_hint()
*
* Returns: %TRUE if window is urgent
*
* Since: 2.8
*/
public bool getUrgencyHint()
{
return gtk_window_get_urgency_hint(gtkWindow) != 0;
}
/**
* Gets the type of the window. See #GtkWindowType.
*
* Returns: the type of the window
*
* Since: 2.20
*/
public GtkWindowType getWindowType()
{
return gtk_window_get_window_type(gtkWindow);
}
/**
* Returns whether @window has an explicit window group.
*
* Returns: %TRUE if @window has an explicit window group.
*
* Since 2.22
*/
public bool hasGroup()
{
return gtk_window_has_group(gtkWindow) != 0;
}
/**
* Returns whether the input focus is within this GtkWindow.
* For real toplevel windows, this is identical to gtk_window_is_active(),
* but for embedded windows, like #GtkPlug, the results will differ.
*
* Returns: %TRUE if the input focus is within this GtkWindow
*
* Since: 2.4
*/
public bool hasToplevelFocus()
{
return gtk_window_has_toplevel_focus(gtkWindow) != 0;
}
/**
* Asks to iconify (i.e. minimize) the specified @window. Note that
* you shouldn’t assume the window is definitely iconified afterward,
* because other entities (e.g. the user or
* [window manager][gtk-X11-arch]) could deiconify it
* again, or there may not be a window manager in which case
* iconification isn’t possible, etc. But normally the window will end
* up iconified. Just don’t write code that crashes if not.
*
* It’s permitted to call this function before showing a window,
* in which case the window will be iconified before it ever appears
* onscreen.
*
* You can track iconification via the “window-state-event” signal
* on #GtkWidget.
*/
public void iconify()
{
gtk_window_iconify(gtkWindow);
}
/**
* Returns whether the window is part of the current active toplevel.
* (That is, the toplevel window receiving keystrokes.)
* The return value is %TRUE if the window is active toplevel
* itself, but also if it is, say, a #GtkPlug embedded in the active toplevel.
* You might use this function if you wanted to draw a widget
* differently in an active window from a widget in an inactive window.
* See gtk_window_has_toplevel_focus()
*
* Returns: %TRUE if the window part of the current active window.
*
* Since: 2.4
*/
public bool isActive()
{
return gtk_window_is_active(gtkWindow) != 0;
}
/**
* Retrieves the current maximized state of @window.
*
* Note that since maximization is ultimately handled by the window
* manager and happens asynchronously to an application request, you
* shouldn’t assume the return value of this function changing
* immediately (or at all), as an effect of calling
* gtk_window_maximize() or gtk_window_unmaximize().
*
* Returns: whether the window has a maximized state.
*
* Since: 3.12
*/
public bool isMaximized()
{
return gtk_window_is_maximized(gtkWindow) != 0;
}
/**
* Asks to maximize @window, so that it becomes full-screen. Note that
* you shouldn’t assume the window is definitely maximized afterward,
* because other entities (e.g. the user or
* [window manager][gtk-X11-arch]) could unmaximize it
* again, and not all window managers support maximization. But
* normally the window will end up maximized. Just don’t write code
* that crashes if not.
*
* It’s permitted to call this function before showing a window,
* in which case the window will be maximized when it appears onscreen
* initially.
*
* You can track maximization via the “window-state-event” signal
* on #GtkWidget, or by listening to notifications on the
* #GtkWindow:is-maximized property.
*/
public void maximize()
{
gtk_window_maximize(gtkWindow);
}
/**
* Activates the targets associated with the mnemonic.
*
* Params:
* keyval = the mnemonic
* modifier = the modifiers
*
* Returns: %TRUE if the activation is done.
*/
public bool mnemonicActivate(uint keyval, GdkModifierType modifier)
{
return gtk_window_mnemonic_activate(gtkWindow, keyval, modifier) != 0;
}
/**
* Asks the [window manager][gtk-X11-arch] to move
* @window to the given position. Window managers are free to ignore
* this; most window managers ignore requests for initial window
* positions (instead using a user-defined placement algorithm) and
* honor requests after the window has already been shown.
*
* Note: the position is the position of the gravity-determined
* reference point for the window. The gravity determines two things:
* first, the location of the reference point in root window
* coordinates; and second, which point on the window is positioned at
* the reference point.
*
* By default the gravity is #GDK_GRAVITY_NORTH_WEST, so the reference
* point is simply the @x, @y supplied to gtk_window_move(). The
* top-left corner of the window decorations (aka window frame or
* border) will be placed at @x, @y. Therefore, to position a window
* at the top left of the screen, you want to use the default gravity
* (which is #GDK_GRAVITY_NORTH_WEST) and move the window to 0,0.
*
* To position a window at the bottom right corner of the screen, you
* would set #GDK_GRAVITY_SOUTH_EAST, which means that the reference
* point is at @x + the window width and @y + the window height, and
* the bottom-right corner of the window border will be placed at that
* reference point. So, to place a window in the bottom right corner
* you would first set gravity to south east, then write:
* `gtk_window_move (window, gdk_screen_width () - window_width,
* gdk_screen_height () - window_height)` (note that this
* example does not take multi-head scenarios into account).
*
* The [Extended Window Manager Hints Specification](http://www.freedesktop.org/Standards/wm-spec)
* has a nice table of gravities in the “implementation notes” section.
*
* The gtk_window_get_position() documentation may also be relevant.
*
* Params:
* x = X coordinate to move window to
* y = Y coordinate to move window to
*/
public void move(int x, int y)
{
gtk_window_move(gtkWindow, x, y);
}
/**
* Parses a standard X Window System geometry string - see the
* manual page for X (type “man X”) for details on this.
* gtk_window_parse_geometry() does work on all GTK+ ports
* including Win32 but is primarily intended for an X environment.
*
* If either a size or a position can be extracted from the
* geometry string, gtk_window_parse_geometry() returns %TRUE
* and calls gtk_window_set_default_size() and/or gtk_window_move()
* to resize/move the window.
*
* If gtk_window_parse_geometry() returns %TRUE, it will also
* set the #GDK_HINT_USER_POS and/or #GDK_HINT_USER_SIZE hints
* indicating to the window manager that the size/position of
* the window was user-specified. This causes most window
* managers to honor the geometry.
*
* Note that for gtk_window_parse_geometry() to work as expected, it has
* to be called when the window has its “final” size, i.e. after calling
* gtk_widget_show_all() on the contents and gtk_window_set_geometry_hints()
* on the window.
* |[<!-- language="C" -->
* #include <gtk/gtk.h>
*
* static void
* fill_with_content (GtkWidget *vbox)
* {
* // fill with content...
* }
*
* int
* main (int argc, char *argv[])
* {
* GtkWidget *window, *vbox;
* GdkGeometry size_hints = {
* 100, 50, 0, 0, 100, 50, 10,
* 10, 0.0, 0.0, GDK_GRAVITY_NORTH_WEST
* };
*
* gtk_init (&argc, &argv);
*
* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
* vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
*
* gtk_container_add (GTK_CONTAINER (window), vbox);
* fill_with_content (vbox);
* gtk_widget_show_all (vbox);
*
* gtk_window_set_geometry_hints (GTK_WINDOW (window),
* NULL,
* &size_hints,
* GDK_HINT_MIN_SIZE |
* GDK_HINT_BASE_SIZE |
* GDK_HINT_RESIZE_INC);
*
* if (argc > 1)
* {
* gboolean res;
* res = gtk_window_parse_geometry (GTK_WINDOW (window),
* argv[1]);
* if (! res)
* fprintf (stderr,
* "Failed to parse “%s”\n",
* argv[1]);
* }
*
* gtk_widget_show_all (window);
* gtk_main ();
*
* return 0;
* }
* ]|
*
* Deprecated: Geometry handling in GTK is deprecated.
*
* Params:
* geometry = geometry string
*
* Returns: %TRUE if string was parsed successfully
*/
public bool parseGeometry(string geometry)
{
return gtk_window_parse_geometry(gtkWindow, Str.toStringz(geometry)) != 0;
}
/**
* Presents a window to the user. This may mean raising the window
* in the stacking order, deiconifying it, moving it to the current
* desktop, and/or giving it the keyboard focus, possibly dependent
* on the user’s platform, window manager, and preferences.
*
* If @window is hidden, this function calls gtk_widget_show()
* as well.
*
* This function should be used when the user tries to open a window
* that’s already open. Say for example the preferences dialog is
* currently open, and the user chooses Preferences from the menu
* a second time; use gtk_window_present() to move the already-open dialog
* where the user can see it.
*
* If you are calling this function in response to a user interaction,
* it is preferable to use gtk_window_present_with_time().
*/
public void present()
{
gtk_window_present(gtkWindow);
}
/**
* Presents a window to the user in response to a user interaction.
* If you need to present a window without a timestamp, use
* gtk_window_present(). See gtk_window_present() for details.
*
* Params:
* timestamp = the timestamp of the user interaction (typically a
* button or key press event) which triggered this call
*
* Since: 2.8
*/
public void presentWithTime(uint timestamp)
{
gtk_window_present_with_time(gtkWindow, timestamp);
}
/**
* Propagate a key press or release event to the focus widget and
* up the focus container chain until a widget handles @event.
* This is normally called by the default ::key_press_event and
* ::key_release_event handlers for toplevel windows,
* however in some cases it may be useful to call this directly when
* overriding the standard key handling for a toplevel window.
*
* Params:
* event = a #GdkEventKey
*
* Returns: %TRUE if a widget in the focus chain handled the event.
*
* Since: 2.4
*/
public bool propagateKeyEvent(GdkEventKey* event)
{
return gtk_window_propagate_key_event(gtkWindow, event) != 0;
}
/**
* Reverses the effects of gtk_window_add_accel_group().
*
* Params:
* accelGroup = a #GtkAccelGroup
*/
public void removeAccelGroup(AccelGroup accelGroup)
{
gtk_window_remove_accel_group(gtkWindow, (accelGroup is null) ? null : accelGroup.getAccelGroupStruct());
}
/**
* Removes a mnemonic from this window.
*
* Params:
* keyval = the mnemonic
* target = the widget that gets activated by the mnemonic
*/
public void removeMnemonic(uint keyval, Widget target)
{
gtk_window_remove_mnemonic(gtkWindow, keyval, (target is null) ? null : target.getWidgetStruct());
}
/**
* Hides @window, then reshows it, resetting the
* default size and position of the window. Used
* by GUI builders only.
*
* Deprecated: GUI builders can call gtk_widget_hide(),
* gtk_widget_unrealize() and then gtk_widget_show() on @window
* themselves, if they still need this functionality.
*/
public void reshowWithInitialSize()
{
gtk_window_reshow_with_initial_size(gtkWindow);
}
/**
* Resizes the window as if the user had done so, obeying geometry
* constraints. The default geometry constraint is that windows may
* not be smaller than their size request; to override this
* constraint, call gtk_widget_set_size_request() to set the window's
* request to a smaller value.
*
* If gtk_window_resize() is called before showing a window for the
* first time, it overrides any default size set with
* gtk_window_set_default_size().
*
* Windows may not be resized smaller than 1 by 1 pixels.
*
* When using client side decorations, GTK+ will do its best to adjust
* the given size so that the resulting window size matches the
* requested size without the title bar, borders and shadows added for
* the client side decorations, but there is no garantee that the
* result will be totally accurate because these widgets added for
* client side decorations depend on the theme and may not be realized
* or visible at the time gtk_window_resize() is issued.
*
* Typically, gtk_window_resize() will compensate for the GtkHeaderBar
* height only if it's known at the time the resulting GtkWindow
* configuration is issued.
* For example, if new widgets are added after the GtkWindow configuration
* and cause the GtkHeaderBar to grow in height, this will result in a
* window content smaller that specified by gtk_window_resize() and not
* a larger window.
*
* Params:
* width = width in pixels to resize the window to
* height = height in pixels to resize the window to
*/
public void resize(int width, int height)
{
gtk_window_resize(gtkWindow, width, height);
}
/**
* Determines whether a resize grip is visible for the specified window.
*
* Deprecated: Resize grips have been removed.
*
* Returns: %TRUE if a resize grip exists and is visible
*
* Since: 3.0
*/
public bool resizeGripIsVisible()
{
return gtk_window_resize_grip_is_visible(gtkWindow) != 0;
}
/**
* Like gtk_window_resize(), but @width and @height are interpreted
* in terms of the base size and increment set with
* gtk_window_set_geometry_hints.
*
* Deprecated: This function does nothing. Use
* gtk_window_resize() and compute the geometry yourself.
*
* Params:
* width = width in resize increments to resize the window to
* height = height in resize increments to resize the window to
*
* Since: 3.0
*/
public void resizeToGeometry(int width, int height)
{
gtk_window_resize_to_geometry(gtkWindow, width, height);
}
/**
* Windows may set a hint asking the desktop environment not to receive
* the input focus. This function sets this hint.
*
* Params:
* setting = %TRUE to let this window receive input focus
*
* Since: 2.4
*/
public void setAcceptFocus(bool setting)
{
gtk_window_set_accept_focus(gtkWindow, setting);
}
/**
* Sets or unsets the #GtkApplication associated with the window.
*
* The application will be kept alive for at least as long as it has any windows
* associated with it (see g_application_hold() for a way to keep it alive
* without windows).
*
* Normally, the connection between the application and the window will remain
* until the window is destroyed, but you can explicitly remove it by setting
* the @application to %NULL.
*
* This is equivalent to calling gtk_application_remove_window() and/or
* gtk_application_add_window() on the old/new applications as relevant.
*
* Params:
* application = a #GtkApplication, or %NULL to unset
*
* Since: 3.0
*/
public void setApplication(Application application)
{
gtk_window_set_application(gtkWindow, (application is null) ? null : application.getGtkApplicationStruct());
}
/**
* Marks @window as attached to @attach_widget. This creates a logical binding
* between the window and the widget it belongs to, which is used by GTK+ to
* propagate information such as styling or accessibility to @window as if it
* was a children of @attach_widget.
*
* Examples of places where specifying this relation is useful are for instance
* a #GtkMenu created by a #GtkComboBox, a completion popup window
* created by #GtkEntry or a typeahead search entry created by #GtkTreeView.
*
* Note that this function should not be confused with
* gtk_window_set_transient_for(), which specifies a window manager relation
* between two toplevels instead.
*
* Passing %NULL for @attach_widget detaches the window.
*
* Params:
* attachWidget = a #GtkWidget, or %NULL
*
* Since: 3.4
*/
public void setAttachedTo(Widget attachWidget)
{
gtk_window_set_attached_to(gtkWindow, (attachWidget is null) ? null : attachWidget.getWidgetStruct());
}
/**
* By default, windows are decorated with a title bar, resize
* controls, etc. Some [window managers][gtk-X11-arch]
* allow GTK+ to disable these decorations, creating a
* borderless window. If you set the decorated property to %FALSE
* using this function, GTK+ will do its best to convince the window
* manager not to decorate the window. Depending on the system, this
* function may not have any effect when called on a window that is
* already visible, so you should call it before calling gtk_widget_show().
*
* On Windows, this function always works, since there’s no window manager
* policy involved.
*
* Params:
* setting = %TRUE to decorate the window
*/
public void setDecorated(bool setting)
{
gtk_window_set_decorated(gtkWindow, setting);
}
/**
* The default widget is the widget that’s activated when the user
* presses Enter in a dialog (for example). This function sets or
* unsets the default widget for a #GtkWindow. When setting (rather
* than unsetting) the default widget it’s generally easier to call
* gtk_widget_grab_default() on the widget. Before making a widget
* the default widget, you must call gtk_widget_set_can_default() on
* the widget you’d like to make the default.
*
* Params:
* defaultWidget = widget to be the default, or %NULL
* to unset the default widget for the toplevel
*/
public void setDefault(Widget defaultWidget)
{
gtk_window_set_default(gtkWindow, (defaultWidget is null) ? null : defaultWidget.getWidgetStruct());
}
/**
* Like gtk_window_set_default_size(), but @width and @height are interpreted
* in terms of the base size and increment set with
* gtk_window_set_geometry_hints.
*
* Deprecated: This function does nothing. If you want to set a default
* size, use gtk_window_set_default_size() instead.
*
* Params:
* width = width in resize increments, or -1 to unset the default width
* height = height in resize increments, or -1 to unset the default height
*
* Since: 3.0
*/
public void setDefaultGeometry(int width, int height)
{
gtk_window_set_default_geometry(gtkWindow, width, height);
}
/**
* Sets the default size of a window. If the window’s “natural” size
* (its size request) is larger than the default, the default will be
* ignored. More generally, if the default size does not obey the
* geometry hints for the window (gtk_window_set_geometry_hints() can
* be used to set these explicitly), the default size will be clamped
* to the nearest permitted size.
*
* Unlike gtk_widget_set_size_request(), which sets a size request for
* a widget and thus would keep users from shrinking the window, this
* function only sets the initial size, just as if the user had
* resized the window themselves. Users can still shrink the window
* again as they normally would. Setting a default size of -1 means to
* use the “natural” default size (the size request of the window).
*
* For more control over a window’s initial size and how resizing works,
* investigate gtk_window_set_geometry_hints().
*
* For some uses, gtk_window_resize() is a more appropriate function.
* gtk_window_resize() changes the current size of the window, rather
* than the size to be used on initial display. gtk_window_resize() always
* affects the window itself, not the geometry widget.
*
* The default size of a window only affects the first time a window is
* shown; if a window is hidden and re-shown, it will remember the size
* it had prior to hiding, rather than using the default size.
*
* Windows can’t actually be 0x0 in size, they must be at least 1x1, but
* passing 0 for @width and @height is OK, resulting in a 1x1 default size.
*
* If you use this function to reestablish a previously saved window size,
* note that the appropriate size to save is the one returned by
* gtk_window_get_size(). Using the window allocation directly will not
* work in all circumstances and can lead to growing or shrinking windows.
*
* Params:
* width = width in pixels, or -1 to unset the default width
* height = height in pixels, or -1 to unset the default height
*/
public void setDefaultSize(int width, int height)
{
gtk_window_set_default_size(gtkWindow, width, height);
}
/**
* By default, windows have a close button in the window frame. Some
* [window managers][gtk-X11-arch] allow GTK+ to
* disable this button. If you set the deletable property to %FALSE
* using this function, GTK+ will do its best to convince the window
* manager not to show a close button. Depending on the system, this
* function may not have any effect when called on a window that is
* already visible, so you should call it before calling gtk_widget_show().
*
* On Windows, this function always works, since there’s no window manager
* policy involved.
*
* Params:
* setting = %TRUE to decorate the window as deletable
*
* Since: 2.10
*/
public void setDeletable(bool setting)
{
gtk_window_set_deletable(gtkWindow, setting);
}
/**
* If @setting is %TRUE, then destroying the transient parent of @window
* will also destroy @window itself. This is useful for dialogs that
* shouldn’t persist beyond the lifetime of the main window they're
* associated with, for example.
*
* Params:
* setting = whether to destroy @window with its transient parent
*/
public void setDestroyWithParent(bool setting)
{
gtk_window_set_destroy_with_parent(gtkWindow, setting);
}
/**
* If @focus is not the current focus widget, and is focusable, sets
* it as the focus widget for the window. If @focus is %NULL, unsets
* the focus widget for this window. To set the focus to a particular
* widget in the toplevel, it is usually more convenient to use
* gtk_widget_grab_focus() instead of this function.
*
* Params:
* focus = widget to be the new focus widget, or %NULL to unset
* any focus widget for the toplevel window.
*/
public void setFocus(Widget focus)
{
gtk_window_set_focus(gtkWindow, (focus is null) ? null : focus.getWidgetStruct());
}
/**
* Windows may set a hint asking the desktop environment not to receive
* the input focus when the window is mapped. This function sets this
* hint.
*
* Params:
* setting = %TRUE to let this window receive input focus on map
*
* Since: 2.6
*/
public void setFocusOnMap(bool setting)
{
gtk_window_set_focus_on_map(gtkWindow, setting);
}
/**
* Sets the #GtkWindow:focus-visible property.
*
* Params:
* setting = the new value
*
* Since: 3.2
*/
public void setFocusVisible(bool setting)
{
gtk_window_set_focus_visible(gtkWindow, setting);
}
/**
* This function sets up hints about how a window can be resized by
* the user. You can set a minimum and maximum size; allowed resize
* increments (e.g. for xterm, you can only resize by the size of a
* character); aspect ratios; and more. See the #GdkGeometry struct.
*
* Params:
* geometryWidget = widget the geometry hints used to be applied to
* or %NULL. Since 3.20 this argument is ignored and GTK behaves as if %NULL was
* set.
* geometry = struct containing geometry information or %NULL
* geomMask = mask indicating which struct fields should be paid attention to
*/
public void setGeometryHints(Widget geometryWidget, GdkGeometry* geometry, GdkWindowHints geomMask)
{
gtk_window_set_geometry_hints(gtkWindow, (geometryWidget is null) ? null : geometryWidget.getWidgetStruct(), geometry, geomMask);
}
/**
* Window gravity defines the meaning of coordinates passed to
* gtk_window_move(). See gtk_window_move() and #GdkGravity for
* more details.
*
* The default window gravity is #GDK_GRAVITY_NORTH_WEST which will
* typically “do what you mean.”
*
* Params:
* gravity = window gravity
*/
public void setGravity(GdkGravity gravity)
{
gtk_window_set_gravity(gtkWindow, gravity);
}
/**
* Sets whether @window has a corner resize grip.
*
* Note that the resize grip is only shown if the window
* is actually resizable and not maximized. Use
* gtk_window_resize_grip_is_visible() to find out if the
* resize grip is currently shown.
*
* Deprecated: Resize grips have been removed.
*
* Params:
* value = %TRUE to allow a resize grip
*
* Since: 3.0
*/
public void setHasResizeGrip(bool value)
{
gtk_window_set_has_resize_grip(gtkWindow, value);
}
/**
* Tells GTK+ whether to drop its extra reference to the window
* when gtk_widget_destroy() is called.
*
* This function is only exported for the benefit of language
* bindings which may need to keep the window alive until their
* wrapper object is garbage collected. There is no justification
* for ever calling this function in an application.
*
* Params:
* setting = the new value
*
* Since: 3.0
*/
public void setHasUserRefCount(bool setting)
{
gtk_window_set_has_user_ref_count(gtkWindow, setting);
}
/**
* If @setting is %TRUE, then @window will request that it’s titlebar
* should be hidden when maximized.
* This is useful for windows that don’t convey any information other
* than the application name in the titlebar, to put the available
* screen space to better use. If the underlying window system does not
* support the request, the setting will not have any effect.
*
* Note that custom titlebars set with gtk_window_set_titlebar() are
* not affected by this. The application is in full control of their
* content and visibility anyway.
*
* Params:
* setting = whether to hide the titlebar when @window is maximized
*
* Since: 3.4
*/
public void setHideTitlebarWhenMaximized(bool setting)
{
gtk_window_set_hide_titlebar_when_maximized(gtkWindow, setting);
}
/**
* Sets up the icon representing a #GtkWindow. This icon is used when
* the window is minimized (also known as iconified). Some window
* managers or desktop environments may also place it in the window
* frame, or display it in other contexts. On others, the icon is not
* used at all, so your mileage may vary.
*
* The icon should be provided in whatever size it was naturally
* drawn; that is, don’t scale the image before passing it to
* GTK+. Scaling is postponed until the last minute, when the desired
* final size is known, to allow best quality.
*
* If you have your icon hand-drawn in multiple sizes, use
* gtk_window_set_icon_list(). Then the best size will be used.
*
* This function is equivalent to calling gtk_window_set_icon_list()
* with a 1-element list.
*
* See also gtk_window_set_default_icon_list() to set the icon
* for all windows in your application in one go.
*
* Params:
* icon = icon image, or %NULL
*/
public void setIcon(Pixbuf icon)
{
gtk_window_set_icon(gtkWindow, (icon is null) ? null : icon.getPixbufStruct());
}
/**
* Sets the icon for @window.
* Warns on failure if @err is %NULL.
*
* This function is equivalent to calling gtk_window_set_icon()
* with a pixbuf created by loading the image from @filename.
*
* Params:
* filename = location of icon file
*
* Returns: %TRUE if setting the icon succeeded.
*
* Since: 2.2
*
* Throws: GException on failure.
*/
public bool setIconFromFile(string filename)
{
GError* err = null;
auto p = gtk_window_set_icon_from_file(gtkWindow, Str.toStringz(filename), &err) != 0;
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
return p;
}
/**
* Sets up the icon representing a #GtkWindow. The icon is used when
* the window is minimized (also known as iconified). Some window
* managers or desktop environments may also place it in the window
* frame, or display it in other contexts. On others, the icon is not
* used at all, so your mileage may vary.
*
* gtk_window_set_icon_list() allows you to pass in the same icon in
* several hand-drawn sizes. The list should contain the natural sizes
* your icon is available in; that is, don’t scale the image before
* passing it to GTK+. Scaling is postponed until the last minute,
* when the desired final size is known, to allow best quality.
*
* By passing several sizes, you may improve the final image quality
* of the icon, by reducing or eliminating automatic image scaling.
*
* Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and
* larger images (64x64, 128x128) if you have them.
*
* See also gtk_window_set_default_icon_list() to set the icon
* for all windows in your application in one go.
*
* Note that transient windows (those who have been set transient for another
* window using gtk_window_set_transient_for()) will inherit their
* icon from their transient parent. So there’s no need to explicitly
* set the icon on transient windows.
*
* Params:
* list = list of #GdkPixbuf
*/
public void setIconList(ListG list)
{
gtk_window_set_icon_list(gtkWindow, (list is null) ? null : list.getListGStruct());
}
/**
* Sets the icon for the window from a named themed icon.
* See the docs for #GtkIconTheme for more details.
* On some platforms, the window icon is not used at all.
*
* Note that this has nothing to do with the WM_ICON_NAME
* property which is mentioned in the ICCCM.
*
* Params:
* name = the name of the themed icon
*
* Since: 2.6
*/
public void setIconName(string name)
{
gtk_window_set_icon_name(gtkWindow, Str.toStringz(name));
}
/**
* Asks to keep @window above, so that it stays on top. Note that
* you shouldn’t assume the window is definitely above afterward,
* because other entities (e.g. the user or
* [window manager][gtk-X11-arch]) could not keep it above,
* and not all window managers support keeping windows above. But
* normally the window will end kept above. Just don’t write code
* that crashes if not.
*
* It’s permitted to call this function before showing a window,
* in which case the window will be kept above when it appears onscreen
* initially.
*
* You can track the above state via the “window-state-event” signal
* on #GtkWidget.
*
* Note that, according to the
* [Extended Window Manager Hints Specification](http://www.freedesktop.org/Standards/wm-spec),
* the above state is mainly meant for user preferences and should not
* be used by applications e.g. for drawing attention to their
* dialogs.
*
* Params:
* setting = whether to keep @window above other windows
*
* Since: 2.4
*/
public void setKeepAbove(bool setting)
{
gtk_window_set_keep_above(gtkWindow, setting);
}
/**
* Asks to keep @window below, so that it stays in bottom. Note that
* you shouldn’t assume the window is definitely below afterward,
* because other entities (e.g. the user or
* [window manager][gtk-X11-arch]) could not keep it below,
* and not all window managers support putting windows below. But
* normally the window will be kept below. Just don’t write code
* that crashes if not.
*
* It’s permitted to call this function before showing a window,
* in which case the window will be kept below when it appears onscreen
* initially.
*
* You can track the below state via the “window-state-event” signal
* on #GtkWidget.
*
* Note that, according to the
* [Extended Window Manager Hints Specification](http://www.freedesktop.org/Standards/wm-spec),
* the above state is mainly meant for user preferences and should not
* be used by applications e.g. for drawing attention to their
* dialogs.
*
* Params:
* setting = whether to keep @window below other windows
*
* Since: 2.4
*/
public void setKeepBelow(bool setting)
{
gtk_window_set_keep_below(gtkWindow, setting);
}
/**
* Sets the mnemonic modifier for this window.
*
* Params:
* modifier = the modifier mask used to activate
* mnemonics on this window.
*/
public void setMnemonicModifier(GdkModifierType modifier)
{
gtk_window_set_mnemonic_modifier(gtkWindow, modifier);
}
/**
* Sets the #GtkWindow:mnemonics-visible property.
*
* Params:
* setting = the new value
*
* Since: 2.20
*/
public void setMnemonicsVisible(bool setting)
{
gtk_window_set_mnemonics_visible(gtkWindow, setting);
}
/**
* Sets a window modal or non-modal. Modal windows prevent interaction
* with other windows in the same application. To keep modal dialogs
* on top of main application windows, use
* gtk_window_set_transient_for() to make the dialog transient for the
* parent; most [window managers][gtk-X11-arch]
* will then disallow lowering the dialog below the parent.
*
* Params:
* modal = whether the window is modal
*/
public void setModal(bool modal)
{
gtk_window_set_modal(gtkWindow, modal);
}
/**
* Request the windowing system to make @window partially transparent,
* with opacity 0 being fully transparent and 1 fully opaque. (Values
* of the opacity parameter are clamped to the [0,1] range.) On X11
* this has any effect only on X screens with a compositing manager
* running. See gtk_widget_is_composited(). On Windows it should work
* always.
*
* Note that setting a window’s opacity after the window has been
* shown causes it to flicker once on Windows.
*
* Deprecated: Use gtk_widget_set_opacity instead.
*
* Params:
* opacity = desired opacity, between 0 and 1
*
* Since: 2.12
*/
public override void setOpacity(double opacity)
{
gtk_window_set_opacity(gtkWindow, opacity);
}
/**
* Sets a position constraint for this window. If the old or new
* constraint is %GTK_WIN_POS_CENTER_ALWAYS, this will also cause
* the window to be repositioned to satisfy the new constraint.
*
* Params:
* position = a position constraint.
*/
public void setPosition(GtkWindowPosition position)
{
gtk_window_set_position(gtkWindow, position);
}
/**
* Sets whether the user can resize a window. Windows are user resizable
* by default.
*
* Params:
* resizable = %TRUE if the user can resize this window
*/
public void setResizable(bool resizable)
{
gtk_window_set_resizable(gtkWindow, resizable);
}
/**
* This function is only useful on X11, not with other GTK+ targets.
*
* In combination with the window title, the window role allows a
* [window manager][gtk-X11-arch] to identify "the
* same" window when an application is restarted. So for example you
* might set the “toolbox” role on your app’s toolbox window, so that
* when the user restarts their session, the window manager can put
* the toolbox back in the same place.
*
* If a window already has a unique title, you don’t need to set the
* role, since the WM can use the title to identify the window when
* restoring the session.
*
* Params:
* role = unique identifier for the window to be used when restoring a session
*/
public void setRole(string role)
{
gtk_window_set_role(gtkWindow, Str.toStringz(role));
}
/**
* Sets the #GdkScreen where the @window is displayed; if
* the window is already mapped, it will be unmapped, and
* then remapped on the new screen.
*
* Params:
* screen = a #GdkScreen.
*
* Since: 2.2
*/
public void setScreen(Screen screen)
{
gtk_window_set_screen(gtkWindow, (screen is null) ? null : screen.getScreenStruct());
}
/**
* Windows may set a hint asking the desktop environment not to display
* the window in the pager. This function sets this hint.
* (A "pager" is any desktop navigation tool such as a workspace
* switcher that displays a thumbnail representation of the windows
* on the screen.)
*
* Params:
* setting = %TRUE to keep this window from appearing in the pager
*
* Since: 2.2
*/
public void setSkipPagerHint(bool setting)
{
gtk_window_set_skip_pager_hint(gtkWindow, setting);
}
/**
* Windows may set a hint asking the desktop environment not to display
* the window in the task bar. This function sets this hint.
*
* Params:
* setting = %TRUE to keep this window from appearing in the task bar
*
* Since: 2.2
*/
public void setSkipTaskbarHint(bool setting)
{
gtk_window_set_skip_taskbar_hint(gtkWindow, setting);
}
/**
* Startup notification identifiers are used by desktop environment to
* track application startup, to provide user feedback and other
* features. This function changes the corresponding property on the
* underlying GdkWindow. Normally, startup identifier is managed
* automatically and you should only use this function in special cases
* like transferring focus from other processes. You should use this
* function before calling gtk_window_present() or any equivalent
* function generating a window map event.
*
* This function is only useful on X11, not with other GTK+ targets.
*
* Params:
* startupId = a string with startup-notification identifier
*
* Since: 2.12
*/
public void setStartupId(string startupId)
{
gtk_window_set_startup_id(gtkWindow, Str.toStringz(startupId));
}
/**
* Sets the title of the #GtkWindow. The title of a window will be
* displayed in its title bar; on the X Window System, the title bar
* is rendered by the [window manager][gtk-X11-arch],
* so exactly how the title appears to users may vary
* according to a user’s exact configuration. The title should help a
* user distinguish this window from other windows they may have
* open. A good title might include the application name and current
* document filename, for example.
*
* Params:
* title = title of the window
*/
public void setTitle(string title)
{
gtk_window_set_title(gtkWindow, Str.toStringz(title));
}
/**
* Sets a custom titlebar for @window.
*
* If you set a custom titlebar, GTK+ will do its best to convince
* the window manager not to put its own titlebar on the window.
* Depending on the system, this function may not work for a window
* that is already visible, so you set the titlebar before calling
* gtk_widget_show().
*
* Params:
* titlebar = the widget to use as titlebar
*
* Since: 3.10
*/
public void setTitlebar(Widget titlebar)
{
gtk_window_set_titlebar(gtkWindow, (titlebar is null) ? null : titlebar.getWidgetStruct());
}
/**
* Dialog windows should be set transient for the main application
* window they were spawned from. This allows
* [window managers][gtk-X11-arch] to e.g. keep the
* dialog on top of the main window, or center the dialog over the
* main window. gtk_dialog_new_with_buttons() and other convenience
* functions in GTK+ will sometimes call
* gtk_window_set_transient_for() on your behalf.
*
* Passing %NULL for @parent unsets the current transient window.
*
* On Wayland, this function can also be used to attach a new
* #GTK_WINDOW_POPUP to a #GTK_WINDOW_TOPLEVEL parent already mapped
* on screen so that the #GTK_WINDOW_POPUP will be created as a
* subsurface-based window #GDK_WINDOW_SUBSURFACE which can be
* positioned at will relatively to the #GTK_WINDOW_TOPLEVEL surface.
*
* On Windows, this function puts the child window on top of the parent,
* much as the window manager would have done on X.
*
* Params:
* parent = parent window, or %NULL
*/
public void setTransientFor(Window parent)
{
gtk_window_set_transient_for(gtkWindow, (parent is null) ? null : parent.getWindowStruct());
}
/**
* By setting the type hint for the window, you allow the window
* manager to decorate and handle the window in a way which is
* suitable to the function of the window in your application.
*
* This function should be called before the window becomes visible.
*
* gtk_dialog_new_with_buttons() and other convenience functions in GTK+
* will sometimes call gtk_window_set_type_hint() on your behalf.
*
* Params:
* hint = the window type
*/
public void setTypeHint(GdkWindowTypeHint hint)
{
gtk_window_set_type_hint(gtkWindow, hint);
}
/**
* Windows may set a hint asking the desktop environment to draw
* the users attention to the window. This function sets this hint.
*
* Params:
* setting = %TRUE to mark this window as urgent
*
* Since: 2.8
*/
public void setUrgencyHint(bool setting)
{
gtk_window_set_urgency_hint(gtkWindow, setting);
}
/**
* Don’t use this function. It sets the X Window System “class” and
* “name” hints for a window. According to the ICCCM, you should
* always set these to the same value for all windows in an
* application, and GTK+ sets them to that value by default, so calling
* this function is sort of pointless. However, you may want to call
* gtk_window_set_role() on each window in your application, for the
* benefit of the session manager. Setting the role allows the window
* manager to restore window positions when loading a saved session.
*
* Params:
* wmclassName = window name hint
* wmclassClass = window class hint
*/
public void setWmclass(string wmclassName, string wmclassClass)
{
gtk_window_set_wmclass(gtkWindow, Str.toStringz(wmclassName), Str.toStringz(wmclassClass));
}
/**
* Asks to stick @window, which means that it will appear on all user
* desktops. Note that you shouldn’t assume the window is definitely
* stuck afterward, because other entities (e.g. the user or
* [window manager][gtk-X11-arch] could unstick it
* again, and some window managers do not support sticking
* windows. But normally the window will end up stuck. Just don't
* write code that crashes if not.
*
* It’s permitted to call this function before showing a window.
*
* You can track stickiness via the “window-state-event” signal
* on #GtkWidget.
*/
public void stick()
{
gtk_window_stick(gtkWindow);
}
/**
* Asks to toggle off the fullscreen state for @window. Note that you
* shouldn’t assume the window is definitely not full screen
* afterward, because other entities (e.g. the user or
* [window manager][gtk-X11-arch]) could fullscreen it
* again, and not all window managers honor requests to unfullscreen
* windows. But normally the window will end up restored to its normal
* state. Just don’t write code that crashes if not.
*
* You can track the fullscreen state via the “window-state-event” signal
* on #GtkWidget.
*
* Since: 2.2
*/
public void unfullscreen()
{
gtk_window_unfullscreen(gtkWindow);
}
/**
* Asks to unmaximize @window. Note that you shouldn’t assume the
* window is definitely unmaximized afterward, because other entities
* (e.g. the user or [window manager][gtk-X11-arch])
* could maximize it again, and not all window
* managers honor requests to unmaximize. But normally the window will
* end up unmaximized. Just don’t write code that crashes if not.
*
* You can track maximization via the “window-state-event” signal
* on #GtkWidget.
*/
public void unmaximize()
{
gtk_window_unmaximize(gtkWindow);
}
/**
* Asks to unstick @window, which means that it will appear on only
* one of the user’s desktops. Note that you shouldn’t assume the
* window is definitely unstuck afterward, because other entities
* (e.g. the user or [window manager][gtk-X11-arch]) could
* stick it again. But normally the window will
* end up stuck. Just don’t write code that crashes if not.
*
* You can track stickiness via the “window-state-event” signal
* on #GtkWidget.
*/
public void unstick()
{
gtk_window_unstick(gtkWindow);
}
protected class OnActivateDefaultDelegateWrapper
{
void delegate(Window) dlg;
gulong handlerId;
this(void delegate(Window) dlg)
{
this.dlg = dlg;
onActivateDefaultListeners ~= this;
}
void remove(OnActivateDefaultDelegateWrapper source)
{
foreach(index, wrapper; onActivateDefaultListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onActivateDefaultListeners[index] = null;
onActivateDefaultListeners = std.algorithm.remove(onActivateDefaultListeners, index);
break;
}
}
}
}
OnActivateDefaultDelegateWrapper[] onActivateDefaultListeners;
/**
* The ::activate-default signal is a
* [keybinding signal][GtkBindingSignal]
* which gets emitted when the user activates the default widget
* of @window.
*/
gulong addOnActivateDefault(void delegate(Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnActivateDefaultDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"activate-default",
cast(GCallback)&callBackActivateDefault,
cast(void*)wrapper,
cast(GClosureNotify)&callBackActivateDefaultDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackActivateDefault(GtkWindow* windowStruct, OnActivateDefaultDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackActivateDefaultDestroy(OnActivateDefaultDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnActivateFocusDelegateWrapper
{
void delegate(Window) dlg;
gulong handlerId;
this(void delegate(Window) dlg)
{
this.dlg = dlg;
onActivateFocusListeners ~= this;
}
void remove(OnActivateFocusDelegateWrapper source)
{
foreach(index, wrapper; onActivateFocusListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onActivateFocusListeners[index] = null;
onActivateFocusListeners = std.algorithm.remove(onActivateFocusListeners, index);
break;
}
}
}
}
OnActivateFocusDelegateWrapper[] onActivateFocusListeners;
/**
* The ::activate-focus signal is a
* [keybinding signal][GtkBindingSignal]
* which gets emitted when the user activates the currently
* focused widget of @window.
*/
gulong addOnActivateFocus(void delegate(Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnActivateFocusDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"activate-focus",
cast(GCallback)&callBackActivateFocus,
cast(void*)wrapper,
cast(GClosureNotify)&callBackActivateFocusDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackActivateFocus(GtkWindow* windowStruct, OnActivateFocusDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackActivateFocusDestroy(OnActivateFocusDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnEnableDebuggingDelegateWrapper
{
bool delegate(bool, Window) dlg;
gulong handlerId;
this(bool delegate(bool, Window) dlg)
{
this.dlg = dlg;
onEnableDebuggingListeners ~= this;
}
void remove(OnEnableDebuggingDelegateWrapper source)
{
foreach(index, wrapper; onEnableDebuggingListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onEnableDebuggingListeners[index] = null;
onEnableDebuggingListeners = std.algorithm.remove(onEnableDebuggingListeners, index);
break;
}
}
}
}
OnEnableDebuggingDelegateWrapper[] onEnableDebuggingListeners;
/**
* The ::enable-debugging signal is a [keybinding signal][GtkBindingSignal]
* which gets emitted when the user enables or disables interactive
* debugging. When @toggle is %TRUE, interactive debugging is toggled
* on or off, when it is %FALSE, the debugger will be pointed at the
* widget under the pointer.
*
* The default bindings for this signal are Ctrl-Shift-I
* and Ctrl-Shift-D.
*
* Params:
* toggle = toggle the debugger
*
* Returns: %TRUE if the key binding was handled
*/
gulong addOnEnableDebugging(bool delegate(bool, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnEnableDebuggingDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"enable-debugging",
cast(GCallback)&callBackEnableDebugging,
cast(void*)wrapper,
cast(GClosureNotify)&callBackEnableDebuggingDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static int callBackEnableDebugging(GtkWindow* windowStruct, bool toggle, OnEnableDebuggingDelegateWrapper wrapper)
{
return wrapper.dlg(toggle, wrapper.outer);
}
extern(C) static void callBackEnableDebuggingDestroy(OnEnableDebuggingDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnKeysChangedDelegateWrapper
{
void delegate(Window) dlg;
gulong handlerId;
this(void delegate(Window) dlg)
{
this.dlg = dlg;
onKeysChangedListeners ~= this;
}
void remove(OnKeysChangedDelegateWrapper source)
{
foreach(index, wrapper; onKeysChangedListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onKeysChangedListeners[index] = null;
onKeysChangedListeners = std.algorithm.remove(onKeysChangedListeners, index);
break;
}
}
}
}
OnKeysChangedDelegateWrapper[] onKeysChangedListeners;
/**
* The ::keys-changed signal gets emitted when the set of accelerators
* or mnemonics that are associated with @window changes.
*/
gulong addOnKeysChanged(void delegate(Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnKeysChangedDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"keys-changed",
cast(GCallback)&callBackKeysChanged,
cast(void*)wrapper,
cast(GClosureNotify)&callBackKeysChangedDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackKeysChanged(GtkWindow* windowStruct, OnKeysChangedDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackKeysChangedDestroy(OnKeysChangedDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnSetFocusDelegateWrapper
{
void delegate(Widget, Window) dlg;
gulong handlerId;
this(void delegate(Widget, Window) dlg)
{
this.dlg = dlg;
onSetFocusListeners ~= this;
}
void remove(OnSetFocusDelegateWrapper source)
{
foreach(index, wrapper; onSetFocusListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onSetFocusListeners[index] = null;
onSetFocusListeners = std.algorithm.remove(onSetFocusListeners, index);
break;
}
}
}
}
OnSetFocusDelegateWrapper[] onSetFocusListeners;
/** */
gulong addOnSetFocus(void delegate(Widget, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnSetFocusDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"set-focus",
cast(GCallback)&callBackSetFocus,
cast(void*)wrapper,
cast(GClosureNotify)&callBackSetFocusDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackSetFocus(GtkWindow* windowStruct, GtkWidget* object, OnSetFocusDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(Widget)(object), wrapper.outer);
}
extern(C) static void callBackSetFocusDestroy(OnSetFocusDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
/**
* This is a convenience function for launching the default application
* to show the uri. The uri must be of a form understood by GIO (i.e. you
* need to install gvfs to get support for uri schemes such as http://
* or ftp://, as only local files are handled by GIO itself).
* Typical examples are
* - `file:///home/gnome/pict.jpg`
* - `http://www.gnome.org`
* - `mailto:me@gnome.org`
*
* Ideally the timestamp is taken from the event triggering
* the gtk_show_uri() call. If timestamp is not known you can take
* %GDK_CURRENT_TIME.
*
* This is the recommended call to be used as it passes information
* necessary for sandbox helpers to parent their dialogs properly.
*
* Params:
* parent = parent window
* uri = the uri to show
* timestamp = a timestamp to prevent focus stealing
*
* Returns: %TRUE on success, %FALSE on error
*
* Since: 3.22
*
* Throws: GException on failure.
*/
public static bool showUriOnWindow(Window parent, string uri, uint timestamp)
{
GError* err = null;
auto p = gtk_show_uri_on_window((parent is null) ? null : parent.getWindowStruct(), Str.toStringz(uri), timestamp, &err) != 0;
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
return p;
}
}
|