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 crate::Object;
6use glib::{
7 prelude::*,
8 signal::{connect_raw, SignalHandlerId},
9 translate::*,
10};
11use std::{boxed::Box as Box_, fmt, mem::transmute};
12
13glib::wrapper! {
14 /// The ATK Interface provided by UI components that represent a top-level window.
15 ///
16 /// [`Window`][crate::Window] should be implemented by the UI elements that represent
17 /// a top-level window, such as the main window of an application or
18 /// dialog.
19 ///
20 /// See [class[`Object`][crate::Object]]
21 ///
22 /// ## Signals
23 ///
24 ///
25 /// #### `activate`
26 /// The signal [`activate`][struct@crate::Window#activate] is emitted when a window
27 /// becomes the active window of the application or session.
28 ///
29 ///
30 ///
31 ///
32 /// #### `create`
33 /// The signal [`create`][struct@crate::Window#create] is emitted when a new window
34 /// is created.
35 ///
36 ///
37 ///
38 ///
39 /// #### `deactivate`
40 /// The signal [`deactivate`][struct@crate::Window#deactivate] is emitted when a window is
41 /// no longer the active window of the application or session.
42 ///
43 ///
44 ///
45 ///
46 /// #### `destroy`
47 /// The signal [`destroy`][struct@crate::Window#destroy] is emitted when a window is
48 /// destroyed.
49 ///
50 ///
51 ///
52 ///
53 /// #### `maximize`
54 /// The signal [`maximize`][struct@crate::Window#maximize] is emitted when a window
55 /// is maximized.
56 ///
57 ///
58 ///
59 ///
60 /// #### `minimize`
61 /// The signal [`minimize`][struct@crate::Window#minimize] is emitted when a window
62 /// is minimized.
63 ///
64 ///
65 ///
66 ///
67 /// #### `move`
68 /// The signal [`move`][struct@crate::Window#move] is emitted when a window
69 /// is moved.
70 ///
71 ///
72 ///
73 ///
74 /// #### `resize`
75 /// The signal [`resize`][struct@crate::Window#resize] is emitted when a window
76 /// is resized.
77 ///
78 ///
79 ///
80 ///
81 /// #### `restore`
82 /// The signal [`restore`][struct@crate::Window#restore] is emitted when a window
83 /// is restored.
84 ///
85 ///
86 /// <details><summary><h4>Object</h4></summary>
87 ///
88 ///
89 /// #### `active-descendant-changed`
90 /// The "active-descendant-changed" signal is emitted by an object
91 /// which has the state ATK_STATE_MANAGES_DESCENDANTS when the focus
92 /// object in the object changes. For instance, a table will emit the
93 /// signal when the cell in the table which has focus changes.
94 ///
95 /// Detailed
96 ///
97 ///
98 /// #### `announcement`
99 /// The "announcement" signal can be emitted to pass an announcement on to
100 /// be read by a screen reader.
101 ///
102 /// Depcrecated (2.50): Use AtkObject::notification instead.
103 ///
104 ///
105 ///
106 ///
107 /// #### `children-changed`
108 /// The signal "children-changed" is emitted when a child is added or
109 /// removed form an object. It supports two details: "add" and
110 /// "remove"
111 ///
112 /// Detailed
113 ///
114 ///
115 /// #### `focus-event`
116 /// The signal "focus-event" is emitted when an object gained or lost
117 /// focus.
118 ///
119 ///
120 ///
121 ///
122 /// #### `notification`
123 /// The "notification" signal can be emitted to pass an announcement on to
124 /// be read by a screen reader.
125 ///
126 ///
127 ///
128 ///
129 /// #### `property-change`
130 /// The signal "property-change" is emitted when an object's property
131 /// value changes. `arg1` contains an `AtkPropertyValues` with the name
132 /// and the new value of the property whose value has changed. Note
133 /// that, as with GObject notify, getting this signal does not
134 /// guarantee that the value of the property has actually changed; it
135 /// may also be emitted when the setter of the property is called to
136 /// reinstate the previous value.
137 ///
138 /// Toolkit implementor note: ATK implementors should use
139 /// [`ObjectExt::notify()`][crate::glib::prelude::ObjectExt::notify()] to emit property-changed
140 /// notifications. [`property-changed`][struct@crate::Object#property-changed] is needed by the
141 /// implementation of `atk_add_global_event_listener()` because GObject
142 /// notify doesn't support emission hooks.
143 ///
144 /// Detailed
145 ///
146 ///
147 /// #### `state-change`
148 /// The "state-change" signal is emitted when an object's state
149 /// changes. The detail value identifies the state type which has
150 /// changed.
151 ///
152 /// Detailed
153 ///
154 ///
155 /// #### `visible-data-changed`
156 /// The "visible-data-changed" signal is emitted when the visual
157 /// appearance of the object changed.
158 ///
159 ///
160 /// </details>
161 ///
162 /// # Implements
163 ///
164 /// [`AtkWindowExt`][trait@crate::prelude::AtkWindowExt], [`AtkObjectExt`][trait@crate::prelude::AtkObjectExt], [`trait@glib::ObjectExt`]
165 #[doc(alias = "AtkWindow")]
166 pub struct Window(Interface<ffi::AtkWindow, ffi::AtkWindowIface>) @requires Object;
167
168 match fn {
169 type_ => || ffi::atk_window_get_type(),
170 }
171}
172
173impl Window {
174 pub const NONE: Option<&'static Window> = None;
175}
176
177mod sealed {
178 pub trait Sealed {}
179 impl<T: super::IsA<super::Window>> Sealed for T {}
180}
181
182/// Trait containing all [`struct@Window`] methods.
183///
184/// # Implementors
185///
186/// [`NoOpObject`][struct@crate::NoOpObject], [`Window`][struct@crate::Window]
187pub trait AtkWindowExt: IsA<Window> + sealed::Sealed + 'static {
188 /// The signal [`activate`][struct@crate::Window#activate] is emitted when a window
189 /// becomes the active window of the application or session.
190 #[doc(alias = "activate")]
191 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
192 unsafe extern "C" fn activate_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
193 this: *mut ffi::AtkWindow,
194 f: glib::ffi::gpointer,
195 ) {
196 let f: &F = &*(f as *const F);
197 f(Window::from_glib_borrow(this).unsafe_cast_ref())
198 }
199 unsafe {
200 let f: Box_<F> = Box_::new(f);
201 connect_raw(
202 self.as_ptr() as *mut _,
203 b"activate\0".as_ptr() as *const _,
204 Some(transmute::<_, unsafe extern "C" fn()>(
205 activate_trampoline::<Self, F> as *const (),
206 )),
207 Box_::into_raw(f),
208 )
209 }
210 }
211
212 /// The signal [`create`][struct@crate::Window#create] is emitted when a new window
213 /// is created.
214 #[doc(alias = "create")]
215 fn connect_create<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
216 unsafe extern "C" fn create_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
217 this: *mut ffi::AtkWindow,
218 f: glib::ffi::gpointer,
219 ) {
220 let f: &F = &*(f as *const F);
221 f(Window::from_glib_borrow(this).unsafe_cast_ref())
222 }
223 unsafe {
224 let f: Box_<F> = Box_::new(f);
225 connect_raw(
226 self.as_ptr() as *mut _,
227 b"create\0".as_ptr() as *const _,
228 Some(transmute::<_, unsafe extern "C" fn()>(
229 create_trampoline::<Self, F> as *const (),
230 )),
231 Box_::into_raw(f),
232 )
233 }
234 }
235
236 /// The signal [`deactivate`][struct@crate::Window#deactivate] is emitted when a window is
237 /// no longer the active window of the application or session.
238 #[doc(alias = "deactivate")]
239 fn connect_deactivate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
240 unsafe extern "C" fn deactivate_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
241 this: *mut ffi::AtkWindow,
242 f: glib::ffi::gpointer,
243 ) {
244 let f: &F = &*(f as *const F);
245 f(Window::from_glib_borrow(this).unsafe_cast_ref())
246 }
247 unsafe {
248 let f: Box_<F> = Box_::new(f);
249 connect_raw(
250 self.as_ptr() as *mut _,
251 b"deactivate\0".as_ptr() as *const _,
252 Some(transmute::<_, unsafe extern "C" fn()>(
253 deactivate_trampoline::<Self, F> as *const (),
254 )),
255 Box_::into_raw(f),
256 )
257 }
258 }
259
260 /// The signal [`destroy`][struct@crate::Window#destroy] is emitted when a window is
261 /// destroyed.
262 #[doc(alias = "destroy")]
263 fn connect_destroy<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
264 unsafe extern "C" fn destroy_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
265 this: *mut ffi::AtkWindow,
266 f: glib::ffi::gpointer,
267 ) {
268 let f: &F = &*(f as *const F);
269 f(Window::from_glib_borrow(this).unsafe_cast_ref())
270 }
271 unsafe {
272 let f: Box_<F> = Box_::new(f);
273 connect_raw(
274 self.as_ptr() as *mut _,
275 b"destroy\0".as_ptr() as *const _,
276 Some(transmute::<_, unsafe extern "C" fn()>(
277 destroy_trampoline::<Self, F> as *const (),
278 )),
279 Box_::into_raw(f),
280 )
281 }
282 }
283
284 /// The signal [`maximize`][struct@crate::Window#maximize] is emitted when a window
285 /// is maximized.
286 #[doc(alias = "maximize")]
287 fn connect_maximize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
288 unsafe extern "C" fn maximize_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
289 this: *mut ffi::AtkWindow,
290 f: glib::ffi::gpointer,
291 ) {
292 let f: &F = &*(f as *const F);
293 f(Window::from_glib_borrow(this).unsafe_cast_ref())
294 }
295 unsafe {
296 let f: Box_<F> = Box_::new(f);
297 connect_raw(
298 self.as_ptr() as *mut _,
299 b"maximize\0".as_ptr() as *const _,
300 Some(transmute::<_, unsafe extern "C" fn()>(
301 maximize_trampoline::<Self, F> as *const (),
302 )),
303 Box_::into_raw(f),
304 )
305 }
306 }
307
308 /// The signal [`minimize`][struct@crate::Window#minimize] is emitted when a window
309 /// is minimized.
310 #[doc(alias = "minimize")]
311 fn connect_minimize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
312 unsafe extern "C" fn minimize_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
313 this: *mut ffi::AtkWindow,
314 f: glib::ffi::gpointer,
315 ) {
316 let f: &F = &*(f as *const F);
317 f(Window::from_glib_borrow(this).unsafe_cast_ref())
318 }
319 unsafe {
320 let f: Box_<F> = Box_::new(f);
321 connect_raw(
322 self.as_ptr() as *mut _,
323 b"minimize\0".as_ptr() as *const _,
324 Some(transmute::<_, unsafe extern "C" fn()>(
325 minimize_trampoline::<Self, F> as *const (),
326 )),
327 Box_::into_raw(f),
328 )
329 }
330 }
331
332 /// The signal [`move`][struct@crate::Window#move] is emitted when a window
333 /// is moved.
334 #[doc(alias = "move")]
335 fn connect_move<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
336 unsafe extern "C" fn move_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
337 this: *mut ffi::AtkWindow,
338 f: glib::ffi::gpointer,
339 ) {
340 let f: &F = &*(f as *const F);
341 f(Window::from_glib_borrow(this).unsafe_cast_ref())
342 }
343 unsafe {
344 let f: Box_<F> = Box_::new(f);
345 connect_raw(
346 self.as_ptr() as *mut _,
347 b"move\0".as_ptr() as *const _,
348 Some(transmute::<_, unsafe extern "C" fn()>(
349 move_trampoline::<Self, F> as *const (),
350 )),
351 Box_::into_raw(f),
352 )
353 }
354 }
355
356 /// The signal [`resize`][struct@crate::Window#resize] is emitted when a window
357 /// is resized.
358 #[doc(alias = "resize")]
359 fn connect_resize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
360 unsafe extern "C" fn resize_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
361 this: *mut ffi::AtkWindow,
362 f: glib::ffi::gpointer,
363 ) {
364 let f: &F = &*(f as *const F);
365 f(Window::from_glib_borrow(this).unsafe_cast_ref())
366 }
367 unsafe {
368 let f: Box_<F> = Box_::new(f);
369 connect_raw(
370 self.as_ptr() as *mut _,
371 b"resize\0".as_ptr() as *const _,
372 Some(transmute::<_, unsafe extern "C" fn()>(
373 resize_trampoline::<Self, F> as *const (),
374 )),
375 Box_::into_raw(f),
376 )
377 }
378 }
379
380 /// The signal [`restore`][struct@crate::Window#restore] is emitted when a window
381 /// is restored.
382 #[doc(alias = "restore")]
383 fn connect_restore<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
384 unsafe extern "C" fn restore_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
385 this: *mut ffi::AtkWindow,
386 f: glib::ffi::gpointer,
387 ) {
388 let f: &F = &*(f as *const F);
389 f(Window::from_glib_borrow(this).unsafe_cast_ref())
390 }
391 unsafe {
392 let f: Box_<F> = Box_::new(f);
393 connect_raw(
394 self.as_ptr() as *mut _,
395 b"restore\0".as_ptr() as *const _,
396 Some(transmute::<_, unsafe extern "C" fn()>(
397 restore_trampoline::<Self, F> as *const (),
398 )),
399 Box_::into_raw(f),
400 )
401 }
402 }
403}
404
405impl<O: IsA<Window>> AtkWindowExt for O {}
406
407impl fmt::Display for Window {
408 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
409 f.write_str("Window")
410 }
411}