pub struct WINDOWS;Expand description
Windows service.
Implementations§
Source§impl WINDOWS
impl WINDOWS
Sourcepub fn exit_on_last_close(&self) -> Var<bool>
pub fn exit_on_last_close(&self) -> Var<bool>
Defines if app process exit should be requested when the last window closes. This is true by default.
This setting does not consider headless windows and is fully ignored in headless apps.
Note that if APP.exit is requested directly the windows service will cancel it, request
close for all headed and headless windows, and if all windows close request app exit again, independent
of this setting.
Sourcepub fn default_render_mode(&self) -> Var<RenderMode>
pub fn default_render_mode(&self) -> Var<RenderMode>
Defines the render mode of windows opened by this service.
Note that this setting only affects windows opened after it is changed, also the view-process may select a different render mode if it cannot support the requested mode.
Sourcepub fn parallel(&self) -> Var<ParallelWin>
pub fn parallel(&self) -> Var<ParallelWin>
Defines what window operations can run in parallel, between windows.
Note that this config is for parallel execution between windows, see the parallel property for parallel execution
within windows and widgets.
See ParallelWin for the options.
Sourcepub fn system_chrome(&self) -> Var<bool>
pub fn system_chrome(&self) -> Var<bool>
Variable that tracks the OS window manager configuration for the window chrome.
The chrome (also known as window decorations) defines the title bar, window buttons and window border. Some
window managers don’t provide a native chrome, you can use this config with WindowVars::chrome
in a register_root_extender to provide a custom fallback chrome, the main crate zng also provides a custom
chrome fallback.
Source§impl WINDOWS
impl WINDOWS
Sourcepub fn open<F>(
&self,
window_id: impl Into<WindowId>,
new_window: impl IntoFuture<IntoFuture = F>,
) -> ResponseVar<WindowVars>
pub fn open<F>( &self, window_id: impl Into<WindowId>, new_window: impl IntoFuture<IntoFuture = F>, ) -> ResponseVar<WindowVars>
Requests a new window.
The new_window future runs inside the new WINDOW context.
Returns a response var that will update once when the window starts building, the WindowVars::instance_state can be
use to continue monitoring the window.
An update cycle is processed between the end of new_window and the window init, this means that you
can use the context WINDOW to set variables that will be read on init with the new value.
Note that there are no window handles, the window is controlled in the service using the ID or from the inside.
§Panics
If the window_id is already assigned to an open or opening window.
Sourcepub fn focus_or_open<F>(
&self,
window_id: impl Into<WindowId>,
new_window: impl IntoFuture<IntoFuture = F>,
) -> ResponseVar<WindowVars>
pub fn focus_or_open<F>( &self, window_id: impl Into<WindowId>, new_window: impl IntoFuture<IntoFuture = F>, ) -> ResponseVar<WindowVars>
Focus a window if it is open or loading, otherwise opens it focused.
Returns a variable that updates once the window starts building or is already open. You can
track the focused status using WindowVars::is_focused.
Sourcepub fn open_headless<F>(
&self,
window_id: impl Into<WindowId>,
new_window: impl IntoFuture<IntoFuture = F>,
with_renderer: bool,
) -> ResponseVar<WindowVars>
pub fn open_headless<F>( &self, window_id: impl Into<WindowId>, new_window: impl IntoFuture<IntoFuture = F>, with_renderer: bool, ) -> ResponseVar<WindowVars>
Requests a new headless window.
This is similar to open, but the window will not show on screen and can optionally not even have a renderer.
§Panics
If the window_id is already assigned to an open or opening window.
Sourcepub fn loading_handle(
&self,
window_id: impl Into<WindowId>,
deadline: impl Into<Deadline>,
debug_name: impl Into<Txt>,
) -> Option<WindowLoadingHandle>
pub fn loading_handle( &self, window_id: impl Into<WindowId>, deadline: impl Into<Deadline>, debug_name: impl Into<Txt>, ) -> 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 or is not found.
Sourcepub fn close(
&self,
window_id: impl Into<WindowId>,
) -> ResponseVar<CloseWindowResult>
pub fn close( &self, window_id: impl Into<WindowId>, ) -> ResponseVar<CloseWindowResult>
Starts closing a 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.
If the window is not found returns Closed.
Sourcepub fn close_together(
&self,
windows: impl IntoIterator<Item = WindowId>,
) -> ResponseVar<CloseWindowResult>
pub fn close_together( &self, windows: impl IntoIterator<Item = WindowId>, ) -> ResponseVar<CloseWindowResult>
Starts closing multiple windows together, the operation can be canceled by listeners of
WINDOW_CLOSE_REQUESTED_EVENT. If canceled none of the windows are closed. Children of each window
are also selected the close together.
Returns a response var that will update once with the result of the operation. Returns
Cancel if windows is empty.
Sourcepub fn close_all(&self) -> ResponseVar<CloseWindowResult>
pub fn close_all(&self) -> ResponseVar<CloseWindowResult>
Starts closing all open windows together, the operation can be canceled by listeners of
WINDOW_CLOSE_REQUESTED_EVENT. If canceled none of the windows are closed.
Returns a response var that will update once with the result of the operation. Returns
Cancel if no window is open.
Source§impl WINDOWS
impl WINDOWS
Sourcepub fn mode(&self, window_id: impl Into<WindowId>) -> Option<WindowMode>
pub fn mode(&self, window_id: impl Into<WindowId>) -> Option<WindowMode>
Gets if the window is headed or headless.
Returns None if the window is not found.
Sourcepub fn vars(&self, window_id: impl Into<WindowId>) -> Option<WindowVars>
pub fn vars(&self, window_id: impl Into<WindowId>) -> Option<WindowVars>
Returns a shared reference the variables that control the window, if the window exists.
Sourcepub fn widget_tree(&self, id: impl Into<WindowId>) -> Option<WidgetInfoTree>
pub fn widget_tree(&self, id: impl Into<WindowId>) -> Option<WidgetInfoTree>
Get the latest info tree for the window.
Sourcepub fn widget_info(&self, id: impl Into<WidgetId>) -> Option<WidgetInfo>
pub fn widget_info(&self, id: impl Into<WidgetId>) -> Option<WidgetInfo>
Search for the widget in the latest info tree of each open window.
Sourcepub fn widget_trees(&self) -> Vec<WidgetInfoTree>
pub fn widget_trees(&self) -> Vec<WidgetInfoTree>
Returns shared references to the widget trees of each open window.
Source§impl WINDOWS
impl WINDOWS
Sourcepub fn frame_image(
&self,
window_id: impl Into<WindowId>,
mask: Option<ImageMaskMode>,
) -> Var<ImageEntry>
pub fn frame_image( &self, window_id: impl Into<WindowId>, mask: Option<ImageMaskMode>, ) -> Var<ImageEntry>
Generate an image from the current rendered frame of the window or the first frame of the window.
The image is not loaded at the moment of return, it will update when the frame pixels are copied.
If the window is not found or an error is reported in the image error.
Sourcepub fn frame_image_rect(
&self,
window_id: impl Into<WindowId>,
rect: Rect<Px, Px>,
mask: Option<ImageMaskMode>,
) -> Var<ImageEntry>
pub fn frame_image_rect( &self, window_id: impl Into<WindowId>, rect: Rect<Px, Px>, mask: Option<ImageMaskMode>, ) -> Var<ImageEntry>
Generate an image from a rectangular selection of the current rendered frame of the window, or of the first frame of the window.
If the window is not found the error is reported in the image error.
Trait Implementations§
Source§impl ImageRenderWindowsService for WINDOWS
Available on crate feature image only.
impl ImageRenderWindowsService for WINDOWS
image only.Source§fn clone_boxed(&self) -> Box<dyn ImageRenderWindowsService>
fn clone_boxed(&self) -> Box<dyn ImageRenderWindowsService>
Source§fn new_window_root(
&self,
node: UiNode,
render_mode: RenderMode,
) -> Box<dyn ImageRenderWindowRoot>
fn new_window_root( &self, node: UiNode, render_mode: RenderMode, ) -> Box<dyn ImageRenderWindowRoot>
Source§fn set_parent_in_window_context(&self, parent_id: WindowId)
fn set_parent_in_window_context(&self, parent_id: WindowId)
Source§fn enable_frame_capture_in_window_context(&self, mask: Option<ImageMaskMode>)
fn enable_frame_capture_in_window_context(&self, mask: Option<ImageMaskMode>)
Source§fn open_headless_window(
&self,
new_window_root: Box<dyn FnOnce() -> Box<dyn ImageRenderWindowRoot> + Send>,
)
fn open_headless_window( &self, new_window_root: Box<dyn FnOnce() -> Box<dyn ImageRenderWindowRoot> + Send>, )
Source§fn close_window(&self, window_id: WindowId)
fn close_window(&self, window_id: WindowId)
Source§impl WINDOWS_Ext for WINDOWS
impl WINDOWS_Ext for WINDOWS
Source§impl WindowsService for WINDOWS
impl WindowsService for WINDOWS
Source§fn widget_tree(&self, id: WindowId) -> Option<WidgetInfoTree>
fn widget_tree(&self, id: WindowId) -> Option<WidgetInfoTree>
Source§fn widget_info(&self, id: WidgetId) -> Option<WidgetInfo>
fn widget_info(&self, id: WidgetId) -> Option<WidgetInfo>
Source§fn update_info(&self, updates: &mut InfoUpdates)
fn update_info(&self, updates: &mut InfoUpdates)
Source§fn update_widgets(&self, updates: &mut WidgetUpdates)
fn update_widgets(&self, updates: &mut WidgetUpdates)
Source§fn update_layout(&self, updates: &mut LayoutUpdates)
fn update_layout(&self, updates: &mut LayoutUpdates)
Source§fn update_render(
&self,
render_widgets: &mut RenderUpdates,
render_update_widgets: &mut RenderUpdates,
)
fn update_render( &self, render_widgets: &mut RenderUpdates, render_update_widgets: &mut RenderUpdates, )
Auto Trait Implementations§
impl Freeze for WINDOWS
impl RefUnwindSafe for WINDOWS
impl Send for WINDOWS
impl Sync for WINDOWS
impl Unpin for WINDOWS
impl UnwindSafe for WINDOWS
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more