Skip to main content

gtk/auto/
buildable.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::Builder;
6use glib::{prelude::*, translate::*};
7use std::fmt;
8
9glib::wrapper! {
10    /// GtkBuildable allows objects to extend and customize their deserialization
11    /// from [GtkBuilder UI descriptions][BUILDER-UI].
12    /// The interface includes methods for setting names and properties of objects,
13    /// parsing custom tags and constructing child objects.
14    ///
15    /// The GtkBuildable interface is implemented by all widgets and
16    /// many of the non-widget objects that are provided by GTK+. The
17    /// main user of this interface is [`Builder`][crate::Builder]. There should be
18    /// very little need for applications to call any of these functions directly.
19    ///
20    /// An object only needs to implement this interface if it needs to extend the
21    /// [`Builder`][crate::Builder] format or run any extra routines at deserialization time.
22    ///
23    /// # Implements
24    ///
25    /// [`BuildableExt`][trait@crate::prelude::BuildableExt], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
26    #[doc(alias = "GtkBuildable")]
27    pub struct Buildable(Interface<ffi::GtkBuildable, ffi::GtkBuildableIface>);
28
29    match fn {
30        type_ => || ffi::gtk_buildable_get_type(),
31    }
32}
33
34impl Buildable {
35    pub const NONE: Option<&'static Buildable> = None;
36}
37
38mod sealed {
39    pub trait Sealed {}
40    impl<T: super::IsA<super::Buildable>> Sealed for T {}
41}
42
43/// Trait containing all [`struct@Buildable`] methods.
44///
45/// # Implementors
46///
47/// [`AboutDialog`][struct@crate::AboutDialog], [`AccelLabel`][struct@crate::AccelLabel], [`ActionBar`][struct@crate::ActionBar], [`AppChooserButton`][struct@crate::AppChooserButton], [`AppChooserDialog`][struct@crate::AppChooserDialog], [`AppChooserWidget`][struct@crate::AppChooserWidget], [`ApplicationWindow`][struct@crate::ApplicationWindow], [`AspectFrame`][struct@crate::AspectFrame], [`Assistant`][struct@crate::Assistant], [`Bin`][struct@crate::Bin], [`Box`][struct@crate::Box], [`Buildable`][struct@crate::Buildable], [`ButtonBox`][struct@crate::ButtonBox], [`Button`][struct@crate::Button], [`Calendar`][struct@crate::Calendar], [`CellAreaBox`][struct@crate::CellAreaBox], [`CellArea`][struct@crate::CellArea], [`CellView`][struct@crate::CellView], [`CheckButton`][struct@crate::CheckButton], [`CheckMenuItem`][struct@crate::CheckMenuItem], [`ColorButton`][struct@crate::ColorButton], [`ColorChooserDialog`][struct@crate::ColorChooserDialog], [`ColorChooserWidget`][struct@crate::ColorChooserWidget], [`ComboBoxText`][struct@crate::ComboBoxText], [`ComboBox`][struct@crate::ComboBox], [`Container`][struct@crate::Container], [`Dialog`][struct@crate::Dialog], [`DrawingArea`][struct@crate::DrawingArea], [`EntryCompletion`][struct@crate::EntryCompletion], [`Entry`][struct@crate::Entry], [`EventBox`][struct@crate::EventBox], [`Expander`][struct@crate::Expander], [`FileChooserButton`][struct@crate::FileChooserButton], [`FileChooserDialog`][struct@crate::FileChooserDialog], [`FileChooserWidget`][struct@crate::FileChooserWidget], [`FileFilter`][struct@crate::FileFilter], [`Fixed`][struct@crate::Fixed], [`FlowBoxChild`][struct@crate::FlowBoxChild], [`FlowBox`][struct@crate::FlowBox], [`FontButton`][struct@crate::FontButton], [`FontChooserDialog`][struct@crate::FontChooserDialog], [`FontChooserWidget`][struct@crate::FontChooserWidget], [`Frame`][struct@crate::Frame], [`GLArea`][struct@crate::GLArea], [`Grid`][struct@crate::Grid], [`HeaderBar`][struct@crate::HeaderBar], [`IconView`][struct@crate::IconView], [`Image`][struct@crate::Image], [`InfoBar`][struct@crate::InfoBar], [`Invisible`][struct@crate::Invisible], [`Label`][struct@crate::Label], [`Layout`][struct@crate::Layout], [`LevelBar`][struct@crate::LevelBar], [`LinkButton`][struct@crate::LinkButton], [`ListBoxRow`][struct@crate::ListBoxRow], [`ListBox`][struct@crate::ListBox], [`ListStore`][struct@crate::ListStore], [`LockButton`][struct@crate::LockButton], [`MenuBar`][struct@crate::MenuBar], [`MenuButton`][struct@crate::MenuButton], [`MenuItem`][struct@crate::MenuItem], [`MenuShell`][struct@crate::MenuShell], [`MenuToolButton`][struct@crate::MenuToolButton], [`Menu`][struct@crate::Menu], [`MessageDialog`][struct@crate::MessageDialog], [`Misc`][struct@crate::Misc], [`ModelButton`][struct@crate::ModelButton], [`Notebook`][struct@crate::Notebook], [`OffscreenWindow`][struct@crate::OffscreenWindow], [`Overlay`][struct@crate::Overlay], [`Paned`][struct@crate::Paned], [`PlacesSidebar`][struct@crate::PlacesSidebar], [`Plug`][struct@crate::Plug], [`PopoverMenu`][struct@crate::PopoverMenu], [`Popover`][struct@crate::Popover], [`ProgressBar`][struct@crate::ProgressBar], [`RadioButton`][struct@crate::RadioButton], [`RadioMenuItem`][struct@crate::RadioMenuItem], [`RadioToolButton`][struct@crate::RadioToolButton], [`Range`][struct@crate::Range], [`RecentChooserDialog`][struct@crate::RecentChooserDialog], [`RecentChooserMenu`][struct@crate::RecentChooserMenu], [`RecentChooserWidget`][struct@crate::RecentChooserWidget], [`RecentFilter`][struct@crate::RecentFilter], [`Revealer`][struct@crate::Revealer], [`ScaleButton`][struct@crate::ScaleButton], [`Scale`][struct@crate::Scale], [`Scrollbar`][struct@crate::Scrollbar], [`ScrolledWindow`][struct@crate::ScrolledWindow], [`SearchBar`][struct@crate::SearchBar], [`SearchEntry`][struct@crate::SearchEntry], [`SeparatorMenuItem`][struct@crate::SeparatorMenuItem], [`SeparatorToolItem`][struct@crate::SeparatorToolItem], [`Separator`][struct@crate::Separator], [`ShortcutLabel`][struct@crate::ShortcutLabel], [`ShortcutsGroup`][struct@crate::ShortcutsGroup], [`ShortcutsSection`][struct@crate::ShortcutsSection], [`ShortcutsShortcut`][struct@crate::ShortcutsShortcut], [`ShortcutsWindow`][struct@crate::ShortcutsWindow], [`SizeGroup`][struct@crate::SizeGroup], [`Socket`][struct@crate::Socket], [`SpinButton`][struct@crate::SpinButton], [`Spinner`][struct@crate::Spinner], [`StackSidebar`][struct@crate::StackSidebar], [`StackSwitcher`][struct@crate::StackSwitcher], [`Stack`][struct@crate::Stack], [`Statusbar`][struct@crate::Statusbar], [`Switch`][struct@crate::Switch], [`TextTagTable`][struct@crate::TextTagTable], [`TextView`][struct@crate::TextView], [`ToggleButton`][struct@crate::ToggleButton], [`ToggleToolButton`][struct@crate::ToggleToolButton], [`ToolButton`][struct@crate::ToolButton], [`ToolItemGroup`][struct@crate::ToolItemGroup], [`ToolItem`][struct@crate::ToolItem], [`ToolPalette`][struct@crate::ToolPalette], [`Toolbar`][struct@crate::Toolbar], [`TreeStore`][struct@crate::TreeStore], [`TreeViewColumn`][struct@crate::TreeViewColumn], [`TreeView`][struct@crate::TreeView], [`Viewport`][struct@crate::Viewport], [`VolumeButton`][struct@crate::VolumeButton], [`Widget`][struct@crate::Widget], [`Window`][struct@crate::Window]
48pub trait BuildableExt: IsA<Buildable> + sealed::Sealed + 'static {
49    /// Adds a child to `self`. `type_` is an optional string
50    /// describing how the child should be added.
51    /// ## `builder`
52    /// a [`Builder`][crate::Builder]
53    /// ## `child`
54    /// child to add
55    /// ## `type_`
56    /// kind of child or [`None`]
57    #[doc(alias = "gtk_buildable_add_child")]
58    fn add_child(
59        &self,
60        builder: &impl IsA<Builder>,
61        child: &impl IsA<glib::Object>,
62        type_: Option<&str>,
63    ) {
64        unsafe {
65            ffi::gtk_buildable_add_child(
66                self.as_ref().to_glib_none().0,
67                builder.as_ref().to_glib_none().0,
68                child.as_ref().to_glib_none().0,
69                type_.to_glib_none().0,
70            );
71        }
72    }
73
74    /// Constructs a child of `self` with the name `name`.
75    ///
76    /// [`Builder`][crate::Builder] calls this function if a “constructor” has been
77    /// specified in the UI definition.
78    /// ## `builder`
79    /// [`Builder`][crate::Builder] used to construct this object
80    /// ## `name`
81    /// name of child to construct
82    ///
83    /// # Returns
84    ///
85    /// the constructed child
86    #[doc(alias = "gtk_buildable_construct_child")]
87    fn construct_child(&self, builder: &impl IsA<Builder>, name: &str) -> Option<glib::Object> {
88        unsafe {
89            from_glib_full(ffi::gtk_buildable_construct_child(
90                self.as_ref().to_glib_none().0,
91                builder.as_ref().to_glib_none().0,
92                name.to_glib_none().0,
93            ))
94        }
95    }
96
97    //#[doc(alias = "gtk_buildable_custom_finished")]
98    //fn custom_finished(&self, builder: &impl IsA<Builder>, child: Option<&impl IsA<glib::Object>>, tagname: &str, data: /*Unimplemented*/Option<Basic: Pointer>) {
99    //    unsafe { TODO: call ffi:gtk_buildable_custom_finished() }
100    //}
101
102    //#[doc(alias = "gtk_buildable_custom_tag_end")]
103    //fn custom_tag_end(&self, builder: &impl IsA<Builder>, child: Option<&impl IsA<glib::Object>>, tagname: &str, data: /*Unimplemented*/Option<Basic: Pointer>) {
104    //    unsafe { TODO: call ffi:gtk_buildable_custom_tag_end() }
105    //}
106
107    //#[doc(alias = "gtk_buildable_custom_tag_start")]
108    //fn custom_tag_start(&self, builder: &impl IsA<Builder>, child: Option<&impl IsA<glib::Object>>, tagname: &str, parser: /*Ignored*/glib::MarkupParser, data: /*Unimplemented*/&mut Option<Basic: Pointer>) -> bool {
109    //    unsafe { TODO: call ffi:gtk_buildable_custom_tag_start() }
110    //}
111
112    /// Get the internal child called `childname` of the `self` object.
113    /// ## `builder`
114    /// a [`Builder`][crate::Builder]
115    /// ## `childname`
116    /// name of child
117    ///
118    /// # Returns
119    ///
120    /// the internal child of the buildable object
121    #[doc(alias = "gtk_buildable_get_internal_child")]
122    #[doc(alias = "get_internal_child")]
123    fn internal_child(&self, builder: &impl IsA<Builder>, childname: &str) -> Option<glib::Object> {
124        unsafe {
125            from_glib_none(ffi::gtk_buildable_get_internal_child(
126                self.as_ref().to_glib_none().0,
127                builder.as_ref().to_glib_none().0,
128                childname.to_glib_none().0,
129            ))
130        }
131    }
132
133    /// Called when the builder finishes the parsing of a
134    /// [GtkBuilder UI definition][BUILDER-UI].
135    /// Note that this will be called once for each time
136    /// `gtk_builder_add_from_file()` or [`BuilderExtManual::add_from_string()`][crate::prelude::BuilderExtManual::add_from_string()]
137    /// is called on a builder.
138    /// ## `builder`
139    /// a [`Builder`][crate::Builder]
140    #[doc(alias = "gtk_buildable_parser_finished")]
141    fn parser_finished(&self, builder: &impl IsA<Builder>) {
142        unsafe {
143            ffi::gtk_buildable_parser_finished(
144                self.as_ref().to_glib_none().0,
145                builder.as_ref().to_glib_none().0,
146            );
147        }
148    }
149
150    /// Sets the property name `name` to `value` on the `self` object.
151    /// ## `builder`
152    /// a [`Builder`][crate::Builder]
153    /// ## `name`
154    /// name of property
155    /// ## `value`
156    /// value of property
157    #[doc(alias = "gtk_buildable_set_buildable_property")]
158    fn set_buildable_property(&self, builder: &impl IsA<Builder>, name: &str, value: &glib::Value) {
159        unsafe {
160            ffi::gtk_buildable_set_buildable_property(
161                self.as_ref().to_glib_none().0,
162                builder.as_ref().to_glib_none().0,
163                name.to_glib_none().0,
164                value.to_glib_none().0,
165            );
166        }
167    }
168}
169
170impl<O: IsA<Buildable>> BuildableExt for O {}
171
172impl fmt::Display for Buildable {
173    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
174        f.write_str("Buildable")
175    }
176}