gtk4/auto/
overlay_layout_child.rs1use crate::{LayoutChild, 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 = "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 unsafe {
124 let f: &F = &*(f as *const F);
125 f(&from_glib_borrow(this))
126 }
127 }
128 unsafe {
129 let f: Box_<F> = Box_::new(f);
130 connect_raw(
131 self.as_ptr() as *mut _,
132 c"notify::clip-overlay".as_ptr() as *const _,
133 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
134 notify_clip_overlay_trampoline::<F> as *const (),
135 )),
136 Box_::into_raw(f),
137 )
138 }
139 }
140
141 #[doc(alias = "measure")]
142 pub fn connect_measure_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
143 unsafe extern "C" fn notify_measure_trampoline<F: Fn(&OverlayLayoutChild) + 'static>(
144 this: *mut ffi::GtkOverlayLayoutChild,
145 _param_spec: glib::ffi::gpointer,
146 f: glib::ffi::gpointer,
147 ) {
148 unsafe {
149 let f: &F = &*(f as *const F);
150 f(&from_glib_borrow(this))
151 }
152 }
153 unsafe {
154 let f: Box_<F> = Box_::new(f);
155 connect_raw(
156 self.as_ptr() as *mut _,
157 c"notify::measure".as_ptr() as *const _,
158 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
159 notify_measure_trampoline::<F> as *const (),
160 )),
161 Box_::into_raw(f),
162 )
163 }
164 }
165}