gtk4/auto/
fixed_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 = "GtkFixedLayoutChild")]
15 pub struct FixedLayoutChild(Object<ffi::GtkFixedLayoutChild, ffi::GtkFixedLayoutChildClass>) @extends LayoutChild;
16
17 match fn {
18 type_ => || ffi::gtk_fixed_layout_child_get_type(),
19 }
20}
21
22impl FixedLayoutChild {
23 #[doc(alias = "gtk_fixed_layout_child_get_transform")]
24 #[doc(alias = "get_transform")]
25 pub fn transform(&self) -> Option<gsk::Transform> {
26 unsafe {
27 from_glib_none(ffi::gtk_fixed_layout_child_get_transform(
28 self.to_glib_none().0,
29 ))
30 }
31 }
32
33 #[doc(alias = "gtk_fixed_layout_child_set_transform")]
34 #[doc(alias = "transform")]
35 pub fn set_transform(&self, transform: &gsk::Transform) {
36 unsafe {
37 ffi::gtk_fixed_layout_child_set_transform(
38 self.to_glib_none().0,
39 transform.to_glib_none().0,
40 );
41 }
42 }
43
44 #[doc(alias = "transform")]
45 pub fn connect_transform_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
46 unsafe extern "C" fn notify_transform_trampoline<F: Fn(&FixedLayoutChild) + 'static>(
47 this: *mut ffi::GtkFixedLayoutChild,
48 _param_spec: glib::ffi::gpointer,
49 f: glib::ffi::gpointer,
50 ) {
51 let f: &F = &*(f as *const F);
52 f(&from_glib_borrow(this))
53 }
54 unsafe {
55 let f: Box_<F> = Box_::new(f);
56 connect_raw(
57 self.as_ptr() as *mut _,
58 c"notify::transform".as_ptr() as *const _,
59 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
60 notify_transform_trampoline::<F> as *const (),
61 )),
62 Box_::into_raw(f),
63 )
64 }
65 }
66}