gtk4/
tree_view.rs
1use glib::translate::*;
4
5use crate::{ffi, prelude::*, CellRenderer, TreeView, TreeViewColumn, TreeViewColumnSizing};
6
7mod sealed {
8 pub trait Sealed {}
9 impl<T: super::IsA<super::TreeView>> Sealed for T {}
10}
11
12#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
16#[allow(deprecated)]
17pub trait TreeViewExtManual: sealed::Sealed + IsA<TreeView> + 'static {
18 #[doc(alias = "gtk_tree_view_insert_column_with_attributes")]
38 fn insert_column_with_attributes(
39 &self,
40 position: i32,
41 title: &str,
42 cell: &impl IsA<CellRenderer>,
43 attributes: &[(&str, i32)],
44 ) -> i32 {
45 let column = TreeViewColumn::new();
46 if self.as_ref().is_fixed_height_mode() {
47 column.set_sizing(TreeViewColumnSizing::Fixed);
48 }
49 column.set_title(title);
50 column.pack_start(cell, true);
51 attributes.iter().for_each(|(attribute, column_id)| {
52 column.add_attribute(cell, attribute, *column_id);
53 });
54 self.as_ref().insert_column(&column, position)
55 }
56
57 #[doc(alias = "gtk_tree_view_set_row_separator_func")]
58 #[doc(alias = "set_row_separator_func")]
59 fn unset_row_separator_func(&self) {
60 unsafe {
61 ffi::gtk_tree_view_set_row_separator_func(
62 self.as_ref().to_glib_none().0,
63 None,
64 std::ptr::null_mut(),
65 None,
66 );
67 }
68 }
69}
70
71impl<O: IsA<TreeView>> TreeViewExtManual for O {}