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 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
215/// Trait containing all [`struct@Toplevel`] methods.
216///
217/// # Implementors
218///
219/// [`Toplevel`][struct@crate::Toplevel]
220pub trait ToplevelExt: IsA<Toplevel> + 'static {
221 /// Begins an interactive move operation.
222 ///
223 /// You might use this function to implement draggable titlebars.
224 /// ## `device`
225 /// the device used for the operation
226 /// ## `button`
227 /// the button being used to drag, or 0 for a keyboard-initiated drag
228 /// ## `x`
229 /// surface X coordinate of mouse click that began the drag
230 /// ## `y`
231 /// surface Y coordinate of mouse click that began the drag
232 /// ## `timestamp`
233 /// timestamp of mouse click that began the drag (use
234 /// [`Event::time()`][crate::Event::time()])
235 #[doc(alias = "gdk_toplevel_begin_move")]
236 fn begin_move(&self, device: &impl IsA<Device>, button: i32, x: f64, y: f64, timestamp: u32) {
237 unsafe {
238 ffi::gdk_toplevel_begin_move(
239 self.as_ref().to_glib_none().0,
240 device.as_ref().to_glib_none().0,
241 button,
242 x,
243 y,
244 timestamp,
245 );
246 }
247 }
248
249 /// Begins an interactive resize operation.
250 ///
251 /// You might use this function to implement a “window resize grip.”
252 /// ## `edge`
253 /// the edge or corner from which the drag is started
254 /// ## `device`
255 /// the device used for the operation
256 /// ## `button`
257 /// the button being used to drag, or 0 for a keyboard-initiated drag
258 /// ## `x`
259 /// surface X coordinate of mouse click that began the drag
260 /// ## `y`
261 /// surface Y coordinate of mouse click that began the drag
262 /// ## `timestamp`
263 /// timestamp of mouse click that began the drag (use
264 /// [`Event::time()`][crate::Event::time()])
265 #[doc(alias = "gdk_toplevel_begin_resize")]
266 fn begin_resize(
267 &self,
268 edge: SurfaceEdge,
269 device: Option<&impl IsA<Device>>,
270 button: i32,
271 x: f64,
272 y: f64,
273 timestamp: u32,
274 ) {
275 unsafe {
276 ffi::gdk_toplevel_begin_resize(
277 self.as_ref().to_glib_none().0,
278 edge.into_glib(),
279 device.map(|p| p.as_ref()).to_glib_none().0,
280 button,
281 x,
282 y,
283 timestamp,
284 );
285 }
286 }
287
288 /// Sets keyboard focus to @surface.
289 ///
290 /// In most cases, [gtk_window_present_with_time()](../gtk4/method.Window.present_with_time.html)
291 /// should be used on a [GtkWindow](../gtk4/class.Window.html), rather than
292 /// calling this function.
293 /// ## `timestamp`
294 /// timestamp of the event triggering the surface focus
295 #[doc(alias = "gdk_toplevel_focus")]
296 fn focus(&self, timestamp: u32) {
297 unsafe {
298 ffi::gdk_toplevel_focus(self.as_ref().to_glib_none().0, timestamp);
299 }
300 }
301
302 /// Gets the bitwise or of the currently active surface state flags,
303 /// from the [`ToplevelState`][crate::ToplevelState] enumeration.
304 ///
305 /// # Returns
306 ///
307 /// surface state bitfield
308 #[doc(alias = "gdk_toplevel_get_state")]
309 #[doc(alias = "get_state")]
310 fn state(&self) -> ToplevelState {
311 unsafe { from_glib(ffi::gdk_toplevel_get_state(self.as_ref().to_glib_none().0)) }
312 }
313
314 /// Requests that the @self inhibit the system shortcuts.
315 ///
316 /// This is asking the desktop environment/windowing system to let all
317 /// keyboard events reach the surface, as long as it is focused, instead
318 /// of triggering system actions.
319 ///
320 /// If granted, the rerouting remains active until the default shortcuts
321 /// processing is restored with [`restore_system_shortcuts()`][Self::restore_system_shortcuts()],
322 /// or the request is revoked by the desktop environment, windowing system
323 /// or the user.
324 ///
325 /// A typical use case for this API is remote desktop or virtual machine
326 /// viewers which need to inhibit the default system keyboard shortcuts
327 /// so that the remote session or virtual host gets those instead of the
328 /// local environment.
329 ///
330 /// The windowing system or desktop environment may ask the user to grant
331 /// or deny the request or even choose to ignore the request entirely.
332 ///
333 /// The caller can be notified whenever the request is granted or revoked
334 /// by listening to the [`shortcuts-inhibited`][struct@crate::Toplevel#shortcuts-inhibited] property.
335 /// ## `event`
336 /// the [`Event`][crate::Event] that is triggering the inhibit
337 /// request, or [`None`] if none is available
338 #[doc(alias = "gdk_toplevel_inhibit_system_shortcuts")]
339 fn inhibit_system_shortcuts(&self, event: Option<impl AsRef<Event>>) {
340 unsafe {
341 ffi::gdk_toplevel_inhibit_system_shortcuts(
342 self.as_ref().to_glib_none().0,
343 event.as_ref().map(|p| p.as_ref()).to_glib_none().0,
344 );
345 }
346 }
347
348 /// Asks to lower the @self below other windows.
349 ///
350 /// The windowing system may choose to ignore the request.
351 ///
352 /// # Returns
353 ///
354 /// [`true`] if the surface was lowered
355 #[doc(alias = "gdk_toplevel_lower")]
356 fn lower(&self) -> bool {
357 unsafe { from_glib(ffi::gdk_toplevel_lower(self.as_ref().to_glib_none().0)) }
358 }
359
360 /// Asks to minimize the @self.
361 ///
362 /// The windowing system may choose to ignore the request.
363 ///
364 /// # Returns
365 ///
366 /// [`true`] if the surface was minimized
367 #[doc(alias = "gdk_toplevel_minimize")]
368 fn minimize(&self) -> bool {
369 unsafe { from_glib(ffi::gdk_toplevel_minimize(self.as_ref().to_glib_none().0)) }
370 }
371
372 /// Present @self after having processed the [`ToplevelLayout`][crate::ToplevelLayout] rules.
373 ///
374 /// If the toplevel was previously not showing, it will be showed,
375 /// otherwise it will change layout according to @layout.
376 ///
377 /// GDK may emit the [`compute-size`][struct@crate::Toplevel#compute-size] signal to let
378 /// the user of this toplevel compute the preferred size of the toplevel
379 /// surface.
380 ///
381 /// Presenting is asynchronous and the specified layout parameters are not
382 /// guaranteed to be respected.
383 /// ## `layout`
384 /// the [`ToplevelLayout`][crate::ToplevelLayout] object used to layout
385 #[doc(alias = "gdk_toplevel_present")]
386 fn present(&self, layout: &ToplevelLayout) {
387 unsafe {
388 ffi::gdk_toplevel_present(self.as_ref().to_glib_none().0, layout.to_glib_none().0);
389 }
390 }
391
392 /// Restore default system keyboard shortcuts which were previously
393 /// inhibited.
394 ///
395 /// This undoes the effect of [`inhibit_system_shortcuts()`][Self::inhibit_system_shortcuts()].
396 #[doc(alias = "gdk_toplevel_restore_system_shortcuts")]
397 fn restore_system_shortcuts(&self) {
398 unsafe {
399 ffi::gdk_toplevel_restore_system_shortcuts(self.as_ref().to_glib_none().0);
400 }
401 }
402
403 /// Sets the toplevel to be decorated.
404 ///
405 /// Setting @decorated to [`false`] hints the desktop environment
406 /// that the surface has its own, client-side decorations and
407 /// does not need to have window decorations added.
408 /// ## `decorated`
409 /// [`true`] to request decorations
410 #[doc(alias = "gdk_toplevel_set_decorated")]
411 #[doc(alias = "decorated")]
412 fn set_decorated(&self, decorated: bool) {
413 unsafe {
414 ffi::gdk_toplevel_set_decorated(self.as_ref().to_glib_none().0, decorated.into_glib());
415 }
416 }
417
418 /// Sets the toplevel to be deletable.
419 ///
420 /// Setting @deletable to [`true`] hints the desktop environment
421 /// that it should offer the user a way to close the surface.
422 /// ## `deletable`
423 /// [`true`] to request a delete button
424 #[doc(alias = "gdk_toplevel_set_deletable")]
425 #[doc(alias = "deletable")]
426 fn set_deletable(&self, deletable: bool) {
427 unsafe {
428 ffi::gdk_toplevel_set_deletable(self.as_ref().to_glib_none().0, deletable.into_glib());
429 }
430 }
431
432 /// Sets a list of icons for the surface.
433 ///
434 /// One of these will be used to represent the surface in iconic form.
435 /// The icon may be shown in window lists or task bars. Which icon
436 /// size is shown depends on the window manager. The window manager
437 /// can scale the icon but setting several size icons can give better
438 /// image quality.
439 ///
440 /// Note that some platforms don't support surface icons.
441 /// ## `surfaces`
442 ///
443 /// A list of textures to use as icon, of different sizes
444 #[doc(alias = "gdk_toplevel_set_icon_list")]
445 #[doc(alias = "icon-list")]
446 fn set_icon_list(&self, surfaces: &[Texture]) {
447 unsafe {
448 ffi::gdk_toplevel_set_icon_list(
449 self.as_ref().to_glib_none().0,
450 surfaces.to_glib_none().0,
451 );
452 }
453 }
454
455 /// Sets the toplevel to be modal.
456 ///
457 /// The application can use this hint to tell the
458 /// window manager that a certain surface has modal
459 /// behaviour. The window manager can use this information
460 /// to handle modal surfaces in a special way.
461 ///
462 /// You should only use this on surfaces for which you have
463 /// previously called [`set_transient_for()`][Self::set_transient_for()].
464 /// ## `modal`
465 /// [`true`] if the surface is modal, [`false`] otherwise.
466 #[doc(alias = "gdk_toplevel_set_modal")]
467 #[doc(alias = "modal")]
468 fn set_modal(&self, modal: bool) {
469 unsafe {
470 ffi::gdk_toplevel_set_modal(self.as_ref().to_glib_none().0, modal.into_glib());
471 }
472 }
473
474 /// Sets the startup notification ID.
475 ///
476 /// When using GTK, typically you should use
477 /// [gtk_window_set_startup_id()](../gtk4/method.Window.set_startup_id.html)
478 /// instead of this low-level function.
479 /// ## `startup_id`
480 /// a string with startup-notification identifier
481 #[doc(alias = "gdk_toplevel_set_startup_id")]
482 #[doc(alias = "startup-id")]
483 fn set_startup_id(&self, startup_id: &str) {
484 unsafe {
485 ffi::gdk_toplevel_set_startup_id(
486 self.as_ref().to_glib_none().0,
487 startup_id.to_glib_none().0,
488 );
489 }
490 }
491
492 /// Sets the title of a toplevel surface.
493 ///
494 /// The title maybe be displayed in the titlebar,
495 /// in lists of windows, etc.
496 /// ## `title`
497 /// title of @surface
498 #[doc(alias = "gdk_toplevel_set_title")]
499 #[doc(alias = "title")]
500 fn set_title(&self, title: &str) {
501 unsafe {
502 ffi::gdk_toplevel_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
503 }
504 }
505
506 /// Sets a transient-for parent.
507 ///
508 /// Indicates to the window manager that @surface is a transient
509 /// dialog associated with the application surface @parent. This
510 /// allows the window manager to do things like center @surface
511 /// on @parent and keep @surface above @parent.
512 ///
513 /// See [gtk_window_set_transient_for()](../gtk4/method.Window.set_transient_for.html)
514 /// if you’re using [GtkWindow](../gtk4/class.Window.html).
515 /// ## `parent`
516 /// another toplevel [`Surface`][crate::Surface]
517 #[doc(alias = "gdk_toplevel_set_transient_for")]
518 #[doc(alias = "transient-for")]
519 fn set_transient_for(&self, parent: &impl IsA<Surface>) {
520 unsafe {
521 ffi::gdk_toplevel_set_transient_for(
522 self.as_ref().to_glib_none().0,
523 parent.as_ref().to_glib_none().0,
524 );
525 }
526 }
527
528 /// Asks the windowing system to show the window menu.
529 ///
530 /// The window menu is the menu shown when right-clicking the titlebar
531 /// on traditional windows managed by the window manager. This is useful
532 /// for windows using client-side decorations, activating it with a
533 /// right-click on the window decorations.
534 /// ## `event`
535 /// a [`Event`][crate::Event] to show the menu for
536 ///
537 /// # Returns
538 ///
539 /// [`true`] if the window menu was shown and [`false`] otherwise.
540 #[doc(alias = "gdk_toplevel_show_window_menu")]
541 fn show_window_menu(&self, event: impl AsRef<Event>) -> bool {
542 unsafe {
543 from_glib(ffi::gdk_toplevel_show_window_menu(
544 self.as_ref().to_glib_none().0,
545 event.as_ref().to_glib_none().0,
546 ))
547 }
548 }
549
550 /// Returns whether the desktop environment supports
551 /// tiled window states.
552 ///
553 /// # Returns
554 ///
555 /// [`true`] if the desktop environment supports tiled window states
556 #[doc(alias = "gdk_toplevel_supports_edge_constraints")]
557 fn supports_edge_constraints(&self) -> bool {
558 unsafe {
559 from_glib(ffi::gdk_toplevel_supports_edge_constraints(
560 self.as_ref().to_glib_none().0,
561 ))
562 }
563 }
564
565 /// Performs a title bar gesture.
566 /// ## `gesture`
567 /// a [`TitlebarGesture`][crate::TitlebarGesture]
568 ///
569 /// # Returns
570 ///
571 /// whether the gesture was performed
572 #[cfg(feature = "v4_4")]
573 #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
574 #[doc(alias = "gdk_toplevel_titlebar_gesture")]
575 fn titlebar_gesture(&self, gesture: TitlebarGesture) -> bool {
576 unsafe {
577 from_glib(ffi::gdk_toplevel_titlebar_gesture(
578 self.as_ref().to_glib_none().0,
579 gesture.into_glib(),
580 ))
581 }
582 }
583
584 /// Whether the window manager should add decorations.
585 fn is_decorated(&self) -> bool {
586 ObjectExt::property(self.as_ref(), "decorated")
587 }
588
589 /// Whether the window manager should allow to close the surface.
590 fn is_deletable(&self) -> bool {
591 ObjectExt::property(self.as_ref(), "deletable")
592 }
593
594 /// The fullscreen mode of the surface.
595 #[doc(alias = "fullscreen-mode")]
596 fn fullscreen_mode(&self) -> FullscreenMode {
597 ObjectExt::property(self.as_ref(), "fullscreen-mode")
598 }
599
600 /// The fullscreen mode of the surface.
601 #[doc(alias = "fullscreen-mode")]
602 fn set_fullscreen_mode(&self, fullscreen_mode: FullscreenMode) {
603 ObjectExt::set_property(self.as_ref(), "fullscreen-mode", fullscreen_mode)
604 }
605
606 //#[doc(alias = "icon-list")]
607 //fn icon_list(&self) -> /*Unimplemented*/Basic: Pointer {
608 // ObjectExt::property(self.as_ref(), "icon-list")
609 //}
610
611 /// Whether the surface is modal.
612 fn is_modal(&self) -> bool {
613 ObjectExt::property(self.as_ref(), "modal")
614 }
615
616 /// Whether the surface should inhibit keyboard shortcuts.
617 #[doc(alias = "shortcuts-inhibited")]
618 fn is_shortcuts_inhibited(&self) -> bool {
619 ObjectExt::property(self.as_ref(), "shortcuts-inhibited")
620 }
621
622 /// The startup ID of the surface.
623 ///
624 /// See [`AppLaunchContext`][crate::AppLaunchContext] for more information about
625 /// startup feedback.
626 #[doc(alias = "startup-id")]
627 fn startup_id(&self) -> Option<glib::GString> {
628 ObjectExt::property(self.as_ref(), "startup-id")
629 }
630
631 /// The title of the surface.
632 fn title(&self) -> Option<glib::GString> {
633 ObjectExt::property(self.as_ref(), "title")
634 }
635
636 /// The transient parent of the surface.
637 #[doc(alias = "transient-for")]
638 fn transient_for(&self) -> Option<Surface> {
639 ObjectExt::property(self.as_ref(), "transient-for")
640 }
641
642 #[doc(alias = "decorated")]
643 fn connect_decorated_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
644 unsafe extern "C" fn notify_decorated_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
645 this: *mut ffi::GdkToplevel,
646 _param_spec: glib::ffi::gpointer,
647 f: glib::ffi::gpointer,
648 ) {
649 let f: &F = &*(f as *const F);
650 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
651 }
652 unsafe {
653 let f: Box_<F> = Box_::new(f);
654 connect_raw(
655 self.as_ptr() as *mut _,
656 c"notify::decorated".as_ptr() as *const _,
657 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
658 notify_decorated_trampoline::<Self, F> as *const (),
659 )),
660 Box_::into_raw(f),
661 )
662 }
663 }
664
665 #[doc(alias = "deletable")]
666 fn connect_deletable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
667 unsafe extern "C" fn notify_deletable_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
668 this: *mut ffi::GdkToplevel,
669 _param_spec: glib::ffi::gpointer,
670 f: glib::ffi::gpointer,
671 ) {
672 let f: &F = &*(f as *const F);
673 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
674 }
675 unsafe {
676 let f: Box_<F> = Box_::new(f);
677 connect_raw(
678 self.as_ptr() as *mut _,
679 c"notify::deletable".as_ptr() as *const _,
680 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
681 notify_deletable_trampoline::<Self, F> as *const (),
682 )),
683 Box_::into_raw(f),
684 )
685 }
686 }
687
688 #[doc(alias = "fullscreen-mode")]
689 fn connect_fullscreen_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
690 unsafe extern "C" fn notify_fullscreen_mode_trampoline<
691 P: IsA<Toplevel>,
692 F: Fn(&P) + 'static,
693 >(
694 this: *mut ffi::GdkToplevel,
695 _param_spec: glib::ffi::gpointer,
696 f: glib::ffi::gpointer,
697 ) {
698 let f: &F = &*(f as *const F);
699 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
700 }
701 unsafe {
702 let f: Box_<F> = Box_::new(f);
703 connect_raw(
704 self.as_ptr() as *mut _,
705 c"notify::fullscreen-mode".as_ptr() as *const _,
706 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
707 notify_fullscreen_mode_trampoline::<Self, F> as *const (),
708 )),
709 Box_::into_raw(f),
710 )
711 }
712 }
713
714 #[doc(alias = "icon-list")]
715 fn connect_icon_list_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
716 unsafe extern "C" fn notify_icon_list_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
717 this: *mut ffi::GdkToplevel,
718 _param_spec: glib::ffi::gpointer,
719 f: glib::ffi::gpointer,
720 ) {
721 let f: &F = &*(f as *const F);
722 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
723 }
724 unsafe {
725 let f: Box_<F> = Box_::new(f);
726 connect_raw(
727 self.as_ptr() as *mut _,
728 c"notify::icon-list".as_ptr() as *const _,
729 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
730 notify_icon_list_trampoline::<Self, F> as *const (),
731 )),
732 Box_::into_raw(f),
733 )
734 }
735 }
736
737 #[doc(alias = "modal")]
738 fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
739 unsafe extern "C" fn notify_modal_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
740 this: *mut ffi::GdkToplevel,
741 _param_spec: glib::ffi::gpointer,
742 f: glib::ffi::gpointer,
743 ) {
744 let f: &F = &*(f as *const F);
745 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
746 }
747 unsafe {
748 let f: Box_<F> = Box_::new(f);
749 connect_raw(
750 self.as_ptr() as *mut _,
751 c"notify::modal".as_ptr() as *const _,
752 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
753 notify_modal_trampoline::<Self, F> as *const (),
754 )),
755 Box_::into_raw(f),
756 )
757 }
758 }
759
760 #[doc(alias = "shortcuts-inhibited")]
761 fn connect_shortcuts_inhibited_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
762 unsafe extern "C" fn notify_shortcuts_inhibited_trampoline<
763 P: IsA<Toplevel>,
764 F: Fn(&P) + 'static,
765 >(
766 this: *mut ffi::GdkToplevel,
767 _param_spec: glib::ffi::gpointer,
768 f: glib::ffi::gpointer,
769 ) {
770 let f: &F = &*(f as *const F);
771 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
772 }
773 unsafe {
774 let f: Box_<F> = Box_::new(f);
775 connect_raw(
776 self.as_ptr() as *mut _,
777 c"notify::shortcuts-inhibited".as_ptr() as *const _,
778 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
779 notify_shortcuts_inhibited_trampoline::<Self, F> as *const (),
780 )),
781 Box_::into_raw(f),
782 )
783 }
784 }
785
786 #[doc(alias = "startup-id")]
787 fn connect_startup_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
788 unsafe extern "C" fn notify_startup_id_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
789 this: *mut ffi::GdkToplevel,
790 _param_spec: glib::ffi::gpointer,
791 f: glib::ffi::gpointer,
792 ) {
793 let f: &F = &*(f as *const F);
794 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
795 }
796 unsafe {
797 let f: Box_<F> = Box_::new(f);
798 connect_raw(
799 self.as_ptr() as *mut _,
800 c"notify::startup-id".as_ptr() as *const _,
801 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
802 notify_startup_id_trampoline::<Self, F> as *const (),
803 )),
804 Box_::into_raw(f),
805 )
806 }
807 }
808
809 #[doc(alias = "state")]
810 fn connect_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
811 unsafe extern "C" fn notify_state_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
812 this: *mut ffi::GdkToplevel,
813 _param_spec: glib::ffi::gpointer,
814 f: glib::ffi::gpointer,
815 ) {
816 let f: &F = &*(f as *const F);
817 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
818 }
819 unsafe {
820 let f: Box_<F> = Box_::new(f);
821 connect_raw(
822 self.as_ptr() as *mut _,
823 c"notify::state".as_ptr() as *const _,
824 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
825 notify_state_trampoline::<Self, F> as *const (),
826 )),
827 Box_::into_raw(f),
828 )
829 }
830 }
831
832 #[doc(alias = "title")]
833 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
834 unsafe extern "C" fn notify_title_trampoline<P: IsA<Toplevel>, F: Fn(&P) + 'static>(
835 this: *mut ffi::GdkToplevel,
836 _param_spec: glib::ffi::gpointer,
837 f: glib::ffi::gpointer,
838 ) {
839 let f: &F = &*(f as *const F);
840 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
841 }
842 unsafe {
843 let f: Box_<F> = Box_::new(f);
844 connect_raw(
845 self.as_ptr() as *mut _,
846 c"notify::title".as_ptr() as *const _,
847 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
848 notify_title_trampoline::<Self, F> as *const (),
849 )),
850 Box_::into_raw(f),
851 )
852 }
853 }
854
855 #[doc(alias = "transient-for")]
856 fn connect_transient_for_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
857 unsafe extern "C" fn notify_transient_for_trampoline<
858 P: IsA<Toplevel>,
859 F: Fn(&P) + 'static,
860 >(
861 this: *mut ffi::GdkToplevel,
862 _param_spec: glib::ffi::gpointer,
863 f: glib::ffi::gpointer,
864 ) {
865 let f: &F = &*(f as *const F);
866 f(Toplevel::from_glib_borrow(this).unsafe_cast_ref())
867 }
868 unsafe {
869 let f: Box_<F> = Box_::new(f);
870 connect_raw(
871 self.as_ptr() as *mut _,
872 c"notify::transient-for".as_ptr() as *const _,
873 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
874 notify_transient_for_trampoline::<Self, F> as *const (),
875 )),
876 Box_::into_raw(f),
877 )
878 }
879 }
880}
881
882impl<O: IsA<Toplevel>> ToplevelExt for O {}