Struct nw_sys::Window

source ·
#[repr(transparent)]
pub struct Window { /* private fields */ }
Expand description

Interface for managing application windows. For usage example please refer to nw_sys::window

Implementations§

Get the corresponding DOM window object of the native window.

NWJS Documentation

Get left offset from window frame to screen.

NWJS Documentation

Set left offset from window frame to screen.

NWJS Documentation

Get top offset from window frame to screen.

NWJS Documentation

Set top offset from window frame to screen.

NWJS Documentation

Get window’s size, including the window’s frame.

NWJS Documentation

Set window’s size, including the window’s frame.

NWJS Documentation

Get window’s size, including the window’s frame.

NWJS Documentation

Set window’s size, including the window’s frame.

NWJS Documentation

Get window’s title.

NWJS Documentation

Set window’s title.

NWJS Documentation

Get window’s menubar.

NWJS Documentation

Set window’s menubar.

NWJS Documentation

Set window’s menubar = null.

NWJS Documentation

Get whether the window is always on top of other windows.

NWJS Documentation

Get whether we’re in fullscreen mode.

NWJS Documentation

Get whether transparency is turned on

NWJS Documentation

Get whether we’re in kiosk mode.

NWJS Documentation

Get the page zoom. 0 for normal size; positive value for zooming in; negative value for zooming out.

NWJS Documentation

Set the page zoom. 0 for normal size; positive value for zooming in; negative value for zooming out.

NWJS Documentation

Moves a window’s left and top edge to the specified coordinates.

NWJS Documentation

Moves a window a specified number of pixels relative to its current coordinates.

NWJS Documentation

Resizes a window to the specified width and height.

NWJS Documentation

Set the inner width of the window

NWJS Documentation

Set the inner height of the window

NWJS Documentation

Resizes a window by the specified amount.

NWJS Documentation

Focus on the window.

NWJS Documentation

Move focus away. Usually it will move focus to other windows of your app, since on some platforms there is no concept of blur.

NWJS Documentation

Show the window if it’s not shown.

NWJS Documentation

Show/Hide the window

NWJS Documentation

Hide the window. User will not be able to find the window once it’s hidden.

NWJS Documentation

Closes the current window. You can prevent the closing by listening to the close event.

NWJS Documentation

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.

NWJS Documentation

Reloads the current window.

NWJS Documentation

Reloads the current page by starting a new renderer process from scratch.

NWJS Documentation

Like reload(), but don’t use caches (aka “shift-reload”).

NWJS Documentation

Maximize the window on GTK and Windows, and zoom the window on Mac OS X.

NWJS Documentation

Unmaximize the window, i.e. the reverse of maximize().

NWJS Documentation

Minimize the window to task bar on Windows, iconify the window on GTK, and miniaturize the window on Mac OS X.

NWJS Documentation

Restore window to previous state after the window is minimized, i.e. the reverse of minimize(). It’s not named unminimize since restore is used commonly.

NWJS Documentation

Make the window fullscreen.

NWJS Documentation

Leave the fullscreen mode.

NWJS Documentation

Toggle the fullscreen mode.

NWJS Documentation

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.

NWJS Documentation

Leave the Kiosk mode.

NWJS Documentation

Toggle the kiosk mode.

NWJS Documentation

Turn on/off the transparency support.

See more info on Transparent Window.

NWJS Documentation

(Mac) Turn the window’s native shadow on/off. Useful for frameless, transparent windows.

NWJS Documentation

Open the devtools to inspect the window.

NWJS Documentation

Open the devtools to inspect the window.

NWJS Documentation

Open the devtools to inspect the window.

NWJS Documentation

Open the devtools to inspect the window.

NWJS Documentation

Open the devtools to inspect the window.

NWJS Documentation

Close the devtools window.

NWJS Documentation

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()

NWJS Documentation

Query the status of devtools window.

NWJS Documentation

Print the web contents in the window with or without the need for user’s interaction.

NWJS Documentation

Set window’s maximum size.

NWJS Documentation

Set window’s minimum size.

NWJS Documentation

Set whether window is resizable.

NWJS Documentation

Sets the widget to be on top of all other windows in the window system.

NWJS Documentation

(Mac and Linux) Sets the widget to be on top of all other windows in the window system.

NWJS Documentation

(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).

NWJS Documentation

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

NWJS Documentation

Control whether to show window in taskbar or dock.

See also show_in_taskbar in Manifest-format.

NWJS Documentation

Request the user’s attension by making the window flashes in the task bar.

NWJS Documentation

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.

NWJS Documentation

Captures the visible area of the window.

To capture the full page, see win.captureScreenshot.

NWJS Documentation

Captures the visible area of the window.

To capture the full page, see win.captureScreenshot.

NWJS Documentation

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.

NWJS Documentation

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.

NWJS Documentation

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.

NWJS Documentation

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)

NWJS Documentation

Execute a piece of JavaScript in the frame.

NWJS Documentation

Execute a piece of JavaScript in the frame.

NWJS Documentation

Load and execute the compiled binary in the frame.

See Protect JavaScript Source Code.

NWJS Documentation

Load and execute the compiled binary in the frame.

See Protect JavaScript Source Code.

NWJS Documentation

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"

NWJS Documentation

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"

NWJS Documentation

Removes all listeners

NWJS Documentation

Removes all listeners of the specified event_name

NWJS Documentation

Add event listener to the specified event_name

NWJS Documentation

Set window’s menubar = null.

NWJS Documentation

Closes the current window without triggering close event.

NWJS Documentation

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

NWJS Documentation

Execute a piece of JavaScript in the frame.

NWJS Documentation

Load and execute the compiled binary in the frame.

See Protect JavaScript Source Code.

NWJS Documentation

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"

NWJS Documentation

Methods from Deref<Target = JsValue>§

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.

Tests whether this JS value is a JS 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.

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.

Tests whether this JS value is null

Tests whether this JS value is undefined

Tests whether the type of this JS value is symbol

Tests whether typeof self == "object" && self !== null.

Tests whether the type of this JS value is function.

Tests whether the type of this JS value is bigint.

Applies the unary typeof JS operator on a JsValue.

MDN documentation

Applies the binary in JS operator on the two JsValues.

MDN documentation

Tests whether the value is “truthy”.

Tests whether the value is “falsy”.

Compare two JsValues for equality, using the == operator in JS.

MDN documentation

Applies the unary ~ JS operator on a JsValue.

MDN documentation

Applies the binary >>> JS operator on the two JsValues.

MDN documentation

Applies the binary / JS operator on two JsValues, catching and returning any RangeError thrown.

MDN documentation

Applies the binary ** JS operator on the two JsValues.

MDN documentation

Applies the binary < JS operator on the two JsValues.

MDN documentation

Applies the binary <= JS operator on the two JsValues.

MDN documentation

Applies the binary >= JS operator on the two JsValues.

MDN documentation

Applies the binary > JS operator on the two JsValues.

MDN documentation

Applies the unary + JS operator on a JsValue. Can throw.

MDN documentation

Trait Implementations§

Converts this type into a shared reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Converts to this type from the input type.
Converts to this type from the input type.
The wasm ABI type that this converts from when coming back out from the ABI boundary.
Recover a Self from Self::Abi. Read more
The wasm ABI type that this converts into when crossing the ABI boundary.
Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
The wasm ABI type that this converts into when crossing the ABI boundary.
Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Performs a dynamic instanceof check to see whether the JsValue provided is an instance of this type. Read more
Performs a zero-cost unchecked conversion from a JsValue into an instance of Self Read more
Performs a zero-cost unchecked conversion from a &JsValue into an instance of &Self. Read more
Test whether this JS value has a type T. Read more
Performs a dynamic cast (checked at runtime) of this value into the target type T. Read more
Performs a dynamic cast (checked at runtime) of this value into the target type T. Read more
Performs a zero-cost unchecked cast into the specified type. Read more
Performs a zero-cost unchecked cast into a reference to the specified type. Read more
Test whether this JS value is an instance of the type T. Read more
Performs a dynamic check to see whether the JsValue provided is a value of this type. Read more
Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
The wasm ABI type references to Self are recovered from.
The type that holds the reference to 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.
Recover a Self::Anchor from Self::Abi. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Same as IntoWasmAbi::Abi
Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.