atk/auto/
window.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 atk_sys;
6use glib::object::Cast;
7use glib::object::IsA;
8use glib::signal::connect_raw;
9use glib::signal::SignalHandlerId;
10use glib::translate::*;
11use glib_sys;
12use std::boxed::Box as Box_;
13use std::fmt;
14use std::mem::transmute;
15use Object;
16
17glib_wrapper! {
18    pub struct Window(Interface<atk_sys::AtkWindow>) @requires Object;
19
20    match fn {
21        get_type => || atk_sys::atk_window_get_type(),
22    }
23}
24
25pub const NONE_WINDOW: Option<&Window> = None;
26
27pub trait AtkWindowExt: 'static {
28    fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
29
30    fn connect_create<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
31
32    fn connect_deactivate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
33
34    fn connect_destroy<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
35
36    fn connect_maximize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
37
38    fn connect_minimize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
39
40    fn connect_move<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
41
42    fn connect_resize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
43
44    fn connect_restore<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
45}
46
47impl<O: IsA<Window>> AtkWindowExt for O {
48    fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
49        unsafe extern "C" fn activate_trampoline<P, F: Fn(&P) + 'static>(
50            this: *mut atk_sys::AtkWindow,
51            f: glib_sys::gpointer,
52        ) where
53            P: IsA<Window>,
54        {
55            let f: &F = &*(f as *const F);
56            f(&Window::from_glib_borrow(this).unsafe_cast())
57        }
58        unsafe {
59            let f: Box_<F> = Box_::new(f);
60            connect_raw(
61                self.as_ptr() as *mut _,
62                b"activate\0".as_ptr() as *const _,
63                Some(transmute(activate_trampoline::<Self, F> as usize)),
64                Box_::into_raw(f),
65            )
66        }
67    }
68
69    fn connect_create<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
70        unsafe extern "C" fn create_trampoline<P, F: Fn(&P) + 'static>(
71            this: *mut atk_sys::AtkWindow,
72            f: glib_sys::gpointer,
73        ) where
74            P: IsA<Window>,
75        {
76            let f: &F = &*(f as *const F);
77            f(&Window::from_glib_borrow(this).unsafe_cast())
78        }
79        unsafe {
80            let f: Box_<F> = Box_::new(f);
81            connect_raw(
82                self.as_ptr() as *mut _,
83                b"create\0".as_ptr() as *const _,
84                Some(transmute(create_trampoline::<Self, F> as usize)),
85                Box_::into_raw(f),
86            )
87        }
88    }
89
90    fn connect_deactivate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
91        unsafe extern "C" fn deactivate_trampoline<P, F: Fn(&P) + 'static>(
92            this: *mut atk_sys::AtkWindow,
93            f: glib_sys::gpointer,
94        ) where
95            P: IsA<Window>,
96        {
97            let f: &F = &*(f as *const F);
98            f(&Window::from_glib_borrow(this).unsafe_cast())
99        }
100        unsafe {
101            let f: Box_<F> = Box_::new(f);
102            connect_raw(
103                self.as_ptr() as *mut _,
104                b"deactivate\0".as_ptr() as *const _,
105                Some(transmute(deactivate_trampoline::<Self, F> as usize)),
106                Box_::into_raw(f),
107            )
108        }
109    }
110
111    fn connect_destroy<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
112        unsafe extern "C" fn destroy_trampoline<P, F: Fn(&P) + 'static>(
113            this: *mut atk_sys::AtkWindow,
114            f: glib_sys::gpointer,
115        ) where
116            P: IsA<Window>,
117        {
118            let f: &F = &*(f as *const F);
119            f(&Window::from_glib_borrow(this).unsafe_cast())
120        }
121        unsafe {
122            let f: Box_<F> = Box_::new(f);
123            connect_raw(
124                self.as_ptr() as *mut _,
125                b"destroy\0".as_ptr() as *const _,
126                Some(transmute(destroy_trampoline::<Self, F> as usize)),
127                Box_::into_raw(f),
128            )
129        }
130    }
131
132    fn connect_maximize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
133        unsafe extern "C" fn maximize_trampoline<P, F: Fn(&P) + 'static>(
134            this: *mut atk_sys::AtkWindow,
135            f: glib_sys::gpointer,
136        ) where
137            P: IsA<Window>,
138        {
139            let f: &F = &*(f as *const F);
140            f(&Window::from_glib_borrow(this).unsafe_cast())
141        }
142        unsafe {
143            let f: Box_<F> = Box_::new(f);
144            connect_raw(
145                self.as_ptr() as *mut _,
146                b"maximize\0".as_ptr() as *const _,
147                Some(transmute(maximize_trampoline::<Self, F> as usize)),
148                Box_::into_raw(f),
149            )
150        }
151    }
152
153    fn connect_minimize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
154        unsafe extern "C" fn minimize_trampoline<P, F: Fn(&P) + 'static>(
155            this: *mut atk_sys::AtkWindow,
156            f: glib_sys::gpointer,
157        ) where
158            P: IsA<Window>,
159        {
160            let f: &F = &*(f as *const F);
161            f(&Window::from_glib_borrow(this).unsafe_cast())
162        }
163        unsafe {
164            let f: Box_<F> = Box_::new(f);
165            connect_raw(
166                self.as_ptr() as *mut _,
167                b"minimize\0".as_ptr() as *const _,
168                Some(transmute(minimize_trampoline::<Self, F> as usize)),
169                Box_::into_raw(f),
170            )
171        }
172    }
173
174    fn connect_move<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
175        unsafe extern "C" fn move_trampoline<P, F: Fn(&P) + 'static>(
176            this: *mut atk_sys::AtkWindow,
177            f: glib_sys::gpointer,
178        ) where
179            P: IsA<Window>,
180        {
181            let f: &F = &*(f as *const F);
182            f(&Window::from_glib_borrow(this).unsafe_cast())
183        }
184        unsafe {
185            let f: Box_<F> = Box_::new(f);
186            connect_raw(
187                self.as_ptr() as *mut _,
188                b"move\0".as_ptr() as *const _,
189                Some(transmute(move_trampoline::<Self, F> as usize)),
190                Box_::into_raw(f),
191            )
192        }
193    }
194
195    fn connect_resize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
196        unsafe extern "C" fn resize_trampoline<P, F: Fn(&P) + 'static>(
197            this: *mut atk_sys::AtkWindow,
198            f: glib_sys::gpointer,
199        ) where
200            P: IsA<Window>,
201        {
202            let f: &F = &*(f as *const F);
203            f(&Window::from_glib_borrow(this).unsafe_cast())
204        }
205        unsafe {
206            let f: Box_<F> = Box_::new(f);
207            connect_raw(
208                self.as_ptr() as *mut _,
209                b"resize\0".as_ptr() as *const _,
210                Some(transmute(resize_trampoline::<Self, F> as usize)),
211                Box_::into_raw(f),
212            )
213        }
214    }
215
216    fn connect_restore<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
217        unsafe extern "C" fn restore_trampoline<P, F: Fn(&P) + 'static>(
218            this: *mut atk_sys::AtkWindow,
219            f: glib_sys::gpointer,
220        ) where
221            P: IsA<Window>,
222        {
223            let f: &F = &*(f as *const F);
224            f(&Window::from_glib_borrow(this).unsafe_cast())
225        }
226        unsafe {
227            let f: Box_<F> = Box_::new(f);
228            connect_raw(
229                self.as_ptr() as *mut _,
230                b"restore\0".as_ptr() as *const _,
231                Some(transmute(restore_trampoline::<Self, F> as usize)),
232                Box_::into_raw(f),
233            )
234        }
235    }
236}
237
238impl fmt::Display for Window {
239    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
240        write!(f, "Window")
241    }
242}