gtk4/auto/
overlay_layout_child.rs
1use 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")]
49 pub struct OverlayLayoutChild(Object<ffi::GtkOverlayLayoutChild, ffi::GtkOverlayLayoutChildClass>) @extends LayoutChild;
50
51 match fn {
52 type_ => || ffi::gtk_overlay_layout_child_get_type(),
53 }
54}
55
56impl OverlayLayoutChild {
57 #[doc(alias = "gtk_overlay_layout_child_get_clip_overlay")]
63 #[doc(alias = "get_clip_overlay")]
64 #[doc(alias = "clip-overlay")]
65 pub fn is_clip_overlay(&self) -> bool {
66 unsafe {
67 from_glib(ffi::gtk_overlay_layout_child_get_clip_overlay(
68 self.to_glib_none().0,
69 ))
70 }
71 }
72
73 #[doc(alias = "gtk_overlay_layout_child_get_measure")]
79 #[doc(alias = "get_measure")]
80 #[doc(alias = "measure")]
81 pub fn is_measure(&self) -> bool {
82 unsafe {
83 from_glib(ffi::gtk_overlay_layout_child_get_measure(
84 self.to_glib_none().0,
85 ))
86 }
87 }
88
89 #[doc(alias = "gtk_overlay_layout_child_set_clip_overlay")]
93 #[doc(alias = "clip-overlay")]
94 pub fn set_clip_overlay(&self, clip_overlay: bool) {
95 unsafe {
96 ffi::gtk_overlay_layout_child_set_clip_overlay(
97 self.to_glib_none().0,
98 clip_overlay.into_glib(),
99 );
100 }
101 }
102
103 #[doc(alias = "gtk_overlay_layout_child_set_measure")]
107 #[doc(alias = "measure")]
108 pub fn set_measure(&self, measure: bool) {
109 unsafe {
110 ffi::gtk_overlay_layout_child_set_measure(self.to_glib_none().0, measure.into_glib());
111 }
112 }
113
114 #[doc(alias = "clip-overlay")]
115 pub fn connect_clip_overlay_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
116 unsafe extern "C" fn notify_clip_overlay_trampoline<
117 F: Fn(&OverlayLayoutChild) + 'static,
118 >(
119 this: *mut ffi::GtkOverlayLayoutChild,
120 _param_spec: glib::ffi::gpointer,
121 f: glib::ffi::gpointer,
122 ) {
123 let f: &F = &*(f as *const F);
124 f(&from_glib_borrow(this))
125 }
126 unsafe {
127 let f: Box_<F> = Box_::new(f);
128 connect_raw(
129 self.as_ptr() as *mut _,
130 b"notify::clip-overlay\0".as_ptr() as *const _,
131 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
132 notify_clip_overlay_trampoline::<F> as *const (),
133 )),
134 Box_::into_raw(f),
135 )
136 }
137 }
138
139 #[doc(alias = "measure")]
140 pub fn connect_measure_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
141 unsafe extern "C" fn notify_measure_trampoline<F: Fn(&OverlayLayoutChild) + 'static>(
142 this: *mut ffi::GtkOverlayLayoutChild,
143 _param_spec: glib::ffi::gpointer,
144 f: glib::ffi::gpointer,
145 ) {
146 let f: &F = &*(f as *const F);
147 f(&from_glib_borrow(this))
148 }
149 unsafe {
150 let f: Box_<F> = Box_::new(f);
151 connect_raw(
152 self.as_ptr() as *mut _,
153 b"notify::measure\0".as_ptr() as *const _,
154 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
155 notify_measure_trampoline::<F> as *const (),
156 )),
157 Box_::into_raw(f),
158 )
159 }
160 }
161}