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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
#![allow(deprecated)]
use crate::{
Buildable, CellArea, CellLayout, CellRenderer, SortType, TreeIter, TreeModel,
TreeViewColumnSizing, Widget,
};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::{boxed::Box as Box_, fmt, mem, mem::transmute};
glib::wrapper! {
/// Use [`ColumnView`][crate::ColumnView] and [`ColumnViewColumn`][crate::ColumnViewColumn]
/// instead of [`TreeView`][crate::TreeView] to show a tabular list
/// A visible column in a [`TreeView`][crate::TreeView] widget
///
/// The [`TreeViewColumn`][crate::TreeViewColumn] object represents a visible column in a [`TreeView`][crate::TreeView] widget.
/// It allows to set properties of the column header, and functions as a holding pen
/// for the cell renderers which determine how the data in the column is displayed.
///
/// Please refer to the [tree widget conceptual overview](section-tree-widget.html)
/// for an overview of all the objects and data types related to the tree widget and
/// how they work together, and to the [`TreeView`][crate::TreeView] documentation for specifics
/// about the CSS node structure for treeviews and their headers.
///
/// ## Properties
///
///
/// #### `alignment`
/// Readable | Writeable
///
///
/// #### `cell-area`
/// The [`CellArea`][crate::CellArea] used to layout cell renderers for this column.
///
/// If no area is specified when creating the tree view column with gtk_tree_view_column_new_with_area()
/// a horizontally oriented [`CellAreaBox`][crate::CellAreaBox] will be used.
///
/// Readable | Writeable | Construct Only
///
///
/// #### `clickable`
/// Readable | Writeable
///
///
/// #### `expand`
/// Readable | Writeable
///
///
/// #### `fixed-width`
/// Readable | Writeable
///
///
/// #### `max-width`
/// Readable | Writeable
///
///
/// #### `min-width`
/// Readable | Writeable
///
///
/// #### `reorderable`
/// Readable | Writeable
///
///
/// #### `resizable`
/// Readable | Writeable
///
///
/// #### `sizing`
/// Readable | Writeable
///
///
/// #### `sort-column-id`
/// Logical sort column ID this column sorts on when selected for sorting. Setting the sort column ID makes the column header
/// clickable. Set to -1 to make the column unsortable.
///
/// Readable | Writeable
///
///
/// #### `sort-indicator`
/// Readable | Writeable
///
///
/// #### `sort-order`
/// Readable | Writeable
///
///
/// #### `spacing`
/// Readable | Writeable
///
///
/// #### `title`
/// Readable | Writeable
///
///
/// #### `visible`
/// Readable | Writeable
///
///
/// #### `widget`
/// Readable | Writeable
///
///
/// #### `width`
/// Readable
///
///
/// #### `x-offset`
/// Readable
///
/// ## Signals
///
///
/// #### `clicked`
/// Emitted when the column's header has been clicked.
///
///
///
/// # Implements
///
/// [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`CellLayoutExt`][trait@crate::prelude::CellLayoutExt], [`CellLayoutExtManual`][trait@crate::prelude::CellLayoutExtManual]
#[doc(alias = "GtkTreeViewColumn")]
pub struct TreeViewColumn(Object<ffi::GtkTreeViewColumn>) @implements Buildable, CellLayout;
match fn {
type_ => || ffi::gtk_tree_view_column_get_type(),
}
}
impl TreeViewColumn {
/// Creates a new [`TreeViewColumn`][crate::TreeViewColumn].
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// A newly created [`TreeViewColumn`][crate::TreeViewColumn].
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_new")]
pub fn new() -> TreeViewColumn {
assert_initialized_main_thread!();
unsafe { from_glib_none(ffi::gtk_tree_view_column_new()) }
}
/// Creates a new [`TreeViewColumn`][crate::TreeViewColumn] using @area to render its cells.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `area`
/// the [`CellArea`][crate::CellArea] that the newly created column should use to layout cells.
///
/// # Returns
///
/// A newly created [`TreeViewColumn`][crate::TreeViewColumn].
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_new_with_area")]
#[doc(alias = "new_with_area")]
pub fn with_area(area: &impl IsA<CellArea>) -> TreeViewColumn {
skip_assert_initialized!();
unsafe {
from_glib_none(ffi::gtk_tree_view_column_new_with_area(
area.as_ref().to_glib_none().0,
))
}
}
// rustdoc-stripper-ignore-next
/// Creates a new builder-pattern struct instance to construct [`TreeViewColumn`] objects.
///
/// This method returns an instance of [`TreeViewColumnBuilder`](crate::builders::TreeViewColumnBuilder) which can be used to create [`TreeViewColumn`] objects.
pub fn builder() -> TreeViewColumnBuilder {
TreeViewColumnBuilder::new()
}
/// Adds an attribute mapping to the list in @self.
///
/// The @column is the
/// column of the model to get a value from, and the @attribute is the
/// parameter on @cell_renderer to be set from the value. So for example
/// if column 2 of the model contains strings, you could have the
/// “text” attribute of a [`CellRendererText`][crate::CellRendererText] get its values from
/// column 2.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `cell_renderer`
/// the [`CellRenderer`][crate::CellRenderer] to set attributes on
/// ## `attribute`
/// An attribute on the renderer
/// ## `column`
/// The column position on the model to get the attribute from.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_add_attribute")]
pub fn add_attribute(
&self,
cell_renderer: &impl IsA<CellRenderer>,
attribute: &str,
column: i32,
) {
unsafe {
ffi::gtk_tree_view_column_add_attribute(
self.to_glib_none().0,
cell_renderer.as_ref().to_glib_none().0,
attribute.to_glib_none().0,
column,
);
}
}
/// Obtains the horizontal position and size of a cell in a column.
///
/// If the cell is not found in the column, @start_pos and @width
/// are not changed and [`false`] is returned.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `cell_renderer`
/// a [`CellRenderer`][crate::CellRenderer]
///
/// # Returns
///
/// [`true`] if @cell belongs to @self
///
/// ## `x_offset`
/// return location for the horizontal
/// position of @cell within @self
///
/// ## `width`
/// return location for the width of @cell
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_cell_get_position")]
pub fn cell_get_position(&self, cell_renderer: &impl IsA<CellRenderer>) -> Option<(i32, i32)> {
unsafe {
let mut x_offset = mem::MaybeUninit::uninit();
let mut width = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gtk_tree_view_column_cell_get_position(
self.to_glib_none().0,
cell_renderer.as_ref().to_glib_none().0,
x_offset.as_mut_ptr(),
width.as_mut_ptr(),
));
if ret {
Some((x_offset.assume_init(), width.assume_init()))
} else {
None
}
}
}
/// Obtains the width and height needed to render the column. This is used
/// primarily by the [`TreeView`][crate::TreeView].
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
///
/// ## `x_offset`
/// location to return x offset of a cell relative to @cell_area
///
/// ## `y_offset`
/// location to return y offset of a cell relative to @cell_area
///
/// ## `width`
/// location to return width needed to render a cell
///
/// ## `height`
/// location to return height needed to render a cell
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_cell_get_size")]
pub fn cell_get_size(&self) -> (i32, i32, i32, i32) {
unsafe {
let mut x_offset = mem::MaybeUninit::uninit();
let mut y_offset = mem::MaybeUninit::uninit();
let mut width = mem::MaybeUninit::uninit();
let mut height = mem::MaybeUninit::uninit();
ffi::gtk_tree_view_column_cell_get_size(
self.to_glib_none().0,
x_offset.as_mut_ptr(),
y_offset.as_mut_ptr(),
width.as_mut_ptr(),
height.as_mut_ptr(),
);
(
x_offset.assume_init(),
y_offset.assume_init(),
width.assume_init(),
height.assume_init(),
)
}
}
/// Returns [`true`] if any of the cells packed into the @self are visible.
/// For this to be meaningful, you must first initialize the cells with
/// gtk_tree_view_column_cell_set_cell_data()
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// [`true`], if any of the cells packed into the @self are currently visible
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_cell_is_visible")]
pub fn cell_is_visible(&self) -> bool {
unsafe {
from_glib(ffi::gtk_tree_view_column_cell_is_visible(
self.to_glib_none().0,
))
}
}
/// Sets the cell renderer based on the @tree_model and @iter. That is, for
/// every attribute mapping in @self, it will get a value from the set
/// column on the @iter, and use that value to set the attribute on the cell
/// renderer. This is used primarily by the [`TreeView`][crate::TreeView].
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `tree_model`
/// The [`TreeModel`][crate::TreeModel] to get the cell renderers attributes from.
/// ## `iter`
/// The [`TreeIter`][crate::TreeIter] to get the cell renderer’s attributes from.
/// ## `is_expander`
/// [`true`], if the row has children
/// ## `is_expanded`
/// [`true`], if the row has visible children
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_cell_set_cell_data")]
pub fn cell_set_cell_data(
&self,
tree_model: &impl IsA<TreeModel>,
iter: &TreeIter,
is_expander: bool,
is_expanded: bool,
) {
unsafe {
ffi::gtk_tree_view_column_cell_set_cell_data(
self.to_glib_none().0,
tree_model.as_ref().to_glib_none().0,
mut_override(iter.to_glib_none().0),
is_expander.into_glib(),
is_expanded.into_glib(),
);
}
}
/// Unsets all the mappings on all renderers on the @self.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_clear")]
pub fn clear(&self) {
unsafe {
ffi::gtk_tree_view_column_clear(self.to_glib_none().0);
}
}
/// Clears all existing attributes previously set with
/// gtk_tree_view_column_set_attributes().
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `cell_renderer`
/// a [`CellRenderer`][crate::CellRenderer] to clear the attribute mapping on.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_clear_attributes")]
pub fn clear_attributes(&self, cell_renderer: &impl IsA<CellRenderer>) {
unsafe {
ffi::gtk_tree_view_column_clear_attributes(
self.to_glib_none().0,
cell_renderer.as_ref().to_glib_none().0,
);
}
}
/// Emits the “clicked” signal on the column. This function will only work if
/// @self is clickable.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_clicked")]
pub fn clicked(&self) {
unsafe {
ffi::gtk_tree_view_column_clicked(self.to_glib_none().0);
}
}
/// Sets the current keyboard focus to be at @cell, if the column contains
/// 2 or more editable and activatable cells.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `cell`
/// A [`CellRenderer`][crate::CellRenderer]
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_focus_cell")]
pub fn focus_cell(&self, cell: &impl IsA<CellRenderer>) {
unsafe {
ffi::gtk_tree_view_column_focus_cell(
self.to_glib_none().0,
cell.as_ref().to_glib_none().0,
);
}
}
/// Returns the current x alignment of @self. This value can range
/// between 0.0 and 1.0.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// The current alignent of @self.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_alignment")]
#[doc(alias = "get_alignment")]
pub fn alignment(&self) -> f32 {
unsafe { ffi::gtk_tree_view_column_get_alignment(self.to_glib_none().0) }
}
/// Returns the button used in the treeview column header
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// The button for the column header.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_button")]
#[doc(alias = "get_button")]
pub fn button(&self) -> Widget {
unsafe { from_glib_none(ffi::gtk_tree_view_column_get_button(self.to_glib_none().0)) }
}
/// Returns [`true`] if the user can click on the header for the column.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// [`true`] if user can click the column header.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_clickable")]
#[doc(alias = "get_clickable")]
pub fn is_clickable(&self) -> bool {
unsafe {
from_glib(ffi::gtk_tree_view_column_get_clickable(
self.to_glib_none().0,
))
}
}
/// Returns [`true`] if the column expands to fill available space.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// [`true`] if the column expands to fill available space.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_expand")]
#[doc(alias = "get_expand")]
pub fn expands(&self) -> bool {
unsafe { from_glib(ffi::gtk_tree_view_column_get_expand(self.to_glib_none().0)) }
}
/// Gets the fixed width of the column. This may not be the actual displayed
/// width of the column; for that, use gtk_tree_view_column_get_width().
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// The fixed width of the column.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_fixed_width")]
#[doc(alias = "get_fixed_width")]
pub fn fixed_width(&self) -> i32 {
unsafe { ffi::gtk_tree_view_column_get_fixed_width(self.to_glib_none().0) }
}
/// Returns the maximum width in pixels of the @self, or -1 if no maximum
/// width is set.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// The maximum width of the @self.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_max_width")]
#[doc(alias = "get_max_width")]
pub fn max_width(&self) -> i32 {
unsafe { ffi::gtk_tree_view_column_get_max_width(self.to_glib_none().0) }
}
/// Returns the minimum width in pixels of the @self, or -1 if no minimum
/// width is set.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// The minimum width of the @self.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_min_width")]
#[doc(alias = "get_min_width")]
pub fn min_width(&self) -> i32 {
unsafe { ffi::gtk_tree_view_column_get_min_width(self.to_glib_none().0) }
}
/// Returns [`true`] if the @self can be reordered by the user.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// [`true`] if the @self can be reordered by the user.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_reorderable")]
#[doc(alias = "get_reorderable")]
pub fn is_reorderable(&self) -> bool {
unsafe {
from_glib(ffi::gtk_tree_view_column_get_reorderable(
self.to_glib_none().0,
))
}
}
/// Returns [`true`] if the @self can be resized by the end user.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// [`true`], if the @self can be resized.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_resizable")]
#[doc(alias = "get_resizable")]
pub fn is_resizable(&self) -> bool {
unsafe {
from_glib(ffi::gtk_tree_view_column_get_resizable(
self.to_glib_none().0,
))
}
}
/// Returns the current type of @self.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// The type of @self.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_sizing")]
#[doc(alias = "get_sizing")]
pub fn sizing(&self) -> TreeViewColumnSizing {
unsafe { from_glib(ffi::gtk_tree_view_column_get_sizing(self.to_glib_none().0)) }
}
/// Gets the logical @sort_column_id that the model sorts on
/// when this column is selected for sorting.
///
/// See [`set_sort_column_id()`][Self::set_sort_column_id()].
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// the current @sort_column_id for this column, or -1 if
/// this column can’t be used for sorting
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_sort_column_id")]
#[doc(alias = "get_sort_column_id")]
pub fn sort_column_id(&self) -> i32 {
unsafe { ffi::gtk_tree_view_column_get_sort_column_id(self.to_glib_none().0) }
}
/// Gets the value set by gtk_tree_view_column_set_sort_indicator().
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// whether the sort indicator arrow is displayed
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_sort_indicator")]
#[doc(alias = "get_sort_indicator")]
pub fn is_sort_indicator(&self) -> bool {
unsafe {
from_glib(ffi::gtk_tree_view_column_get_sort_indicator(
self.to_glib_none().0,
))
}
}
/// Gets the value set by gtk_tree_view_column_set_sort_order().
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// the sort order the sort indicator is indicating
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_sort_order")]
#[doc(alias = "get_sort_order")]
pub fn sort_order(&self) -> SortType {
unsafe {
from_glib(ffi::gtk_tree_view_column_get_sort_order(
self.to_glib_none().0,
))
}
}
/// Returns the spacing of @self.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// the spacing of @self.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_spacing")]
#[doc(alias = "get_spacing")]
pub fn spacing(&self) -> i32 {
unsafe { ffi::gtk_tree_view_column_get_spacing(self.to_glib_none().0) }
}
/// Returns the title of the widget.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// the title of the column. This string should not be
/// modified or freed.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_title")]
#[doc(alias = "get_title")]
pub fn title(&self) -> glib::GString {
unsafe { from_glib_none(ffi::gtk_tree_view_column_get_title(self.to_glib_none().0)) }
}
/// Returns the [`TreeView`][crate::TreeView] wherein @self has been inserted.
/// If @column is currently not inserted in any tree view, [`None`] is
/// returned.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// The tree view wherein @column
/// has been inserted
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_tree_view")]
#[doc(alias = "get_tree_view")]
pub fn tree_view(&self) -> Option<Widget> {
unsafe {
from_glib_none(ffi::gtk_tree_view_column_get_tree_view(
self.to_glib_none().0,
))
}
}
/// Returns [`true`] if @self is visible.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// whether the column is visible or not. If it is visible, then
/// the tree will show the column.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_visible")]
#[doc(alias = "get_visible")]
pub fn is_visible(&self) -> bool {
unsafe { from_glib(ffi::gtk_tree_view_column_get_visible(self.to_glib_none().0)) }
}
/// Returns the [`Widget`][crate::Widget] in the button on the column header.
///
/// If a custom widget has not been set then [`None`] is returned.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// The [`Widget`][crate::Widget] in the column header
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_widget")]
#[doc(alias = "get_widget")]
pub fn widget(&self) -> Option<Widget> {
unsafe { from_glib_none(ffi::gtk_tree_view_column_get_widget(self.to_glib_none().0)) }
}
/// Returns the current size of @self in pixels.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// The current width of @self.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_width")]
#[doc(alias = "get_width")]
pub fn width(&self) -> i32 {
unsafe { ffi::gtk_tree_view_column_get_width(self.to_glib_none().0) }
}
/// Returns the current X offset of @self in pixels.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
///
/// # Returns
///
/// The current X offset of @self.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_get_x_offset")]
#[doc(alias = "get_x_offset")]
pub fn x_offset(&self) -> i32 {
unsafe { ffi::gtk_tree_view_column_get_x_offset(self.to_glib_none().0) }
}
/// Adds the @cell to end of the column. If @expand is [`false`], then the @cell
/// is allocated no more space than it needs. Any unused space is divided
/// evenly between cells for which @expand is [`true`].
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `cell`
/// The [`CellRenderer`][crate::CellRenderer]
/// ## `expand`
/// [`true`] if @cell is to be given extra space allocated to @self.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_pack_end")]
pub fn pack_end(&self, cell: &impl IsA<CellRenderer>, expand: bool) {
unsafe {
ffi::gtk_tree_view_column_pack_end(
self.to_glib_none().0,
cell.as_ref().to_glib_none().0,
expand.into_glib(),
);
}
}
/// Packs the @cell into the beginning of the column. If @expand is [`false`], then
/// the @cell is allocated no more space than it needs. Any unused space is divided
/// evenly between cells for which @expand is [`true`].
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `cell`
/// The [`CellRenderer`][crate::CellRenderer]
/// ## `expand`
/// [`true`] if @cell is to be given extra space allocated to @self.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_pack_start")]
pub fn pack_start(&self, cell: &impl IsA<CellRenderer>, expand: bool) {
unsafe {
ffi::gtk_tree_view_column_pack_start(
self.to_glib_none().0,
cell.as_ref().to_glib_none().0,
expand.into_glib(),
);
}
}
/// Flags the column, and the cell renderers added to this column, to have
/// their sizes renegotiated.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_queue_resize")]
pub fn queue_resize(&self) {
unsafe {
ffi::gtk_tree_view_column_queue_resize(self.to_glib_none().0);
}
}
/// Sets the alignment of the title or custom widget inside the column header.
/// The alignment determines its location inside the button -- 0.0 for left, 0.5
/// for center, 1.0 for right.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `xalign`
/// The alignment, which is between [0.0 and 1.0] inclusive.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_alignment")]
pub fn set_alignment(&self, xalign: f32) {
unsafe {
ffi::gtk_tree_view_column_set_alignment(self.to_glib_none().0, xalign);
}
}
/// Sets the `GtkTreeCellDataFunc` to use for the column.
///
/// This
/// function is used instead of the standard attributes mapping for
/// setting the column value, and should set the value of @self's
/// cell renderer as appropriate. @func may be [`None`] to remove an
/// older one.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `cell_renderer`
/// A [`CellRenderer`][crate::CellRenderer]
/// ## `func`
/// The `GtkTreeCellDataFunc` to use.
/// ## `func_data`
/// The user data for @func.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_cell_data_func")]
pub fn set_cell_data_func<
P: Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static,
>(
&self,
cell_renderer: &impl IsA<CellRenderer>,
func: P,
) {
let func_data: Box_<P> = Box_::new(func);
unsafe extern "C" fn func_func<
P: Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static,
>(
tree_column: *mut ffi::GtkTreeViewColumn,
cell: *mut ffi::GtkCellRenderer,
tree_model: *mut ffi::GtkTreeModel,
iter: *mut ffi::GtkTreeIter,
data: glib::ffi::gpointer,
) {
let tree_column = from_glib_borrow(tree_column);
let cell = from_glib_borrow(cell);
let tree_model = from_glib_borrow(tree_model);
let iter = from_glib_borrow(iter);
let callback: &P = &*(data as *mut _);
(*callback)(&tree_column, &cell, &tree_model, &iter)
}
let func = Some(func_func::<P> as _);
unsafe extern "C" fn destroy_func<
P: Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static,
>(
data: glib::ffi::gpointer,
) {
let _callback: Box_<P> = Box_::from_raw(data as *mut _);
}
let destroy_call4 = Some(destroy_func::<P> as _);
let super_callback0: Box_<P> = func_data;
unsafe {
ffi::gtk_tree_view_column_set_cell_data_func(
self.to_glib_none().0,
cell_renderer.as_ref().to_glib_none().0,
func,
Box_::into_raw(super_callback0) as *mut _,
destroy_call4,
);
}
}
/// Sets the header to be active if @clickable is [`true`]. When the header is
/// active, then it can take keyboard focus, and can be clicked.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `clickable`
/// [`true`] if the header is active.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_clickable")]
pub fn set_clickable(&self, clickable: bool) {
unsafe {
ffi::gtk_tree_view_column_set_clickable(self.to_glib_none().0, clickable.into_glib());
}
}
/// Sets the column to take available extra space. This space is shared equally
/// amongst all columns that have the expand set to [`true`]. If no column has this
/// option set, then the last column gets all extra space. By default, every
/// column is created with this [`false`].
///
/// Along with “fixed-width”, the “expand” property changes when the column is
/// resized by the user.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `expand`
/// [`true`] if the column should expand to fill available space.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_expand")]
pub fn set_expand(&self, expand: bool) {
unsafe {
ffi::gtk_tree_view_column_set_expand(self.to_glib_none().0, expand.into_glib());
}
}
/// If @fixed_width is not -1, sets the fixed width of @self; otherwise
/// unsets it. The effective value of @fixed_width is clamped between the
/// minimum and maximum width of the column; however, the value stored in the
/// “fixed-width” property is not clamped. If the column sizing is
/// [`TreeViewColumnSizing::GrowOnly`][crate::TreeViewColumnSizing::GrowOnly] or [`TreeViewColumnSizing::Autosize`][crate::TreeViewColumnSizing::Autosize], setting
/// a fixed width overrides the automatically calculated width. Note that
/// @fixed_width is only a hint to GTK; the width actually allocated to the
/// column may be greater or less than requested.
///
/// Along with “expand”, the “fixed-width” property changes when the column is
/// resized by the user.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `fixed_width`
/// The new fixed width, in pixels, or -1.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_fixed_width")]
pub fn set_fixed_width(&self, fixed_width: i32) {
unsafe {
ffi::gtk_tree_view_column_set_fixed_width(self.to_glib_none().0, fixed_width);
}
}
/// Sets the maximum width of the @self. If @max_width is -1, then the
/// maximum width is unset. Note, the column can actually be wider than max
/// width if it’s the last column in a view. In this case, the column expands to
/// fill any extra space.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `max_width`
/// The maximum width of the column in pixels, or -1.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_max_width")]
pub fn set_max_width(&self, max_width: i32) {
unsafe {
ffi::gtk_tree_view_column_set_max_width(self.to_glib_none().0, max_width);
}
}
/// Sets the minimum width of the @self. If @min_width is -1, then the
/// minimum width is unset.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `min_width`
/// The minimum width of the column in pixels, or -1.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_min_width")]
pub fn set_min_width(&self, min_width: i32) {
unsafe {
ffi::gtk_tree_view_column_set_min_width(self.to_glib_none().0, min_width);
}
}
/// If @reorderable is [`true`], then the column can be reordered by the end user
/// dragging the header.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `reorderable`
/// [`true`], if the column can be reordered.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_reorderable")]
pub fn set_reorderable(&self, reorderable: bool) {
unsafe {
ffi::gtk_tree_view_column_set_reorderable(
self.to_glib_none().0,
reorderable.into_glib(),
);
}
}
/// If @resizable is [`true`], then the user can explicitly resize the column by
/// grabbing the outer edge of the column button.
///
/// If resizable is [`true`] and
/// sizing mode of the column is [`TreeViewColumnSizing::Autosize`][crate::TreeViewColumnSizing::Autosize], then the sizing
/// mode is changed to [`TreeViewColumnSizing::GrowOnly`][crate::TreeViewColumnSizing::GrowOnly].
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `resizable`
/// [`true`], if the column can be resized
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_resizable")]
pub fn set_resizable(&self, resizable: bool) {
unsafe {
ffi::gtk_tree_view_column_set_resizable(self.to_glib_none().0, resizable.into_glib());
}
}
/// Sets the growth behavior of @self to @type_.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `type_`
/// The [`TreeViewColumn`][crate::TreeViewColumn]Sizing.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_sizing")]
pub fn set_sizing(&self, type_: TreeViewColumnSizing) {
unsafe {
ffi::gtk_tree_view_column_set_sizing(self.to_glib_none().0, type_.into_glib());
}
}
/// Sets the logical @sort_column_id that this column sorts on when this column
/// is selected for sorting. Doing so makes the column header clickable.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `sort_column_id`
/// The @sort_column_id of the model to sort on.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_sort_column_id")]
pub fn set_sort_column_id(&self, sort_column_id: i32) {
unsafe {
ffi::gtk_tree_view_column_set_sort_column_id(self.to_glib_none().0, sort_column_id);
}
}
/// Call this function with a @setting of [`true`] to display an arrow in
/// the header button indicating the column is sorted. Call
/// gtk_tree_view_column_set_sort_order() to change the direction of
/// the arrow.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `setting`
/// [`true`] to display an indicator that the column is sorted
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_sort_indicator")]
pub fn set_sort_indicator(&self, setting: bool) {
unsafe {
ffi::gtk_tree_view_column_set_sort_indicator(
self.to_glib_none().0,
setting.into_glib(),
);
}
}
/// Changes the appearance of the sort indicator.
///
/// This does not actually sort the model. Use
/// gtk_tree_view_column_set_sort_column_id() if you want automatic sorting
/// support. This function is primarily for custom sorting behavior, and should
/// be used in conjunction with gtk_tree_sortable_set_sort_column_id() to do
/// that. For custom models, the mechanism will vary.
///
/// The sort indicator changes direction to indicate normal sort or reverse sort.
/// Note that you must have the sort indicator enabled to see anything when
/// calling this function; see gtk_tree_view_column_set_sort_indicator().
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `order`
/// sort order that the sort indicator should indicate
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_sort_order")]
pub fn set_sort_order(&self, order: SortType) {
unsafe {
ffi::gtk_tree_view_column_set_sort_order(self.to_glib_none().0, order.into_glib());
}
}
/// Sets the spacing field of @self, which is the number of pixels to
/// place between cell renderers packed into it.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `spacing`
/// distance between cell renderers in pixels.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_spacing")]
pub fn set_spacing(&self, spacing: i32) {
unsafe {
ffi::gtk_tree_view_column_set_spacing(self.to_glib_none().0, spacing);
}
}
/// Sets the title of the @self. If a custom widget has been set, then
/// this value is ignored.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `title`
/// The title of the @self.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_title")]
pub fn set_title(&self, title: &str) {
unsafe {
ffi::gtk_tree_view_column_set_title(self.to_glib_none().0, title.to_glib_none().0);
}
}
/// Sets the visibility of @self.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `visible`
/// [`true`] if the @self is visible.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_visible")]
pub fn set_visible(&self, visible: bool) {
unsafe {
ffi::gtk_tree_view_column_set_visible(self.to_glib_none().0, visible.into_glib());
}
}
/// Sets the widget in the header to be @widget. If widget is [`None`], then the
/// header button is set with a [`Label`][crate::Label] set to the title of @self.
///
/// # Deprecated since 4.10
///
/// Use GtkColumnView instead
/// ## `widget`
/// A child [`Widget`][crate::Widget]
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_tree_view_column_set_widget")]
pub fn set_widget(&self, widget: Option<&impl IsA<Widget>>) {
unsafe {
ffi::gtk_tree_view_column_set_widget(
self.to_glib_none().0,
widget.map(|p| p.as_ref()).to_glib_none().0,
);
}
}
/// The [`CellArea`][crate::CellArea] used to layout cell renderers for this column.
///
/// If no area is specified when creating the tree view column with gtk_tree_view_column_new_with_area()
/// a horizontally oriented [`CellAreaBox`][crate::CellAreaBox] will be used.
#[doc(alias = "cell-area")]
pub fn cell_area(&self) -> Option<CellArea> {
ObjectExt::property(self, "cell-area")
}
/// Emitted when the column's header has been clicked.
#[doc(alias = "clicked")]
pub fn connect_clicked<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn clicked_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"clicked\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
clicked_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "alignment")]
pub fn connect_alignment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_alignment_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::alignment\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_alignment_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "clickable")]
pub fn connect_clickable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_clickable_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::clickable\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_clickable_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "expand")]
pub fn connect_expand_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_expand_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::expand\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_expand_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "fixed-width")]
pub fn connect_fixed_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_fixed_width_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::fixed-width\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_fixed_width_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "max-width")]
pub fn connect_max_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_max_width_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::max-width\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_max_width_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "min-width")]
pub fn connect_min_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_min_width_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::min-width\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_min_width_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "reorderable")]
pub fn connect_reorderable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_reorderable_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::reorderable\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_reorderable_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "resizable")]
pub fn connect_resizable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_resizable_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::resizable\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_resizable_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "sizing")]
pub fn connect_sizing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_sizing_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::sizing\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_sizing_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "sort-column-id")]
pub fn connect_sort_column_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_sort_column_id_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::sort-column-id\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_sort_column_id_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "sort-indicator")]
pub fn connect_sort_indicator_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_sort_indicator_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::sort-indicator\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_sort_indicator_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "sort-order")]
pub fn connect_sort_order_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_sort_order_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::sort-order\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_sort_order_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "spacing")]
pub fn connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_spacing_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::spacing\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_spacing_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "title")]
pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_title_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::title\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_title_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "visible")]
pub fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_visible_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::visible\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_visible_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "widget")]
pub fn connect_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_widget_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::widget\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_widget_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "width")]
pub fn connect_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_width_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::width\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_width_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "x-offset")]
pub fn connect_x_offset_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_x_offset_trampoline<F: Fn(&TreeViewColumn) + 'static>(
this: *mut ffi::GtkTreeViewColumn,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::x-offset\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_x_offset_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl Default for TreeViewColumn {
fn default() -> Self {
Self::new()
}
}
// rustdoc-stripper-ignore-next
/// A [builder-pattern] type to construct [`TreeViewColumn`] objects.
///
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct TreeViewColumnBuilder {
builder: glib::object::ObjectBuilder<'static, TreeViewColumn>,
}
impl TreeViewColumnBuilder {
fn new() -> Self {
Self {
builder: glib::object::Object::builder(),
}
}
pub fn alignment(self, alignment: f32) -> Self {
Self {
builder: self.builder.property("alignment", alignment),
}
}
/// The [`CellArea`][crate::CellArea] used to layout cell renderers for this column.
///
/// If no area is specified when creating the tree view column with gtk_tree_view_column_new_with_area()
/// a horizontally oriented [`CellAreaBox`][crate::CellAreaBox] will be used.
pub fn cell_area(self, cell_area: &impl IsA<CellArea>) -> Self {
Self {
builder: self
.builder
.property("cell-area", cell_area.clone().upcast()),
}
}
pub fn clickable(self, clickable: bool) -> Self {
Self {
builder: self.builder.property("clickable", clickable),
}
}
pub fn expand(self, expand: bool) -> Self {
Self {
builder: self.builder.property("expand", expand),
}
}
pub fn fixed_width(self, fixed_width: i32) -> Self {
Self {
builder: self.builder.property("fixed-width", fixed_width),
}
}
pub fn max_width(self, max_width: i32) -> Self {
Self {
builder: self.builder.property("max-width", max_width),
}
}
pub fn min_width(self, min_width: i32) -> Self {
Self {
builder: self.builder.property("min-width", min_width),
}
}
pub fn reorderable(self, reorderable: bool) -> Self {
Self {
builder: self.builder.property("reorderable", reorderable),
}
}
pub fn resizable(self, resizable: bool) -> Self {
Self {
builder: self.builder.property("resizable", resizable),
}
}
pub fn sizing(self, sizing: TreeViewColumnSizing) -> Self {
Self {
builder: self.builder.property("sizing", sizing),
}
}
/// Logical sort column ID this column sorts on when selected for sorting. Setting the sort column ID makes the column header
/// clickable. Set to -1 to make the column unsortable.
pub fn sort_column_id(self, sort_column_id: i32) -> Self {
Self {
builder: self.builder.property("sort-column-id", sort_column_id),
}
}
pub fn sort_indicator(self, sort_indicator: bool) -> Self {
Self {
builder: self.builder.property("sort-indicator", sort_indicator),
}
}
pub fn sort_order(self, sort_order: SortType) -> Self {
Self {
builder: self.builder.property("sort-order", sort_order),
}
}
pub fn spacing(self, spacing: i32) -> Self {
Self {
builder: self.builder.property("spacing", spacing),
}
}
pub fn title(self, title: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("title", title.into()),
}
}
pub fn visible(self, visible: bool) -> Self {
Self {
builder: self.builder.property("visible", visible),
}
}
pub fn widget(self, widget: &impl IsA<Widget>) -> Self {
Self {
builder: self.builder.property("widget", widget.clone().upcast()),
}
}
// rustdoc-stripper-ignore-next
/// Build the [`TreeViewColumn`].
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
pub fn build(self) -> TreeViewColumn {
self.builder.build()
}
}
impl fmt::Display for TreeViewColumn {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("TreeViewColumn")
}
}