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