1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use glib::object::IsA;
use glib::translate::*;
use gtk_sys;
use std::fmt;
use Buildable;
use Container;
use Widget;

glib_wrapper! {
    /// The `Bin` widget is a container with just one child.
    /// It is not very useful itself, but it is useful for deriving subclasses,
    /// since it provides common code needed for handling a single child widget.
    ///
    /// Many GTK+ widgets are subclasses of `Bin`, including `Window`,
    /// `Button`, `Frame`, `HandleBox` or `ScrolledWindow`.
    ///
    /// # Implements
    ///
    /// [`BinExt`](trait.BinExt.html), [`ContainerExt`](trait.ContainerExt.html), [`WidgetExt`](trait.WidgetExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html), [`BuildableExt`](trait.BuildableExt.html), [`WidgetExtManual`](prelude/trait.WidgetExtManual.html), [`BuildableExtManual`](prelude/trait.BuildableExtManual.html)
    pub struct Bin(Object<gtk_sys::GtkBin, gtk_sys::GtkBinClass, BinClass>) @extends Container, Widget, @implements Buildable;

    match fn {
        get_type => || gtk_sys::gtk_bin_get_type(),
    }
}

pub const NONE_BIN: Option<&Bin> = None;

/// Trait containing all `Bin` methods.
///
/// # Implementors
///
/// [`ActionBar`](struct.ActionBar.html), [`Bin`](struct.Bin.html), [`Button`](struct.Button.html), [`ComboBox`](struct.ComboBox.html), [`EventBox`](struct.EventBox.html), [`Expander`](struct.Expander.html), [`FlowBoxChild`](struct.FlowBoxChild.html), [`Frame`](struct.Frame.html), [`ListBoxRow`](struct.ListBoxRow.html), [`MenuItem`](struct.MenuItem.html), [`Overlay`](struct.Overlay.html), [`Popover`](struct.Popover.html), [`Revealer`](struct.Revealer.html), [`ScrolledWindow`](struct.ScrolledWindow.html), [`SearchBar`](struct.SearchBar.html), [`StackSidebar`](struct.StackSidebar.html), [`ToolItem`](struct.ToolItem.html), [`Viewport`](struct.Viewport.html), [`Window`](struct.Window.html)
pub trait BinExt: 'static {
    /// Gets the child of the `Bin`, or `None` if the bin contains
    /// no child widget. The returned widget does not have a reference
    /// added, so you do not need to unref it.
    ///
    /// # Returns
    ///
    /// the child of `self`, or `None` if it does
    /// not have a child.
    fn get_child(&self) -> Option<Widget>;
}

impl<O: IsA<Bin>> BinExt for O {
    fn get_child(&self) -> Option<Widget> {
        unsafe { from_glib_none(gtk_sys::gtk_bin_get_child(self.as_ref().to_glib_none().0)) }
    }
}

impl fmt::Display for Bin {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "Bin")
    }
}