pub struct WINDOWS_EXTENSIONS;Expand description
Windows extensions hooks.
Implementations§
Source§impl WINDOWS_EXTENSIONS
impl WINDOWS_EXTENSIONS
Sourcepub fn register_root_extender(
&self,
extender: impl FnMut(WindowRootExtenderArgs) -> UiNode + Send + 'static,
)
pub fn register_root_extender( &self, extender: impl FnMut(WindowRootExtenderArgs) -> UiNode + Send + 'static, )
Register the closure extender to be called with the root of every new window starting on the next update.
The closure returns the new root node that will be passed to any other root extender until
the actual final root node is created. The closure is called in the WINDOW context of the new window,
so it can be used to modify the window context too.
This is an advanced API that enables app wide features, like themes, to inject context in every new window. The extender is called in the context of the window, after the window creation future has completed.
Note that the root node passed to the extender is the child node of the WindowRoot widget, not the widget itself.
The extended root will be wrapped in the root widget node, that is, the final root widget will be
root(extender_nodes(CONTEXT(EVENT(..)))), so extension nodes should operate as CONTEXT properties.
Note that for themes the zng-wgt-window crate provides a register_style_fn API that is built over this
method and more oriented for theming.
Sourcepub fn register_open_nested_handler(
&self,
handler: impl FnMut(&mut OpenNestedHandlerArgs) + Send + 'static,
)
pub fn register_open_nested_handler( &self, handler: impl FnMut(&mut OpenNestedHandlerArgs) + Send + 'static, )
Register the closure handler to be called for every new window starting on the next update.
The closure is called in the new WINDOW context and can optionally call OpenNestedHandlerArgs::nest to convert to a nested window.
Nested windows can be manipulated using the WINDOWS API just like other windows, but are layout and rendered inside another window.
This is primarily an adapter for mobile platforms that only support one real window, it accelerates cross platform support from projects originally desktop only.
Note that this API is not recommended for implementing features such as window docking or
tabbing, for that you probably need to model tabs as objects that can outlive their host windows and use ArcNode
to transfer the content between host windows.
Sourcepub fn view_extensions_init(
&self,
window_id: impl Into<WindowId>,
extension_id: ApiExtensionId,
request: ApiExtensionPayload,
) -> Result<(), ViewExtensionError>
pub fn view_extensions_init( &self, window_id: impl Into<WindowId>, extension_id: ApiExtensionId, request: ApiExtensionPayload, ) -> Result<(), ViewExtensionError>
Add a view-process extension payload to the window request for the view-process.
This will only work if called on the first UiNode::init and at most the first UiNode::layout of the window.
The payload is dropped after it is send, this method must be called again on VIEW_PROCESS_INITED_EVENT
to reinitialize the extensions after view-process respawn.
Sourcepub fn view_window_extension_raw(
&self,
window_id: impl Into<WindowId>,
extension_id: ApiExtensionId,
request: ApiExtensionPayload,
) -> Result<ApiExtensionPayload, ViewExtensionError>
pub fn view_window_extension_raw( &self, window_id: impl Into<WindowId>, extension_id: ApiExtensionId, request: ApiExtensionPayload, ) -> Result<ApiExtensionPayload, ViewExtensionError>
Call a view-process headed window extension with custom encoded payload.
Note that unlike most service methods this calls happens immediately.
Sourcepub fn view_window_extension<I, O>(
&self,
window_id: impl Into<WindowId>,
extension_id: ApiExtensionId,
request: &I,
) -> Result<O, ViewExtensionError>where
I: Serialize,
O: DeserializeOwned,
pub fn view_window_extension<I, O>(
&self,
window_id: impl Into<WindowId>,
extension_id: ApiExtensionId,
request: &I,
) -> Result<O, ViewExtensionError>where
I: Serialize,
O: DeserializeOwned,
Call a headed window extension with serialized payload.
Note that unlike most service methods this call happens immediately.
Sourcepub fn view_render_extension_raw(
&self,
window_id: impl Into<WindowId>,
extension_id: ApiExtensionId,
request: ApiExtensionPayload,
) -> Result<ApiExtensionPayload, ViewExtensionError>
pub fn view_render_extension_raw( &self, window_id: impl Into<WindowId>, extension_id: ApiExtensionId, request: ApiExtensionPayload, ) -> Result<ApiExtensionPayload, ViewExtensionError>
Call a view-process render extension with custom encoded payload for the renderer associated with the window.
Note that unlike most service methods this call happens immediately.
Sourcepub fn view_render_extension<I, O>(
&self,
window_id: impl Into<WindowId>,
extension_id: ApiExtensionId,
request: &I,
) -> Result<O, ViewExtensionError>where
I: Serialize,
O: DeserializeOwned,
pub fn view_render_extension<I, O>(
&self,
window_id: impl Into<WindowId>,
extension_id: ApiExtensionId,
request: &I,
) -> Result<O, ViewExtensionError>where
I: Serialize,
O: DeserializeOwned,
Call a render extension with serialized payload for the renderer associated with the window.
Note that unlike most service methods this call happens immediately.
Auto Trait Implementations§
impl Freeze for WINDOWS_EXTENSIONS
impl RefUnwindSafe for WINDOWS_EXTENSIONS
impl Send for WINDOWS_EXTENSIONS
impl Sync for WINDOWS_EXTENSIONS
impl Unpin for WINDOWS_EXTENSIONS
impl UnwindSafe for WINDOWS_EXTENSIONS
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> 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