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