/usr/include/d/gtkd-3/gtk/TextView.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 | /*
* 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.TextView;
private import gdk.Window;
private import glib.ConstructionException;
private import glib.MemorySlice;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Signals;
private import gtk.Container;
private import gtk.ScrollableIF;
private import gtk.ScrollableT;
private import gtk.TextAttributes;
private import gtk.TextBuffer;
private import gtk.TextChildAnchor;
private import gtk.TextIter;
private import gtk.TextMark;
private import gtk.Widget;
private import gtk.c.functions;
public import gtk.c.types;
public import gtkc.gtktypes;
private import pango.PgTabArray;
private import std.algorithm;
/**
* You may wish to begin by reading the
* [text widget conceptual overview][TextWidget]
* which gives an overview of all the objects and data
* types related to the text widget and how they work together.
*
* # CSS nodes
*
* |[<!-- language="plain" -->
* textview.view
* ├── border.top
* ├── border.left
* ├── text
* │ ╰── [selection]
* ├── border.right
* ├── border.bottom
* ╰── [window.popup]
* ]|
*
* GtkTextView has a main css node with name textview and style class .view,
* and subnodes for each of the border windows, and the main text area,
* with names border and text, respectively. The border nodes each get
* one of the style classes .left, .right, .top or .bottom.
*
* A node representing the selection will appear below the text node.
*
* If a context menu is opened, the window node will appear as a subnode
* of the main node.
*/
public class TextView : Container, ScrollableIF
{
/** the main Gtk struct */
protected GtkTextView* gtkTextView;
/** Get the main Gtk struct */
public GtkTextView* getTextViewStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gtkTextView;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gtkTextView;
}
protected override void setStruct(GObject* obj)
{
gtkTextView = cast(GtkTextView*)obj;
super.setStruct(obj);
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GtkTextView* gtkTextView, bool ownedRef = false)
{
this.gtkTextView = gtkTextView;
super(cast(GtkContainer*)gtkTextView, ownedRef);
}
// add the Scrollable capabilities
mixin ScrollableT!(GtkTextView);
/**
* Get the text line at the pixel y
*/
string getLineTextAt(int y)
{
TextIter iter = new TextIter();
int windowX;
int windowY;
bufferToWindowCoords(TextWindowType.TEXT, 0, y, windowX, windowY);
gtk_text_view_get_line_at_y(gtkTextView, iter.getTextIterStruct(), y+y-windowY, null);
TextIter iterEnd = new TextIter();
TextBuffer buffer = getBuffer();
buffer.getIterAtOffset(iterEnd, iter.getOffset()+iter.getCharsInLine());
return buffer.getText(iter, iterEnd, false);
}
/**
* Simply appends some on the cursor position
* Params:
* text = the text to append
*/
void insertText(string text)
{
TextBuffer buf = getBuffer();
buf.insertAtCursor(text);
}
/**
* Simply appends some text to this view
* Params:
* text = the text to append
*/
void appendText(string text, bool ensureVisible=true)
{
TextBuffer buf = getBuffer();
TextIter iter = new TextIter();
buf.getEndIter(iter);
buf.insert(iter, text);
if ( ensureVisible )
{
double within_margin = 0.0;
bool use_align = false;
double xalign = 0.0;
double yalign = 0.0;
scrollToMark(buf.createMark("",iter,true), within_margin, use_align, xalign, yalign);
}
}
/**
*/
/** */
public static GType getType()
{
return gtk_text_view_get_type();
}
/**
* Creates a new #GtkTextView. If you don’t call gtk_text_view_set_buffer()
* before using the text view, an empty default buffer will be created
* for you. Get the buffer with gtk_text_view_get_buffer(). If you want
* to specify your own buffer, consider gtk_text_view_new_with_buffer().
*
* Returns: a new #GtkTextView
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this()
{
auto p = gtk_text_view_new();
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GtkTextView*) p);
}
/**
* Creates a new #GtkTextView widget displaying the buffer
* @buffer. One buffer can be shared among many widgets.
* @buffer may be %NULL to create a default buffer, in which case
* this function is equivalent to gtk_text_view_new(). The
* text view adds its own reference count to the buffer; it does not
* take over an existing reference.
*
* Params:
* buffer = a #GtkTextBuffer
*
* Returns: a new #GtkTextView.
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this(TextBuffer buffer)
{
auto p = gtk_text_view_new_with_buffer((buffer is null) ? null : buffer.getTextBufferStruct());
if(p is null)
{
throw new ConstructionException("null returned by new_with_buffer");
}
this(cast(GtkTextView*) p);
}
/**
* Adds a child widget in the text buffer, at the given @anchor.
*
* Params:
* child = a #GtkWidget
* anchor = a #GtkTextChildAnchor in the #GtkTextBuffer for @text_view
*/
public void addChildAtAnchor(Widget child, TextChildAnchor anchor)
{
gtk_text_view_add_child_at_anchor(gtkTextView, (child is null) ? null : child.getWidgetStruct(), (anchor is null) ? null : anchor.getTextChildAnchorStruct());
}
/**
* Adds a child at fixed coordinates in one of the text widget's
* windows.
*
* The window must have nonzero size (see
* gtk_text_view_set_border_window_size()). Note that the child
* coordinates are given relative to scrolling. When
* placing a child in #GTK_TEXT_WINDOW_WIDGET, scrolling is
* irrelevant, the child floats above all scrollable areas. But when
* placing a child in one of the scrollable windows (border windows or
* text window) it will move with the scrolling as needed.
*
* Params:
* child = a #GtkWidget
* whichWindow = which window the child should appear in
* xpos = X position of child in window coordinates
* ypos = Y position of child in window coordinates
*/
public void addChildInWindow(Widget child, GtkTextWindowType whichWindow, int xpos, int ypos)
{
gtk_text_view_add_child_in_window(gtkTextView, (child is null) ? null : child.getWidgetStruct(), whichWindow, xpos, ypos);
}
/**
* Moves the given @iter backward by one display (wrapped) line.
* A display line is different from a paragraph. Paragraphs are
* separated by newlines or other paragraph separator characters.
* Display lines are created by line-wrapping a paragraph. If
* wrapping is turned off, display lines and paragraphs will be the
* same. Display lines are divided differently for each view, since
* they depend on the view’s width; paragraphs are the same in all
* views, since they depend on the contents of the #GtkTextBuffer.
*
* Params:
* iter = a #GtkTextIter
*
* Returns: %TRUE if @iter was moved and is not on the end iterator
*/
public bool backwardDisplayLine(TextIter iter)
{
return gtk_text_view_backward_display_line(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0;
}
/**
* Moves the given @iter backward to the next display line start.
* A display line is different from a paragraph. Paragraphs are
* separated by newlines or other paragraph separator characters.
* Display lines are created by line-wrapping a paragraph. If
* wrapping is turned off, display lines and paragraphs will be the
* same. Display lines are divided differently for each view, since
* they depend on the view’s width; paragraphs are the same in all
* views, since they depend on the contents of the #GtkTextBuffer.
*
* Params:
* iter = a #GtkTextIter
*
* Returns: %TRUE if @iter was moved and is not on the end iterator
*/
public bool backwardDisplayLineStart(TextIter iter)
{
return gtk_text_view_backward_display_line_start(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0;
}
/**
* Converts coordinate (@buffer_x, @buffer_y) to coordinates for the window
* @win, and stores the result in (@window_x, @window_y).
*
* Note that you can’t convert coordinates for a nonexisting window (see
* gtk_text_view_set_border_window_size()).
*
* Params:
* win = a #GtkTextWindowType, except %GTK_TEXT_WINDOW_PRIVATE
* bufferX = buffer x coordinate
* bufferY = buffer y coordinate
* windowX = window x coordinate return location or %NULL
* windowY = window y coordinate return location or %NULL
*/
public void bufferToWindowCoords(GtkTextWindowType win, int bufferX, int bufferY, out int windowX, out int windowY)
{
gtk_text_view_buffer_to_window_coords(gtkTextView, win, bufferX, bufferY, &windowX, &windowY);
}
/**
* Moves the given @iter forward by one display (wrapped) line.
* A display line is different from a paragraph. Paragraphs are
* separated by newlines or other paragraph separator characters.
* Display lines are created by line-wrapping a paragraph. If
* wrapping is turned off, display lines and paragraphs will be the
* same. Display lines are divided differently for each view, since
* they depend on the view’s width; paragraphs are the same in all
* views, since they depend on the contents of the #GtkTextBuffer.
*
* Params:
* iter = a #GtkTextIter
*
* Returns: %TRUE if @iter was moved and is not on the end iterator
*/
public bool forwardDisplayLine(TextIter iter)
{
return gtk_text_view_forward_display_line(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0;
}
/**
* Moves the given @iter forward to the next display line end.
* A display line is different from a paragraph. Paragraphs are
* separated by newlines or other paragraph separator characters.
* Display lines are created by line-wrapping a paragraph. If
* wrapping is turned off, display lines and paragraphs will be the
* same. Display lines are divided differently for each view, since
* they depend on the view’s width; paragraphs are the same in all
* views, since they depend on the contents of the #GtkTextBuffer.
*
* Params:
* iter = a #GtkTextIter
*
* Returns: %TRUE if @iter was moved and is not on the end iterator
*/
public bool forwardDisplayLineEnd(TextIter iter)
{
return gtk_text_view_forward_display_line_end(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0;
}
/**
* Returns whether pressing the Tab key inserts a tab characters.
* gtk_text_view_set_accepts_tab().
*
* Returns: %TRUE if pressing the Tab key inserts a tab character,
* %FALSE if pressing the Tab key moves the keyboard focus.
*
* Since: 2.4
*/
public bool getAcceptsTab()
{
return gtk_text_view_get_accepts_tab(gtkTextView) != 0;
}
/**
* Gets the width of the specified border window. See
* gtk_text_view_set_border_window_size().
*
* Params:
* type = window to return size from
*
* Returns: width of window
*/
public int getBorderWindowSize(GtkTextWindowType type)
{
return gtk_text_view_get_border_window_size(gtkTextView, type);
}
/**
* Gets the bottom margin for text in the @text_view.
*
* Returns: bottom margin in pixels
*
* Since: 3.18
*/
public int getBottomMargin()
{
return gtk_text_view_get_bottom_margin(gtkTextView);
}
/**
* Returns the #GtkTextBuffer being displayed by this text view.
* The reference count on the buffer is not incremented; the caller
* of this function won’t own a new reference.
*
* Returns: a #GtkTextBuffer
*/
public TextBuffer getBuffer()
{
auto p = gtk_text_view_get_buffer(gtkTextView);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(TextBuffer)(cast(GtkTextBuffer*) p);
}
/**
* Given an @iter within a text layout, determine the positions of the
* strong and weak cursors if the insertion point is at that
* iterator. The position of each cursor is stored as a zero-width
* rectangle. The strong cursor location is the location where
* characters of the directionality equal to the base direction of the
* paragraph are inserted. The weak cursor location is the location
* where characters of the directionality opposite to the base
* direction of the paragraph are inserted.
*
* If @iter is %NULL, the actual cursor position is used.
*
* Note that if @iter happens to be the actual cursor position, and
* there is currently an IM preedit sequence being entered, the
* returned locations will be adjusted to account for the preedit
* cursor’s offset within the preedit sequence.
*
* The rectangle position is in buffer coordinates; use
* gtk_text_view_buffer_to_window_coords() to convert these
* coordinates to coordinates for one of the windows in the text view.
*
* Params:
* iter = a #GtkTextIter
* strong = location to store the strong
* cursor position (may be %NULL)
* weak = location to store the weak
* cursor position (may be %NULL)
*
* Since: 3.0
*/
public void getCursorLocations(TextIter iter, out GdkRectangle strong, out GdkRectangle weak)
{
gtk_text_view_get_cursor_locations(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), &strong, &weak);
}
/**
* Find out whether the cursor should be displayed.
*
* Returns: whether the insertion mark is visible
*/
public bool getCursorVisible()
{
return gtk_text_view_get_cursor_visible(gtkTextView) != 0;
}
/**
* Obtains a copy of the default text attributes. These are the
* attributes used for text unless a tag overrides them.
* You’d typically pass the default attributes in to
* gtk_text_iter_get_attributes() in order to get the
* attributes in effect at a given text position.
*
* The return value is a copy owned by the caller of this function,
* and should be freed with gtk_text_attributes_unref().
*
* Returns: a new #GtkTextAttributes
*/
public TextAttributes getDefaultAttributes()
{
auto p = gtk_text_view_get_default_attributes(gtkTextView);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(TextAttributes)(cast(GtkTextAttributes*) p, true);
}
/**
* Returns the default editability of the #GtkTextView. Tags in the
* buffer may override this setting for some ranges of text.
*
* Returns: whether text is editable by default
*/
public bool getEditable()
{
return gtk_text_view_get_editable(gtkTextView) != 0;
}
/**
* Gets the default indentation of paragraphs in @text_view.
* Tags in the view’s buffer may override the default.
* The indentation may be negative.
*
* Returns: number of pixels of indentation
*/
public int getIndent()
{
return gtk_text_view_get_indent(gtkTextView);
}
/**
* Gets the value of the #GtkTextView:input-hints property.
*
* Since: 3.6
*/
public GtkInputHints getInputHints()
{
return gtk_text_view_get_input_hints(gtkTextView);
}
/**
* Gets the value of the #GtkTextView:input-purpose property.
*
* Since: 3.6
*/
public GtkInputPurpose getInputPurpose()
{
return gtk_text_view_get_input_purpose(gtkTextView);
}
/**
* Retrieves the iterator at buffer coordinates @x and @y. Buffer
* coordinates are coordinates for the entire buffer, not just the
* currently-displayed portion. If you have coordinates from an
* event, you have to convert those to buffer coordinates with
* gtk_text_view_window_to_buffer_coords().
*
* Params:
* iter = a #GtkTextIter
* x = x position, in buffer coordinates
* y = y position, in buffer coordinates
*
* Returns: %TRUE if the position is over text
*/
public bool getIterAtLocation(out TextIter iter, int x, int y)
{
GtkTextIter* outiter = sliceNew!GtkTextIter();
auto p = gtk_text_view_get_iter_at_location(gtkTextView, outiter, x, y) != 0;
iter = ObjectG.getDObject!(TextIter)(outiter, true);
return p;
}
/**
* Retrieves the iterator pointing to the character at buffer
* coordinates @x and @y. Buffer coordinates are coordinates for
* the entire buffer, not just the currently-displayed portion.
* If you have coordinates from an event, you have to convert
* those to buffer coordinates with
* gtk_text_view_window_to_buffer_coords().
*
* Note that this is different from gtk_text_view_get_iter_at_location(),
* which returns cursor locations, i.e. positions between
* characters.
*
* Params:
* iter = a #GtkTextIter
* trailing = if non-%NULL, location to store an integer indicating where
* in the grapheme the user clicked. It will either be
* zero, or the number of characters in the grapheme.
* 0 represents the trailing edge of the grapheme.
* x = x position, in buffer coordinates
* y = y position, in buffer coordinates
*
* Returns: %TRUE if the position is over text
*
* Since: 2.6
*/
public bool getIterAtPosition(out TextIter iter, out int trailing, int x, int y)
{
GtkTextIter* outiter = sliceNew!GtkTextIter();
auto p = gtk_text_view_get_iter_at_position(gtkTextView, outiter, &trailing, x, y) != 0;
iter = ObjectG.getDObject!(TextIter)(outiter, true);
return p;
}
/**
* Gets a rectangle which roughly contains the character at @iter.
* The rectangle position is in buffer coordinates; use
* gtk_text_view_buffer_to_window_coords() to convert these
* coordinates to coordinates for one of the windows in the text view.
*
* Params:
* iter = a #GtkTextIter
* location = bounds of the character at @iter
*/
public void getIterLocation(TextIter iter, out GdkRectangle location)
{
gtk_text_view_get_iter_location(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), &location);
}
/**
* Gets the default justification of paragraphs in @text_view.
* Tags in the buffer may override the default.
*
* Returns: default justification
*/
public GtkJustification getJustification()
{
return gtk_text_view_get_justification(gtkTextView);
}
/**
* Gets the default left margin size of paragraphs in the @text_view.
* Tags in the buffer may override the default.
*
* Returns: left margin in pixels
*/
public int getLeftMargin()
{
return gtk_text_view_get_left_margin(gtkTextView);
}
/**
* Gets the #GtkTextIter at the start of the line containing
* the coordinate @y. @y is in buffer coordinates, convert from
* window coordinates with gtk_text_view_window_to_buffer_coords().
* If non-%NULL, @line_top will be filled with the coordinate of the top
* edge of the line.
*
* Params:
* targetIter = a #GtkTextIter
* y = a y coordinate
* lineTop = return location for top coordinate of the line
*/
public void getLineAtY(out TextIter targetIter, int y, out int lineTop)
{
GtkTextIter* outtargetIter = sliceNew!GtkTextIter();
gtk_text_view_get_line_at_y(gtkTextView, outtargetIter, y, &lineTop);
targetIter = ObjectG.getDObject!(TextIter)(outtargetIter, true);
}
/**
* Gets the y coordinate of the top of the line containing @iter,
* and the height of the line. The coordinate is a buffer coordinate;
* convert to window coordinates with gtk_text_view_buffer_to_window_coords().
*
* Params:
* iter = a #GtkTextIter
* y = return location for a y coordinate
* height = return location for a height
*/
public void getLineYrange(TextIter iter, out int y, out int height)
{
gtk_text_view_get_line_yrange(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), &y, &height);
}
/**
* Gets the value of the #GtkTextView:monospace property.
*
* Returns: %TRUE if monospace fonts are desired
*
* Since: 3.16
*/
public bool getMonospace()
{
return gtk_text_view_get_monospace(gtkTextView) != 0;
}
/**
* Returns whether the #GtkTextView is in overwrite mode or not.
*
* Returns: whether @text_view is in overwrite mode or not.
*
* Since: 2.4
*/
public bool getOverwrite()
{
return gtk_text_view_get_overwrite(gtkTextView) != 0;
}
/**
* Gets the default number of pixels to put above paragraphs.
* Adding this function with gtk_text_view_get_pixels_below_lines()
* is equal to the line space between each paragraph.
*
* Returns: default number of pixels above paragraphs
*/
public int getPixelsAboveLines()
{
return gtk_text_view_get_pixels_above_lines(gtkTextView);
}
/**
* Gets the value set by gtk_text_view_set_pixels_below_lines().
*
* The line space is the sum of the value returned by this function and the
* value returned by gtk_text_view_get_pixels_above_lines().
*
* Returns: default number of blank pixels below paragraphs
*/
public int getPixelsBelowLines()
{
return gtk_text_view_get_pixels_below_lines(gtkTextView);
}
/**
* Gets the value set by gtk_text_view_set_pixels_inside_wrap().
*
* Returns: default number of pixels of blank space between wrapped lines
*/
public int getPixelsInsideWrap()
{
return gtk_text_view_get_pixels_inside_wrap(gtkTextView);
}
/**
* Gets the default right margin for text in @text_view. Tags
* in the buffer may override the default.
*
* Returns: right margin in pixels
*/
public int getRightMargin()
{
return gtk_text_view_get_right_margin(gtkTextView);
}
/**
* Gets the default tabs for @text_view. Tags in the buffer may
* override the defaults. The returned array will be %NULL if
* “standard” (8-space) tabs are used. Free the return value
* with pango_tab_array_free().
*
* Returns: copy of default tab array, or %NULL if
* “standard" tabs are used; must be freed with pango_tab_array_free().
*/
public PgTabArray getTabs()
{
auto p = gtk_text_view_get_tabs(gtkTextView);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(PgTabArray)(cast(PangoTabArray*) p, true);
}
/**
* Gets the top margin for text in the @text_view.
*
* Returns: top margin in pixels
*
* Since: 3.18
*/
public int getTopMargin()
{
return gtk_text_view_get_top_margin(gtkTextView);
}
/**
* Fills @visible_rect with the currently-visible
* region of the buffer, in buffer coordinates. Convert to window coordinates
* with gtk_text_view_buffer_to_window_coords().
*
* Params:
* visibleRect = rectangle to fill
*/
public void getVisibleRect(out GdkRectangle visibleRect)
{
gtk_text_view_get_visible_rect(gtkTextView, &visibleRect);
}
/**
* Retrieves the #GdkWindow corresponding to an area of the text view;
* possible windows include the overall widget window, child windows
* on the left, right, top, bottom, and the window that displays the
* text buffer. Windows are %NULL and nonexistent if their width or
* height is 0, and are nonexistent before the widget has been
* realized.
*
* Params:
* win = window to get
*
* Returns: a #GdkWindow, or %NULL
*/
public Window getWindow(GtkTextWindowType win)
{
auto p = gtk_text_view_get_window(gtkTextView, win);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
}
/**
* Usually used to find out which window an event corresponds to.
*
* If you connect to an event signal on @text_view, this function
* should be called on `event->window` to see which window it was.
*
* Params:
* window = a window type
*
* Returns: the window type.
*/
public GtkTextWindowType getWindowType(Window window)
{
return gtk_text_view_get_window_type(gtkTextView, (window is null) ? null : window.getWindowStruct());
}
/**
* Gets the line wrapping for the view.
*
* Returns: the line wrap setting
*/
public GtkWrapMode getWrapMode()
{
return gtk_text_view_get_wrap_mode(gtkTextView);
}
/**
* Allow the #GtkTextView input method to internally handle key press
* and release events. If this function returns %TRUE, then no further
* processing should be done for this key event. See
* gtk_im_context_filter_keypress().
*
* Note that you are expected to call this function from your handler
* when overriding key event handling. This is needed in the case when
* you need to insert your own key handling between the input method
* and the default key event handling of the #GtkTextView.
*
* |[<!-- language="C" -->
* static gboolean
* gtk_foo_bar_key_press_event (GtkWidget *widget,
* GdkEventKey *event)
* {
* if ((key->keyval == GDK_KEY_Return || key->keyval == GDK_KEY_KP_Enter))
* {
* if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (view), event))
* return TRUE;
* }
*
* // Do some stuff
*
* return GTK_WIDGET_CLASS (gtk_foo_bar_parent_class)->key_press_event (widget, event);
* }
* ]|
*
* Params:
* event = the key event
*
* Returns: %TRUE if the input method handled the key event.
*
* Since: 2.22
*/
public bool imContextFilterKeypress(GdkEventKey* event)
{
return gtk_text_view_im_context_filter_keypress(gtkTextView, event) != 0;
}
/**
* Updates the position of a child, as for gtk_text_view_add_child_in_window().
*
* Params:
* child = child widget already added to the text view
* xpos = new X position in window coordinates
* ypos = new Y position in window coordinates
*/
public void moveChild(Widget child, int xpos, int ypos)
{
gtk_text_view_move_child(gtkTextView, (child is null) ? null : child.getWidgetStruct(), xpos, ypos);
}
/**
* Moves a mark within the buffer so that it's
* located within the currently-visible text area.
*
* Params:
* mark = a #GtkTextMark
*
* Returns: %TRUE if the mark moved (wasn’t already onscreen)
*/
public bool moveMarkOnscreen(TextMark mark)
{
return gtk_text_view_move_mark_onscreen(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct()) != 0;
}
/**
* Move the iterator a given number of characters visually, treating
* it as the strong cursor position. If @count is positive, then the
* new strong cursor position will be @count positions to the right of
* the old cursor position. If @count is negative then the new strong
* cursor position will be @count positions to the left of the old
* cursor position.
*
* In the presence of bi-directional text, the correspondence
* between logical and visual order will depend on the direction
* of the current run, and there may be jumps when the cursor
* is moved off of the end of a run.
*
* Params:
* iter = a #GtkTextIter
* count = number of characters to move (negative moves left,
* positive moves right)
*
* Returns: %TRUE if @iter moved and is not on the end iterator
*/
public bool moveVisually(TextIter iter, int count)
{
return gtk_text_view_move_visually(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), count) != 0;
}
/**
* Moves the cursor to the currently visible region of the
* buffer, it it isn’t there already.
*
* Returns: %TRUE if the cursor had to be moved.
*/
public bool placeCursorOnscreen()
{
return gtk_text_view_place_cursor_onscreen(gtkTextView) != 0;
}
/**
* Ensures that the cursor is shown (i.e. not in an 'off' blink
* interval) and resets the time that it will stay blinking (or
* visible, in case blinking is disabled).
*
* This function should be called in response to user input
* (e.g. from derived classes that override the textview's
* #GtkWidget::key-press-event handler).
*
* Since: 3.20
*/
public void resetCursorBlink()
{
gtk_text_view_reset_cursor_blink(gtkTextView);
}
/**
* Reset the input method context of the text view if needed.
*
* This can be necessary in the case where modifying the buffer
* would confuse on-going input method behavior.
*
* Since: 2.22
*/
public void resetImContext()
{
gtk_text_view_reset_im_context(gtkTextView);
}
/**
* Scrolls @text_view the minimum distance such that @mark is contained
* within the visible area of the widget.
*
* Params:
* mark = a mark in the buffer for @text_view
*/
public void scrollMarkOnscreen(TextMark mark)
{
gtk_text_view_scroll_mark_onscreen(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct());
}
/**
* Scrolls @text_view so that @iter is on the screen in the position
* indicated by @xalign and @yalign. An alignment of 0.0 indicates
* left or top, 1.0 indicates right or bottom, 0.5 means center.
* If @use_align is %FALSE, the text scrolls the minimal distance to
* get the mark onscreen, possibly not scrolling at all. The effective
* screen for purposes of this function is reduced by a margin of size
* @within_margin.
*
* Note that this function uses the currently-computed height of the
* lines in the text buffer. Line heights are computed in an idle
* handler; so this function may not have the desired effect if it’s
* called before the height computations. To avoid oddness, consider
* using gtk_text_view_scroll_to_mark() which saves a point to be
* scrolled to after line validation.
*
* Params:
* iter = a #GtkTextIter
* withinMargin = margin as a [0.0,0.5) fraction of screen size
* useAlign = whether to use alignment arguments (if %FALSE,
* just get the mark onscreen)
* xalign = horizontal alignment of mark within visible area
* yalign = vertical alignment of mark within visible area
*
* Returns: %TRUE if scrolling occurred
*/
public bool scrollToIter(TextIter iter, double withinMargin, bool useAlign, double xalign, double yalign)
{
return gtk_text_view_scroll_to_iter(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), withinMargin, useAlign, xalign, yalign) != 0;
}
/**
* Scrolls @text_view so that @mark is on the screen in the position
* indicated by @xalign and @yalign. An alignment of 0.0 indicates
* left or top, 1.0 indicates right or bottom, 0.5 means center.
* If @use_align is %FALSE, the text scrolls the minimal distance to
* get the mark onscreen, possibly not scrolling at all. The effective
* screen for purposes of this function is reduced by a margin of size
* @within_margin.
*
* Params:
* mark = a #GtkTextMark
* withinMargin = margin as a [0.0,0.5) fraction of screen size
* useAlign = whether to use alignment arguments (if %FALSE, just
* get the mark onscreen)
* xalign = horizontal alignment of mark within visible area
* yalign = vertical alignment of mark within visible area
*/
public void scrollToMark(TextMark mark, double withinMargin, bool useAlign, double xalign, double yalign)
{
gtk_text_view_scroll_to_mark(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct(), withinMargin, useAlign, xalign, yalign);
}
/**
* Sets the behavior of the text widget when the Tab key is pressed.
* If @accepts_tab is %TRUE, a tab character is inserted. If @accepts_tab
* is %FALSE the keyboard focus is moved to the next widget in the focus
* chain.
*
* Params:
* acceptsTab = %TRUE if pressing the Tab key should insert a tab
* character, %FALSE, if pressing the Tab key should move the
* keyboard focus.
*
* Since: 2.4
*/
public void setAcceptsTab(bool acceptsTab)
{
gtk_text_view_set_accepts_tab(gtkTextView, acceptsTab);
}
/**
* Sets the width of %GTK_TEXT_WINDOW_LEFT or %GTK_TEXT_WINDOW_RIGHT,
* or the height of %GTK_TEXT_WINDOW_TOP or %GTK_TEXT_WINDOW_BOTTOM.
* Automatically destroys the corresponding window if the size is set
* to 0, and creates the window if the size is set to non-zero. This
* function can only be used for the “border windows”, and it won’t
* work with %GTK_TEXT_WINDOW_WIDGET, %GTK_TEXT_WINDOW_TEXT, or
* %GTK_TEXT_WINDOW_PRIVATE.
*
* Params:
* type = window to affect
* size = width or height of the window
*/
public void setBorderWindowSize(GtkTextWindowType type, int size)
{
gtk_text_view_set_border_window_size(gtkTextView, type, size);
}
/**
* Sets the bottom margin for text in @text_view.
*
* Note that this function is confusingly named.
* In CSS terms, the value set here is padding.
*
* Params:
* bottomMargin = bottom margin in pixels
*
* Since: 3.18
*/
public void setBottomMargin(int bottomMargin)
{
gtk_text_view_set_bottom_margin(gtkTextView, bottomMargin);
}
/**
* Sets @buffer as the buffer being displayed by @text_view. The previous
* buffer displayed by the text view is unreferenced, and a reference is
* added to @buffer. If you owned a reference to @buffer before passing it
* to this function, you must remove that reference yourself; #GtkTextView
* will not “adopt” it.
*
* Params:
* buffer = a #GtkTextBuffer
*/
public void setBuffer(TextBuffer buffer)
{
gtk_text_view_set_buffer(gtkTextView, (buffer is null) ? null : buffer.getTextBufferStruct());
}
/**
* Toggles whether the insertion point should be displayed. A buffer with
* no editable text probably shouldn’t have a visible cursor, so you may
* want to turn the cursor off.
*
* Note that this property may be overridden by the
* #GtkSettings:gtk-keynave-use-caret settings.
*
* Params:
* setting = whether to show the insertion cursor
*/
public void setCursorVisible(bool setting)
{
gtk_text_view_set_cursor_visible(gtkTextView, setting);
}
/**
* Sets the default editability of the #GtkTextView. You can override
* this default setting with tags in the buffer, using the “editable”
* attribute of tags.
*
* Params:
* setting = whether it’s editable
*/
public void setEditable(bool setting)
{
gtk_text_view_set_editable(gtkTextView, setting);
}
/**
* Sets the default indentation for paragraphs in @text_view.
* Tags in the buffer may override the default.
*
* Params:
* indent = indentation in pixels
*/
public void setIndent(int indent)
{
gtk_text_view_set_indent(gtkTextView, indent);
}
/**
* Sets the #GtkTextView:input-hints property, which
* allows input methods to fine-tune their behaviour.
*
* Params:
* hints = the hints
*
* Since: 3.6
*/
public void setInputHints(GtkInputHints hints)
{
gtk_text_view_set_input_hints(gtkTextView, hints);
}
/**
* Sets the #GtkTextView:input-purpose property which
* can be used by on-screen keyboards and other input
* methods to adjust their behaviour.
*
* Params:
* purpose = the purpose
*
* Since: 3.6
*/
public void setInputPurpose(GtkInputPurpose purpose)
{
gtk_text_view_set_input_purpose(gtkTextView, purpose);
}
/**
* Sets the default justification of text in @text_view.
* Tags in the view’s buffer may override the default.
*
* Params:
* justification = justification
*/
public void setJustification(GtkJustification justification)
{
gtk_text_view_set_justification(gtkTextView, justification);
}
/**
* Sets the default left margin for text in @text_view.
* Tags in the buffer may override the default.
*
* Note that this function is confusingly named.
* In CSS terms, the value set here is padding.
*
* Params:
* leftMargin = left margin in pixels
*/
public void setLeftMargin(int leftMargin)
{
gtk_text_view_set_left_margin(gtkTextView, leftMargin);
}
/**
* Sets the #GtkTextView:monospace property, which
* indicates that the text view should use monospace
* fonts.
*
* Params:
* monospace = %TRUE to request monospace styling
*
* Since: 3.16
*/
public void setMonospace(bool monospace)
{
gtk_text_view_set_monospace(gtkTextView, monospace);
}
/**
* Changes the #GtkTextView overwrite mode.
*
* Params:
* overwrite = %TRUE to turn on overwrite mode, %FALSE to turn it off
*
* Since: 2.4
*/
public void setOverwrite(bool overwrite)
{
gtk_text_view_set_overwrite(gtkTextView, overwrite);
}
/**
* Sets the default number of blank pixels above paragraphs in @text_view.
* Tags in the buffer for @text_view may override the defaults.
*
* Params:
* pixelsAboveLines = pixels above paragraphs
*/
public void setPixelsAboveLines(int pixelsAboveLines)
{
gtk_text_view_set_pixels_above_lines(gtkTextView, pixelsAboveLines);
}
/**
* Sets the default number of pixels of blank space
* to put below paragraphs in @text_view. May be overridden
* by tags applied to @text_view’s buffer.
*
* Params:
* pixelsBelowLines = pixels below paragraphs
*/
public void setPixelsBelowLines(int pixelsBelowLines)
{
gtk_text_view_set_pixels_below_lines(gtkTextView, pixelsBelowLines);
}
/**
* Sets the default number of pixels of blank space to leave between
* display/wrapped lines within a paragraph. May be overridden by
* tags in @text_view’s buffer.
*
* Params:
* pixelsInsideWrap = default number of pixels between wrapped lines
*/
public void setPixelsInsideWrap(int pixelsInsideWrap)
{
gtk_text_view_set_pixels_inside_wrap(gtkTextView, pixelsInsideWrap);
}
/**
* Sets the default right margin for text in the text view.
* Tags in the buffer may override the default.
*
* Note that this function is confusingly named.
* In CSS terms, the value set here is padding.
*
* Params:
* rightMargin = right margin in pixels
*/
public void setRightMargin(int rightMargin)
{
gtk_text_view_set_right_margin(gtkTextView, rightMargin);
}
/**
* Sets the default tab stops for paragraphs in @text_view.
* Tags in the buffer may override the default.
*
* Params:
* tabs = tabs as a #PangoTabArray
*/
public void setTabs(PgTabArray tabs)
{
gtk_text_view_set_tabs(gtkTextView, (tabs is null) ? null : tabs.getPgTabArrayStruct());
}
/**
* Sets the top margin for text in @text_view.
*
* Note that this function is confusingly named.
* In CSS terms, the value set here is padding.
*
* Params:
* topMargin = top margin in pixels
*
* Since: 3.18
*/
public void setTopMargin(int topMargin)
{
gtk_text_view_set_top_margin(gtkTextView, topMargin);
}
/**
* Sets the line wrapping for the view.
*
* Params:
* wrapMode = a #GtkWrapMode
*/
public void setWrapMode(GtkWrapMode wrapMode)
{
gtk_text_view_set_wrap_mode(gtkTextView, wrapMode);
}
/**
* Determines whether @iter is at the start of a display line.
* See gtk_text_view_forward_display_line() for an explanation of
* display lines vs. paragraphs.
*
* Params:
* iter = a #GtkTextIter
*
* Returns: %TRUE if @iter begins a wrapped line
*/
public bool startsDisplayLine(TextIter iter)
{
return gtk_text_view_starts_display_line(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0;
}
/**
* Converts coordinates on the window identified by @win to buffer
* coordinates, storing the result in (@buffer_x,@buffer_y).
*
* Note that you can’t convert coordinates for a nonexisting window (see
* gtk_text_view_set_border_window_size()).
*
* Params:
* win = a #GtkTextWindowType except %GTK_TEXT_WINDOW_PRIVATE
* windowX = window x coordinate
* windowY = window y coordinate
* bufferX = buffer x coordinate return location or %NULL
* bufferY = buffer y coordinate return location or %NULL
*/
public void windowToBufferCoords(GtkTextWindowType win, int windowX, int windowY, out int bufferX, out int bufferY)
{
gtk_text_view_window_to_buffer_coords(gtkTextView, win, windowX, windowY, &bufferX, &bufferY);
}
protected class OnBackspaceDelegateWrapper
{
void delegate(TextView) dlg;
gulong handlerId;
this(void delegate(TextView) dlg)
{
this.dlg = dlg;
onBackspaceListeners ~= this;
}
void remove(OnBackspaceDelegateWrapper source)
{
foreach(index, wrapper; onBackspaceListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onBackspaceListeners[index] = null;
onBackspaceListeners = std.algorithm.remove(onBackspaceListeners, index);
break;
}
}
}
}
OnBackspaceDelegateWrapper[] onBackspaceListeners;
/**
* The ::backspace signal is a
* [keybinding signal][GtkBindingSignal]
* which gets emitted when the user asks for it.
*
* The default bindings for this signal are
* Backspace and Shift-Backspace.
*/
gulong addOnBackspace(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnBackspaceDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"backspace",
cast(GCallback)&callBackBackspace,
cast(void*)wrapper,
cast(GClosureNotify)&callBackBackspaceDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackBackspace(GtkTextView* textviewStruct, OnBackspaceDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackBackspaceDestroy(OnBackspaceDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnCopyClipboardDelegateWrapper
{
void delegate(TextView) dlg;
gulong handlerId;
this(void delegate(TextView) dlg)
{
this.dlg = dlg;
onCopyClipboardListeners ~= this;
}
void remove(OnCopyClipboardDelegateWrapper source)
{
foreach(index, wrapper; onCopyClipboardListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onCopyClipboardListeners[index] = null;
onCopyClipboardListeners = std.algorithm.remove(onCopyClipboardListeners, index);
break;
}
}
}
}
OnCopyClipboardDelegateWrapper[] onCopyClipboardListeners;
/**
* The ::copy-clipboard signal is a
* [keybinding signal][GtkBindingSignal]
* which gets emitted to copy the selection to the clipboard.
*
* The default bindings for this signal are
* Ctrl-c and Ctrl-Insert.
*/
gulong addOnCopyClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnCopyClipboardDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"copy-clipboard",
cast(GCallback)&callBackCopyClipboard,
cast(void*)wrapper,
cast(GClosureNotify)&callBackCopyClipboardDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackCopyClipboard(GtkTextView* textviewStruct, OnCopyClipboardDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackCopyClipboardDestroy(OnCopyClipboardDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnCutClipboardDelegateWrapper
{
void delegate(TextView) dlg;
gulong handlerId;
this(void delegate(TextView) dlg)
{
this.dlg = dlg;
onCutClipboardListeners ~= this;
}
void remove(OnCutClipboardDelegateWrapper source)
{
foreach(index, wrapper; onCutClipboardListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onCutClipboardListeners[index] = null;
onCutClipboardListeners = std.algorithm.remove(onCutClipboardListeners, index);
break;
}
}
}
}
OnCutClipboardDelegateWrapper[] onCutClipboardListeners;
/**
* The ::cut-clipboard signal is a
* [keybinding signal][GtkBindingSignal]
* which gets emitted to cut the selection to the clipboard.
*
* The default bindings for this signal are
* Ctrl-x and Shift-Delete.
*/
gulong addOnCutClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnCutClipboardDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"cut-clipboard",
cast(GCallback)&callBackCutClipboard,
cast(void*)wrapper,
cast(GClosureNotify)&callBackCutClipboardDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackCutClipboard(GtkTextView* textviewStruct, OnCutClipboardDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackCutClipboardDestroy(OnCutClipboardDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnDeleteFromCursorDelegateWrapper
{
void delegate(GtkDeleteType, int, TextView) dlg;
gulong handlerId;
this(void delegate(GtkDeleteType, int, TextView) dlg)
{
this.dlg = dlg;
onDeleteFromCursorListeners ~= this;
}
void remove(OnDeleteFromCursorDelegateWrapper source)
{
foreach(index, wrapper; onDeleteFromCursorListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onDeleteFromCursorListeners[index] = null;
onDeleteFromCursorListeners = std.algorithm.remove(onDeleteFromCursorListeners, index);
break;
}
}
}
}
OnDeleteFromCursorDelegateWrapper[] onDeleteFromCursorListeners;
/**
* The ::delete-from-cursor signal is a
* [keybinding signal][GtkBindingSignal]
* which gets emitted when the user initiates a text deletion.
*
* If the @type is %GTK_DELETE_CHARS, GTK+ deletes the selection
* if there is one, otherwise it deletes the requested number
* of characters.
*
* The default bindings for this signal are
* Delete for deleting a character, Ctrl-Delete for
* deleting a word and Ctrl-Backspace for deleting a word
* backwords.
*
* Params:
* type = the granularity of the deletion, as a #GtkDeleteType
* count = the number of @type units to delete
*/
gulong addOnDeleteFromCursor(void delegate(GtkDeleteType, int, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnDeleteFromCursorDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"delete-from-cursor",
cast(GCallback)&callBackDeleteFromCursor,
cast(void*)wrapper,
cast(GClosureNotify)&callBackDeleteFromCursorDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackDeleteFromCursor(GtkTextView* textviewStruct, GtkDeleteType type, int count, OnDeleteFromCursorDelegateWrapper wrapper)
{
wrapper.dlg(type, count, wrapper.outer);
}
extern(C) static void callBackDeleteFromCursorDestroy(OnDeleteFromCursorDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnExtendSelectionDelegateWrapper
{
bool delegate(GtkTextExtendSelection, TextIter, TextIter, TextIter, TextView) dlg;
gulong handlerId;
this(bool delegate(GtkTextExtendSelection, TextIter, TextIter, TextIter, TextView) dlg)
{
this.dlg = dlg;
onExtendSelectionListeners ~= this;
}
void remove(OnExtendSelectionDelegateWrapper source)
{
foreach(index, wrapper; onExtendSelectionListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onExtendSelectionListeners[index] = null;
onExtendSelectionListeners = std.algorithm.remove(onExtendSelectionListeners, index);
break;
}
}
}
}
OnExtendSelectionDelegateWrapper[] onExtendSelectionListeners;
/**
* The ::extend-selection signal is emitted when the selection needs to be
* extended at @location.
*
* Params:
* granularity = the granularity type
* location = the location where to extend the selection
* start = where the selection should start
* end = where the selection should end
*
* Returns: %GDK_EVENT_STOP to stop other handlers from being invoked for the
* event. %GDK_EVENT_PROPAGATE to propagate the event further.
*
* Since: 3.16
*/
gulong addOnExtendSelection(bool delegate(GtkTextExtendSelection, TextIter, TextIter, TextIter, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnExtendSelectionDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"extend-selection",
cast(GCallback)&callBackExtendSelection,
cast(void*)wrapper,
cast(GClosureNotify)&callBackExtendSelectionDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static int callBackExtendSelection(GtkTextView* textviewStruct, GtkTextExtendSelection granularity, GtkTextIter* location, GtkTextIter* start, GtkTextIter* end, OnExtendSelectionDelegateWrapper wrapper)
{
return wrapper.dlg(granularity, ObjectG.getDObject!(TextIter)(location), ObjectG.getDObject!(TextIter)(start), ObjectG.getDObject!(TextIter)(end), wrapper.outer);
}
extern(C) static void callBackExtendSelectionDestroy(OnExtendSelectionDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnInsertAtCursorDelegateWrapper
{
void delegate(string, TextView) dlg;
gulong handlerId;
this(void delegate(string, TextView) dlg)
{
this.dlg = dlg;
onInsertAtCursorListeners ~= this;
}
void remove(OnInsertAtCursorDelegateWrapper source)
{
foreach(index, wrapper; onInsertAtCursorListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onInsertAtCursorListeners[index] = null;
onInsertAtCursorListeners = std.algorithm.remove(onInsertAtCursorListeners, index);
break;
}
}
}
}
OnInsertAtCursorDelegateWrapper[] onInsertAtCursorListeners;
/**
* The ::insert-at-cursor signal is a
* [keybinding signal][GtkBindingSignal]
* which gets emitted when the user initiates the insertion of a
* fixed string at the cursor.
*
* This signal has no default bindings.
*
* Params:
* str = the string to insert
*/
gulong addOnInsertAtCursor(void delegate(string, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnInsertAtCursorDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"insert-at-cursor",
cast(GCallback)&callBackInsertAtCursor,
cast(void*)wrapper,
cast(GClosureNotify)&callBackInsertAtCursorDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackInsertAtCursor(GtkTextView* textviewStruct, char* str, OnInsertAtCursorDelegateWrapper wrapper)
{
wrapper.dlg(Str.toString(str), wrapper.outer);
}
extern(C) static void callBackInsertAtCursorDestroy(OnInsertAtCursorDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnMoveCursorDelegateWrapper
{
void delegate(GtkMovementStep, int, bool, TextView) dlg;
gulong handlerId;
this(void delegate(GtkMovementStep, int, bool, TextView) dlg)
{
this.dlg = dlg;
onMoveCursorListeners ~= this;
}
void remove(OnMoveCursorDelegateWrapper source)
{
foreach(index, wrapper; onMoveCursorListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onMoveCursorListeners[index] = null;
onMoveCursorListeners = std.algorithm.remove(onMoveCursorListeners, index);
break;
}
}
}
}
OnMoveCursorDelegateWrapper[] onMoveCursorListeners;
/**
* The ::move-cursor signal is a
* [keybinding signal][GtkBindingSignal]
* which gets emitted when the user initiates a cursor movement.
* If the cursor is not visible in @text_view, this signal causes
* the viewport to be moved instead.
*
* Applications should not connect to it, but may emit it with
* g_signal_emit_by_name() if they need to control the cursor
* programmatically.
*
* The default bindings for this signal come in two variants,
* the variant with the Shift modifier extends the selection,
* the variant without the Shift modifer does not.
* There are too many key combinations to list them all here.
* - Arrow keys move by individual characters/lines
* - Ctrl-arrow key combinations move by words/paragraphs
* - Home/End keys move to the ends of the buffer
* - PageUp/PageDown keys move vertically by pages
* - Ctrl-PageUp/PageDown keys move horizontally by pages
*
* Params:
* step = the granularity of the move, as a #GtkMovementStep
* count = the number of @step units to move
* extendSelection = %TRUE if the move should extend the selection
*/
gulong addOnMoveCursor(void delegate(GtkMovementStep, int, bool, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnMoveCursorDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"move-cursor",
cast(GCallback)&callBackMoveCursor,
cast(void*)wrapper,
cast(GClosureNotify)&callBackMoveCursorDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackMoveCursor(GtkTextView* textviewStruct, GtkMovementStep step, int count, bool extendSelection, OnMoveCursorDelegateWrapper wrapper)
{
wrapper.dlg(step, count, extendSelection, wrapper.outer);
}
extern(C) static void callBackMoveCursorDestroy(OnMoveCursorDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnMoveViewportDelegateWrapper
{
void delegate(GtkScrollStep, int, TextView) dlg;
gulong handlerId;
this(void delegate(GtkScrollStep, int, TextView) dlg)
{
this.dlg = dlg;
onMoveViewportListeners ~= this;
}
void remove(OnMoveViewportDelegateWrapper source)
{
foreach(index, wrapper; onMoveViewportListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onMoveViewportListeners[index] = null;
onMoveViewportListeners = std.algorithm.remove(onMoveViewportListeners, index);
break;
}
}
}
}
OnMoveViewportDelegateWrapper[] onMoveViewportListeners;
/**
* The ::move-viewport signal is a
* [keybinding signal][GtkBindingSignal]
* which can be bound to key combinations to allow the user
* to move the viewport, i.e. change what part of the text view
* is visible in a containing scrolled window.
*
* There are no default bindings for this signal.
*
* Params:
* step = the granularity of the movement, as a #GtkScrollStep
* count = the number of @step units to move
*/
gulong addOnMoveViewport(void delegate(GtkScrollStep, int, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnMoveViewportDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"move-viewport",
cast(GCallback)&callBackMoveViewport,
cast(void*)wrapper,
cast(GClosureNotify)&callBackMoveViewportDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackMoveViewport(GtkTextView* textviewStruct, GtkScrollStep step, int count, OnMoveViewportDelegateWrapper wrapper)
{
wrapper.dlg(step, count, wrapper.outer);
}
extern(C) static void callBackMoveViewportDestroy(OnMoveViewportDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnPasteClipboardDelegateWrapper
{
void delegate(TextView) dlg;
gulong handlerId;
this(void delegate(TextView) dlg)
{
this.dlg = dlg;
onPasteClipboardListeners ~= this;
}
void remove(OnPasteClipboardDelegateWrapper source)
{
foreach(index, wrapper; onPasteClipboardListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onPasteClipboardListeners[index] = null;
onPasteClipboardListeners = std.algorithm.remove(onPasteClipboardListeners, index);
break;
}
}
}
}
OnPasteClipboardDelegateWrapper[] onPasteClipboardListeners;
/**
* The ::paste-clipboard signal is a
* [keybinding signal][GtkBindingSignal]
* which gets emitted to paste the contents of the clipboard
* into the text view.
*
* The default bindings for this signal are
* Ctrl-v and Shift-Insert.
*/
gulong addOnPasteClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnPasteClipboardDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"paste-clipboard",
cast(GCallback)&callBackPasteClipboard,
cast(void*)wrapper,
cast(GClosureNotify)&callBackPasteClipboardDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackPasteClipboard(GtkTextView* textviewStruct, OnPasteClipboardDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackPasteClipboardDestroy(OnPasteClipboardDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnPopulatePopupDelegateWrapper
{
void delegate(Widget, TextView) dlg;
gulong handlerId;
this(void delegate(Widget, TextView) dlg)
{
this.dlg = dlg;
onPopulatePopupListeners ~= this;
}
void remove(OnPopulatePopupDelegateWrapper source)
{
foreach(index, wrapper; onPopulatePopupListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onPopulatePopupListeners[index] = null;
onPopulatePopupListeners = std.algorithm.remove(onPopulatePopupListeners, index);
break;
}
}
}
}
OnPopulatePopupDelegateWrapper[] onPopulatePopupListeners;
/**
* The ::populate-popup signal gets emitted before showing the
* context menu of the text view.
*
* If you need to add items to the context menu, connect
* to this signal and append your items to the @popup, which
* will be a #GtkMenu in this case.
*
* If #GtkTextView:populate-all is %TRUE, this signal will
* also be emitted to populate touch popups. In this case,
* @popup will be a different container, e.g. a #GtkToolbar.
*
* The signal handler should not make assumptions about the
* type of @widget, but check whether @popup is a #GtkMenu
* or #GtkToolbar or another kind of container.
*
* Params:
* popup = the container that is being populated
*/
gulong addOnPopulatePopup(void delegate(Widget, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnPopulatePopupDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"populate-popup",
cast(GCallback)&callBackPopulatePopup,
cast(void*)wrapper,
cast(GClosureNotify)&callBackPopulatePopupDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackPopulatePopup(GtkTextView* textviewStruct, GtkWidget* popup, OnPopulatePopupDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(Widget)(popup), wrapper.outer);
}
extern(C) static void callBackPopulatePopupDestroy(OnPopulatePopupDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnPreeditChangedDelegateWrapper
{
void delegate(string, TextView) dlg;
gulong handlerId;
this(void delegate(string, TextView) dlg)
{
this.dlg = dlg;
onPreeditChangedListeners ~= this;
}
void remove(OnPreeditChangedDelegateWrapper source)
{
foreach(index, wrapper; onPreeditChangedListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onPreeditChangedListeners[index] = null;
onPreeditChangedListeners = std.algorithm.remove(onPreeditChangedListeners, index);
break;
}
}
}
}
OnPreeditChangedDelegateWrapper[] onPreeditChangedListeners;
/**
* If an input method is used, the typed text will not immediately
* be committed to the buffer. So if you are interested in the text,
* connect to this signal.
*
* This signal is only emitted if the text at the given position
* is actually editable.
*
* Params:
* preedit = the current preedit string
*
* Since: 2.20
*/
gulong addOnPreeditChanged(void delegate(string, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnPreeditChangedDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"preedit-changed",
cast(GCallback)&callBackPreeditChanged,
cast(void*)wrapper,
cast(GClosureNotify)&callBackPreeditChangedDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackPreeditChanged(GtkTextView* textviewStruct, char* preedit, OnPreeditChangedDelegateWrapper wrapper)
{
wrapper.dlg(Str.toString(preedit), wrapper.outer);
}
extern(C) static void callBackPreeditChangedDestroy(OnPreeditChangedDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnSelectAllDelegateWrapper
{
void delegate(bool, TextView) dlg;
gulong handlerId;
this(void delegate(bool, TextView) dlg)
{
this.dlg = dlg;
onSelectAllListeners ~= this;
}
void remove(OnSelectAllDelegateWrapper source)
{
foreach(index, wrapper; onSelectAllListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onSelectAllListeners[index] = null;
onSelectAllListeners = std.algorithm.remove(onSelectAllListeners, index);
break;
}
}
}
}
OnSelectAllDelegateWrapper[] onSelectAllListeners;
/**
* The ::select-all signal is a
* [keybinding signal][GtkBindingSignal]
* which gets emitted to select or unselect the complete
* contents of the text view.
*
* The default bindings for this signal are Ctrl-a and Ctrl-/
* for selecting and Shift-Ctrl-a and Ctrl-\ for unselecting.
*
* Params:
* select = %TRUE to select, %FALSE to unselect
*/
gulong addOnSelectAll(void delegate(bool, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnSelectAllDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"select-all",
cast(GCallback)&callBackSelectAll,
cast(void*)wrapper,
cast(GClosureNotify)&callBackSelectAllDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackSelectAll(GtkTextView* textviewStruct, bool select, OnSelectAllDelegateWrapper wrapper)
{
wrapper.dlg(select, wrapper.outer);
}
extern(C) static void callBackSelectAllDestroy(OnSelectAllDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnSetAnchorDelegateWrapper
{
void delegate(TextView) dlg;
gulong handlerId;
this(void delegate(TextView) dlg)
{
this.dlg = dlg;
onSetAnchorListeners ~= this;
}
void remove(OnSetAnchorDelegateWrapper source)
{
foreach(index, wrapper; onSetAnchorListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onSetAnchorListeners[index] = null;
onSetAnchorListeners = std.algorithm.remove(onSetAnchorListeners, index);
break;
}
}
}
}
OnSetAnchorDelegateWrapper[] onSetAnchorListeners;
/**
* The ::set-anchor signal is a
* [keybinding signal][GtkBindingSignal]
* which gets emitted when the user initiates setting the "anchor"
* mark. The "anchor" mark gets placed at the same position as the
* "insert" mark.
*
* This signal has no default bindings.
*/
gulong addOnSetAnchor(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnSetAnchorDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"set-anchor",
cast(GCallback)&callBackSetAnchor,
cast(void*)wrapper,
cast(GClosureNotify)&callBackSetAnchorDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackSetAnchor(GtkTextView* textviewStruct, OnSetAnchorDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackSetAnchorDestroy(OnSetAnchorDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnToggleCursorVisibleDelegateWrapper
{
void delegate(TextView) dlg;
gulong handlerId;
this(void delegate(TextView) dlg)
{
this.dlg = dlg;
onToggleCursorVisibleListeners ~= this;
}
void remove(OnToggleCursorVisibleDelegateWrapper source)
{
foreach(index, wrapper; onToggleCursorVisibleListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onToggleCursorVisibleListeners[index] = null;
onToggleCursorVisibleListeners = std.algorithm.remove(onToggleCursorVisibleListeners, index);
break;
}
}
}
}
OnToggleCursorVisibleDelegateWrapper[] onToggleCursorVisibleListeners;
/**
* The ::toggle-cursor-visible signal is a
* [keybinding signal][GtkBindingSignal]
* which gets emitted to toggle the #GtkTextView:cursor-visible
* property.
*
* The default binding for this signal is F7.
*/
gulong addOnToggleCursorVisible(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnToggleCursorVisibleDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"toggle-cursor-visible",
cast(GCallback)&callBackToggleCursorVisible,
cast(void*)wrapper,
cast(GClosureNotify)&callBackToggleCursorVisibleDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackToggleCursorVisible(GtkTextView* textviewStruct, OnToggleCursorVisibleDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackToggleCursorVisibleDestroy(OnToggleCursorVisibleDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnToggleOverwriteDelegateWrapper
{
void delegate(TextView) dlg;
gulong handlerId;
this(void delegate(TextView) dlg)
{
this.dlg = dlg;
onToggleOverwriteListeners ~= this;
}
void remove(OnToggleOverwriteDelegateWrapper source)
{
foreach(index, wrapper; onToggleOverwriteListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onToggleOverwriteListeners[index] = null;
onToggleOverwriteListeners = std.algorithm.remove(onToggleOverwriteListeners, index);
break;
}
}
}
}
OnToggleOverwriteDelegateWrapper[] onToggleOverwriteListeners;
/**
* The ::toggle-overwrite signal is a
* [keybinding signal][GtkBindingSignal]
* which gets emitted to toggle the overwrite mode of the text view.
*
* The default bindings for this signal is Insert.
*/
gulong addOnToggleOverwrite(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnToggleOverwriteDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"toggle-overwrite",
cast(GCallback)&callBackToggleOverwrite,
cast(void*)wrapper,
cast(GClosureNotify)&callBackToggleOverwriteDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackToggleOverwrite(GtkTextView* textviewStruct, OnToggleOverwriteDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackToggleOverwriteDestroy(OnToggleOverwriteDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
}
|