zng::window

Trait HeadlessAppWindowExt

source
pub trait HeadlessAppWindowExt {
    // Required methods
    fn open_window<F>(
        &mut self,
        new_window: impl IntoFuture<IntoFuture = F>,
    ) -> WindowId
       where F: Future<Output = WindowRoot> + Send + 'static;
    fn focus_window(&mut self, window_id: WindowId);
    fn blur_window(&mut self, window_id: WindowId);
    fn window_frame_image(
        &mut self,
        window_id: WindowId,
        mask: Option<ImageMaskMode>,
    ) -> ReadOnlyVar<Img, ArcVar<Img>>;
    fn close_window(&mut self, window_id: WindowId) -> bool;
    fn run_window<F>(&mut self, new_window: impl IntoFuture<IntoFuture = F>)
       where F: Send + Future<Output = WindowRoot> + 'static;
    fn doc_test_window<F>(
        &mut self,
        new_window: impl IntoFuture<IntoFuture = F>,
    )
       where F: Future<Output = WindowRoot> + 'static + Send;
}
Expand description

Window extension methods for HeadlessApp.

Required Methods§

source

fn open_window<F>( &mut self, new_window: impl IntoFuture<IntoFuture = F>, ) -> WindowId
where F: Future<Output = WindowRoot> + Send + 'static,

Open a new headless window and returns the new window ID.

The new_window runs inside the WINDOW context of the new window.

Returns the WindowId of the new window after the window is open and loaded and has generated one frame or if the window already closed before the first frame.

source

fn focus_window(&mut self, window_id: WindowId)

Cause the headless window to think it is focused in the screen.

source

fn blur_window(&mut self, window_id: WindowId)

Cause the headless window to think focus moved away from it.

source

fn window_frame_image( &mut self, window_id: WindowId, mask: Option<ImageMaskMode>, ) -> ReadOnlyVar<Img, ArcVar<Img>>

Copy the current frame pixels of the window.

The var will update until the image is loaded or error.

source

fn close_window(&mut self, window_id: WindowId) -> bool

Sends a close request.

Returns if the window was found and closed.

source

fn run_window<F>(&mut self, new_window: impl IntoFuture<IntoFuture = F>)
where F: Send + Future<Output = WindowRoot> + 'static,

Open a new headless window and update the app until the window closes.

source

fn doc_test_window<F>(&mut self, new_window: impl IntoFuture<IntoFuture = F>)
where F: Future<Output = WindowRoot> + 'static + Send,

Open a new headless window and update the app until the window closes or 60 seconds elapse.

Object Safety§

This trait is not object safe.

Implementors§