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
// 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! {
    #[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;

pub trait BuildableExt: 'static {
    #[doc(alias = "gtk_buildable_add_child")]
    fn add_child<P: IsA<Builder>, Q: IsA<glib::Object>>(
        &self,
        builder: &P,
        child: &Q,
        type_: Option<&str>,
    );

    #[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;

    #[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>;

    #[doc(alias = "gtk_buildable_parser_finished")]
    fn parser_finished<P: IsA<Builder>>(&self, builder: &P);

    #[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")
    }
}