gtk4/auto/tree_row_reference.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::{TreeModel, TreePath, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// A GtkTreeRowReference tracks model changes so that it always refers to the
10 /// same row (a [`TreePath`][crate::TreePath] refers to a position, not a fixed row). Create a
11 /// new GtkTreeRowReference with gtk_tree_row_reference_new().
12 ///
13 /// # Deprecated since 4.10
14 ///
15 /// Use [`gio::ListModel`][crate::gio::ListModel] instead
16 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
17 pub struct TreeRowReference(Boxed<ffi::GtkTreeRowReference>);
18
19 match fn {
20 copy => |ptr| ffi::gtk_tree_row_reference_copy(mut_override(ptr)),
21 free => |ptr| ffi::gtk_tree_row_reference_free(ptr),
22 type_ => || ffi::gtk_tree_row_reference_get_type(),
23 }
24}
25
26impl TreeRowReference {
27 /// t a valid path in @model, then [`None`] is returned.
28 ///
29 /// # Deprecated since 4.10
30 ///
31 /// ## `model`
32 /// a [`TreeModel`][crate::TreeModel]
33 /// ## `path`
34 /// a valid [`TreePath`][crate::TreePath] to monitor
35 ///
36 /// # Returns
37 ///
38 /// a newly allocated [`TreeRowReference`][crate::TreeRowReference]
39 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
40 #[allow(deprecated)]
41 #[doc(alias = "gtk_tree_row_reference_new")]
42 pub fn new(model: &impl IsA<TreeModel>, path: &TreePath) -> Option<TreeRowReference> {
43 skip_assert_initialized!();
44 unsafe {
45 from_glib_full(ffi::gtk_tree_row_reference_new(
46 model.as_ref().to_glib_none().0,
47 mut_override(path.to_glib_none().0),
48 ))
49 }
50 }
51
52 /// t work for reasons of internal implementation.
53 ///
54 /// This type of row reference is primarily meant by structures that
55 /// need to carefully monitor exactly when a row reference updates
56 /// itself, and is not generally needed by most applications.
57 ///
58 /// # Deprecated since 4.10
59 ///
60 /// ## `proxy`
61 /// a proxy `GObject`
62 /// ## `model`
63 /// a [`TreeModel`][crate::TreeModel]
64 /// ## `path`
65 /// a valid [`TreePath`][crate::TreePath] to monitor
66 ///
67 /// # Returns
68 ///
69 /// a newly allocated [`TreeRowReference`][crate::TreeRowReference]
70 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
71 #[allow(deprecated)]
72 #[doc(alias = "gtk_tree_row_reference_new_proxy")]
73 pub fn new_proxy(
74 proxy: &impl IsA<glib::Object>,
75 model: &impl IsA<TreeModel>,
76 path: &TreePath,
77 ) -> Option<TreeRowReference> {
78 skip_assert_initialized!();
79 unsafe {
80 from_glib_full(ffi::gtk_tree_row_reference_new_proxy(
81 proxy.as_ref().to_glib_none().0,
82 model.as_ref().to_glib_none().0,
83 mut_override(path.to_glib_none().0),
84 ))
85 }
86 }
87
88 /// Returns the model that the row reference is monitoring.
89 ///
90 /// # Deprecated since 4.10
91 ///
92 ///
93 /// # Returns
94 ///
95 /// the model
96 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
97 #[allow(deprecated)]
98 #[doc(alias = "gtk_tree_row_reference_get_model")]
99 #[doc(alias = "get_model")]
100 pub fn model(&self) -> TreeModel {
101 unsafe {
102 from_glib_none(ffi::gtk_tree_row_reference_get_model(mut_override(
103 self.to_glib_none().0,
104 )))
105 }
106 }
107
108 /// Returns a path that the row reference currently points to,
109 /// or [`None`] if the path pointed to is no longer valid.
110 ///
111 /// # Deprecated since 4.10
112 ///
113 ///
114 /// # Returns
115 ///
116 /// a current path
117 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
118 #[allow(deprecated)]
119 #[doc(alias = "gtk_tree_row_reference_get_path")]
120 #[doc(alias = "get_path")]
121 pub fn path(&self) -> Option<TreePath> {
122 unsafe {
123 from_glib_full(ffi::gtk_tree_row_reference_get_path(mut_override(
124 self.to_glib_none().0,
125 )))
126 }
127 }
128
129 /// Returns [`true`] if the @self is non-[`None`] and refers to
130 /// a current valid path.
131 ///
132 /// # Deprecated since 4.10
133 ///
134 ///
135 /// # Returns
136 ///
137 /// [`true`] if @self points to a valid path
138 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
139 #[allow(deprecated)]
140 #[doc(alias = "gtk_tree_row_reference_valid")]
141 pub fn valid(&self) -> bool {
142 unsafe {
143 from_glib(ffi::gtk_tree_row_reference_valid(mut_override(
144 self.to_glib_none().0,
145 )))
146 }
147 }
148
149 /// Lets a set of row reference created by
150 /// gtk_tree_row_reference_new_proxy() know that the
151 /// model emitted the ::row-deleted signal.
152 ///
153 /// # Deprecated since 4.10
154 ///
155 /// ## `proxy`
156 /// a `GObject`
157 /// ## `path`
158 /// the path position that was deleted
159 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
160 #[allow(deprecated)]
161 #[doc(alias = "gtk_tree_row_reference_deleted")]
162 pub fn deleted(proxy: &impl IsA<glib::Object>, path: &TreePath) {
163 assert_initialized_main_thread!();
164 unsafe {
165 ffi::gtk_tree_row_reference_deleted(
166 proxy.as_ref().to_glib_none().0,
167 mut_override(path.to_glib_none().0),
168 );
169 }
170 }
171
172 /// Lets a set of row reference created by
173 /// gtk_tree_row_reference_new_proxy() know that the
174 /// model emitted the ::row-inserted signal.
175 ///
176 /// # Deprecated since 4.10
177 ///
178 /// ## `proxy`
179 /// a `GObject`
180 /// ## `path`
181 /// the row position that was inserted
182 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
183 #[allow(deprecated)]
184 #[doc(alias = "gtk_tree_row_reference_inserted")]
185 pub fn inserted(proxy: &impl IsA<glib::Object>, path: &TreePath) {
186 assert_initialized_main_thread!();
187 unsafe {
188 ffi::gtk_tree_row_reference_inserted(
189 proxy.as_ref().to_glib_none().0,
190 mut_override(path.to_glib_none().0),
191 );
192 }
193 }
194}