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")]
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 let f: &F = &*(f as *const F);
321 f(&from_glib_borrow(this))
322 }
323 unsafe {
324 let f: Box_<F> = Box_::new(f);
325 connect_raw(
326 self.as_ptr() as *mut _,
327 c"notify::accessible-description".as_ptr() as *const _,
328 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
329 notify_accessible_description_trampoline::<F> as *const (),
330 )),
331 Box_::into_raw(f),
332 )
333 }
334 }
335
336 #[cfg(feature = "v4_12")]
337 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
338 #[doc(alias = "accessible-label")]
339 pub fn connect_accessible_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
340 unsafe extern "C" fn notify_accessible_label_trampoline<F: Fn(&ColumnViewRow) + 'static>(
341 this: *mut ffi::GtkColumnViewRow,
342 _param_spec: glib::ffi::gpointer,
343 f: glib::ffi::gpointer,
344 ) {
345 let f: &F = &*(f as *const F);
346 f(&from_glib_borrow(this))
347 }
348 unsafe {
349 let f: Box_<F> = Box_::new(f);
350 connect_raw(
351 self.as_ptr() as *mut _,
352 c"notify::accessible-label".as_ptr() as *const _,
353 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
354 notify_accessible_label_trampoline::<F> as *const (),
355 )),
356 Box_::into_raw(f),
357 )
358 }
359 }
360
361 #[cfg(feature = "v4_12")]
362 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
363 #[doc(alias = "activatable")]
364 pub fn connect_activatable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
365 unsafe extern "C" fn notify_activatable_trampoline<F: Fn(&ColumnViewRow) + 'static>(
366 this: *mut ffi::GtkColumnViewRow,
367 _param_spec: glib::ffi::gpointer,
368 f: glib::ffi::gpointer,
369 ) {
370 let f: &F = &*(f as *const F);
371 f(&from_glib_borrow(this))
372 }
373 unsafe {
374 let f: Box_<F> = Box_::new(f);
375 connect_raw(
376 self.as_ptr() as *mut _,
377 c"notify::activatable".as_ptr() as *const _,
378 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
379 notify_activatable_trampoline::<F> as *const (),
380 )),
381 Box_::into_raw(f),
382 )
383 }
384 }
385
386 #[cfg(feature = "v4_12")]
387 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
388 #[doc(alias = "focusable")]
389 pub fn connect_focusable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
390 unsafe extern "C" fn notify_focusable_trampoline<F: Fn(&ColumnViewRow) + 'static>(
391 this: *mut ffi::GtkColumnViewRow,
392 _param_spec: glib::ffi::gpointer,
393 f: glib::ffi::gpointer,
394 ) {
395 let f: &F = &*(f as *const F);
396 f(&from_glib_borrow(this))
397 }
398 unsafe {
399 let f: Box_<F> = Box_::new(f);
400 connect_raw(
401 self.as_ptr() as *mut _,
402 c"notify::focusable".as_ptr() as *const _,
403 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
404 notify_focusable_trampoline::<F> as *const (),
405 )),
406 Box_::into_raw(f),
407 )
408 }
409 }
410
411 #[cfg(feature = "v4_12")]
412 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
413 #[doc(alias = "item")]
414 pub fn connect_item_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
415 unsafe extern "C" fn notify_item_trampoline<F: Fn(&ColumnViewRow) + 'static>(
416 this: *mut ffi::GtkColumnViewRow,
417 _param_spec: glib::ffi::gpointer,
418 f: glib::ffi::gpointer,
419 ) {
420 let f: &F = &*(f as *const F);
421 f(&from_glib_borrow(this))
422 }
423 unsafe {
424 let f: Box_<F> = Box_::new(f);
425 connect_raw(
426 self.as_ptr() as *mut _,
427 c"notify::item".as_ptr() as *const _,
428 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
429 notify_item_trampoline::<F> as *const (),
430 )),
431 Box_::into_raw(f),
432 )
433 }
434 }
435
436 #[cfg(feature = "v4_12")]
437 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
438 #[doc(alias = "position")]
439 pub fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
440 unsafe extern "C" fn notify_position_trampoline<F: Fn(&ColumnViewRow) + 'static>(
441 this: *mut ffi::GtkColumnViewRow,
442 _param_spec: glib::ffi::gpointer,
443 f: glib::ffi::gpointer,
444 ) {
445 let f: &F = &*(f as *const F);
446 f(&from_glib_borrow(this))
447 }
448 unsafe {
449 let f: Box_<F> = Box_::new(f);
450 connect_raw(
451 self.as_ptr() as *mut _,
452 c"notify::position".as_ptr() as *const _,
453 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
454 notify_position_trampoline::<F> as *const (),
455 )),
456 Box_::into_raw(f),
457 )
458 }
459 }
460
461 #[cfg(feature = "v4_12")]
462 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
463 #[doc(alias = "selectable")]
464 pub fn connect_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
465 unsafe extern "C" fn notify_selectable_trampoline<F: Fn(&ColumnViewRow) + 'static>(
466 this: *mut ffi::GtkColumnViewRow,
467 _param_spec: glib::ffi::gpointer,
468 f: glib::ffi::gpointer,
469 ) {
470 let f: &F = &*(f as *const F);
471 f(&from_glib_borrow(this))
472 }
473 unsafe {
474 let f: Box_<F> = Box_::new(f);
475 connect_raw(
476 self.as_ptr() as *mut _,
477 c"notify::selectable".as_ptr() as *const _,
478 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
479 notify_selectable_trampoline::<F> as *const (),
480 )),
481 Box_::into_raw(f),
482 )
483 }
484 }
485
486 #[cfg(feature = "v4_12")]
487 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
488 #[doc(alias = "selected")]
489 pub fn connect_selected_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
490 unsafe extern "C" fn notify_selected_trampoline<F: Fn(&ColumnViewRow) + 'static>(
491 this: *mut ffi::GtkColumnViewRow,
492 _param_spec: glib::ffi::gpointer,
493 f: glib::ffi::gpointer,
494 ) {
495 let f: &F = &*(f as *const F);
496 f(&from_glib_borrow(this))
497 }
498 unsafe {
499 let f: Box_<F> = Box_::new(f);
500 connect_raw(
501 self.as_ptr() as *mut _,
502 c"notify::selected".as_ptr() as *const _,
503 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
504 notify_selected_trampoline::<F> as *const (),
505 )),
506 Box_::into_raw(f),
507 )
508 }
509 }
510}
511
512#[must_use = "The builder must be built to be used"]
517pub struct ColumnViewRowBuilder {
518 builder: glib::object::ObjectBuilder<'static, ColumnViewRow>,
519}
520
521impl ColumnViewRowBuilder {
522 fn new() -> Self {
523 Self {
524 builder: glib::object::Object::builder(),
525 }
526 }
527
528 #[cfg(feature = "v4_12")]
530 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
531 pub fn accessible_description(self, accessible_description: impl Into<glib::GString>) -> Self {
532 Self {
533 builder: self
534 .builder
535 .property("accessible-description", accessible_description.into()),
536 }
537 }
538
539 #[cfg(feature = "v4_12")]
541 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
542 pub fn accessible_label(self, accessible_label: impl Into<glib::GString>) -> Self {
543 Self {
544 builder: self
545 .builder
546 .property("accessible-label", accessible_label.into()),
547 }
548 }
549
550 #[cfg(feature = "v4_12")]
552 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
553 pub fn activatable(self, activatable: bool) -> Self {
554 Self {
555 builder: self.builder.property("activatable", activatable),
556 }
557 }
558
559 #[cfg(feature = "v4_12")]
561 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
562 pub fn focusable(self, focusable: bool) -> Self {
563 Self {
564 builder: self.builder.property("focusable", focusable),
565 }
566 }
567
568 #[cfg(feature = "v4_12")]
570 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
571 pub fn selectable(self, selectable: bool) -> Self {
572 Self {
573 builder: self.builder.property("selectable", selectable),
574 }
575 }
576
577 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
580 pub fn build(self) -> ColumnViewRow {
581 assert_initialized_main_thread!();
582 self.builder.build()
583 }
584}