gtk4/auto/
overlay_layout_child.rs1use crate::{ffi, LayoutChild};
6use glib::{
7 prelude::*,
8 signal::{connect_raw, SignalHandlerId},
9 translate::*,
10};
11use std::boxed::Box as Box_;
12
13glib::wrapper! {
14 #[doc(alias = "GtkOverlayLayoutChild")]
15 pub struct OverlayLayoutChild(Object<ffi::GtkOverlayLayoutChild, ffi::GtkOverlayLayoutChildClass>) @extends LayoutChild;
16
17 match fn {
18 type_ => || ffi::gtk_overlay_layout_child_get_type(),
19 }
20}
21
22impl OverlayLayoutChild {
23 #[doc(alias = "gtk_overlay_layout_child_get_clip_overlay")]
24 #[doc(alias = "get_clip_overlay")]
25 #[doc(alias = "clip-overlay")]
26 pub fn is_clip_overlay(&self) -> bool {
27 unsafe {
28 from_glib(ffi::gtk_overlay_layout_child_get_clip_overlay(
29 self.to_glib_none().0,
30 ))
31 }
32 }
33
34 #[doc(alias = "gtk_overlay_layout_child_get_measure")]
35 #[doc(alias = "get_measure")]
36 #[doc(alias = "measure")]
37 pub fn is_measure(&self) -> bool {
38 unsafe {
39 from_glib(ffi::gtk_overlay_layout_child_get_measure(
40 self.to_glib_none().0,
41 ))
42 }
43 }
44
45 #[doc(alias = "gtk_overlay_layout_child_set_clip_overlay")]
46 #[doc(alias = "clip-overlay")]
47 pub fn set_clip_overlay(&self, clip_overlay: bool) {
48 unsafe {
49 ffi::gtk_overlay_layout_child_set_clip_overlay(
50 self.to_glib_none().0,
51 clip_overlay.into_glib(),
52 );
53 }
54 }
55
56 #[doc(alias = "gtk_overlay_layout_child_set_measure")]
57 #[doc(alias = "measure")]
58 pub fn set_measure(&self, measure: bool) {
59 unsafe {
60 ffi::gtk_overlay_layout_child_set_measure(self.to_glib_none().0, measure.into_glib());
61 }
62 }
63
64 #[doc(alias = "clip-overlay")]
65 pub fn connect_clip_overlay_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
66 unsafe extern "C" fn notify_clip_overlay_trampoline<
67 F: Fn(&OverlayLayoutChild) + 'static,
68 >(
69 this: *mut ffi::GtkOverlayLayoutChild,
70 _param_spec: glib::ffi::gpointer,
71 f: glib::ffi::gpointer,
72 ) {
73 let f: &F = &*(f as *const F);
74 f(&from_glib_borrow(this))
75 }
76 unsafe {
77 let f: Box_<F> = Box_::new(f);
78 connect_raw(
79 self.as_ptr() as *mut _,
80 c"notify::clip-overlay".as_ptr() as *const _,
81 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
82 notify_clip_overlay_trampoline::<F> as *const (),
83 )),
84 Box_::into_raw(f),
85 )
86 }
87 }
88
89 #[doc(alias = "measure")]
90 pub fn connect_measure_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
91 unsafe extern "C" fn notify_measure_trampoline<F: Fn(&OverlayLayoutChild) + 'static>(
92 this: *mut ffi::GtkOverlayLayoutChild,
93 _param_spec: glib::ffi::gpointer,
94 f: glib::ffi::gpointer,
95 ) {
96 let f: &F = &*(f as *const F);
97 f(&from_glib_borrow(this))
98 }
99 unsafe {
100 let f: Box_<F> = Box_::new(f);
101 connect_raw(
102 self.as_ptr() as *mut _,
103 c"notify::measure".as_ptr() as *const _,
104 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
105 notify_measure_trampoline::<F> as *const (),
106 )),
107 Box_::into_raw(f),
108 )
109 }
110 }
111}