Struct workflow_nw::ipc::imports::Window
source · pub struct Window { /* private fields */ }Expand description
Interface for managing application windows. For usage example please refer to nw_sys::window
Implementations§
source§impl Window
impl Window
source§impl Window
impl Window
source§impl Window
impl Window
sourcepub fn set_height(&self, height: u32)
pub fn set_height(&self, height: u32)
Set window’s size, including the window’s frame.
source§impl Window
impl Window
sourcepub fn is_always_on_top(&self) -> bool
pub fn is_always_on_top(&self) -> bool
Get whether the window is always on top of other windows.
source§impl Window
impl Window
sourcepub fn zoom_level(&self) -> i16
pub fn zoom_level(&self) -> i16
Get the page zoom. 0 for normal size; positive value for zooming in; negative value for zooming out.
source§impl Window
impl Window
sourcepub fn set_zoom_level(&self, zoom: i16)
pub fn set_zoom_level(&self, zoom: i16)
Set the page zoom. 0 for normal size; positive value for zooming in; negative value for zooming out.
source§impl Window
impl Window
source§impl Window
impl Window
source§impl Window
impl Window
source§impl Window
impl Window
sourcepub fn set_inner_height(&self, height: u32)
pub fn set_inner_height(&self, height: u32)
Set the inner height of the window
source§impl Window
impl Window
source§impl Window
impl Window
source§impl Window
impl Window
source§impl Window
impl Window
source§impl Window
impl Window
sourcepub fn close_impl(&self, force: bool)
pub fn close_impl(&self, force: bool)
Closes the current window. You can prevent the closing by listening to the close event. if force is equals true, then the close event will be ignored.
source§impl Window
impl Window
sourcepub fn reload_dev(&self)
pub fn reload_dev(&self)
Reloads the current page by starting a new renderer process from scratch.
source§impl Window
impl Window
sourcepub fn reload_ignoring_cache(&self)
pub fn reload_ignoring_cache(&self)
Like reload(), but don’t use caches (aka “shift-reload”).
source§impl Window
impl Window
source§impl Window
impl Window
sourcepub fn unmaximize(&self)
pub fn unmaximize(&self)
Unmaximize the window, i.e. the reverse of maximize().
source§impl Window
impl Window
source§impl Window
impl Window
source§impl Window
impl Window
sourcepub fn enter_fullscreen(&self)
pub fn enter_fullscreen(&self)
Make the window fullscreen.
source§impl Window
impl Window
sourcepub fn leave_fullscreen(&self)
pub fn leave_fullscreen(&self)
Leave the fullscreen mode.
source§impl Window
impl Window
sourcepub fn toggle_fullscreen(&self)
pub fn toggle_fullscreen(&self)
Toggle the fullscreen mode.
source§impl Window
impl Window
sourcepub fn enter_kiosk_mode(&self)
pub fn enter_kiosk_mode(&self)
Enter the Kiosk mode. In Kiosk mode, the app will be fullscreen and try to prevent users from leaving the app, so you should remember to provide a way in app to leave Kiosk mode. This mode is mainly used for presentation on public displays.
source§impl Window
impl Window
sourcepub fn leave_kiosk_mode(&self)
pub fn leave_kiosk_mode(&self)
Leave the Kiosk mode.
source§impl Window
impl Window
sourcepub fn toggle_kiosk_mode(&self)
pub fn toggle_kiosk_mode(&self)
Toggle the kiosk mode.
source§impl Window
impl Window
sourcepub fn set_shadow(&self, shadow: bool)
pub fn set_shadow(&self, shadow: bool)
(Mac) Turn the window’s native shadow on/off. Useful for frameless, transparent windows.
source§impl Window
impl Window
sourcepub fn show_dev_tools(&self)
pub fn show_dev_tools(&self)
Open the devtools to inspect the window.
source§impl Window
impl Window
sourcepub fn show_dev_tools_with_id(&self, iframe_id: &str)
pub fn show_dev_tools_with_id(&self, iframe_id: &str)
Open the devtools to inspect the window.
source§impl Window
impl Window
sourcepub fn show_dev_tools_with_id_and_callback(
&self,
iframe_id: &str,
callback: &Function,
)
pub fn show_dev_tools_with_id_and_callback( &self, iframe_id: &str, callback: &Function, )
Open the devtools to inspect the window.
source§impl Window
impl Window
sourcepub fn show_dev_tools_with_iframe(&self, iframe_element: &HtmlIFrameElement)
pub fn show_dev_tools_with_iframe(&self, iframe_element: &HtmlIFrameElement)
Open the devtools to inspect the window.
source§impl Window
impl Window
sourcepub fn show_dev_tools_with_iframe_and_callback(
&self,
iframe_element: &HtmlIFrameElement,
callback: &Function,
)
pub fn show_dev_tools_with_iframe_and_callback( &self, iframe_element: &HtmlIFrameElement, callback: &Function, )
Open the devtools to inspect the window.
source§impl Window
impl Window
sourcepub fn close_dev_tools(&self)
pub fn close_dev_tools(&self)
Close the devtools window.
source§impl Window
impl Window
sourcepub fn get_printers(&self, callback: &Function)
pub fn get_printers(&self, callback: &Function)
Enumerate the printers in the system.
The callback function will receive an array of JSON objects for
the printer information. The device name of the JSON object can
be used as parameter in win.print()
source§impl Window
impl Window
sourcepub fn print(&self, options: &PrintOptions)
pub fn print(&self, options: &PrintOptions)
Print the web contents in the window with or without the need for user’s interaction.
source§impl Window
impl Window
sourcepub fn set_maximum_size(&self, width: u32, height: u32)
pub fn set_maximum_size(&self, width: u32, height: u32)
Set window’s maximum size.
source§impl Window
impl Window
sourcepub fn set_minimum_size(&self, width: u32, height: u32)
pub fn set_minimum_size(&self, width: u32, height: u32)
Set window’s minimum size.
source§impl Window
impl Window
sourcepub fn set_resizable(&self, resizable: bool)
pub fn set_resizable(&self, resizable: bool)
Set whether window is resizable.
source§impl Window
impl Window
sourcepub fn set_always_on_top(&self, top: bool)
pub fn set_always_on_top(&self, top: bool)
Sets the widget to be on top of all other windows in the window system.
source§impl Window
impl Window
sourcepub fn set_visible_on_all_workspaces(&self, top: bool)
pub fn set_visible_on_all_workspaces(&self, top: bool)
(Mac and Linux) Sets the widget to be on top of all other windows in the window system.
source§impl Window
impl Window
sourcepub fn can_set_visible_on_all_workspaces(&self) -> bool
pub fn can_set_visible_on_all_workspaces(&self) -> bool
(Mac and Linux)
Returns a boolean indicating if the platform (currently Mac OS X and Linux)
support Window API method win.set_visible_on_all_workspaces(true/false).
source§impl Window
impl Window
sourcepub fn set_position_impl(&self, position: JsValue)
pub fn set_position_impl(&self, position: JsValue)
Move window to specified position. Currently only center is supported on all platforms, which will put window in the middle of the screen.
There are three valid positions: null or center or mouse
source§impl Window
impl Window
sourcepub fn set_show_in_taskbar(&self, show: bool)
pub fn set_show_in_taskbar(&self, show: bool)
Control whether to show window in taskbar or dock.
See also show_in_taskbar in Manifest-format.
source§impl Window
impl Window
sourcepub fn request_attention(&self, attension: bool)
pub fn request_attention(&self, attension: bool)
Request the user’s attension by making the window flashes in the task bar.
source§impl Window
impl Window
sourcepub fn request_attention_with_number(&self, attension: i16)
pub fn request_attention_with_number(&self, attension: i16)
Request the user’s attension by making the window flashes in the task bar.
On Mac, value < 0 will trigger NSInformationalRequest, while value > 0 will trigger NSCriticalRequest.
source§impl Window
impl Window
sourcepub fn capture_page(&self, callback: &Function)
pub fn capture_page(&self, callback: &Function)
Captures the visible area of the window.
To capture the full page, see win.captureScreenshot.
source§impl Window
impl Window
sourcepub fn capture_page_with_config(
&self,
callback: &Function,
config: &CaptureConfig,
)
pub fn capture_page_with_config( &self, callback: &Function, config: &CaptureConfig, )
Captures the visible area of the window.
To capture the full page, see win.captureScreenshot.
source§impl Window
impl Window
sourcepub fn capture_screenshot(&self, config: &ScreenshotConfig) -> Promise
pub fn capture_screenshot(&self, config: &ScreenshotConfig) -> Promise
Captures the the window. It can be used to capture the full page beyond the visible area.
Note: This API is experimental and subject to change in the future.
source§impl Window
impl Window
sourcepub fn capture_screenshot_with_callback(
&self,
config: &ScreenshotConfig,
callback: &Function,
)
pub fn capture_screenshot_with_callback( &self, config: &ScreenshotConfig, callback: &Function, )
Captures the the window. It can be used to capture the full page beyond the visible area.
Note: This API is experimental and subject to change in the future.
source§impl Window
impl Window
sourcepub fn set_progress_bar(&self, progress: f32)
pub fn set_progress_bar(&self, progress: f32)
Set progress bar
Note: Only Ubuntu is supported,
and you’ll need to specify the application .desktop file through
NW_DESKTOP env.
If NW_DESKTOP env variable is not found, it uses nw.desktop by default.
source§impl Window
impl Window
sourcepub fn set_badge_label(&self, label: &str)
pub fn set_badge_label(&self, label: &str)
Set the badge label on the window icon in taskbar or dock.
Note: This API is only supported on Ubuntu and the label is restricted
to a string number only. You’ll also need to specify the .desktop
file for your application (see the note on set_progress_bar)
source§impl Window
impl Window
source§impl Window
impl Window
sourcepub fn eval_with_iframe(&self, iframe: &HtmlIFrameElement, script: &str)
pub fn eval_with_iframe(&self, iframe: &HtmlIFrameElement, script: &str)
Execute a piece of JavaScript in the frame.
source§impl Window
impl Window
sourcepub fn eval_nw_bin_impl(&self, iframe: JsValue, script: JsValue)
pub fn eval_nw_bin_impl(&self, iframe: JsValue, script: JsValue)
Load and execute the compiled binary in the frame.
source§impl Window
impl Window
sourcepub fn eval_nw_bin_with_iframe_impl(
&self,
iframe: &HtmlIFrameElement,
script: JsValue,
)
pub fn eval_nw_bin_with_iframe_impl( &self, iframe: &HtmlIFrameElement, script: JsValue, )
Load and execute the compiled binary in the frame.
source§impl Window
impl Window
sourcepub fn eval_nw_bin_module_impl(
&self,
iframe: JsValue,
script: JsValue,
module_path: &str,
)
pub fn eval_nw_bin_module_impl( &self, iframe: JsValue, script: JsValue, module_path: &str, )
Load and execute the compiled binary for Modules in the frame.
The binary should be compiled with nwjc –nw-module.
The following code will load lib.bin as module and other modules
can refer to it with something like import * from "./lib.js"
source§impl Window
impl Window
sourcepub fn eval_nw_bin_module_with_iframe(
&self,
iframe: &HtmlIFrameElement,
script: JsValue,
module_path: &str,
)
pub fn eval_nw_bin_module_with_iframe( &self, iframe: &HtmlIFrameElement, script: JsValue, module_path: &str, )
Load and execute the compiled binary for Modules in the frame.
The binary should be compiled with nwjc –nw-module.
The following code will load lib.bin as module and other modules
can refer to it with something like import * from "./lib.js"
source§impl Window
impl Window
sourcepub fn remove_all_listeners(&self)
pub fn remove_all_listeners(&self)
Removes all listeners
source§impl Window
impl Window
sourcepub fn remove_all_listeners_with_name(&self, event_name: &str)
pub fn remove_all_listeners_with_name(&self, event_name: &str)
Removes all listeners of the specified event_name
source§impl Window
impl Window
source§impl Window
impl Window
Set window’s menubar = null.
sourcepub fn close_with_force(&self)
pub fn close_with_force(&self)
Closes the current window without triggering close event.
sourcepub fn set_position(&self, position: WindowPosition)
pub fn set_position(&self, position: WindowPosition)
Move window to specified position. Currently only center is supported on all platforms, which will put window in the middle of the screen.
There are three valid positions: null or center or mouse
sourcepub fn eval(&self, iframe: Option<HtmlIFrameElement>, script: &str)
pub fn eval(&self, iframe: Option<HtmlIFrameElement>, script: &str)
Execute a piece of JavaScript in the frame.
sourcepub fn eval_nw_bin(&self, iframe: Option<HtmlIFrameElement>, script: NWBinary)
pub fn eval_nw_bin(&self, iframe: Option<HtmlIFrameElement>, script: NWBinary)
Load and execute the compiled binary in the frame.
sourcepub fn eval_nw_bin_module(
&self,
iframe: Option<HtmlIFrameElement>,
script: NWBinary,
module_path: &str,
)
pub fn eval_nw_bin_module( &self, iframe: Option<HtmlIFrameElement>, script: NWBinary, module_path: &str, )
Load and execute the compiled binary for Modules in the frame.
The binary should be compiled with nwjc –nw-module.
The following code will load lib.bin as module and other modules
can refer to it with something like import * from "./lib.js"
Methods from Deref<Target = JsValue>§
pub const NULL: JsValue = _
pub const UNDEFINED: JsValue = _
pub const TRUE: JsValue = _
pub const FALSE: JsValue = _
sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Returns the f64 value of this JS value if it’s an instance of a
number.
If this JS value is not an instance of a number then this returns
None.
sourcepub fn as_string(&self) -> Option<String>
pub fn as_string(&self) -> Option<String>
If this JS value is a string value, this function copies the JS string
value into wasm linear memory, encoded as UTF-8, and returns it as a
Rust String.
To avoid the copying and re-encoding, consider the
JsString::try_from() function from js-sys
instead.
If this JS value is not an instance of a string or if it’s not valid
utf-8 then this returns None.
§UTF-16 vs UTF-8
JavaScript strings in general are encoded as UTF-16, but Rust strings
are encoded as UTF-8. This can cause the Rust string to look a bit
different than the JS string sometimes. For more details see the
documentation about the str type which contains a few
caveats about the encodings.
sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Returns the bool value of this JS value if it’s an instance of a
boolean.
If this JS value is not an instance of a boolean then this returns
None.
sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
Tests whether this JS value is undefined
sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Tests whether the type of this JS value is function.
sourcepub fn js_in(&self, obj: &JsValue) -> bool
pub fn js_in(&self, obj: &JsValue) -> bool
Applies the binary in JS operator on the two JsValues.
sourcepub fn loose_eq(&self, other: &JsValue) -> bool
pub fn loose_eq(&self, other: &JsValue) -> bool
Compare two JsValues for equality, using the == operator in JS.
sourcepub fn unsigned_shr(&self, rhs: &JsValue) -> u32
pub fn unsigned_shr(&self, rhs: &JsValue) -> u32
Applies the binary >>> JS operator on the two JsValues.
sourcepub fn checked_div(&self, rhs: &JsValue) -> JsValue
pub fn checked_div(&self, rhs: &JsValue) -> JsValue
Applies the binary / JS operator on two JsValues, catching and returning any RangeError thrown.
sourcepub fn pow(&self, rhs: &JsValue) -> JsValue
pub fn pow(&self, rhs: &JsValue) -> JsValue
Applies the binary ** JS operator on the two JsValues.
sourcepub fn lt(&self, other: &JsValue) -> bool
pub fn lt(&self, other: &JsValue) -> bool
Applies the binary < JS operator on the two JsValues.
sourcepub fn le(&self, other: &JsValue) -> bool
pub fn le(&self, other: &JsValue) -> bool
Applies the binary <= JS operator on the two JsValues.
sourcepub fn ge(&self, other: &JsValue) -> bool
pub fn ge(&self, other: &JsValue) -> bool
Applies the binary >= JS operator on the two JsValues.
sourcepub fn gt(&self, other: &JsValue) -> bool
pub fn gt(&self, other: &JsValue) -> bool
Applies the binary > JS operator on the two JsValues.
sourcepub fn unchecked_into_f64(&self) -> f64
pub fn unchecked_into_f64(&self) -> f64
Applies the unary + JS operator on a JsValue. Can throw.
Trait Implementations§
source§impl FromWasmAbi for Window
impl FromWasmAbi for Window
source§impl<'a> IntoWasmAbi for &'a Window
impl<'a> IntoWasmAbi for &'a Window
source§impl IntoWasmAbi for Window
impl IntoWasmAbi for Window
source§impl IpcDispatch for Window
impl IpcDispatch for Window
fn as_target(&self) -> IpcTarget
fn notify<'life0, 'async_trait, Ops, Msg>(
&'life0 self,
op: Ops,
payload: Msg,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Ops: OpsT + 'async_trait,
Msg: BorshSerialize + Send + Sync + 'static + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn call<'life0, 'async_trait, Ops, Req, Resp>( &'life0 self, op: Ops, req: Req, ) -> Pin<Box<dyn Future<Output = Result<Resp>> + Send + 'async_trait>>
fn call_with_source<'life0, 'life1, 'async_trait, Ops, Req, Resp>( &'life0 self, op: Ops, req: Req, source: &'life1 IpcTarget, ) -> Pin<Box<dyn Future<Output = Result<Resp>> + Send + 'async_trait>>
source§impl JsCast for Window
impl JsCast for Window
source§fn instanceof(val: &JsValue) -> bool
fn instanceof(val: &JsValue) -> bool
instanceof check to see whether the JsValue
provided is an instance of this type. Read moresource§fn unchecked_from_js(val: JsValue) -> Window
fn unchecked_from_js(val: JsValue) -> Window
source§fn unchecked_from_js_ref(val: &JsValue) -> &Window
fn unchecked_from_js_ref(val: &JsValue) -> &Window
source§fn has_type<T>(&self) -> boolwhere
T: JsCast,
fn has_type<T>(&self) -> boolwhere
T: JsCast,
T. Read moresource§fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
T. Read moresource§fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
T. Read moresource§fn unchecked_into<T>(self) -> Twhere
T: JsCast,
fn unchecked_into<T>(self) -> Twhere
T: JsCast,
source§fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
source§impl LongRefFromWasmAbi for Window
impl LongRefFromWasmAbi for Window
§type Abi = <JsValue as LongRefFromWasmAbi>::Abi
type Abi = <JsValue as LongRefFromWasmAbi>::Abi
RefFromWasmAbi::Abisource§unsafe fn long_ref_from_abi(
js: <Window as LongRefFromWasmAbi>::Abi,
) -> <Window as LongRefFromWasmAbi>::Anchor
unsafe fn long_ref_from_abi( js: <Window as LongRefFromWasmAbi>::Abi, ) -> <Window as LongRefFromWasmAbi>::Anchor
RefFromWasmAbi::ref_from_abisource§impl OptionFromWasmAbi for Window
impl OptionFromWasmAbi for Window
source§impl<'a> OptionIntoWasmAbi for &'a Window
impl<'a> OptionIntoWasmAbi for &'a Window
source§impl OptionIntoWasmAbi for Window
impl OptionIntoWasmAbi for Window
source§impl RefFromWasmAbi for Window
impl RefFromWasmAbi for Window
§type Abi = <JsValue as RefFromWasmAbi>::Abi
type Abi = <JsValue as RefFromWasmAbi>::Abi
Self are recovered from.§type Anchor = ManuallyDrop<Window>
type Anchor = ManuallyDrop<Window>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.source§unsafe fn ref_from_abi(
js: <Window as RefFromWasmAbi>::Abi,
) -> <Window as RefFromWasmAbi>::Anchor
unsafe fn ref_from_abi( js: <Window as RefFromWasmAbi>::Abi, ) -> <Window as RefFromWasmAbi>::Anchor
impl Send for Window
impl Sync for Window
Auto Trait Implementations§
impl Freeze for Window
impl RefUnwindSafe for Window
impl Unpin for Window
impl UnwindSafe for Window
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abisource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.