gtk 0.16.2

Rust bindings for the GTK+ 3 library
Documentation
// 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(),
    }
}

impl Buildable {
    pub const NONE: Option<&'static Buildable> = None;
}

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

    #[doc(alias = "gtk_buildable_construct_child")]
    fn construct_child(&self, builder: &impl IsA<Builder>, name: &str) -> Option<glib::Object>;

    //#[doc(alias = "gtk_buildable_custom_finished")]
    //fn custom_finished(&self, builder: &impl IsA<Builder>, child: Option<&impl IsA<glib::Object>>, tagname: &str, data: /*Unimplemented*/Option<Basic: Pointer>);

    //#[doc(alias = "gtk_buildable_custom_tag_end")]
    //fn custom_tag_end(&self, builder: &impl IsA<Builder>, child: Option<&impl IsA<glib::Object>>, tagname: &str, data: /*Unimplemented*/Option<Basic: Pointer>);

    //#[doc(alias = "gtk_buildable_custom_tag_start")]
    //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;

    #[doc(alias = "gtk_buildable_get_internal_child")]
    #[doc(alias = "get_internal_child")]
    fn internal_child(&self, builder: &impl IsA<Builder>, childname: &str) -> Option<glib::Object>;

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

    #[doc(alias = "gtk_buildable_set_buildable_property")]
    fn set_buildable_property(&self, builder: &impl IsA<Builder>, name: &str, value: &glib::Value);
}

impl<O: IsA<Buildable>> BuildableExt for O {
    fn add_child(
        &self,
        builder: &impl IsA<Builder>,
        child: &impl IsA<glib::Object>,
        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(&self, builder: &impl IsA<Builder>, 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(&self, builder: &impl IsA<Builder>, child: Option<&impl IsA<glib::Object>>, tagname: &str, data: /*Unimplemented*/Option<Basic: Pointer>) {
    //    unsafe { TODO: call ffi:gtk_buildable_custom_finished() }
    //}

    //fn custom_tag_end(&self, builder: &impl IsA<Builder>, child: Option<&impl IsA<glib::Object>>, tagname: &str, data: /*Unimplemented*/Option<Basic: Pointer>) {
    //    unsafe { TODO: call ffi:gtk_buildable_custom_tag_end() }
    //}

    //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 {
    //    unsafe { TODO: call ffi:gtk_buildable_custom_tag_start() }
    //}

    fn internal_child(&self, builder: &impl IsA<Builder>, 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(&self, builder: &impl IsA<Builder>) {
        unsafe {
            ffi::gtk_buildable_parser_finished(
                self.as_ref().to_glib_none().0,
                builder.as_ref().to_glib_none().0,
            );
        }
    }

    fn set_buildable_property(&self, builder: &impl IsA<Builder>, 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")
    }
}