// 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_sys;
use std::boxed::Box as Box_;
use std::fmt;
use std::mem::transmute;
use Object;

glib_wrapper! {
    pub struct Window(Interface<atk_sys::AtkWindow>) @requires Object;

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

pub const NONE_WINDOW: Option<&Window> = None;

pub trait AtkWindowExt: 'static {
    fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

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

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

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

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

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

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

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

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

impl<O: IsA<Window>> AtkWindowExt for O {
    fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn activate_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut atk_sys::AtkWindow,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Window>,
        {
            let f: &F = &*(f as *const F);
            f(&Window::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"activate\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    activate_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

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

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

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

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

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

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

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

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

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