gtk4/auto/
fixed_layout_child.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use 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    /// [`LayoutChild`][crate::LayoutChild] subclass for children in a [`FixedLayout`][crate::FixedLayout].
15    ///
16    /// ## Properties
17    ///
18    ///
19    /// #### `transform`
20    ///  The transform of the child.
21    ///
22    /// Readable | Writeable
23    /// <details><summary><h4>LayoutChild</h4></summary>
24    ///
25    ///
26    /// #### `child-widget`
27    ///  The widget that is associated to the [`LayoutChild`][crate::LayoutChild] instance.
28    ///
29    /// Readable | Writeable | Construct Only
30    ///
31    ///
32    /// #### `layout-manager`
33    ///  The layout manager that created the [`LayoutChild`][crate::LayoutChild] instance.
34    ///
35    /// Readable | Writeable | Construct Only
36    /// </details>
37    ///
38    /// # Implements
39    ///
40    /// [`LayoutChildExt`][trait@crate::prelude::LayoutChildExt], [`trait@glib::ObjectExt`]
41    #[doc(alias = "GtkFixedLayoutChild")]
42    pub struct FixedLayoutChild(Object<ffi::GtkFixedLayoutChild, ffi::GtkFixedLayoutChildClass>) @extends LayoutChild;
43
44    match fn {
45        type_ => || ffi::gtk_fixed_layout_child_get_type(),
46    }
47}
48
49impl FixedLayoutChild {
50    /// Retrieves the transformation of the child.
51    ///
52    /// # Returns
53    ///
54    /// a [`gsk::Transform`][crate::gsk::Transform]
55    #[doc(alias = "gtk_fixed_layout_child_get_transform")]
56    #[doc(alias = "get_transform")]
57    pub fn transform(&self) -> Option<gsk::Transform> {
58        unsafe {
59            from_glib_none(ffi::gtk_fixed_layout_child_get_transform(
60                self.to_glib_none().0,
61            ))
62        }
63    }
64
65    /// Sets the transformation of the child of a [`FixedLayout`][crate::FixedLayout].
66    /// ## `transform`
67    /// a [`gsk::Transform`][crate::gsk::Transform]
68    #[doc(alias = "gtk_fixed_layout_child_set_transform")]
69    #[doc(alias = "transform")]
70    pub fn set_transform(&self, transform: &gsk::Transform) {
71        unsafe {
72            ffi::gtk_fixed_layout_child_set_transform(
73                self.to_glib_none().0,
74                transform.to_glib_none().0,
75            );
76        }
77    }
78
79    #[doc(alias = "transform")]
80    pub fn connect_transform_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
81        unsafe extern "C" fn notify_transform_trampoline<F: Fn(&FixedLayoutChild) + 'static>(
82            this: *mut ffi::GtkFixedLayoutChild,
83            _param_spec: glib::ffi::gpointer,
84            f: glib::ffi::gpointer,
85        ) {
86            let f: &F = &*(f as *const F);
87            f(&from_glib_borrow(this))
88        }
89        unsafe {
90            let f: Box_<F> = Box_::new(f);
91            connect_raw(
92                self.as_ptr() as *mut _,
93                b"notify::transform\0".as_ptr() as *const _,
94                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
95                    notify_transform_trampoline::<F> as *const (),
96                )),
97                Box_::into_raw(f),
98            )
99        }
100    }
101}