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