gtk4/auto/tree_model_sort.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#![allow(deprecated)]
5
6use crate::{TreeDragSource, TreeIter, TreeModel, TreePath, TreeSortable, ffi};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 /// Use [`SortListModel`][crate::SortListModel] instead
11 /// modified_data,
12 /// -1);
13 /// g_free (modified_data);
14 /// }
15 /// ```text
16 ///
17 ///
18 /// ## Properties
19 ///
20 ///
21 /// #### `model`
22 /// The model of the tree model sort.
23 ///
24 /// Readable | Writable | Construct Only
25 ///
26 /// # Implements
27 ///
28 /// [`TreeModelSortExt`][trait@crate::prelude::TreeModelSortExt], [`trait@glib::ObjectExt`], [`TreeDragSourceExt`][trait@crate::prelude::TreeDragSourceExt], [`TreeModelExt`][trait@crate::prelude::TreeModelExt], [`TreeSortableExt`][trait@crate::prelude::TreeSortableExt], [`TreeModelExtManual`][trait@crate::prelude::TreeModelExtManual], [`TreeSortableExtManual`][trait@crate::prelude::TreeSortableExtManual]
29 #[doc(alias = "GtkTreeModelSort")]
30 pub struct TreeModelSort(Object<ffi::GtkTreeModelSort, ffi::GtkTreeModelSortClass>) @implements TreeDragSource, TreeModel, TreeSortable;
31
32 match fn {
33 type_ => || ffi::gtk_tree_model_sort_get_type(),
34 }
35}
36
37impl TreeModelSort {
38 pub const NONE: Option<&'static TreeModelSort> = None;
39
40 /// Creates a new [`TreeModelSort`][crate::TreeModelSort], with @child_model as the child model.
41 ///
42 /// # Deprecated since 4.10
43 ///
44 /// ## `child_model`
45 /// A [`TreeModel`][crate::TreeModel]
46 ///
47 /// # Returns
48 ///
49 /// A new [`TreeModelSort`][crate::TreeModelSort].
50 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
51 #[allow(deprecated)]
52 #[doc(alias = "gtk_tree_model_sort_new_with_model")]
53 #[doc(alias = "new_with_model")]
54 pub fn with_model(child_model: &impl IsA<TreeModel>) -> TreeModelSort {
55 skip_assert_initialized!();
56 unsafe {
57 from_glib_full(ffi::gtk_tree_model_sort_new_with_model(
58 child_model.as_ref().to_glib_none().0,
59 ))
60 }
61 }
62}
63
64/// Trait containing all [`struct@TreeModelSort`] methods.
65///
66/// # Implementors
67///
68/// [`TreeModelSort`][struct@crate::TreeModelSort]
69pub trait TreeModelSortExt: IsA<TreeModelSort> + 'static {
70 /// t change often) and there has been a lot of
71 /// unreffed access to nodes. As a side effect of this function, all unreffed
72 /// iters will be invalid.
73 ///
74 /// # Deprecated since 4.10
75 ///
76 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
77 #[allow(deprecated)]
78 #[doc(alias = "gtk_tree_model_sort_clear_cache")]
79 fn clear_cache(&self) {
80 unsafe {
81 ffi::gtk_tree_model_sort_clear_cache(self.as_ref().to_glib_none().0);
82 }
83 }
84
85 /// Sets @sort_iter to point to the row in @self that corresponds to
86 /// the row pointed at by @child_iter. If @sort_iter was not set, [`false`]
87 /// is returned. Note: a boolean is only returned since 2.14.
88 ///
89 /// # Deprecated since 4.10
90 ///
91 /// ## `child_iter`
92 /// A valid [`TreeIter`][crate::TreeIter] pointing to a row on the child model
93 ///
94 /// # Returns
95 ///
96 /// [`true`], if @sort_iter was set, i.e. if @sort_iter is a
97 /// valid iterator pointer to a visible row in the child model.
98 ///
99 /// ## `sort_iter`
100 /// An uninitialized [`TreeIter`][crate::TreeIter]
101 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
102 #[allow(deprecated)]
103 #[doc(alias = "gtk_tree_model_sort_convert_child_iter_to_iter")]
104 fn convert_child_iter_to_iter(&self, child_iter: &TreeIter) -> Option<TreeIter> {
105 unsafe {
106 let mut sort_iter = TreeIter::uninitialized();
107 let ret = from_glib(ffi::gtk_tree_model_sort_convert_child_iter_to_iter(
108 self.as_ref().to_glib_none().0,
109 sort_iter.to_glib_none_mut().0,
110 mut_override(child_iter.to_glib_none().0),
111 ));
112 if ret { Some(sort_iter) } else { None }
113 }
114 }
115
116 /// t a valid
117 /// path on the child model, then [`None`] is returned.
118 ///
119 /// # Deprecated since 4.10
120 ///
121 /// ## `child_path`
122 /// A [`TreePath`][crate::TreePath] to convert
123 ///
124 /// # Returns
125 ///
126 /// A newly allocated [`TreePath`][crate::TreePath]
127 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
128 #[allow(deprecated)]
129 #[doc(alias = "gtk_tree_model_sort_convert_child_path_to_path")]
130 fn convert_child_path_to_path(&self, child_path: &TreePath) -> Option<TreePath> {
131 unsafe {
132 from_glib_full(ffi::gtk_tree_model_sort_convert_child_path_to_path(
133 self.as_ref().to_glib_none().0,
134 mut_override(child_path.to_glib_none().0),
135 ))
136 }
137 }
138
139 /// Sets @child_iter to point to the row pointed to by @sorted_iter.
140 ///
141 /// # Deprecated since 4.10
142 ///
143 /// ## `sorted_iter`
144 /// A valid [`TreeIter`][crate::TreeIter] pointing to a row on @self.
145 ///
146 /// # Returns
147 ///
148 ///
149 /// ## `child_iter`
150 /// An uninitialized [`TreeIter`][crate::TreeIter]
151 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
152 #[allow(deprecated)]
153 #[doc(alias = "gtk_tree_model_sort_convert_iter_to_child_iter")]
154 fn convert_iter_to_child_iter(&self, sorted_iter: &TreeIter) -> TreeIter {
155 unsafe {
156 let mut child_iter = TreeIter::uninitialized();
157 ffi::gtk_tree_model_sort_convert_iter_to_child_iter(
158 self.as_ref().to_glib_none().0,
159 child_iter.to_glib_none_mut().0,
160 mut_override(sorted_iter.to_glib_none().0),
161 );
162 child_iter
163 }
164 }
165
166 /// Converts @sorted_path to a path on the child model of @self.
167 /// That is, @sorted_path points to a location in @self. The
168 /// returned path will point to the same location in the model not being
169 /// sorted. If @sorted_path does not point to a location in the child model,
170 /// [`None`] is returned.
171 ///
172 /// # Deprecated since 4.10
173 ///
174 /// ## `sorted_path`
175 /// A [`TreePath`][crate::TreePath] to convert
176 ///
177 /// # Returns
178 ///
179 /// A newly allocated [`TreePath`][crate::TreePath]
180 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
181 #[allow(deprecated)]
182 #[doc(alias = "gtk_tree_model_sort_convert_path_to_child_path")]
183 fn convert_path_to_child_path(&self, sorted_path: &TreePath) -> Option<TreePath> {
184 unsafe {
185 from_glib_full(ffi::gtk_tree_model_sort_convert_path_to_child_path(
186 self.as_ref().to_glib_none().0,
187 mut_override(sorted_path.to_glib_none().0),
188 ))
189 }
190 }
191
192 /// Returns the model the [`TreeModelSort`][crate::TreeModelSort] is sorting.
193 ///
194 /// # Deprecated since 4.10
195 ///
196 ///
197 /// # Returns
198 ///
199 /// the "child model" being sorted
200 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
201 #[allow(deprecated)]
202 #[doc(alias = "gtk_tree_model_sort_get_model")]
203 #[doc(alias = "get_model")]
204 fn model(&self) -> TreeModel {
205 unsafe {
206 from_glib_none(ffi::gtk_tree_model_sort_get_model(
207 self.as_ref().to_glib_none().0,
208 ))
209 }
210 }
211
212 /// purposes.
213 ///
214 /// Checks if the given iter is a valid iter for this [`TreeModelSort`][crate::TreeModelSort].
215 ///
216 /// # Deprecated since 4.10
217 ///
218 /// ## `iter`
219 /// A [`TreeIter`][crate::TreeIter]
220 ///
221 /// # Returns
222 ///
223 /// [`true`] if the iter is valid, [`false`] if the iter is invalid.
224 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
225 #[allow(deprecated)]
226 #[doc(alias = "gtk_tree_model_sort_iter_is_valid")]
227 fn iter_is_valid(&self, iter: &TreeIter) -> bool {
228 unsafe {
229 from_glib(ffi::gtk_tree_model_sort_iter_is_valid(
230 self.as_ref().to_glib_none().0,
231 mut_override(iter.to_glib_none().0),
232 ))
233 }
234 }
235
236 /// state.
237 ///
238 /// # Deprecated since 4.10
239 ///
240 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
241 #[allow(deprecated)]
242 #[doc(alias = "gtk_tree_model_sort_reset_default_sort_func")]
243 fn reset_default_sort_func(&self) {
244 unsafe {
245 ffi::gtk_tree_model_sort_reset_default_sort_func(self.as_ref().to_glib_none().0);
246 }
247 }
248}
249
250impl<O: IsA<TreeModelSort>> TreeModelSortExt for O {}