gtk4/auto/
tree_list_row.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::ffi;
6use glib::{
7    prelude::*,
8    signal::{connect_raw, SignalHandlerId},
9    translate::*,
10};
11use std::boxed::Box as Box_;
12
13glib::wrapper! {
14    #[doc(alias = "GtkTreeListRow")]
15    pub struct TreeListRow(Object<ffi::GtkTreeListRow, ffi::GtkTreeListRowClass>);
16
17    match fn {
18        type_ => || ffi::gtk_tree_list_row_get_type(),
19    }
20}
21
22impl TreeListRow {
23    #[doc(alias = "gtk_tree_list_row_get_child_row")]
24    #[doc(alias = "get_child_row")]
25    #[must_use]
26    pub fn child_row(&self, position: u32) -> Option<TreeListRow> {
27        unsafe {
28            from_glib_full(ffi::gtk_tree_list_row_get_child_row(
29                self.to_glib_none().0,
30                position,
31            ))
32        }
33    }
34
35    #[doc(alias = "gtk_tree_list_row_get_children")]
36    #[doc(alias = "get_children")]
37    pub fn children(&self) -> Option<gio::ListModel> {
38        unsafe { from_glib_none(ffi::gtk_tree_list_row_get_children(self.to_glib_none().0)) }
39    }
40
41    #[doc(alias = "gtk_tree_list_row_get_depth")]
42    #[doc(alias = "get_depth")]
43    pub fn depth(&self) -> u32 {
44        unsafe { ffi::gtk_tree_list_row_get_depth(self.to_glib_none().0) }
45    }
46
47    #[doc(alias = "gtk_tree_list_row_get_expanded")]
48    #[doc(alias = "get_expanded")]
49    #[doc(alias = "expanded")]
50    pub fn is_expanded(&self) -> bool {
51        unsafe { from_glib(ffi::gtk_tree_list_row_get_expanded(self.to_glib_none().0)) }
52    }
53
54    #[doc(alias = "gtk_tree_list_row_get_item")]
55    #[doc(alias = "get_item")]
56    pub fn item(&self) -> Option<glib::Object> {
57        unsafe { from_glib_full(ffi::gtk_tree_list_row_get_item(self.to_glib_none().0)) }
58    }
59
60    #[doc(alias = "gtk_tree_list_row_get_parent")]
61    #[doc(alias = "get_parent")]
62    #[must_use]
63    pub fn parent(&self) -> Option<TreeListRow> {
64        unsafe { from_glib_full(ffi::gtk_tree_list_row_get_parent(self.to_glib_none().0)) }
65    }
66
67    #[doc(alias = "gtk_tree_list_row_get_position")]
68    #[doc(alias = "get_position")]
69    pub fn position(&self) -> u32 {
70        unsafe { ffi::gtk_tree_list_row_get_position(self.to_glib_none().0) }
71    }
72
73    #[doc(alias = "gtk_tree_list_row_is_expandable")]
74    #[doc(alias = "expandable")]
75    pub fn is_expandable(&self) -> bool {
76        unsafe { from_glib(ffi::gtk_tree_list_row_is_expandable(self.to_glib_none().0)) }
77    }
78
79    #[doc(alias = "gtk_tree_list_row_set_expanded")]
80    #[doc(alias = "expanded")]
81    pub fn set_expanded(&self, expanded: bool) {
82        unsafe {
83            ffi::gtk_tree_list_row_set_expanded(self.to_glib_none().0, expanded.into_glib());
84        }
85    }
86
87    #[doc(alias = "children")]
88    pub fn connect_children_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
89        unsafe extern "C" fn notify_children_trampoline<F: Fn(&TreeListRow) + 'static>(
90            this: *mut ffi::GtkTreeListRow,
91            _param_spec: glib::ffi::gpointer,
92            f: glib::ffi::gpointer,
93        ) {
94            let f: &F = &*(f as *const F);
95            f(&from_glib_borrow(this))
96        }
97        unsafe {
98            let f: Box_<F> = Box_::new(f);
99            connect_raw(
100                self.as_ptr() as *mut _,
101                c"notify::children".as_ptr() as *const _,
102                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
103                    notify_children_trampoline::<F> as *const (),
104                )),
105                Box_::into_raw(f),
106            )
107        }
108    }
109
110    #[doc(alias = "depth")]
111    pub fn connect_depth_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
112        unsafe extern "C" fn notify_depth_trampoline<F: Fn(&TreeListRow) + 'static>(
113            this: *mut ffi::GtkTreeListRow,
114            _param_spec: glib::ffi::gpointer,
115            f: glib::ffi::gpointer,
116        ) {
117            let f: &F = &*(f as *const F);
118            f(&from_glib_borrow(this))
119        }
120        unsafe {
121            let f: Box_<F> = Box_::new(f);
122            connect_raw(
123                self.as_ptr() as *mut _,
124                c"notify::depth".as_ptr() as *const _,
125                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
126                    notify_depth_trampoline::<F> as *const (),
127                )),
128                Box_::into_raw(f),
129            )
130        }
131    }
132
133    #[doc(alias = "expandable")]
134    pub fn connect_expandable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
135        unsafe extern "C" fn notify_expandable_trampoline<F: Fn(&TreeListRow) + 'static>(
136            this: *mut ffi::GtkTreeListRow,
137            _param_spec: glib::ffi::gpointer,
138            f: glib::ffi::gpointer,
139        ) {
140            let f: &F = &*(f as *const F);
141            f(&from_glib_borrow(this))
142        }
143        unsafe {
144            let f: Box_<F> = Box_::new(f);
145            connect_raw(
146                self.as_ptr() as *mut _,
147                c"notify::expandable".as_ptr() as *const _,
148                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
149                    notify_expandable_trampoline::<F> as *const (),
150                )),
151                Box_::into_raw(f),
152            )
153        }
154    }
155
156    #[doc(alias = "expanded")]
157    pub fn connect_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
158        unsafe extern "C" fn notify_expanded_trampoline<F: Fn(&TreeListRow) + 'static>(
159            this: *mut ffi::GtkTreeListRow,
160            _param_spec: glib::ffi::gpointer,
161            f: glib::ffi::gpointer,
162        ) {
163            let f: &F = &*(f as *const F);
164            f(&from_glib_borrow(this))
165        }
166        unsafe {
167            let f: Box_<F> = Box_::new(f);
168            connect_raw(
169                self.as_ptr() as *mut _,
170                c"notify::expanded".as_ptr() as *const _,
171                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
172                    notify_expanded_trampoline::<F> as *const (),
173                )),
174                Box_::into_raw(f),
175            )
176        }
177    }
178
179    #[doc(alias = "item")]
180    pub fn connect_item_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
181        unsafe extern "C" fn notify_item_trampoline<F: Fn(&TreeListRow) + 'static>(
182            this: *mut ffi::GtkTreeListRow,
183            _param_spec: glib::ffi::gpointer,
184            f: glib::ffi::gpointer,
185        ) {
186            let f: &F = &*(f as *const F);
187            f(&from_glib_borrow(this))
188        }
189        unsafe {
190            let f: Box_<F> = Box_::new(f);
191            connect_raw(
192                self.as_ptr() as *mut _,
193                c"notify::item".as_ptr() as *const _,
194                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
195                    notify_item_trampoline::<F> as *const (),
196                )),
197                Box_::into_raw(f),
198            )
199        }
200    }
201}