// 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 atk_sys;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::value::SetValueOptional;
use glib::GString;
use glib::StaticType;
use glib::Value;
use glib_sys;
use gobject_sys;
use libc;
use std::boxed::Box as Box_;
use std::fmt;
use std::mem::transmute;
use Layer;
use RelationSet;
use RelationType;
use Role;
use State;
use StateSet;

glib_wrapper! {
    pub struct Object(Object<atk_sys::AtkObject, atk_sys::AtkObjectClass, ObjectClass>);

    match fn {
        get_type => || atk_sys::atk_object_get_type(),
    }
}

pub const NONE_OBJECT: Option<&Object> = None;

pub trait AtkObjectExt: 'static {
    fn add_relationship<P: IsA<Object>>(&self, relationship: RelationType, target: &P) -> bool;

    #[cfg(any(feature = "v2_34", feature = "dox"))]
    fn get_accessible_id(&self) -> Option<GString>;

    //fn get_attributes(&self) -> /*Ignored*/Option<AttributeSet>;

    fn get_description(&self) -> Option<GString>;

    fn get_index_in_parent(&self) -> i32;

    fn get_layer(&self) -> Layer;

    fn get_mdi_zorder(&self) -> i32;

    fn get_n_accessible_children(&self) -> i32;

    fn get_name(&self) -> Option<GString>;

    fn get_object_locale(&self) -> Option<GString>;

    fn get_parent(&self) -> Option<Object>;

    fn get_role(&self) -> Role;

    //fn initialize(&self, data: /*Unimplemented*/Option<Fundamental: Pointer>);

    fn notify_state_change(&self, state: State, value: bool);

    fn peek_parent(&self) -> Option<Object>;

    fn ref_accessible_child(&self, i: i32) -> Option<Object>;

    fn ref_relation_set(&self) -> Option<RelationSet>;

    fn ref_state_set(&self) -> Option<StateSet>;

    fn remove_relationship<P: IsA<Object>>(&self, relationship: RelationType, target: &P) -> bool;

    #[cfg(any(feature = "v2_34", feature = "dox"))]
    fn set_accessible_id(&self, name: &str);

    fn set_description(&self, description: &str);

    fn set_name(&self, name: &str);

    fn set_parent<P: IsA<Object>>(&self, parent: &P);

    fn set_role(&self, role: Role);

    fn get_property_accessible_component_layer(&self) -> i32;

    fn get_property_accessible_component_mdi_zorder(&self) -> i32;

    fn get_property_accessible_description(&self) -> Option<GString>;

    fn set_property_accessible_description(&self, accessible_description: Option<&str>);

    fn get_property_accessible_hypertext_nlinks(&self) -> i32;

    fn get_property_accessible_name(&self) -> Option<GString>;

    fn set_property_accessible_name(&self, accessible_name: Option<&str>);

    fn get_property_accessible_parent(&self) -> Option<Object>;

    fn set_property_accessible_parent<P: IsA<Object> + SetValueOptional>(
        &self,
        accessible_parent: Option<&P>,
    );

    fn get_property_accessible_role(&self) -> Role;

    fn set_property_accessible_role(&self, accessible_role: Role);

    fn get_property_accessible_table_caption(&self) -> Option<GString>;

    fn set_property_accessible_table_caption(&self, accessible_table_caption: Option<&str>);

    fn get_property_accessible_table_caption_object(&self) -> Option<Object>;

    fn set_property_accessible_table_caption_object<P: IsA<Object> + SetValueOptional>(
        &self,
        accessible_table_caption_object: Option<&P>,
    );

    fn get_property_accessible_table_column_description(&self) -> Option<GString>;

    fn set_property_accessible_table_column_description(
        &self,
        accessible_table_column_description: Option<&str>,
    );

    fn get_property_accessible_table_column_header(&self) -> Option<Object>;

    fn set_property_accessible_table_column_header<P: IsA<Object> + SetValueOptional>(
        &self,
        accessible_table_column_header: Option<&P>,
    );

    fn get_property_accessible_table_row_description(&self) -> Option<GString>;

    fn set_property_accessible_table_row_description(
        &self,
        accessible_table_row_description: Option<&str>,
    );

    fn get_property_accessible_table_row_header(&self) -> Option<Object>;

    fn set_property_accessible_table_row_header<P: IsA<Object> + SetValueOptional>(
        &self,
        accessible_table_row_header: Option<&P>,
    );

    fn get_property_accessible_table_summary(&self) -> Option<Object>;

    fn set_property_accessible_table_summary<P: IsA<Object> + SetValueOptional>(
        &self,
        accessible_table_summary: Option<&P>,
    );

    fn get_property_accessible_value(&self) -> f64;

    fn set_property_accessible_value(&self, accessible_value: f64);

    fn connect_active_descendant_changed<F: Fn(&Self, &Object) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_children_changed<F: Fn(&Self, u32, &Object) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    //fn connect_property_change<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;

    fn connect_state_change<F: Fn(&Self, &str, bool) + 'static>(&self, f: F) -> SignalHandlerId;

    fn connect_visible_data_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

    fn connect_property_accessible_component_layer_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_component_mdi_zorder_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_description_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_hypertext_nlinks_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_name_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_parent_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_role_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_table_caption_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_table_caption_object_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_table_column_description_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_table_column_header_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_table_row_description_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_table_row_header_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_table_summary_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_accessible_value_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;
}

impl<O: IsA<Object>> AtkObjectExt for O {
    fn add_relationship<P: IsA<Object>>(&self, relationship: RelationType, target: &P) -> bool {
        unsafe {
            from_glib(atk_sys::atk_object_add_relationship(
                self.as_ref().to_glib_none().0,
                relationship.to_glib(),
                target.as_ref().to_glib_none().0,
            ))
        }
    }

    #[cfg(any(feature = "v2_34", feature = "dox"))]
    fn get_accessible_id(&self) -> Option<GString> {
        unsafe {
            from_glib_none(atk_sys::atk_object_get_accessible_id(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    //fn get_attributes(&self) -> /*Ignored*/Option<AttributeSet> {
    //    unsafe { TODO: call atk_sys:atk_object_get_attributes() }
    //}

    fn get_description(&self) -> Option<GString> {
        unsafe {
            from_glib_none(atk_sys::atk_object_get_description(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_index_in_parent(&self) -> i32 {
        unsafe { atk_sys::atk_object_get_index_in_parent(self.as_ref().to_glib_none().0) }
    }

    fn get_layer(&self) -> Layer {
        unsafe {
            from_glib(atk_sys::atk_object_get_layer(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_mdi_zorder(&self) -> i32 {
        unsafe { atk_sys::atk_object_get_mdi_zorder(self.as_ref().to_glib_none().0) }
    }

    fn get_n_accessible_children(&self) -> i32 {
        unsafe { atk_sys::atk_object_get_n_accessible_children(self.as_ref().to_glib_none().0) }
    }

    fn get_name(&self) -> Option<GString> {
        unsafe { from_glib_none(atk_sys::atk_object_get_name(self.as_ref().to_glib_none().0)) }
    }

    fn get_object_locale(&self) -> Option<GString> {
        unsafe {
            from_glib_none(atk_sys::atk_object_get_object_locale(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_parent(&self) -> Option<Object> {
        unsafe {
            from_glib_none(atk_sys::atk_object_get_parent(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_role(&self) -> Role {
        unsafe { from_glib(atk_sys::atk_object_get_role(self.as_ref().to_glib_none().0)) }
    }

    //fn initialize(&self, data: /*Unimplemented*/Option<Fundamental: Pointer>) {
    //    unsafe { TODO: call atk_sys:atk_object_initialize() }
    //}

    fn notify_state_change(&self, state: State, value: bool) {
        unsafe {
            atk_sys::atk_object_notify_state_change(
                self.as_ref().to_glib_none().0,
                state,
                value.to_glib(),
            );
        }
    }

    fn peek_parent(&self) -> Option<Object> {
        unsafe {
            from_glib_none(atk_sys::atk_object_peek_parent(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn ref_accessible_child(&self, i: i32) -> Option<Object> {
        unsafe {
            from_glib_full(atk_sys::atk_object_ref_accessible_child(
                self.as_ref().to_glib_none().0,
                i,
            ))
        }
    }

    fn ref_relation_set(&self) -> Option<RelationSet> {
        unsafe {
            from_glib_full(atk_sys::atk_object_ref_relation_set(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn ref_state_set(&self) -> Option<StateSet> {
        unsafe {
            from_glib_full(atk_sys::atk_object_ref_state_set(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn remove_relationship<P: IsA<Object>>(&self, relationship: RelationType, target: &P) -> bool {
        unsafe {
            from_glib(atk_sys::atk_object_remove_relationship(
                self.as_ref().to_glib_none().0,
                relationship.to_glib(),
                target.as_ref().to_glib_none().0,
            ))
        }
    }

    #[cfg(any(feature = "v2_34", feature = "dox"))]
    fn set_accessible_id(&self, name: &str) {
        unsafe {
            atk_sys::atk_object_set_accessible_id(
                self.as_ref().to_glib_none().0,
                name.to_glib_none().0,
            );
        }
    }

    fn set_description(&self, description: &str) {
        unsafe {
            atk_sys::atk_object_set_description(
                self.as_ref().to_glib_none().0,
                description.to_glib_none().0,
            );
        }
    }

    fn set_name(&self, name: &str) {
        unsafe {
            atk_sys::atk_object_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0);
        }
    }

    fn set_parent<P: IsA<Object>>(&self, parent: &P) {
        unsafe {
            atk_sys::atk_object_set_parent(
                self.as_ref().to_glib_none().0,
                parent.as_ref().to_glib_none().0,
            );
        }
    }

    fn set_role(&self, role: Role) {
        unsafe {
            atk_sys::atk_object_set_role(self.as_ref().to_glib_none().0, role.to_glib());
        }
    }

    fn get_property_accessible_component_layer(&self) -> i32 {
        unsafe {
            let mut value = Value::from_type(<i32 as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-component-layer\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-component-layer` getter")
                .unwrap()
        }
    }

    fn get_property_accessible_component_mdi_zorder(&self) -> i32 {
        unsafe {
            let mut value = Value::from_type(<i32 as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-component-mdi-zorder\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-component-mdi-zorder` getter")
                .unwrap()
        }
    }

    fn get_property_accessible_description(&self) -> Option<GString> {
        unsafe {
            let mut value = Value::from_type(<GString as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-description\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-description` getter")
        }
    }

    fn set_property_accessible_description(&self, accessible_description: Option<&str>) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-description\0".as_ptr() as *const _,
                Value::from(accessible_description).to_glib_none().0,
            );
        }
    }

    fn get_property_accessible_hypertext_nlinks(&self) -> i32 {
        unsafe {
            let mut value = Value::from_type(<i32 as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-hypertext-nlinks\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-hypertext-nlinks` getter")
                .unwrap()
        }
    }

    fn get_property_accessible_name(&self) -> Option<GString> {
        unsafe {
            let mut value = Value::from_type(<GString as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-name\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-name` getter")
        }
    }

    fn set_property_accessible_name(&self, accessible_name: Option<&str>) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-name\0".as_ptr() as *const _,
                Value::from(accessible_name).to_glib_none().0,
            );
        }
    }

    fn get_property_accessible_parent(&self) -> Option<Object> {
        unsafe {
            let mut value = Value::from_type(<Object as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-parent\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-parent` getter")
        }
    }

    fn set_property_accessible_parent<P: IsA<Object> + SetValueOptional>(
        &self,
        accessible_parent: Option<&P>,
    ) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-parent\0".as_ptr() as *const _,
                Value::from(accessible_parent).to_glib_none().0,
            );
        }
    }

    fn get_property_accessible_role(&self) -> Role {
        unsafe {
            let mut value = Value::from_type(<Role as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-role\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-role` getter")
                .unwrap()
        }
    }

    fn set_property_accessible_role(&self, accessible_role: Role) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-role\0".as_ptr() as *const _,
                Value::from(&accessible_role).to_glib_none().0,
            );
        }
    }

    fn get_property_accessible_table_caption(&self) -> Option<GString> {
        unsafe {
            let mut value = Value::from_type(<GString as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-caption\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-table-caption` getter")
        }
    }

    fn set_property_accessible_table_caption(&self, accessible_table_caption: Option<&str>) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-caption\0".as_ptr() as *const _,
                Value::from(accessible_table_caption).to_glib_none().0,
            );
        }
    }

    fn get_property_accessible_table_caption_object(&self) -> Option<Object> {
        unsafe {
            let mut value = Value::from_type(<Object as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-caption-object\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-table-caption-object` getter")
        }
    }

    fn set_property_accessible_table_caption_object<P: IsA<Object> + SetValueOptional>(
        &self,
        accessible_table_caption_object: Option<&P>,
    ) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-caption-object\0".as_ptr() as *const _,
                Value::from(accessible_table_caption_object)
                    .to_glib_none()
                    .0,
            );
        }
    }

    fn get_property_accessible_table_column_description(&self) -> Option<GString> {
        unsafe {
            let mut value = Value::from_type(<GString as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-column-description\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-table-column-description` getter")
        }
    }

    fn set_property_accessible_table_column_description(
        &self,
        accessible_table_column_description: Option<&str>,
    ) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-column-description\0".as_ptr() as *const _,
                Value::from(accessible_table_column_description)
                    .to_glib_none()
                    .0,
            );
        }
    }

    fn get_property_accessible_table_column_header(&self) -> Option<Object> {
        unsafe {
            let mut value = Value::from_type(<Object as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-column-header\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-table-column-header` getter")
        }
    }

    fn set_property_accessible_table_column_header<P: IsA<Object> + SetValueOptional>(
        &self,
        accessible_table_column_header: Option<&P>,
    ) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-column-header\0".as_ptr() as *const _,
                Value::from(accessible_table_column_header).to_glib_none().0,
            );
        }
    }

    fn get_property_accessible_table_row_description(&self) -> Option<GString> {
        unsafe {
            let mut value = Value::from_type(<GString as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-row-description\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-table-row-description` getter")
        }
    }

    fn set_property_accessible_table_row_description(
        &self,
        accessible_table_row_description: Option<&str>,
    ) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-row-description\0".as_ptr() as *const _,
                Value::from(accessible_table_row_description)
                    .to_glib_none()
                    .0,
            );
        }
    }

    fn get_property_accessible_table_row_header(&self) -> Option<Object> {
        unsafe {
            let mut value = Value::from_type(<Object as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-row-header\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-table-row-header` getter")
        }
    }

    fn set_property_accessible_table_row_header<P: IsA<Object> + SetValueOptional>(
        &self,
        accessible_table_row_header: Option<&P>,
    ) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-row-header\0".as_ptr() as *const _,
                Value::from(accessible_table_row_header).to_glib_none().0,
            );
        }
    }

    fn get_property_accessible_table_summary(&self) -> Option<Object> {
        unsafe {
            let mut value = Value::from_type(<Object as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-summary\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-table-summary` getter")
        }
    }

    fn set_property_accessible_table_summary<P: IsA<Object> + SetValueOptional>(
        &self,
        accessible_table_summary: Option<&P>,
    ) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-table-summary\0".as_ptr() as *const _,
                Value::from(accessible_table_summary).to_glib_none().0,
            );
        }
    }

    fn get_property_accessible_value(&self) -> f64 {
        unsafe {
            let mut value = Value::from_type(<f64 as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-value\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `accessible-value` getter")
                .unwrap()
        }
    }

    fn set_property_accessible_value(&self, accessible_value: f64) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"accessible-value\0".as_ptr() as *const _,
                Value::from(&accessible_value).to_glib_none().0,
            );
        }
    }

    fn connect_active_descendant_changed<F: Fn(&Self, &Object) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn active_descendant_changed_trampoline<P, F: Fn(&P, &Object) + 'static>(
            this: *mut atk_sys::AtkObject,
            arg1: *mut atk_sys::AtkObject,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(
                &Object::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(arg1),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"active-descendant-changed\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    active_descendant_changed_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_children_changed<F: Fn(&Self, u32, &Object) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn children_changed_trampoline<P, F: Fn(&P, u32, &Object) + 'static>(
            this: *mut atk_sys::AtkObject,
            arg1: libc::c_uint,
            arg2: *mut atk_sys::AtkObject,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(
                &Object::from_glib_borrow(this).unsafe_cast_ref(),
                arg1,
                &from_glib_borrow(arg2),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"children-changed\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    children_changed_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    //fn connect_property_change<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
    //    Ignored arg1: Atk.PropertyValues
    //}

    fn connect_state_change<F: Fn(&Self, &str, bool) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn state_change_trampoline<P, F: Fn(&P, &str, bool) + 'static>(
            this: *mut atk_sys::AtkObject,
            arg1: *mut libc::c_char,
            arg2: glib_sys::gboolean,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(
                &Object::from_glib_borrow(this).unsafe_cast_ref(),
                &GString::from_glib_borrow(arg1),
                from_glib(arg2),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"state-change\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    state_change_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_visible_data_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn visible_data_changed_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut atk_sys::AtkObject,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"visible-data-changed\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    visible_data_changed_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_component_layer_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_component_layer_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-component-layer\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_component_layer_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_component_mdi_zorder_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_component_mdi_zorder_trampoline<
            P,
            F: Fn(&P) + 'static,
        >(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-component-mdi-zorder\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_component_mdi_zorder_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_description_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_description_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-description\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_description_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_hypertext_nlinks_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_hypertext_nlinks_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-hypertext-nlinks\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_hypertext_nlinks_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_name_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_name_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-name\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_name_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_parent_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_parent_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-parent\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_parent_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_role_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_role_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-role\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_role_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_table_caption_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_table_caption_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-table-caption\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_table_caption_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_table_caption_object_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_table_caption_object_trampoline<
            P,
            F: Fn(&P) + 'static,
        >(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-table-caption-object\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_table_caption_object_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_table_column_description_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_table_column_description_trampoline<
            P,
            F: Fn(&P) + 'static,
        >(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-table-column-description\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_table_column_description_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_table_column_header_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_table_column_header_trampoline<
            P,
            F: Fn(&P) + 'static,
        >(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-table-column-header\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_table_column_header_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_table_row_description_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_table_row_description_trampoline<
            P,
            F: Fn(&P) + 'static,
        >(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-table-row-description\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_table_row_description_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_table_row_header_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_table_row_header_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-table-row-header\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_table_row_header_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_table_summary_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_table_summary_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-table-summary\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_table_summary_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_accessible_value_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_accessible_value_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut atk_sys::AtkObject,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Object>,
        {
            let f: &F = &*(f as *const F);
            f(&Object::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::accessible-value\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_accessible_value_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl fmt::Display for Object {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "Object")
    }
}
