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, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// GtkBuildable allows objects to extend and customize their deserialization
10    /// from [GtkBuilder UI descriptions][BUILDER-UI].
11    /// The interface includes methods for setting names and properties of objects,
12    /// parsing custom tags and constructing child objects.
13    ///
14    /// The GtkBuildable interface is implemented by all widgets and
15    /// many of the non-widget objects that are provided by GTK+. The
16    /// main user of this interface is [`Builder`][crate::Builder]. There should be
17    /// very little need for applications to call any of these functions directly.
18    ///
19    /// An object only needs to implement this interface if it needs to extend the
20    /// [`Builder`][crate::Builder] format or run any extra routines at deserialization time.
21    ///
22    /// # Implements
23    ///
24    /// [`BuildableExt`][trait@crate::prelude::BuildableExt], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
25    #[doc(alias = "GtkBuildable")]
26    pub struct Buildable(Interface<ffi::GtkBuildable, ffi::GtkBuildableIface>);
27
28    match fn {
29        type_ => || ffi::gtk_buildable_get_type(),
30    }
31}
32
33impl Buildable {
34    pub const NONE: Option<&'static Buildable> = None;
35}
36
37/// Trait containing all [`struct@Buildable`] methods.
38///
39/// # Implementors
40///
41/// [`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]
42pub trait BuildableExt: IsA<Buildable> + 'static {
43    /// Adds a child to `self`. `type_` is an optional string
44    /// describing how the child should be added.
45    /// ## `builder`
46    /// a [`Builder`][crate::Builder]
47    /// ## `child`
48    /// child to add
49    /// ## `type_`
50    /// kind of child or [`None`]
51    #[doc(alias = "gtk_buildable_add_child")]
52    fn add_child(
53        &self,
54        builder: &impl IsA<Builder>,
55        child: &impl IsA<glib::Object>,
56        type_: Option<&str>,
57    ) {
58        unsafe {
59            ffi::gtk_buildable_add_child(
60                self.as_ref().to_glib_none().0,
61                builder.as_ref().to_glib_none().0,
62                child.as_ref().to_glib_none().0,
63                type_.to_glib_none().0,
64            );
65        }
66    }
67
68    /// Constructs a child of `self` with the name `name`.
69    ///
70    /// [`Builder`][crate::Builder] calls this function if a “constructor” has been
71    /// specified in the UI definition.
72    /// ## `builder`
73    /// [`Builder`][crate::Builder] used to construct this object
74    /// ## `name`
75    /// name of child to construct
76    ///
77    /// # Returns
78    ///
79    /// the constructed child
80    #[doc(alias = "gtk_buildable_construct_child")]
81    fn construct_child(&self, builder: &impl IsA<Builder>, name: &str) -> Option<glib::Object> {
82        unsafe {
83            from_glib_full(ffi::gtk_buildable_construct_child(
84                self.as_ref().to_glib_none().0,
85                builder.as_ref().to_glib_none().0,
86                name.to_glib_none().0,
87            ))
88        }
89    }
90
91    //#[doc(alias = "gtk_buildable_custom_finished")]
92    //fn custom_finished(&self, builder: &impl IsA<Builder>, child: Option<&impl IsA<glib::Object>>, tagname: &str, data: /*Unimplemented*/Option<Basic: Pointer>) {
93    //    unsafe { TODO: call ffi:gtk_buildable_custom_finished() }
94    //}
95
96    //#[doc(alias = "gtk_buildable_custom_tag_end")]
97    //fn custom_tag_end(&self, builder: &impl IsA<Builder>, child: Option<&impl IsA<glib::Object>>, tagname: &str, data: /*Unimplemented*/Option<Basic: Pointer>) {
98    //    unsafe { TODO: call ffi:gtk_buildable_custom_tag_end() }
99    //}
100
101    //#[doc(alias = "gtk_buildable_custom_tag_start")]
102    //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 {
103    //    unsafe { TODO: call ffi:gtk_buildable_custom_tag_start() }
104    //}
105
106    /// Get the internal child called `childname` of the `self` object.
107    /// ## `builder`
108    /// a [`Builder`][crate::Builder]
109    /// ## `childname`
110    /// name of child
111    ///
112    /// # Returns
113    ///
114    /// the internal child of the buildable object
115    #[doc(alias = "gtk_buildable_get_internal_child")]
116    #[doc(alias = "get_internal_child")]
117    fn internal_child(&self, builder: &impl IsA<Builder>, childname: &str) -> Option<glib::Object> {
118        unsafe {
119            from_glib_none(ffi::gtk_buildable_get_internal_child(
120                self.as_ref().to_glib_none().0,
121                builder.as_ref().to_glib_none().0,
122                childname.to_glib_none().0,
123            ))
124        }
125    }
126
127    /// Called when the builder finishes the parsing of a
128    /// [GtkBuilder UI definition][BUILDER-UI].
129    /// Note that this will be called once for each time
130    /// `gtk_builder_add_from_file()` or [`BuilderExtManual::add_from_string()`][crate::prelude::BuilderExtManual::add_from_string()]
131    /// is called on a builder.
132    /// ## `builder`
133    /// a [`Builder`][crate::Builder]
134    #[doc(alias = "gtk_buildable_parser_finished")]
135    fn parser_finished(&self, builder: &impl IsA<Builder>) {
136        unsafe {
137            ffi::gtk_buildable_parser_finished(
138                self.as_ref().to_glib_none().0,
139                builder.as_ref().to_glib_none().0,
140            );
141        }
142    }
143
144    /// Sets the property name `name` to `value` on the `self` object.
145    /// ## `builder`
146    /// a [`Builder`][crate::Builder]
147    /// ## `name`
148    /// name of property
149    /// ## `value`
150    /// value of property
151    #[doc(alias = "gtk_buildable_set_buildable_property")]
152    fn set_buildable_property(&self, builder: &impl IsA<Builder>, name: &str, value: &glib::Value) {
153        unsafe {
154            ffi::gtk_buildable_set_buildable_property(
155                self.as_ref().to_glib_none().0,
156                builder.as_ref().to_glib_none().0,
157                name.to_glib_none().0,
158                value.to_glib_none().0,
159            );
160        }
161    }
162}
163
164impl<O: IsA<Buildable>> BuildableExt for O {}