Trait zng::window::WINDOW_Ext

source ·
pub trait WINDOW_Ext {
    // Provided methods
    fn vars(&self) -> WindowVars { ... }
    fn is_open(&self) -> bool { ... }
    fn is_loaded(&self) -> bool { ... }
    fn enable_access(&self) { ... }
    fn loading_handle(
        &self,
        deadline: impl Into<Deadline>,
    ) -> Option<WindowLoadingHandle> { ... }
    fn frame_image(
        &self,
        mask: Option<ImageMaskMode>,
    ) -> ReadOnlyVar<Img, ArcVar<Img>> { ... }
    fn frame_image_rect(
        &self,
        rect: Rect<Px, Px>,
        mask: Option<ImageMaskMode>,
    ) -> ReadOnlyVar<Img, ArcVar<Img>> { ... }
    fn bring_to_top(&self) { ... }
    fn close(
        &self,
    ) -> ReadOnlyVar<Response<CloseWindowResult>, ArcVar<Response<CloseWindowResult>>> { ... }
}
Expand description

Extensions methods for WINDOW contexts of windows open by WINDOWS.

Provided Methods§

source

fn vars(&self) -> WindowVars

Clone a reference to the variables that get and set window properties.

source

fn is_open(&self) -> bool

Returns true if the window is open.

source

fn is_loaded(&self) -> bool

Returns true if the window is open and loaded.

source

fn enable_access(&self)

Enable accessibility info.

If access is not already enabled, enables it in the app-process only.

source

fn loading_handle( &self, deadline: impl Into<Deadline>, ) -> Option<WindowLoadingHandle>

Gets a handle that stops the window from loading while the handle is alive.

A window is only opened in the view-process after it is loaded, without any loading handles the window is considered loaded after the first layout pass. Nodes in the window can request a loading handle to delay the view opening to after all async resources it requires are loaded.

Note that a window is only loaded after all handles are dropped or expired, you should set a reasonable deadline,
it is best to partially render a window after a short time than not show anything.

Returns None if the window has already loaded.

source

fn frame_image( &self, mask: Option<ImageMaskMode>, ) -> ReadOnlyVar<Img, ArcVar<Img>>

Generate an image from the current rendered frame of the window.

The image is not loaded at the moment of return, it will update when it is loaded.

source

fn frame_image_rect( &self, rect: Rect<Px, Px>, mask: Option<ImageMaskMode>, ) -> ReadOnlyVar<Img, ArcVar<Img>>

Generate an image from a selection of the current rendered frame of the window.

The image is not loaded at the moment of return, it will update when it is loaded.

If the window is not found the error is reported in the image error.

source

fn bring_to_top(&self)

Move the window to the front of the operating system Z stack.

See WINDOWS.bring_to_top for more details.

source

fn close( &self, ) -> ReadOnlyVar<Response<CloseWindowResult>, ArcVar<Response<CloseWindowResult>>>

Starts closing the window, the operation can be canceled by listeners of WINDOW_CLOSE_REQUESTED_EVENT. If the window has children they are closed together.

Returns a response var that will update once with the result of the operation.

See WINDOWS.close for more details.

Object Safety§

This trait is not object safe.

Implementors§