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