1use 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 = "GtkColumnViewRow")]
15 pub struct ColumnViewRow(Object<ffi::GtkColumnViewRow, ffi::GtkColumnViewRowClass>);
16
17 match fn {
18 type_ => || ffi::gtk_column_view_row_get_type(),
19 }
20}
21
22impl ColumnViewRow {
23 pub fn builder() -> ColumnViewRowBuilder {
28 ColumnViewRowBuilder::new()
29 }
30
31 #[doc(alias = "gtk_column_view_row_get_accessible_description")]
32 #[doc(alias = "get_accessible_description")]
33 #[doc(alias = "accessible-description")]
34 pub fn accessible_description(&self) -> glib::GString {
35 unsafe {
36 from_glib_none(ffi::gtk_column_view_row_get_accessible_description(
37 self.to_glib_none().0,
38 ))
39 }
40 }
41
42 #[doc(alias = "gtk_column_view_row_get_accessible_label")]
43 #[doc(alias = "get_accessible_label")]
44 #[doc(alias = "accessible-label")]
45 pub fn accessible_label(&self) -> glib::GString {
46 unsafe {
47 from_glib_none(ffi::gtk_column_view_row_get_accessible_label(
48 self.to_glib_none().0,
49 ))
50 }
51 }
52
53 #[doc(alias = "gtk_column_view_row_get_activatable")]
54 #[doc(alias = "get_activatable")]
55 #[doc(alias = "activatable")]
56 pub fn is_activatable(&self) -> bool {
57 unsafe {
58 from_glib(ffi::gtk_column_view_row_get_activatable(
59 self.to_glib_none().0,
60 ))
61 }
62 }
63
64 #[doc(alias = "gtk_column_view_row_get_focusable")]
65 #[doc(alias = "get_focusable")]
66 #[doc(alias = "focusable")]
67 pub fn is_focusable(&self) -> bool {
68 unsafe {
69 from_glib(ffi::gtk_column_view_row_get_focusable(
70 self.to_glib_none().0,
71 ))
72 }
73 }
74
75 #[doc(alias = "gtk_column_view_row_get_item")]
76 #[doc(alias = "get_item")]
77 pub fn item(&self) -> Option<glib::Object> {
78 unsafe { from_glib_none(ffi::gtk_column_view_row_get_item(self.to_glib_none().0)) }
79 }
80
81 #[doc(alias = "gtk_column_view_row_get_position")]
82 #[doc(alias = "get_position")]
83 pub fn position(&self) -> u32 {
84 unsafe { ffi::gtk_column_view_row_get_position(self.to_glib_none().0) }
85 }
86
87 #[doc(alias = "gtk_column_view_row_get_selectable")]
88 #[doc(alias = "get_selectable")]
89 #[doc(alias = "selectable")]
90 pub fn is_selectable(&self) -> bool {
91 unsafe {
92 from_glib(ffi::gtk_column_view_row_get_selectable(
93 self.to_glib_none().0,
94 ))
95 }
96 }
97
98 #[doc(alias = "gtk_column_view_row_get_selected")]
99 #[doc(alias = "get_selected")]
100 #[doc(alias = "selected")]
101 pub fn is_selected(&self) -> bool {
102 unsafe { from_glib(ffi::gtk_column_view_row_get_selected(self.to_glib_none().0)) }
103 }
104
105 #[doc(alias = "gtk_column_view_row_set_accessible_description")]
106 #[doc(alias = "accessible-description")]
107 pub fn set_accessible_description(&self, description: &str) {
108 unsafe {
109 ffi::gtk_column_view_row_set_accessible_description(
110 self.to_glib_none().0,
111 description.to_glib_none().0,
112 );
113 }
114 }
115
116 #[doc(alias = "gtk_column_view_row_set_accessible_label")]
117 #[doc(alias = "accessible-label")]
118 pub fn set_accessible_label(&self, label: &str) {
119 unsafe {
120 ffi::gtk_column_view_row_set_accessible_label(
121 self.to_glib_none().0,
122 label.to_glib_none().0,
123 );
124 }
125 }
126
127 #[doc(alias = "gtk_column_view_row_set_activatable")]
128 #[doc(alias = "activatable")]
129 pub fn set_activatable(&self, activatable: bool) {
130 unsafe {
131 ffi::gtk_column_view_row_set_activatable(
132 self.to_glib_none().0,
133 activatable.into_glib(),
134 );
135 }
136 }
137
138 #[doc(alias = "gtk_column_view_row_set_focusable")]
139 #[doc(alias = "focusable")]
140 pub fn set_focusable(&self, focusable: bool) {
141 unsafe {
142 ffi::gtk_column_view_row_set_focusable(self.to_glib_none().0, focusable.into_glib());
143 }
144 }
145
146 #[doc(alias = "gtk_column_view_row_set_selectable")]
147 #[doc(alias = "selectable")]
148 pub fn set_selectable(&self, selectable: bool) {
149 unsafe {
150 ffi::gtk_column_view_row_set_selectable(self.to_glib_none().0, selectable.into_glib());
151 }
152 }
153
154 #[cfg(feature = "v4_12")]
155 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
156 #[doc(alias = "accessible-description")]
157 pub fn connect_accessible_description_notify<F: Fn(&Self) + 'static>(
158 &self,
159 f: F,
160 ) -> SignalHandlerId {
161 unsafe extern "C" fn notify_accessible_description_trampoline<
162 F: Fn(&ColumnViewRow) + 'static,
163 >(
164 this: *mut ffi::GtkColumnViewRow,
165 _param_spec: glib::ffi::gpointer,
166 f: glib::ffi::gpointer,
167 ) {
168 let f: &F = &*(f as *const F);
169 f(&from_glib_borrow(this))
170 }
171 unsafe {
172 let f: Box_<F> = Box_::new(f);
173 connect_raw(
174 self.as_ptr() as *mut _,
175 c"notify::accessible-description".as_ptr() as *const _,
176 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
177 notify_accessible_description_trampoline::<F> as *const (),
178 )),
179 Box_::into_raw(f),
180 )
181 }
182 }
183
184 #[cfg(feature = "v4_12")]
185 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
186 #[doc(alias = "accessible-label")]
187 pub fn connect_accessible_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
188 unsafe extern "C" fn notify_accessible_label_trampoline<F: Fn(&ColumnViewRow) + 'static>(
189 this: *mut ffi::GtkColumnViewRow,
190 _param_spec: glib::ffi::gpointer,
191 f: glib::ffi::gpointer,
192 ) {
193 let f: &F = &*(f as *const F);
194 f(&from_glib_borrow(this))
195 }
196 unsafe {
197 let f: Box_<F> = Box_::new(f);
198 connect_raw(
199 self.as_ptr() as *mut _,
200 c"notify::accessible-label".as_ptr() as *const _,
201 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
202 notify_accessible_label_trampoline::<F> as *const (),
203 )),
204 Box_::into_raw(f),
205 )
206 }
207 }
208
209 #[cfg(feature = "v4_12")]
210 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
211 #[doc(alias = "activatable")]
212 pub fn connect_activatable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
213 unsafe extern "C" fn notify_activatable_trampoline<F: Fn(&ColumnViewRow) + 'static>(
214 this: *mut ffi::GtkColumnViewRow,
215 _param_spec: glib::ffi::gpointer,
216 f: glib::ffi::gpointer,
217 ) {
218 let f: &F = &*(f as *const F);
219 f(&from_glib_borrow(this))
220 }
221 unsafe {
222 let f: Box_<F> = Box_::new(f);
223 connect_raw(
224 self.as_ptr() as *mut _,
225 c"notify::activatable".as_ptr() as *const _,
226 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
227 notify_activatable_trampoline::<F> as *const (),
228 )),
229 Box_::into_raw(f),
230 )
231 }
232 }
233
234 #[cfg(feature = "v4_12")]
235 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
236 #[doc(alias = "focusable")]
237 pub fn connect_focusable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
238 unsafe extern "C" fn notify_focusable_trampoline<F: Fn(&ColumnViewRow) + 'static>(
239 this: *mut ffi::GtkColumnViewRow,
240 _param_spec: glib::ffi::gpointer,
241 f: glib::ffi::gpointer,
242 ) {
243 let f: &F = &*(f as *const F);
244 f(&from_glib_borrow(this))
245 }
246 unsafe {
247 let f: Box_<F> = Box_::new(f);
248 connect_raw(
249 self.as_ptr() as *mut _,
250 c"notify::focusable".as_ptr() as *const _,
251 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
252 notify_focusable_trampoline::<F> as *const (),
253 )),
254 Box_::into_raw(f),
255 )
256 }
257 }
258
259 #[cfg(feature = "v4_12")]
260 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
261 #[doc(alias = "item")]
262 pub fn connect_item_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
263 unsafe extern "C" fn notify_item_trampoline<F: Fn(&ColumnViewRow) + 'static>(
264 this: *mut ffi::GtkColumnViewRow,
265 _param_spec: glib::ffi::gpointer,
266 f: glib::ffi::gpointer,
267 ) {
268 let f: &F = &*(f as *const F);
269 f(&from_glib_borrow(this))
270 }
271 unsafe {
272 let f: Box_<F> = Box_::new(f);
273 connect_raw(
274 self.as_ptr() as *mut _,
275 c"notify::item".as_ptr() as *const _,
276 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
277 notify_item_trampoline::<F> as *const (),
278 )),
279 Box_::into_raw(f),
280 )
281 }
282 }
283
284 #[cfg(feature = "v4_12")]
285 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
286 #[doc(alias = "position")]
287 pub fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
288 unsafe extern "C" fn notify_position_trampoline<F: Fn(&ColumnViewRow) + 'static>(
289 this: *mut ffi::GtkColumnViewRow,
290 _param_spec: glib::ffi::gpointer,
291 f: glib::ffi::gpointer,
292 ) {
293 let f: &F = &*(f as *const F);
294 f(&from_glib_borrow(this))
295 }
296 unsafe {
297 let f: Box_<F> = Box_::new(f);
298 connect_raw(
299 self.as_ptr() as *mut _,
300 c"notify::position".as_ptr() as *const _,
301 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
302 notify_position_trampoline::<F> as *const (),
303 )),
304 Box_::into_raw(f),
305 )
306 }
307 }
308
309 #[cfg(feature = "v4_12")]
310 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
311 #[doc(alias = "selectable")]
312 pub fn connect_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
313 unsafe extern "C" fn notify_selectable_trampoline<F: Fn(&ColumnViewRow) + 'static>(
314 this: *mut ffi::GtkColumnViewRow,
315 _param_spec: glib::ffi::gpointer,
316 f: glib::ffi::gpointer,
317 ) {
318 let f: &F = &*(f as *const F);
319 f(&from_glib_borrow(this))
320 }
321 unsafe {
322 let f: Box_<F> = Box_::new(f);
323 connect_raw(
324 self.as_ptr() as *mut _,
325 c"notify::selectable".as_ptr() as *const _,
326 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
327 notify_selectable_trampoline::<F> as *const (),
328 )),
329 Box_::into_raw(f),
330 )
331 }
332 }
333
334 #[cfg(feature = "v4_12")]
335 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
336 #[doc(alias = "selected")]
337 pub fn connect_selected_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
338 unsafe extern "C" fn notify_selected_trampoline<F: Fn(&ColumnViewRow) + 'static>(
339 this: *mut ffi::GtkColumnViewRow,
340 _param_spec: glib::ffi::gpointer,
341 f: glib::ffi::gpointer,
342 ) {
343 let f: &F = &*(f as *const F);
344 f(&from_glib_borrow(this))
345 }
346 unsafe {
347 let f: Box_<F> = Box_::new(f);
348 connect_raw(
349 self.as_ptr() as *mut _,
350 c"notify::selected".as_ptr() as *const _,
351 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
352 notify_selected_trampoline::<F> as *const (),
353 )),
354 Box_::into_raw(f),
355 )
356 }
357 }
358}
359
360#[must_use = "The builder must be built to be used"]
365pub struct ColumnViewRowBuilder {
366 builder: glib::object::ObjectBuilder<'static, ColumnViewRow>,
367}
368
369impl ColumnViewRowBuilder {
370 fn new() -> Self {
371 Self {
372 builder: glib::object::Object::builder(),
373 }
374 }
375
376 #[cfg(feature = "v4_12")]
377 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
378 pub fn accessible_description(self, accessible_description: impl Into<glib::GString>) -> Self {
379 Self {
380 builder: self
381 .builder
382 .property("accessible-description", accessible_description.into()),
383 }
384 }
385
386 #[cfg(feature = "v4_12")]
387 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
388 pub fn accessible_label(self, accessible_label: impl Into<glib::GString>) -> Self {
389 Self {
390 builder: self
391 .builder
392 .property("accessible-label", accessible_label.into()),
393 }
394 }
395
396 #[cfg(feature = "v4_12")]
397 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
398 pub fn activatable(self, activatable: bool) -> Self {
399 Self {
400 builder: self.builder.property("activatable", activatable),
401 }
402 }
403
404 #[cfg(feature = "v4_12")]
405 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
406 pub fn focusable(self, focusable: bool) -> Self {
407 Self {
408 builder: self.builder.property("focusable", focusable),
409 }
410 }
411
412 #[cfg(feature = "v4_12")]
413 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
414 pub fn selectable(self, selectable: bool) -> Self {
415 Self {
416 builder: self.builder.property("selectable", selectable),
417 }
418 }
419
420 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
423 pub fn build(self) -> ColumnViewRow {
424 assert_initialized_main_thread!();
425 self.builder.build()
426 }
427}