Skip to main content

gtk/auto/
bin.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::{Buildable, Container, Widget, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// The [`Bin`][crate::Bin] widget is a container with just one child.
10    /// It is not very useful itself, but it is useful for deriving subclasses,
11    /// since it provides common code needed for handling a single child widget.
12    ///
13    /// Many GTK+ widgets are subclasses of [`Bin`][crate::Bin], including [`Window`][crate::Window],
14    /// [`Button`][crate::Button], [`Frame`][crate::Frame], `GtkHandleBox` or [`ScrolledWindow`][crate::ScrolledWindow].
15    ///
16    /// This is an Abstract Base Class, you cannot instantiate it.
17    ///
18    /// # Implements
19    ///
20    /// [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
21    #[doc(alias = "GtkBin")]
22    pub struct Bin(Object<ffi::GtkBin, ffi::GtkBinClass>) @extends Container, Widget, @implements Buildable;
23
24    match fn {
25        type_ => || ffi::gtk_bin_get_type(),
26    }
27}
28
29impl Bin {
30    pub const NONE: Option<&'static Bin> = None;
31}
32
33/// Trait containing all [`struct@Bin`] methods.
34///
35/// # Implementors
36///
37/// [`ActionBar`][struct@crate::ActionBar], [`Bin`][struct@crate::Bin], [`Button`][struct@crate::Button], [`ComboBox`][struct@crate::ComboBox], [`EventBox`][struct@crate::EventBox], [`Expander`][struct@crate::Expander], [`FlowBoxChild`][struct@crate::FlowBoxChild], [`Frame`][struct@crate::Frame], [`ListBoxRow`][struct@crate::ListBoxRow], [`MenuItem`][struct@crate::MenuItem], [`Overlay`][struct@crate::Overlay], [`Popover`][struct@crate::Popover], [`Revealer`][struct@crate::Revealer], [`ScrolledWindow`][struct@crate::ScrolledWindow], [`SearchBar`][struct@crate::SearchBar], [`StackSidebar`][struct@crate::StackSidebar], [`ToolItem`][struct@crate::ToolItem], [`Viewport`][struct@crate::Viewport], [`Window`][struct@crate::Window]
38pub trait BinExt: IsA<Bin> + 'static {
39    /// Gets the child of the [`Bin`][crate::Bin], or [`None`] if the bin contains
40    /// no child widget. The returned widget does not have a reference
41    /// added, so you do not need to unref it.
42    ///
43    /// # Returns
44    ///
45    /// the child of `self`, or [`None`] if it does
46    /// not have a child.
47    #[doc(alias = "gtk_bin_get_child")]
48    #[doc(alias = "get_child")]
49    fn child(&self) -> Option<Widget> {
50        unsafe { from_glib_none(ffi::gtk_bin_get_child(self.as_ref().to_glib_none().0)) }
51    }
52}
53
54impl<O: IsA<Bin>> BinExt for O {}