gtk4/auto/
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, LayoutManager, Widget};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// [`LayoutChild`][crate::LayoutChild] is the base class for objects that are meant to hold
10    /// layout properties.
11    ///
12    /// If a [`LayoutManager`][crate::LayoutManager] has per-child properties, like their packing type,
13    /// or the horizontal and vertical span, or the icon name, then the layout
14    /// manager should use a [`LayoutChild`][crate::LayoutChild] implementation to store those properties.
15    ///
16    /// A [`LayoutChild`][crate::LayoutChild] instance is only ever valid while a widget is part
17    /// of a layout.
18    ///
19    /// This is an Abstract Base Class, you cannot instantiate it.
20    ///
21    /// ## Properties
22    ///
23    ///
24    /// #### `child-widget`
25    ///  The widget that is associated to the [`LayoutChild`][crate::LayoutChild] instance.
26    ///
27    /// Readable | Writeable | Construct Only
28    ///
29    ///
30    /// #### `layout-manager`
31    ///  The layout manager that created the [`LayoutChild`][crate::LayoutChild] instance.
32    ///
33    /// Readable | Writeable | Construct Only
34    ///
35    /// # Implements
36    ///
37    /// [`LayoutChildExt`][trait@crate::prelude::LayoutChildExt], [`trait@glib::ObjectExt`]
38    #[doc(alias = "GtkLayoutChild")]
39    pub struct LayoutChild(Object<ffi::GtkLayoutChild, ffi::GtkLayoutChildClass>);
40
41    match fn {
42        type_ => || ffi::gtk_layout_child_get_type(),
43    }
44}
45
46impl LayoutChild {
47    pub const NONE: Option<&'static LayoutChild> = None;
48}
49
50mod sealed {
51    pub trait Sealed {}
52    impl<T: super::IsA<super::LayoutChild>> Sealed for T {}
53}
54
55/// Trait containing all [`struct@LayoutChild`] methods.
56///
57/// # Implementors
58///
59/// [`ConstraintLayoutChild`][struct@crate::ConstraintLayoutChild], [`FixedLayoutChild`][struct@crate::FixedLayoutChild], [`GridLayoutChild`][struct@crate::GridLayoutChild], [`LayoutChild`][struct@crate::LayoutChild], [`OverlayLayoutChild`][struct@crate::OverlayLayoutChild]
60pub trait LayoutChildExt: IsA<LayoutChild> + sealed::Sealed + 'static {
61    /// Retrieves the [`Widget`][crate::Widget] associated to the given @self.
62    ///
63    /// # Returns
64    ///
65    /// a [`Widget`][crate::Widget]
66    #[doc(alias = "gtk_layout_child_get_child_widget")]
67    #[doc(alias = "get_child_widget")]
68    #[doc(alias = "child-widget")]
69    fn child_widget(&self) -> Widget {
70        unsafe {
71            from_glib_none(ffi::gtk_layout_child_get_child_widget(
72                self.as_ref().to_glib_none().0,
73            ))
74        }
75    }
76
77    /// Retrieves the [`LayoutManager`][crate::LayoutManager] instance that created the
78    /// given @self.
79    ///
80    /// # Returns
81    ///
82    /// a [`LayoutManager`][crate::LayoutManager]
83    #[doc(alias = "gtk_layout_child_get_layout_manager")]
84    #[doc(alias = "get_layout_manager")]
85    #[doc(alias = "layout-manager")]
86    fn layout_manager(&self) -> LayoutManager {
87        unsafe {
88            from_glib_none(ffi::gtk_layout_child_get_layout_manager(
89                self.as_ref().to_glib_none().0,
90            ))
91        }
92    }
93}
94
95impl<O: IsA<LayoutChild>> LayoutChildExt for O {}