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")]
74 pub struct ColumnViewRow(Object<ffi::GtkColumnViewRow, ffi::GtkColumnViewRowClass>);
75
76 match fn {
77 type_ => || ffi::gtk_column_view_row_get_type(),
78 }
79}
80
81impl ColumnViewRow {
82 pub fn builder() -> ColumnViewRowBuilder {
87 ColumnViewRowBuilder::new()
88 }
89
90 #[doc(alias = "gtk_column_view_row_get_accessible_description")]
96 #[doc(alias = "get_accessible_description")]
97 #[doc(alias = "accessible-description")]
98 pub fn accessible_description(&self) -> glib::GString {
99 unsafe {
100 from_glib_none(ffi::gtk_column_view_row_get_accessible_description(
101 self.to_glib_none().0,
102 ))
103 }
104 }
105
106 #[doc(alias = "gtk_column_view_row_get_accessible_label")]
112 #[doc(alias = "get_accessible_label")]
113 #[doc(alias = "accessible-label")]
114 pub fn accessible_label(&self) -> glib::GString {
115 unsafe {
116 from_glib_none(ffi::gtk_column_view_row_get_accessible_label(
117 self.to_glib_none().0,
118 ))
119 }
120 }
121
122 #[doc(alias = "gtk_column_view_row_get_activatable")]
129 #[doc(alias = "get_activatable")]
130 #[doc(alias = "activatable")]
131 pub fn is_activatable(&self) -> bool {
132 unsafe {
133 from_glib(ffi::gtk_column_view_row_get_activatable(
134 self.to_glib_none().0,
135 ))
136 }
137 }
138
139 #[doc(alias = "gtk_column_view_row_get_focusable")]
146 #[doc(alias = "get_focusable")]
147 #[doc(alias = "focusable")]
148 pub fn is_focusable(&self) -> bool {
149 unsafe {
150 from_glib(ffi::gtk_column_view_row_get_focusable(
151 self.to_glib_none().0,
152 ))
153 }
154 }
155
156 #[doc(alias = "gtk_column_view_row_get_item")]
164 #[doc(alias = "get_item")]
165 pub fn item(&self) -> Option<glib::Object> {
166 unsafe { from_glib_none(ffi::gtk_column_view_row_get_item(self.to_glib_none().0)) }
167 }
168
169 #[doc(alias = "gtk_column_view_row_get_position")]
177 #[doc(alias = "get_position")]
178 pub fn position(&self) -> u32 {
179 unsafe { ffi::gtk_column_view_row_get_position(self.to_glib_none().0) }
180 }
181
182 #[doc(alias = "gtk_column_view_row_get_selectable")]
191 #[doc(alias = "get_selectable")]
192 #[doc(alias = "selectable")]
193 pub fn is_selectable(&self) -> bool {
194 unsafe {
195 from_glib(ffi::gtk_column_view_row_get_selectable(
196 self.to_glib_none().0,
197 ))
198 }
199 }
200
201 #[doc(alias = "gtk_column_view_row_get_selected")]
210 #[doc(alias = "get_selected")]
211 #[doc(alias = "selected")]
212 pub fn is_selected(&self) -> bool {
213 unsafe { from_glib(ffi::gtk_column_view_row_get_selected(self.to_glib_none().0)) }
214 }
215
216 #[doc(alias = "gtk_column_view_row_set_accessible_description")]
221 #[doc(alias = "accessible-description")]
222 pub fn set_accessible_description(&self, description: &str) {
223 unsafe {
224 ffi::gtk_column_view_row_set_accessible_description(
225 self.to_glib_none().0,
226 description.to_glib_none().0,
227 );
228 }
229 }
230
231 #[doc(alias = "gtk_column_view_row_set_accessible_label")]
236 #[doc(alias = "accessible-label")]
237 pub fn set_accessible_label(&self, label: &str) {
238 unsafe {
239 ffi::gtk_column_view_row_set_accessible_label(
240 self.to_glib_none().0,
241 label.to_glib_none().0,
242 );
243 }
244 }
245
246 #[doc(alias = "gtk_column_view_row_set_activatable")]
257 #[doc(alias = "activatable")]
258 pub fn set_activatable(&self, activatable: bool) {
259 unsafe {
260 ffi::gtk_column_view_row_set_activatable(
261 self.to_glib_none().0,
262 activatable.into_glib(),
263 );
264 }
265 }
266
267 #[doc(alias = "gtk_column_view_row_set_focusable")]
279 #[doc(alias = "focusable")]
280 pub fn set_focusable(&self, focusable: bool) {
281 unsafe {
282 ffi::gtk_column_view_row_set_focusable(self.to_glib_none().0, focusable.into_glib());
283 }
284 }
285
286 #[doc(alias = "gtk_column_view_row_set_selectable")]
300 #[doc(alias = "selectable")]
301 pub fn set_selectable(&self, selectable: bool) {
302 unsafe {
303 ffi::gtk_column_view_row_set_selectable(self.to_glib_none().0, selectable.into_glib());
304 }
305 }
306
307 #[cfg(feature = "v4_12")]
308 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
309 #[doc(alias = "accessible-description")]
310 pub fn connect_accessible_description_notify<F: Fn(&Self) + 'static>(
311 &self,
312 f: F,
313 ) -> SignalHandlerId {
314 unsafe extern "C" fn notify_accessible_description_trampoline<
315 F: Fn(&ColumnViewRow) + 'static,
316 >(
317 this: *mut ffi::GtkColumnViewRow,
318 _param_spec: glib::ffi::gpointer,
319 f: glib::ffi::gpointer,
320 ) {
321 let f: &F = &*(f as *const F);
322 f(&from_glib_borrow(this))
323 }
324 unsafe {
325 let f: Box_<F> = Box_::new(f);
326 connect_raw(
327 self.as_ptr() as *mut _,
328 b"notify::accessible-description\0".as_ptr() as *const _,
329 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
330 notify_accessible_description_trampoline::<F> as *const (),
331 )),
332 Box_::into_raw(f),
333 )
334 }
335 }
336
337 #[cfg(feature = "v4_12")]
338 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
339 #[doc(alias = "accessible-label")]
340 pub fn connect_accessible_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
341 unsafe extern "C" fn notify_accessible_label_trampoline<F: Fn(&ColumnViewRow) + 'static>(
342 this: *mut ffi::GtkColumnViewRow,
343 _param_spec: glib::ffi::gpointer,
344 f: glib::ffi::gpointer,
345 ) {
346 let f: &F = &*(f as *const F);
347 f(&from_glib_borrow(this))
348 }
349 unsafe {
350 let f: Box_<F> = Box_::new(f);
351 connect_raw(
352 self.as_ptr() as *mut _,
353 b"notify::accessible-label\0".as_ptr() as *const _,
354 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
355 notify_accessible_label_trampoline::<F> as *const (),
356 )),
357 Box_::into_raw(f),
358 )
359 }
360 }
361
362 #[cfg(feature = "v4_12")]
363 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
364 #[doc(alias = "activatable")]
365 pub fn connect_activatable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
366 unsafe extern "C" fn notify_activatable_trampoline<F: Fn(&ColumnViewRow) + 'static>(
367 this: *mut ffi::GtkColumnViewRow,
368 _param_spec: glib::ffi::gpointer,
369 f: glib::ffi::gpointer,
370 ) {
371 let f: &F = &*(f as *const F);
372 f(&from_glib_borrow(this))
373 }
374 unsafe {
375 let f: Box_<F> = Box_::new(f);
376 connect_raw(
377 self.as_ptr() as *mut _,
378 b"notify::activatable\0".as_ptr() as *const _,
379 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
380 notify_activatable_trampoline::<F> as *const (),
381 )),
382 Box_::into_raw(f),
383 )
384 }
385 }
386
387 #[cfg(feature = "v4_12")]
388 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
389 #[doc(alias = "focusable")]
390 pub fn connect_focusable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
391 unsafe extern "C" fn notify_focusable_trampoline<F: Fn(&ColumnViewRow) + 'static>(
392 this: *mut ffi::GtkColumnViewRow,
393 _param_spec: glib::ffi::gpointer,
394 f: glib::ffi::gpointer,
395 ) {
396 let f: &F = &*(f as *const F);
397 f(&from_glib_borrow(this))
398 }
399 unsafe {
400 let f: Box_<F> = Box_::new(f);
401 connect_raw(
402 self.as_ptr() as *mut _,
403 b"notify::focusable\0".as_ptr() as *const _,
404 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
405 notify_focusable_trampoline::<F> as *const (),
406 )),
407 Box_::into_raw(f),
408 )
409 }
410 }
411
412 #[cfg(feature = "v4_12")]
413 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
414 #[doc(alias = "item")]
415 pub fn connect_item_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
416 unsafe extern "C" fn notify_item_trampoline<F: Fn(&ColumnViewRow) + 'static>(
417 this: *mut ffi::GtkColumnViewRow,
418 _param_spec: glib::ffi::gpointer,
419 f: glib::ffi::gpointer,
420 ) {
421 let f: &F = &*(f as *const F);
422 f(&from_glib_borrow(this))
423 }
424 unsafe {
425 let f: Box_<F> = Box_::new(f);
426 connect_raw(
427 self.as_ptr() as *mut _,
428 b"notify::item\0".as_ptr() as *const _,
429 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
430 notify_item_trampoline::<F> as *const (),
431 )),
432 Box_::into_raw(f),
433 )
434 }
435 }
436
437 #[cfg(feature = "v4_12")]
438 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
439 #[doc(alias = "position")]
440 pub fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
441 unsafe extern "C" fn notify_position_trampoline<F: Fn(&ColumnViewRow) + 'static>(
442 this: *mut ffi::GtkColumnViewRow,
443 _param_spec: glib::ffi::gpointer,
444 f: glib::ffi::gpointer,
445 ) {
446 let f: &F = &*(f as *const F);
447 f(&from_glib_borrow(this))
448 }
449 unsafe {
450 let f: Box_<F> = Box_::new(f);
451 connect_raw(
452 self.as_ptr() as *mut _,
453 b"notify::position\0".as_ptr() as *const _,
454 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
455 notify_position_trampoline::<F> as *const (),
456 )),
457 Box_::into_raw(f),
458 )
459 }
460 }
461
462 #[cfg(feature = "v4_12")]
463 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
464 #[doc(alias = "selectable")]
465 pub fn connect_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
466 unsafe extern "C" fn notify_selectable_trampoline<F: Fn(&ColumnViewRow) + 'static>(
467 this: *mut ffi::GtkColumnViewRow,
468 _param_spec: glib::ffi::gpointer,
469 f: glib::ffi::gpointer,
470 ) {
471 let f: &F = &*(f as *const F);
472 f(&from_glib_borrow(this))
473 }
474 unsafe {
475 let f: Box_<F> = Box_::new(f);
476 connect_raw(
477 self.as_ptr() as *mut _,
478 b"notify::selectable\0".as_ptr() as *const _,
479 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
480 notify_selectable_trampoline::<F> as *const (),
481 )),
482 Box_::into_raw(f),
483 )
484 }
485 }
486
487 #[cfg(feature = "v4_12")]
488 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
489 #[doc(alias = "selected")]
490 pub fn connect_selected_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
491 unsafe extern "C" fn notify_selected_trampoline<F: Fn(&ColumnViewRow) + 'static>(
492 this: *mut ffi::GtkColumnViewRow,
493 _param_spec: glib::ffi::gpointer,
494 f: glib::ffi::gpointer,
495 ) {
496 let f: &F = &*(f as *const F);
497 f(&from_glib_borrow(this))
498 }
499 unsafe {
500 let f: Box_<F> = Box_::new(f);
501 connect_raw(
502 self.as_ptr() as *mut _,
503 b"notify::selected\0".as_ptr() as *const _,
504 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
505 notify_selected_trampoline::<F> as *const (),
506 )),
507 Box_::into_raw(f),
508 )
509 }
510 }
511}
512
513#[must_use = "The builder must be built to be used"]
518pub struct ColumnViewRowBuilder {
519 builder: glib::object::ObjectBuilder<'static, ColumnViewRow>,
520}
521
522impl ColumnViewRowBuilder {
523 fn new() -> Self {
524 Self {
525 builder: glib::object::Object::builder(),
526 }
527 }
528
529 #[cfg(feature = "v4_12")]
531 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
532 pub fn accessible_description(self, accessible_description: impl Into<glib::GString>) -> Self {
533 Self {
534 builder: self
535 .builder
536 .property("accessible-description", accessible_description.into()),
537 }
538 }
539
540 #[cfg(feature = "v4_12")]
542 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
543 pub fn accessible_label(self, accessible_label: impl Into<glib::GString>) -> Self {
544 Self {
545 builder: self
546 .builder
547 .property("accessible-label", accessible_label.into()),
548 }
549 }
550
551 #[cfg(feature = "v4_12")]
553 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
554 pub fn activatable(self, activatable: bool) -> Self {
555 Self {
556 builder: self.builder.property("activatable", activatable),
557 }
558 }
559
560 #[cfg(feature = "v4_12")]
562 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
563 pub fn focusable(self, focusable: bool) -> Self {
564 Self {
565 builder: self.builder.property("focusable", focusable),
566 }
567 }
568
569 #[cfg(feature = "v4_12")]
571 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
572 pub fn selectable(self, selectable: bool) -> Self {
573 Self {
574 builder: self.builder.property("selectable", selectable),
575 }
576 }
577
578 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
581 pub fn build(self) -> ColumnViewRow {
582 assert_initialized_main_thread!();
583 self.builder.build()
584 }
585}