pub trait ToplevelExt:
IsA<Toplevel>
+ Sealed
+ 'static {
Show 38 methods
// Provided methods
fn begin_move(
&self,
device: &impl IsA<Device>,
button: i32,
x: f64,
y: f64,
timestamp: u32,
) { ... }
fn begin_resize(
&self,
edge: SurfaceEdge,
device: Option<&impl IsA<Device>>,
button: i32,
x: f64,
y: f64,
timestamp: u32,
) { ... }
fn focus(&self, timestamp: u32) { ... }
fn state(&self) -> ToplevelState { ... }
fn inhibit_system_shortcuts(&self, event: Option<impl AsRef<Event>>) { ... }
fn lower(&self) -> bool { ... }
fn minimize(&self) -> bool { ... }
fn present(&self, layout: &ToplevelLayout) { ... }
fn restore_system_shortcuts(&self) { ... }
fn set_decorated(&self, decorated: bool) { ... }
fn set_deletable(&self, deletable: bool) { ... }
fn set_icon_list(&self, surfaces: &[Texture]) { ... }
fn set_modal(&self, modal: bool) { ... }
fn set_startup_id(&self, startup_id: &str) { ... }
fn set_title(&self, title: &str) { ... }
fn set_transient_for(&self, parent: &impl IsA<Surface>) { ... }
fn show_window_menu(&self, event: impl AsRef<Event>) -> bool { ... }
fn supports_edge_constraints(&self) -> bool { ... }
fn titlebar_gesture(&self, gesture: TitlebarGesture) -> bool { ... }
fn is_decorated(&self) -> bool { ... }
fn is_deletable(&self) -> bool { ... }
fn fullscreen_mode(&self) -> FullscreenMode { ... }
fn set_fullscreen_mode(&self, fullscreen_mode: FullscreenMode) { ... }
fn is_modal(&self) -> bool { ... }
fn is_shortcuts_inhibited(&self) -> bool { ... }
fn startup_id(&self) -> Option<GString> { ... }
fn title(&self) -> Option<GString> { ... }
fn transient_for(&self) -> Option<Surface> { ... }
fn connect_decorated_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_deletable_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_fullscreen_mode_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_icon_list_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_modal_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_shortcuts_inhibited_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_startup_id_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_state_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_title_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_transient_for_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Provided Methods§
Sourcefn begin_move(
&self,
device: &impl IsA<Device>,
button: i32,
x: f64,
y: f64,
timestamp: u32,
)
fn begin_move( &self, device: &impl IsA<Device>, button: i32, x: f64, y: f64, timestamp: u32, )
Begins an interactive move operation.
You might use this function to implement draggable titlebars.
§device
the device used for the operation
§button
the button being used to drag, or 0 for a keyboard-initiated drag
§x
surface X coordinate of mouse click that began the drag
§y
surface Y coordinate of mouse click that began the drag
§timestamp
timestamp of mouse click that began the drag (use
Event::time()
)
Sourcefn begin_resize(
&self,
edge: SurfaceEdge,
device: Option<&impl IsA<Device>>,
button: i32,
x: f64,
y: f64,
timestamp: u32,
)
fn begin_resize( &self, edge: SurfaceEdge, device: Option<&impl IsA<Device>>, button: i32, x: f64, y: f64, timestamp: u32, )
Begins an interactive resize operation.
You might use this function to implement a “window resize grip.”
§edge
the edge or corner from which the drag is started
§device
the device used for the operation
§button
the button being used to drag, or 0 for a keyboard-initiated drag
§x
surface X coordinate of mouse click that began the drag
§y
surface Y coordinate of mouse click that began the drag
§timestamp
timestamp of mouse click that began the drag (use
Event::time()
)
Sourcefn focus(&self, timestamp: u32)
fn focus(&self, timestamp: u32)
Sets keyboard focus to @surface.
In most cases, gtk_window_present_with_time() should be used on a GtkWindow, rather than calling this function.
§timestamp
timestamp of the event triggering the surface focus
Sourcefn state(&self) -> ToplevelState
fn state(&self) -> ToplevelState
Gets the bitwise or of the currently active surface state flags,
from the ToplevelState
enumeration.
§Returns
surface state bitfield
Sourcefn inhibit_system_shortcuts(&self, event: Option<impl AsRef<Event>>)
fn inhibit_system_shortcuts(&self, event: Option<impl AsRef<Event>>)
Requests that the @self inhibit the system shortcuts.
This is asking the desktop environment/windowing system to let all keyboard events reach the surface, as long as it is focused, instead of triggering system actions.
If granted, the rerouting remains active until the default shortcuts
processing is restored with restore_system_shortcuts()
,
or the request is revoked by the desktop environment, windowing system
or the user.
A typical use case for this API is remote desktop or virtual machine viewers which need to inhibit the default system keyboard shortcuts so that the remote session or virtual host gets those instead of the local environment.
The windowing system or desktop environment may ask the user to grant or deny the request or even choose to ignore the request entirely.
The caller can be notified whenever the request is granted or revoked
by listening to the shortcuts-inhibited
property.
§event
the Event
that is triggering the inhibit
request, or None
if none is available
Sourcefn present(&self, layout: &ToplevelLayout)
fn present(&self, layout: &ToplevelLayout)
Present @self after having processed the ToplevelLayout
rules.
If the toplevel was previously not showing, it will be showed, otherwise it will change layout according to @layout.
GDK may emit the compute-size
signal to let
the user of this toplevel compute the preferred size of the toplevel
surface.
Presenting is asynchronous and the specified layout parameters are not guaranteed to be respected.
§layout
the ToplevelLayout
object used to layout
Sourcefn restore_system_shortcuts(&self)
fn restore_system_shortcuts(&self)
Restore default system keyboard shortcuts which were previously inhibited.
This undoes the effect of inhibit_system_shortcuts()
.
Sourcefn set_decorated(&self, decorated: bool)
fn set_decorated(&self, decorated: bool)
Sourcefn set_deletable(&self, deletable: bool)
fn set_deletable(&self, deletable: bool)
Sourcefn set_icon_list(&self, surfaces: &[Texture])
fn set_icon_list(&self, surfaces: &[Texture])
Sets a list of icons for the surface.
One of these will be used to represent the surface in iconic form. The icon may be shown in window lists or task bars. Which icon size is shown depends on the window manager. The window manager can scale the icon but setting several size icons can give better image quality.
Note that some platforms don’t support surface icons.
§surfaces
A list of textures to use as icon, of different sizes
Sourcefn set_modal(&self, modal: bool)
fn set_modal(&self, modal: bool)
Sets the toplevel to be modal.
The application can use this hint to tell the window manager that a certain surface has modal behaviour. The window manager can use this information to handle modal surfaces in a special way.
You should only use this on surfaces for which you have
previously called set_transient_for()
.
§modal
Sourcefn set_startup_id(&self, startup_id: &str)
fn set_startup_id(&self, startup_id: &str)
Sets the startup notification ID.
When using GTK, typically you should use gtk_window_set_startup_id() instead of this low-level function.
§startup_id
a string with startup-notification identifier
Sourcefn set_title(&self, title: &str)
fn set_title(&self, title: &str)
Sets the title of a toplevel surface.
The title maybe be displayed in the titlebar, in lists of windows, etc.
§title
title of @surface
Sourcefn set_transient_for(&self, parent: &impl IsA<Surface>)
fn set_transient_for(&self, parent: &impl IsA<Surface>)
Sets a transient-for parent.
Indicates to the window manager that @surface is a transient dialog associated with the application surface @parent. This allows the window manager to do things like center @surface on @parent and keep @surface above @parent.
See gtk_window_set_transient_for() if you’re using GtkWindow.
§parent
another toplevel Surface
Asks the windowing system to show the window menu.
The window menu is the menu shown when right-clicking the titlebar on traditional windows managed by the window manager. This is useful for windows using client-side decorations, activating it with a right-click on the window decorations.
§event
a Event
to show the menu for
§Returns
Sourcefn supports_edge_constraints(&self) -> bool
fn supports_edge_constraints(&self) -> bool
Sourcefn titlebar_gesture(&self, gesture: TitlebarGesture) -> bool
Available on crate feature v4_4
only.
fn titlebar_gesture(&self, gesture: TitlebarGesture) -> bool
v4_4
only.Sourcefn is_decorated(&self) -> bool
fn is_decorated(&self) -> bool
Whether the window manager should add decorations.
Sourcefn is_deletable(&self) -> bool
fn is_deletable(&self) -> bool
Whether the window manager should allow to close the surface.
Sourcefn fullscreen_mode(&self) -> FullscreenMode
fn fullscreen_mode(&self) -> FullscreenMode
The fullscreen mode of the surface.
Sourcefn set_fullscreen_mode(&self, fullscreen_mode: FullscreenMode)
fn set_fullscreen_mode(&self, fullscreen_mode: FullscreenMode)
The fullscreen mode of the surface.
Sourcefn is_shortcuts_inhibited(&self) -> bool
fn is_shortcuts_inhibited(&self) -> bool
Whether the surface should inhibit keyboard shortcuts.
Sourcefn startup_id(&self) -> Option<GString>
fn startup_id(&self) -> Option<GString>
The startup ID of the surface.
See AppLaunchContext
for more information about
startup feedback.
Sourcefn transient_for(&self) -> Option<Surface>
fn transient_for(&self) -> Option<Surface>
The transient parent of the surface.
fn connect_decorated_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_deletable_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_fullscreen_mode_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_icon_list_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_shortcuts_inhibited_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_startup_id_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_transient_for_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.