Trait gdk4::prelude::ToplevelExt

source ·
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 { ... }
}
Expand description

Trait containing all Toplevel methods.

Implementors

Toplevel

Provided Methods§

source

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())

source

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())

source

fn focus(&self, timestamp: u32)

Sets keyboard focus to @surface.

In most cases, Gtk::Window::present_with_time() should be used on a Gtk::Window, rather than calling this function.

timestamp

timestamp of the event triggering the surface focus

source

fn state(&self) -> ToplevelState

Gets the bitwise or of the currently active surface state flags, from the ToplevelState enumeration.

Returns

surface state bitfield

source

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

source

fn lower(&self) -> bool

Asks to lower the @self below other windows.

The windowing system may choose to ignore the request.

Returns

true if the surface was lowered

source

fn minimize(&self) -> bool

Asks to minimize the @self.

The windowing system may choose to ignore the request.

Returns

true if the surface was minimized

source

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

source

fn restore_system_shortcuts(&self)

Restore default system keyboard shortcuts which were previously inhibited.

This undoes the effect of inhibit_system_shortcuts().

source

fn set_decorated(&self, decorated: bool)

Sets the toplevel to be decorated.

Setting @decorated to false hints the desktop environment that the surface has its own, client-side decorations and does not need to have window decorations added.

decorated

true to request decorations

source

fn set_deletable(&self, deletable: bool)

Sets the toplevel to be deletable.

Setting @deletable to true hints the desktop environment that it should offer the user a way to close the surface.

deletable

true to request a delete button

source

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

source

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().

true if the surface is modal, false otherwise.

source

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

source

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

source

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 Gtk::Window or Gtk::Dialog.

parent

another toplevel Surface

source

fn show_window_menu(&self, event: impl AsRef<Event>) -> bool

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

true if the window menu was shown and false otherwise.

source

fn supports_edge_constraints(&self) -> bool

Returns whether the desktop environment supports tiled window states.

Returns

true if the desktop environment supports tiled window states

source

fn titlebar_gesture(&self, gesture: TitlebarGesture) -> bool

Available on crate feature v4_4 only.
source

fn is_decorated(&self) -> bool

Whether the window manager should add decorations.

source

fn is_deletable(&self) -> bool

Whether the window manager should allow to close the surface.

source

fn fullscreen_mode(&self) -> FullscreenMode

The fullscreen mode of the surface.

source

fn set_fullscreen_mode(&self, fullscreen_mode: FullscreenMode)

The fullscreen mode of the surface.

source

fn is_modal(&self) -> bool

Whether the surface is modal.

source

fn is_shortcuts_inhibited(&self) -> bool

Whether the surface should inhibit keyboard shortcuts.

source

fn startup_id(&self) -> Option<GString>

The startup ID of the surface.

See AppLaunchContext for more information about startup feedback.

source

fn title(&self) -> Option<GString>

The title of the surface.

source

fn transient_for(&self) -> Option<Surface>

The transient parent of the surface.

source

fn connect_decorated_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

source

fn connect_deletable_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

source

fn connect_fullscreen_mode_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

source

fn connect_icon_list_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

source

fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

source

fn connect_shortcuts_inhibited_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

source

fn connect_startup_id_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

source

fn connect_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

source

fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

source

fn connect_transient_for_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

Implementors§