floem

Trait WindowIdExt

Source
pub trait WindowIdExt: WindowIdExtSealed {
Show 22 methods // Required methods fn bounds_on_screen_including_frame(&self) -> Option<Rect>; fn bounds_of_content_on_screen(&self) -> Option<Rect>; fn position_on_screen_including_frame(&self) -> Option<Point>; fn position_of_content_on_screen(&self) -> Option<Point>; fn monitor_bounds(&self) -> Option<Rect>; fn is_visible(&self) -> bool; fn is_minimized(&self) -> bool; fn is_maximized(&self) -> bool; fn is_document_edited(&self) -> bool; fn force_repaint(&self) -> bool; fn root_view(&self) -> Option<ViewId>; fn screen_layout(&self) -> Option<ScreenLayout>; fn scale(&self) -> f64; // Provided methods fn set_document_edited(&self, edited: bool) { ... } fn set_visible(&self, visible: bool) { ... } fn set_window_inner_bounds(&self, bounds: Rect) { ... } fn set_window_outer_bounds(&self, bounds: Rect) { ... } fn maximized(&self, maximized: bool) { ... } fn minimized(&self, minimized: bool) { ... } fn set_outer_location(&self, location: Point) { ... } fn set_content_size(&self, size: Size) { ... } fn request_attention(&self, urgency: Urgency) { ... }
}
Expand description

Extends WindowId to give instances methods to retrieve properties of the associated window, much as ViewId does.

Methods may return None if the view is not realized on-screen, or if information needed to compute the result is not available on the current platform or available on the current platform but not from the calling thread.

Platform support notes:

  • macOS: Many of the methods here, if called from a thread other than main, are blocking because accessing most window properties may only be done from the main thread on that OS.
  • Android & Wayland: Getting the outer position of a window is not supported by winit and methods whose return value have that as a prerequisite will return None or return a reasonable default.
  • X11: Some window managers (Openbox was one such which was tested) appear to support retrieving separate window-with-frame and window-content positions and sizes, but in fact report the same values for both.

Required Methods§

Source

fn bounds_on_screen_including_frame(&self) -> Option<Rect>

Get the bounds of the content of this window, including titlebar and native window borders.

Source

fn bounds_of_content_on_screen(&self) -> Option<Rect>

Get the bounds of the content of this window, excluding titlebar and native window borders.

Source

fn position_on_screen_including_frame(&self) -> Option<Point>

Get the location of the window including any OS titlebar.

Source

fn position_of_content_on_screen(&self) -> Option<Point>

Get the location of the window’s content on the monitor where it currently resides, excluding any OS titlebar.

Source

fn monitor_bounds(&self) -> Option<Rect>

Get the logical bounds of the monitor this window is on.

Source

fn is_visible(&self) -> bool

Determine if this window is currently visible. Note that if a call to set a window visible which is invisible has happened within the current event loop cycle, the state returned will not reflect that.

Source

fn is_minimized(&self) -> bool

Determine if this window is currently minimized. Note that if a call to minimize or unminimize this window, and it is currently in the opposite state, has happened the current event loop cycle, the state returned will not reflect that.

Source

fn is_maximized(&self) -> bool

Determine if this window is currently maximize. Note that if a call to maximize or unmaximize this window, and it is currently in the opposite state, has happened the current event loop cycle, the state returned will not reflect that.

Source

fn is_document_edited(&self) -> bool

Determine if the window decorations should indicate an edited, unsaved document. Platform-dependent: Will only ever return true on macOS.

Source

fn force_repaint(&self) -> bool

Force a repaint of this window through the native window’s repaint mechanism, bypassing floem’s normal repaint mechanism.

This method may be removed or deprecated in the future, but has been needed in some situations, and to address a few ongoing issues in winit (window unmaximize is delayed until an external event triggers a repaint of the requesting window), and may be needed as a workaround if other such issues are discovered until they can be addressed.

Returns true if the repaint request was issued successfully (i.e. there is an actual system-level window corresponding to this WindowId).

Source

fn root_view(&self) -> Option<ViewId>

Get the root view of this window.

Source

fn screen_layout(&self) -> Option<ScreenLayout>

Get a layout of this window in relation to the monitor on which it currently resides, if any.

Source

fn scale(&self) -> f64

Get the dots-per-inch scaling of this window or 1.0 if the platform does not support it (Android).

Provided Methods§

Source

fn set_document_edited(&self, edited: bool)

Instruct the window manager to indicate in the window’s decorations that the window contains an unsaved, edited document. Only has an effect on macOS.

Source

fn set_visible(&self, visible: bool)

Set this window’s visible state, hiding or showing it if it has been hidden

Source

fn set_window_inner_bounds(&self, bounds: Rect)

Update the bounds of this window.

Source

fn set_window_outer_bounds(&self, bounds: Rect)

Update the bounds of this window.

Source

fn maximized(&self, maximized: bool)

Change this window’s maximized state.

Source

fn minimized(&self, minimized: bool)

Change this window’s minimized state.

Source

fn set_outer_location(&self, location: Point)

Change this window’s minimized state.

Source

fn set_content_size(&self, size: Size)

Ask the OS’s windowing framework to update the size of the window based on the passed size for its content (excluding titlebar, frame or other decorations).

Source

fn request_attention(&self, urgency: Urgency)

Cause the desktop to perform some attention-drawing behavior that draws the user’s attention specifically to this window - e.g. bouncing in the dock on macOS. On X11, after calling this method with some urgency other than None, it is necessary to clear the attention-seeking state by calling this method again with Urgency::None.

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.

Implementors§