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 glib;
6use glib::object::IsA;
7use glib::translate::*;
8use gtk_sys;
9use std::fmt;
10use Builder;
11
12glib_wrapper! {
13    pub struct Buildable(Interface<gtk_sys::GtkBuildable>);
14
15    match fn {
16        get_type => || gtk_sys::gtk_buildable_get_type(),
17    }
18}
19
20pub const NONE_BUILDABLE: Option<&Buildable> = None;
21
22pub trait BuildableExt: 'static {
23    fn add_child<P: IsA<Builder>, Q: IsA<glib::Object>>(
24        &self,
25        builder: &P,
26        child: &Q,
27        type_: Option<&str>,
28    );
29
30    fn construct_child<P: IsA<Builder>>(&self, builder: &P, name: &str) -> Option<glib::Object>;
31
32    //fn custom_finished<P: IsA<Builder>, Q: IsA<glib::Object>>(&self, builder: &P, child: Option<&Q>, tagname: &str, data: /*Unimplemented*/Option<Fundamental: Pointer>);
33
34    //fn custom_tag_end<P: IsA<Builder>, Q: IsA<glib::Object>>(&self, builder: &P, child: Option<&Q>, tagname: &str, data: /*Unimplemented*/Option<Fundamental: Pointer>);
35
36    //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;
37
38    fn get_internal_child<P: IsA<Builder>>(
39        &self,
40        builder: &P,
41        childname: &str,
42    ) -> Option<glib::Object>;
43
44    fn parser_finished<P: IsA<Builder>>(&self, builder: &P);
45
46    fn set_buildable_property<P: IsA<Builder>>(&self, builder: &P, name: &str, value: &glib::Value);
47}
48
49impl<O: IsA<Buildable>> BuildableExt for O {
50    fn add_child<P: IsA<Builder>, Q: IsA<glib::Object>>(
51        &self,
52        builder: &P,
53        child: &Q,
54        type_: Option<&str>,
55    ) {
56        unsafe {
57            gtk_sys::gtk_buildable_add_child(
58                self.as_ref().to_glib_none().0,
59                builder.as_ref().to_glib_none().0,
60                child.as_ref().to_glib_none().0,
61                type_.to_glib_none().0,
62            );
63        }
64    }
65
66    fn construct_child<P: IsA<Builder>>(&self, builder: &P, name: &str) -> Option<glib::Object> {
67        unsafe {
68            from_glib_full(gtk_sys::gtk_buildable_construct_child(
69                self.as_ref().to_glib_none().0,
70                builder.as_ref().to_glib_none().0,
71                name.to_glib_none().0,
72            ))
73        }
74    }
75
76    //fn custom_finished<P: IsA<Builder>, Q: IsA<glib::Object>>(&self, builder: &P, child: Option<&Q>, tagname: &str, data: /*Unimplemented*/Option<Fundamental: Pointer>) {
77    //    unsafe { TODO: call gtk_sys:gtk_buildable_custom_finished() }
78    //}
79
80    //fn custom_tag_end<P: IsA<Builder>, Q: IsA<glib::Object>>(&self, builder: &P, child: Option<&Q>, tagname: &str, data: /*Unimplemented*/Option<Fundamental: Pointer>) {
81    //    unsafe { TODO: call gtk_sys:gtk_buildable_custom_tag_end() }
82    //}
83
84    //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 {
85    //    unsafe { TODO: call gtk_sys:gtk_buildable_custom_tag_start() }
86    //}
87
88    fn get_internal_child<P: IsA<Builder>>(
89        &self,
90        builder: &P,
91        childname: &str,
92    ) -> Option<glib::Object> {
93        unsafe {
94            from_glib_none(gtk_sys::gtk_buildable_get_internal_child(
95                self.as_ref().to_glib_none().0,
96                builder.as_ref().to_glib_none().0,
97                childname.to_glib_none().0,
98            ))
99        }
100    }
101
102    fn parser_finished<P: IsA<Builder>>(&self, builder: &P) {
103        unsafe {
104            gtk_sys::gtk_buildable_parser_finished(
105                self.as_ref().to_glib_none().0,
106                builder.as_ref().to_glib_none().0,
107            );
108        }
109    }
110
111    fn set_buildable_property<P: IsA<Builder>>(
112        &self,
113        builder: &P,
114        name: &str,
115        value: &glib::Value,
116    ) {
117        unsafe {
118            gtk_sys::gtk_buildable_set_buildable_property(
119                self.as_ref().to_glib_none().0,
120                builder.as_ref().to_glib_none().0,
121                name.to_glib_none().0,
122                value.to_glib_none().0,
123            );
124        }
125    }
126}
127
128impl fmt::Display for Buildable {
129    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
130        write!(f, "Buildable")
131    }
132}