gdk4/auto/toplevel.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
5#[cfg(feature = "v4_4")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
7use crate::TitlebarGesture;
8use crate::{
9 ffi, Device, Event, FullscreenMode, Surface, SurfaceEdge, Texture, ToplevelLayout,
10 ToplevelState,
11};
12use glib::{
13 prelude::*,
14 signal::{connect_raw, SignalHandlerId},
15 translate::*,
16};
17use std::boxed::Box as Box_;
18
19glib::wrapper! {
20 /// A [`Toplevel`][crate::Toplevel] is a freestanding toplevel surface.
21 ///
22 /// The [`Toplevel`][crate::Toplevel] interface provides useful APIs for interacting with
23 /// the windowing system, such as controlling maximization and size of the
24 /// surface, setting icons and transient parents for dialogs.
25 ///
26 /// ## Properties
27 ///
28 ///
29 /// #### `decorated`
30 /// Whether the window manager should add decorations.
31 ///
32 /// Readable | Writeable
33 ///
34 ///
35 /// #### `deletable`
36 /// Whether the window manager should allow to close the surface.
37 ///
38 /// Readable | Writeable
39 ///
40 ///
41 /// #### `fullscreen-mode`
42 /// The fullscreen mode of the surface.
43 ///
44 /// Readable | Writeable
45 ///
46 ///
47 /// #### `icon-list`
48 /// A list of textures to use as icon.
49 ///
50 /// Readable | Writeable
51 ///
52 ///
53 /// #### `modal`
54 /// Whether the surface is modal.
55 ///
56 /// Readable | Writeable
57 ///
58 ///
59 /// #### `shortcuts-inhibited`
60 /// Whether the surface should inhibit keyboard shortcuts.
61 ///
62 /// Readable
63 ///
64 ///
65 /// #### `startup-id`
66 /// The startup ID of the surface.
67 ///
68 /// See [`AppLaunchContext`][crate::AppLaunchContext] for more information about
69 /// startup feedback.
70 ///
71 /// Readable | Writeable
72 ///
73 ///
74 /// #### `state`
75 /// The state of the toplevel.
76 ///
77 /// Readable
78 ///
79 ///
80 /// #### `title`
81 /// The title of the surface.
82 ///
83 /// Readable | Writeable
84 ///
85 ///
86 /// #### `transient-for`
87 /// The transient parent of the surface.
88 ///
89 /// Readable | Writeable
90 /// <details><summary><h4>Surface</h4></summary>
91 ///
92 ///
93 /// #### `cursor`
94 /// The mouse pointer for the [`Surface`][crate::Surface].
95 ///
96 /// Readable | Writeable
97 ///
98 ///
99 /// #### `display`
100 /// The [`Display`][crate::Display] connection of the surface.
101 ///
102 /// Readable | Writeable | Construct Only
103 ///
104 ///
105 /// #### `frame-clock`
106 /// The [`FrameClock`][crate::FrameClock] of the surface.
107 ///
108 /// Readable | Writeable | Construct Only
109 ///
110 ///
111 /// #### `height`
112 /// The height of the surface, in pixels.
113 ///
114 /// Readable
115 ///
116 ///
117 /// #### `mapped`
118 /// Whether the surface is mapped.
119 ///
120 /// Readable
121 ///
122 ///
123 /// #### `scale`
124 /// The scale of the surface.
125 ///
126 /// Readable
127 ///
128 ///
129 /// #### `scale-factor`
130 /// The scale factor of the surface.
131 ///
132 /// The scale factor is the next larger integer,
133 /// compared to [`scale`][struct@crate::Surface#scale].
134 ///
135 /// Readable
136 ///
137 ///
138 /// #### `width`
139 /// The width of the surface in pixels.
140 ///
141 /// Readable
142 /// </details>
143 ///
144 /// ## Signals
145 ///
146 ///
147 /// #### `compute-size`
148 /// Emitted when the size for the surface needs to be computed, when
149 /// it is present.
150 ///
151 /// This signal will normally be emitted during or after a call to
152 /// [`ToplevelExt::present()`][crate::prelude::ToplevelExt::present()], depending on the configuration
153 /// received by the windowing system. It may also be emitted at any
154 /// other point in time, in response to the windowing system
155 /// spontaneously changing the configuration of the toplevel surface.
156 ///
157 /// It is the responsibility of the toplevel user to handle this signal
158 /// and compute the desired size of the toplevel, given the information
159 /// passed via the [`ToplevelSize`][crate::ToplevelSize] object. Failing to do so
160 /// will result in an arbitrary size being used as a result.
161 ///
162 ///
163 /// <details><summary><h4>Surface</h4></summary>
164 ///
165 ///
166 /// #### `enter-monitor`
167 /// Emitted when @surface starts being present on the monitor.
168 ///
169 ///
170 ///
171 ///
172 /// #### `event`
173 /// Emitted when GDK receives an input event for @surface.
174 ///
175 ///
176 ///
177 ///
178 /// #### `layout`
179 /// Emitted when the size of @surface is changed, or when relayout should
180 /// be performed.
181 ///
182 /// Surface size is reported in ”application pixels”, not
183 /// ”device pixels” (see gdk_surface_get_scale_factor()).
184 ///
185 ///
186 ///
187 ///
188 /// #### `leave-monitor`
189 /// Emitted when @surface stops being present on the monitor.
190 ///
191 ///
192 ///
193 ///
194 /// #### `render`
195 /// Emitted when part of the surface needs to be redrawn.
196 ///
197 ///
198 /// </details>
199 ///
200 /// # Implements
201 ///
202 /// [`ToplevelExt`][trait@crate::prelude::ToplevelExt], [`SurfaceExt`][trait@crate::prelude::SurfaceExt], [`ToplevelExtManual`][trait@crate::prelude::ToplevelExtManual], [`SurfaceExtManual`][trait@crate::prelude::SurfaceExtManual]
203 #[doc(alias = "GdkToplevel")]
204 pub struct Toplevel(Interface<ffi::GdkToplevel, ffi::GdkToplevelInterface>) @requires Surface;
205
206 match fn {
207 type_ => || ffi::gdk_toplevel_get_type(),
208 }
209}
210
211impl Toplevel {
212 pub const NONE: Option<&'static Toplevel> = None;
213}
214
215mod sealed {
216 pub trait Sealed {}
217 impl<T: super::IsA<super::Toplevel>> Sealed for T {}
218}
219
220/// Trait containing all [`struct@Toplevel`] methods.
221///
222/// # Implementors
223///
224/// [`Toplevel`][struct@crate::Toplevel]
225pub trait ToplevelExt: IsA<Toplevel> + sealed::Sealed + 'static {
226 /// Begins an interactive move operation.
227 ///
228 /// You might use this function to implement draggable titlebars.
229 /// ## `device`
230 /// the device used for the operation
231 /// ## `button`
232 /// the button being used to drag, or 0 for a keyboard-initiated drag
233 /// ## `x`
234 /// surface X coordinate of mouse click that began the drag
235 /// ## `y`
236 /// surface Y coordinate of mouse click that began the drag
237 /// ## `timestamp`
238 /// timestamp of mouse click that began the drag (use
239 /// [`Event::time()`][crate::Event::time()])
240 #[doc(alias = "gdk_toplevel_begin_move")]
241 fn begin_move(&self, device: &impl IsA<Device>, button: i32, x: f64, y: f64, timestamp: u32) {
242 unsafe {
243 ffi::gdk_toplevel_begin_move(
244 self.as_ref().to_glib_none().0,
245 device.as_ref().to_glib_none().0,
246 button,
247 x,
248 y,
249 timestamp,
250 );
251 }
252 }
253
254 /// Begins an interactive resize operation.
255 ///
256 /// You might use this function to implement a “window resize grip.”
257 /// ## `edge`
258 /// the edge or corner from which the drag is started
259 /// ## `device`
260 /// the device used for the operation
261 /// ## `button`
262 /// the button being used to drag, or 0 for a keyboard-initiated drag
263 /// ## `x`
264 /// surface X coordinate of mouse click that began the drag
265 /// ## `y`
266 /// surface Y coordinate of mouse click that began the drag
267 /// ## `timestamp`
268 /// timestamp of mouse click that began the drag (use
269 /// [`Event::time()`][crate::Event::time()])
270 #[doc(alias = "gdk_toplevel_begin_resize")]
271 fn begin_resize(
272 &self,
273 edge: SurfaceEdge,
274 device: Option<&impl IsA<Device>>,
275 button: i32,
276 x: f64,
277 y: f64,
278 timestamp: u32,
279 ) {
280 unsafe {
281 ffi::gdk_toplevel_begin_resize(
282 self.as_ref().to_glib_none().0,
283 edge.into_glib(),
284 device.map(|p| p.as_ref()).to_glib_none().0,
285 button,
286 x,
287 y,
288 timestamp,
289 );
290 }
291 }
292
293 /// Sets keyboard focus to @surface.
294 ///
295 /// In most cases, [gtk_window_present_with_time()](../gtk4/method.Window.present_with_time.html)
296 /// should be used on a [GtkWindow](../gtk4/class.Window.html), rather than
297 /// calling this function.
298 /// ## `timestamp`
299 /// timestamp of the event triggering the surface focus
300 #[doc(alias = "gdk_toplevel_focus")]
301 fn focus(&self, timestamp: u32) {
302 unsafe {
303 ffi::gdk_toplevel_focus(self.as_ref().to_glib_none().0, timestamp);
304 }
305 }
306
307 /// Gets the bitwise or of the currently active surface state flags,
308 /// from the [`ToplevelState`][crate::ToplevelState] enumeration.
309 ///
310 /// # Returns
311 ///
312 /// surface state bitfield
313 #[doc(alias = "gdk_toplevel_get_state")]
314 #[doc(alias = "get_state")]
315 fn state(&self) -> ToplevelState {
316 unsafe { from_glib(ffi::gdk_toplevel_get_state(self.as_ref().to_glib_none().0)) }
317 }
318
319 /// Requests that the @self inhibit the system shortcuts.
320 ///
321 /// This is asking the desktop environment/windowing system to let all
322 /// keyboard events reach the surface, as long as it is focused, instead
323 /// of triggering system actions.
324 ///
325 /// If granted, the rerouting remains active until the default shortcuts
326 /// processing is restored with [`restore_system_shortcuts()`][Self::restore_system_shortcuts()],
327 /// or the request is revoked by the desktop environment, windowing system
328 /// or the user.
329 ///
330 /// A typical use case for this API is remote desktop or virtual machine
331 /// viewers which need to inhibit the default system keyboard shortcuts
332 /// so that the remote session or virtual host gets those instead of the
333 /// local environment.
334 ///
335 /// The windowing system or desktop environment may ask the user to grant
336 /// or deny the request or even choose to ignore the request entirely.
337 ///
338 /// The caller can be notified whenever the request is granted or revoked
339 /// by listening to the [`shortcuts-inhibited`][struct@crate::Toplevel#shortcuts-inhibited] property.
340 /// ## `event`
341 /// the [`Event`][crate::Event] that is triggering the inhibit
342 /// request, or [`None`] if none is available
343 #[doc(alias = "gdk_toplevel_inhibit_system_shortcuts")]
344 fn inhibit_system_shortcuts(&self, event: Option<impl AsRef<Event>>) {
345 unsafe {
346 ffi::gdk_toplevel_inhibit_system_shortcuts(
347 self.as_ref().to_glib_none().0,
348 event.as_ref().map(|p| p.as_ref()).to_glib_none().0,
349 );
350 }
351 }
352
353 /// Asks to lower the @self below other windows.
354 ///
355 /// The windowing system may choose to ignore the request.
356 ///
357 /// # Returns
358 ///
359 /// [`true`] if the surface was lowered
360 #[doc(alias = "gdk_toplevel_lower")]
361 fn lower(&self) -> bool {
362 unsafe { from_glib(ffi::gdk_toplevel_lower(self.as_ref().to_glib_none().0)) }
363 }
364
365 /// Asks to minimize the @self.
366 ///
367 /// The windowing system may choose to ignore the request.
368 ///
369 /// # Returns
370 ///
371 /// [`true`] if the surface was minimized
372 #[doc(alias = "gdk_toplevel_minimize")]
373 fn minimize(&self) -> bool {
374 unsafe { from_glib(ffi::gdk_toplevel_minimize(self.as_ref().to_glib_none().0)) }
375 }
376
377 /// Present @self after having processed the [`ToplevelLayout`][crate::ToplevelLayout] rules.
378 ///
379 /// If the toplevel was previously not showing, it will be showed,
380 /// otherwise it will change layout according to @layout.
381 ///
382 /// GDK may emit the [`compute-size`][struct@crate::Toplevel#compute-size] signal to let
383 /// the user of this toplevel compute the preferred size of the toplevel
384 /// surface.
385 ///
386 /// Presenting is asynchronous and the specified layout parameters are not
387 /// guaranteed to be respected.
388 /// ## `layout`
389 /// the [`ToplevelLayout`][crate::ToplevelLayout] object used to layout
390 #[doc(alias = "gdk_toplevel_present")]
391 fn present(&self, layout: &ToplevelLayout) {
392 unsafe {
393 ffi::gdk_toplevel_present(self.as_ref().to_glib_none().0, layout.to_glib_none().0);
394 }
395 }
396
397 /// Restore default system keyboard shortcuts which were previously
398 /// inhibited.
399 ///
400 /// This undoes the effect of [`inhibit_system_shortcuts()`][Self::inhibit_system_shortcuts()].
401 #[doc(alias = "gdk_toplevel_restore_system_shortcuts")]
402 fn restore_system_shortcuts(&self) {
403 unsafe {
404 ffi::gdk_toplevel_restore_system_shortcuts(self.as_ref().to_glib_none().0);
405 }
406 }
407
408 /// Sets the toplevel to be decorated.
409 ///
410 /// Setting @decorated to [`false`] hints the desktop environment
411 /// that the surface has its own, client-side decorations and
412 /// does not need to have window decorations added.
413 /// ## `decorated`
414 /// [`true`] to request decorations
415 #[doc(alias = "gdk_toplevel_set_decorated")]
416 #[doc(alias = "decorated")]
417 fn set_decorated(&self, decorated: bool) {
418 unsafe {
419 ffi::gdk_toplevel_set_decorated(self.as_ref().to_glib_none().0, decorated.into_glib());
420 }
421 }
422
423 /// Sets the toplevel to be deletable.
424 ///
425 /// Setting @deletable to [`true`] hints the desktop environment
426 /// that it should offer the user a way to close the surface.
427 /// ## `deletable`
428 /// [`true`] to request a delete button
429 #[doc(alias = "gdk_toplevel_set_deletable")]
430 #[doc(alias = "deletable")]
431 fn set_deletable(&self, deletable: bool) {
432 unsafe {
433 ffi::gdk_toplevel_set_deletable(self.as_ref().to_glib_none().0, deletable.into_glib());
434 }
435 }
436
437 /// Sets a list of icons for the surface.
438 ///
439 /// One of these will be used to represent the surface in iconic form.
440 /// The icon may be shown in window lists or task bars. Which icon
441 /// size is shown depends on the window manager. The window manager
442 /// can scale the icon but setting several size icons can give better
443 /// image quality.
444 ///
445 /// Note that some platforms don't support surface icons.
446 /// ## `surfaces`
447 ///
448 /// A list of textures to use as icon, of different sizes
449 #[doc(alias = "gdk_toplevel_set_icon_list")]
450 #[doc(alias = "icon-list")]
451 fn set_icon_list(&self, surfaces: &[Texture]) {
452 unsafe {
453 ffi::gdk_toplevel_set_icon_list(
454 self.as_ref().to_glib_none().0,
455 surfaces.to_glib_none().0,
456 );
457 }
458 }
459
460 /// Sets the toplevel to be modal.
461 ///
462 /// The application can use this hint to tell the
463 /// window manager that a certain surface has modal
464 /// behaviour. The window manager can use this information
465 /// to handle modal surfaces in a special way.
466 ///
467 /// You should only use this on surfaces for which you have
468 /// previously called [`set_transient_for()`][Self::set_transient_for()].
469 /// ## `modal`
470 /// [`true`] if the surface is modal, [`false`] otherwise.
471 #[doc(alias = "gdk_toplevel_set_modal")]
472 #[doc(alias = "modal")]
473 fn set_modal(&self, modal: bool) {
474 unsafe {
475 ffi::gdk_toplevel_set_modal(self.as_ref().to_glib_none().0, modal.into_glib());
476 }
477 }
478
479 /// Sets the startup notification ID.
480 ///
481 /// When using GTK, typically you should use
482 /// [gtk_window_set_startup_id()](../gtk4/method.Window.set_startup_id.html)
483 /// instead of this low-level function.
484 /// ## `startup_id`
485 /// a string with startup-notification identifier
486 #[doc(alias = "gdk_toplevel_set_startup_id")]
487 #[doc(alias = "startup-id")]
488 fn set_startup_id(&self, startup_id: &str) {
489 unsafe {
490 ffi::gdk_toplevel_set_startup_id(
491 self.as_ref().to_glib_none().0,
492 startup_id.to_glib_none().0,
493 );
494 }
495 }
496
497 /// Sets the title of a toplevel surface.
498 ///
499 /// The title maybe be displayed in the titlebar,
500 /// in lists of windows, etc.
501 /// ## `title`
502 /// title of @surface
503 #[doc(alias = "gdk_toplevel_set_title")]
504 #[doc(alias = "title")]
505 fn set_title(&self, title: &str) {
506 unsafe {
507 ffi::gdk_toplevel_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
508 }
509 }
510
511 /// Sets a transient-for parent.
512 ///
513 /// Indicates to the window manager that @surface is a transient
514 /// dialog associated with the application surface @parent. This
515 /// allows the window manager to do things like center @surface
516 /// on @parent and keep @surface above @parent.
517 ///
518 /// See [gtk_window_set_transient_for()](../gtk4/method.Window.set_transient_for.html)
519 /// if you’re using [GtkWindow](../gtk4/class.Window.html).
520 /// ## `parent`
521 /// another toplevel [`Surface`][crate::Surface]
522 #[doc(alias = "gdk_toplevel_set_transient_for")]
523 #[doc(alias = "transient-for")]
524 fn set_transient_for(&self, parent: &impl IsA<Surface>) {
525 unsafe {
526 ffi::gdk_toplevel_set_transient_for(
527 self.as_ref().to_glib_none().0,
528 parent.as_ref().to_glib_none().0,
529 );
530 }
531 }
532
533 /// Asks the windowing system to show the window menu.
534 ///
535 /// The window menu is the menu shown when right-clicking the titlebar
536 /// on traditional windows managed by the window manager. This is useful
537 /// for windows using client-side decorations, activating it with a
538 /// right-click on the window decorations.
539 /// ## `event`
540 /// a [`Event`][crate::Event] to show the menu for
541 ///
542 /// # Returns
543 ///
544 /// [`true`] if the window menu was shown and [`false`] otherwise.
545 #[doc(alias = "gdk_toplevel_show_window_menu")]
546 fn show_window_menu(&self, event: impl AsRef<Event>) -> bool {
547 unsafe {
548 from_glib(ffi::gdk_toplevel_show_window_menu(
549 self.as_ref().to_glib_none().0,
550 event.as_ref().to_glib_none().0,
551 ))
552 }
553 }
554
555 /// Returns whether the desktop environment supports
556 /// tiled window states.
557 ///
558 /// # Returns
559 ///
560 /// [`true`] if the desktop environment supports tiled window states
561 #[doc(alias = "gdk_toplevel_supports_edge_constraints")]
562 fn supports_edge_constraints(&self) -> bool {
563 unsafe {
564 from_glib(ffi::gdk_toplevel_supports_edge_constraints(
565 self.as_ref().to_glib_none().0,
566 ))
567 }
568 }
569
570 /// Performs a title bar gesture.
571 /// ## `gesture`
572 /// a [`TitlebarGesture`][crate::TitlebarGesture]
573 ///
574 /// # Returns
575 ///
576 /// whether the gesture was performed
577 #[cfg(feature = "v4_4")]
578 #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
579 #[doc(alias = "gdk_toplevel_titlebar_gesture")]
580 fn titlebar_gesture(&self, gesture: TitlebarGesture) -> bool {
581 unsafe {
582 from_glib(ffi::gdk_toplevel_titlebar_gesture(
583 self.as_ref().to_glib_none().0,
584 gesture.into_glib(),
585 ))
586 }
587 }
588
589 /// Whether the window manager should add decorations.
590 fn is_decorated(&self) -> bool {
591 ObjectExt::property(self.as_ref(), "decorated")
592 }
593
594 /// Whether the window manager should allow to close the surface.
595 fn is_deletable(&self) -> bool {
596 ObjectExt::property(self.as_ref(), "deletable")
597 }
598
599 /// The fullscreen mode of the surface.
600 #[doc(alias = "fullscreen-mode")]
601 fn fullscreen_mode(&self) -> FullscreenMode {
602 ObjectExt::property(self.as_ref(), "fullscreen-mode")
603 }
604
605 /// The fullscreen mode of the surface.
606 #[doc(alias = "fullscreen-mode")]
607 fn set_fullscreen_mode(&self, fullscreen_mode: FullscreenMode) {
608 ObjectExt::set_property(self.as_ref(), "fullscreen-mode", fullscreen_mode)
609 }
610
611 //#[doc(alias = "icon-list")]
612 //fn icon_list(&self) -> /*Unimplemented*/Basic: Pointer {
613 // ObjectExt::property(self.as_ref(), "icon-list")
614 //}
615
616 /// Whether the surface is modal.
617 fn is_modal(&self) -> bool {
618 ObjectExt::property(self.as_ref(), "modal")
619 }
620
621 /// Whether the surface should inhibit keyboard shortcuts.
622 #[doc(alias = "shortcuts-inhibited")]
623 fn is_shortcuts_inhibited(&self) -> bool {
624 ObjectExt::property(self.as_ref(), "shortcuts-inhibited")
625 }
626
627 /// The startup ID of the surface.
628 ///
629 /// See [`AppLaunchContext`][crate::AppLaunchContext] for more information about
630 /// startup feedback.
631 #[doc(alias = "startup-id")]
632 fn startup_id(&self) -> Option<glib::GString> {
633 ObjectExt::property(self.as_ref(), "startup-id")
634 }
635
636 /// The title of the surface.
637 fn title(&self) -> Option<glib::GString> {
638 ObjectExt::property(self.as_ref(), "title")
639 }
640
641 /// The transient parent of the surface.
642 #[doc(alias = "transient-for")]
643 fn transient_for(&self) -> Option<Surface> {
644 ObjectExt::property(self.as_ref(), "transient-for")
645 }
646
647 #[doc(alias = "decorated")]
648 fn connect_decorated_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
649 unsafe extern "C" fn notify_decorated_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
650 this: *mut ffi::GdkToplevel,
651 _param_spec: glib::ffi::gpointer,
652 f: glib::ffi::gpointer,
653 ) {
654 let f: &F = &*(f as *const F);
655 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
656 }
657 unsafe {
658 let f: Box_<F> = Box_::new(f);
659 connect_raw(
660 self.as_ptr() as *mut _,
661 b"notify::decorated\0".as_ptr() as *const _,
662 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
663 notify_decorated_trampoline::<Self, F> as *const (),
664 )),
665 Box_::into_raw(f),
666 )
667 }
668 }
669
670 #[doc(alias = "deletable")]
671 fn connect_deletable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
672 unsafe extern "C" fn notify_deletable_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
673 this: *mut ffi::GdkToplevel,
674 _param_spec: glib::ffi::gpointer,
675 f: glib::ffi::gpointer,
676 ) {
677 let f: &F = &*(f as *const F);
678 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
679 }
680 unsafe {
681 let f: Box_<F> = Box_::new(f);
682 connect_raw(
683 self.as_ptr() as *mut _,
684 b"notify::deletable\0".as_ptr() as *const _,
685 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
686 notify_deletable_trampoline::<Self, F> as *const (),
687 )),
688 Box_::into_raw(f),
689 )
690 }
691 }
692
693 #[doc(alias = "fullscreen-mode")]
694 fn connect_fullscreen_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
695 unsafe extern "C" fn notify_fullscreen_mode_trampoline<
696 P: IsA<Toplevel>,
697 F: Fn(&P) + 'static,
698 >(
699 this: *mut ffi::GdkToplevel,
700 _param_spec: glib::ffi::gpointer,
701 f: glib::ffi::gpointer,
702 ) {
703 let f: &F = &*(f as *const F);
704 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
705 }
706 unsafe {
707 let f: Box_<F> = Box_::new(f);
708 connect_raw(
709 self.as_ptr() as *mut _,
710 b"notify::fullscreen-mode\0".as_ptr() as *const _,
711 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
712 notify_fullscreen_mode_trampoline::<Self, F> as *const (),
713 )),
714 Box_::into_raw(f),
715 )
716 }
717 }
718
719 #[doc(alias = "icon-list")]
720 fn connect_icon_list_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
721 unsafe extern "C" fn notify_icon_list_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
722 this: *mut ffi::GdkToplevel,
723 _param_spec: glib::ffi::gpointer,
724 f: glib::ffi::gpointer,
725 ) {
726 let f: &F = &*(f as *const F);
727 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
728 }
729 unsafe {
730 let f: Box_<F> = Box_::new(f);
731 connect_raw(
732 self.as_ptr() as *mut _,
733 b"notify::icon-list\0".as_ptr() as *const _,
734 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
735 notify_icon_list_trampoline::<Self, F> as *const (),
736 )),
737 Box_::into_raw(f),
738 )
739 }
740 }
741
742 #[doc(alias = "modal")]
743 fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
744 unsafe extern "C" fn notify_modal_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
745 this: *mut ffi::GdkToplevel,
746 _param_spec: glib::ffi::gpointer,
747 f: glib::ffi::gpointer,
748 ) {
749 let f: &F = &*(f as *const F);
750 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
751 }
752 unsafe {
753 let f: Box_<F> = Box_::new(f);
754 connect_raw(
755 self.as_ptr() as *mut _,
756 b"notify::modal\0".as_ptr() as *const _,
757 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
758 notify_modal_trampoline::<Self, F> as *const (),
759 )),
760 Box_::into_raw(f),
761 )
762 }
763 }
764
765 #[doc(alias = "shortcuts-inhibited")]
766 fn connect_shortcuts_inhibited_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
767 unsafe extern "C" fn notify_shortcuts_inhibited_trampoline<
768 P: IsA<Toplevel>,
769 F: Fn(&P) + 'static,
770 >(
771 this: *mut ffi::GdkToplevel,
772 _param_spec: glib::ffi::gpointer,
773 f: glib::ffi::gpointer,
774 ) {
775 let f: &F = &*(f as *const F);
776 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
777 }
778 unsafe {
779 let f: Box_<F> = Box_::new(f);
780 connect_raw(
781 self.as_ptr() as *mut _,
782 b"notify::shortcuts-inhibited\0".as_ptr() as *const _,
783 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
784 notify_shortcuts_inhibited_trampoline::<Self, F> as *const (),
785 )),
786 Box_::into_raw(f),
787 )
788 }
789 }
790
791 #[doc(alias = "startup-id")]
792 fn connect_startup_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
793 unsafe extern "C" fn notify_startup_id_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
794 this: *mut ffi::GdkToplevel,
795 _param_spec: glib::ffi::gpointer,
796 f: glib::ffi::gpointer,
797 ) {
798 let f: &F = &*(f as *const F);
799 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
800 }
801 unsafe {
802 let f: Box_<F> = Box_::new(f);
803 connect_raw(
804 self.as_ptr() as *mut _,
805 b"notify::startup-id\0".as_ptr() as *const _,
806 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
807 notify_startup_id_trampoline::<Self, F> as *const (),
808 )),
809 Box_::into_raw(f),
810 )
811 }
812 }
813
814 #[doc(alias = "state")]
815 fn connect_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
816 unsafe extern "C" fn notify_state_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
817 this: *mut ffi::GdkToplevel,
818 _param_spec: glib::ffi::gpointer,
819 f: glib::ffi::gpointer,
820 ) {
821 let f: &F = &*(f as *const F);
822 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
823 }
824 unsafe {
825 let f: Box_<F> = Box_::new(f);
826 connect_raw(
827 self.as_ptr() as *mut _,
828 b"notify::state\0".as_ptr() as *const _,
829 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
830 notify_state_trampoline::<Self, F> as *const (),
831 )),
832 Box_::into_raw(f),
833 )
834 }
835 }
836
837 #[doc(alias = "title")]
838 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
839 unsafe extern "C" fn notify_title_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
840 this: *mut ffi::GdkToplevel,
841 _param_spec: glib::ffi::gpointer,
842 f: glib::ffi::gpointer,
843 ) {
844 let f: &F = &*(f as *const F);
845 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
846 }
847 unsafe {
848 let f: Box_<F> = Box_::new(f);
849 connect_raw(
850 self.as_ptr() as *mut _,
851 b"notify::title\0".as_ptr() as *const _,
852 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
853 notify_title_trampoline::<Self, F> as *const (),
854 )),
855 Box_::into_raw(f),
856 )
857 }
858 }
859
860 #[doc(alias = "transient-for")]
861 fn connect_transient_for_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
862 unsafe extern "C" fn notify_transient_for_trampoline<
863 P: IsA<Toplevel>,
864 F: Fn(&P) + 'static,
865 >(
866 this: *mut ffi::GdkToplevel,
867 _param_spec: glib::ffi::gpointer,
868 f: glib::ffi::gpointer,
869 ) {
870 let f: &F = &*(f as *const F);
871 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
872 }
873 unsafe {
874 let f: Box_<F> = Box_::new(f);
875 connect_raw(
876 self.as_ptr() as *mut _,
877 b"notify::transient-for\0".as_ptr() as *const _,
878 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
879 notify_transient_for_trampoline::<Self, F> as *const (),
880 )),
881 Box_::into_raw(f),
882 )
883 }
884 }
885}
886
887impl<O: IsA<Toplevel>> ToplevelExt for O {}