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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
// 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 crate::Builder; use glib::object::IsA; use glib::translate::*; use std::fmt; glib::wrapper! { /// GtkBuildable allows objects to extend and customize their deserialization /// from [GtkBuilder UI descriptions][BUILDER-UI]. /// The interface includes methods for setting names and properties of objects, /// parsing custom tags and constructing child objects. /// /// The GtkBuildable interface is implemented by all widgets and /// many of the non-widget objects that are provided by GTK+. The /// main user of this interface is [`Builder`][crate::Builder]. There should be /// very little need for applications to call any of these functions directly. /// /// An object only needs to implement this interface if it needs to extend the /// [`Builder`][crate::Builder] format or run any extra routines at deserialization time. /// /// # Implements /// /// [`BuildableExt`][trait@crate::prelude::BuildableExt], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual] #[doc(alias = "GtkBuildable")] pub struct Buildable(Interface<ffi::GtkBuildable, ffi::GtkBuildableIface>); match fn { type_ => || ffi::gtk_buildable_get_type(), } } pub const NONE_BUILDABLE: Option<&Buildable> = None; /// Trait containing all [`struct@Buildable`] methods. /// /// # Implementors /// /// [`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] pub trait BuildableExt: 'static { /// Adds a child to `self`. `type_` is an optional string /// describing how the child should be added. /// ## `builder` /// a [`Builder`][crate::Builder] /// ## `child` /// child to add /// ## `type_` /// kind of child or [`None`] #[doc(alias = "gtk_buildable_add_child")] fn add_child<P: IsA<Builder>, Q: IsA<glib::Object>>( &self, builder: &P, child: &Q, type_: Option<&str>, ); /// Constructs a child of `self` with the name `name`. /// /// [`Builder`][crate::Builder] calls this function if a “constructor” has been /// specified in the UI definition. /// ## `builder` /// [`Builder`][crate::Builder] used to construct this object /// ## `name` /// name of child to construct /// /// # Returns /// /// the constructed child #[doc(alias = "gtk_buildable_construct_child")] fn construct_child<P: IsA<Builder>>(&self, builder: &P, name: &str) -> Option<glib::Object>; //#[doc(alias = "gtk_buildable_custom_finished")] //fn custom_finished<P: IsA<Builder>, Q: IsA<glib::Object>>(&self, builder: &P, child: Option<&Q>, tagname: &str, data: /*Unimplemented*/Option<Fundamental: Pointer>); //#[doc(alias = "gtk_buildable_custom_tag_end")] //fn custom_tag_end<P: IsA<Builder>, Q: IsA<glib::Object>>(&self, builder: &P, child: Option<&Q>, tagname: &str, data: /*Unimplemented*/Option<Fundamental: Pointer>); //#[doc(alias = "gtk_buildable_custom_tag_start")] //fn custom_tag_start<P: IsA<Builder>, Q: IsA<glib::Object>>(&self, builder: &P, child: Option<&Q>, tagname: &str, parser: /*Ignored*/glib::MarkupParser, data: /*Unimplemented*/&mut Option<Fundamental: Pointer>) -> bool; /// Get the internal child called `childname` of the `self` object. /// ## `builder` /// a [`Builder`][crate::Builder] /// ## `childname` /// name of child /// /// # Returns /// /// the internal child of the buildable object #[doc(alias = "gtk_buildable_get_internal_child")] #[doc(alias = "get_internal_child")] fn internal_child<P: IsA<Builder>>(&self, builder: &P, childname: &str) -> Option<glib::Object>; /// Called when the builder finishes the parsing of a /// [GtkBuilder UI definition][BUILDER-UI]. /// Note that this will be called once for each time /// `gtk_builder_add_from_file()` or [`BuilderExt::add_from_string()`][crate::prelude::BuilderExt::add_from_string()] /// is called on a builder. /// ## `builder` /// a [`Builder`][crate::Builder] #[doc(alias = "gtk_buildable_parser_finished")] fn parser_finished<P: IsA<Builder>>(&self, builder: &P); /// Sets the property name `name` to `value` on the `self` object. /// ## `builder` /// a [`Builder`][crate::Builder] /// ## `name` /// name of property /// ## `value` /// value of property #[doc(alias = "gtk_buildable_set_buildable_property")] fn set_buildable_property<P: IsA<Builder>>(&self, builder: &P, name: &str, value: &glib::Value); } impl<O: IsA<Buildable>> BuildableExt for O { fn add_child<P: IsA<Builder>, Q: IsA<glib::Object>>( &self, builder: &P, child: &Q, type_: Option<&str>, ) { unsafe { ffi::gtk_buildable_add_child( self.as_ref().to_glib_none().0, builder.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, type_.to_glib_none().0, ); } } fn construct_child<P: IsA<Builder>>(&self, builder: &P, name: &str) -> Option<glib::Object> { unsafe { from_glib_full(ffi::gtk_buildable_construct_child( self.as_ref().to_glib_none().0, builder.as_ref().to_glib_none().0, name.to_glib_none().0, )) } } //fn custom_finished<P: IsA<Builder>, Q: IsA<glib::Object>>(&self, builder: &P, child: Option<&Q>, tagname: &str, data: /*Unimplemented*/Option<Fundamental: Pointer>) { // unsafe { TODO: call ffi:gtk_buildable_custom_finished() } //} //fn custom_tag_end<P: IsA<Builder>, Q: IsA<glib::Object>>(&self, builder: &P, child: Option<&Q>, tagname: &str, data: /*Unimplemented*/Option<Fundamental: Pointer>) { // unsafe { TODO: call ffi:gtk_buildable_custom_tag_end() } //} //fn custom_tag_start<P: IsA<Builder>, Q: IsA<glib::Object>>(&self, builder: &P, child: Option<&Q>, tagname: &str, parser: /*Ignored*/glib::MarkupParser, data: /*Unimplemented*/&mut Option<Fundamental: Pointer>) -> bool { // unsafe { TODO: call ffi:gtk_buildable_custom_tag_start() } //} fn internal_child<P: IsA<Builder>>( &self, builder: &P, childname: &str, ) -> Option<glib::Object> { unsafe { from_glib_none(ffi::gtk_buildable_get_internal_child( self.as_ref().to_glib_none().0, builder.as_ref().to_glib_none().0, childname.to_glib_none().0, )) } } fn parser_finished<P: IsA<Builder>>(&self, builder: &P) { unsafe { ffi::gtk_buildable_parser_finished( self.as_ref().to_glib_none().0, builder.as_ref().to_glib_none().0, ); } } fn set_buildable_property<P: IsA<Builder>>( &self, builder: &P, name: &str, value: &glib::Value, ) { unsafe { ffi::gtk_buildable_set_buildable_property( self.as_ref().to_glib_none().0, builder.as_ref().to_glib_none().0, name.to_glib_none().0, value.to_glib_none().0, ); } } } impl fmt::Display for Buildable { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Buildable") } }