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