Struct tauri::window::Window [−][src]
Expand description
A webview window managed by Tauri.
This type also implements Manager
which allows you to manage other windows attached to
the same application.
Implementations
pub fn create_window<F>(
&mut self,
label: String,
url: WindowUrl,
setup: F
) -> Result<Window<R>> where
F: FnOnce(<R::Dispatcher as Dispatch>::WindowBuilder, WebviewAttributes) -> (<R::Dispatcher as Dispatch>::WindowBuilder, WebviewAttributes),
pub fn create_window<F>(
&mut self,
label: String,
url: WindowUrl,
setup: F
) -> Result<Window<R>> where
F: FnOnce(<R::Dispatcher as Dispatch>::WindowBuilder, WebviewAttributes) -> (<R::Dispatcher as Dispatch>::WindowBuilder, WebviewAttributes),
Creates a new webview window.
Emits an event to the current window.
Emits an event on all windows except this one.
Listen to an event on this window.
Listen to a an event on this window a single time.
Registers a window event listener.
Registers a menu event listener.
Gets a handle to the window menu.
Returns the scale factor that can be used to map logical pixels to physical pixels, and vice versa.
Panics
- Panics if the event loop is not running yet, usually when called on the
setup
closure. - Panics when called on the main thread, usually on the
run
closure.
You can spawn a task to use the API using crate::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
Returns the position of the top-left hand corner of the window’s client area relative to the top-left hand corner of the desktop.
Panics
- Panics if the event loop is not running yet, usually when called on the
setup
closure. - Panics when called on the main thread, usually on the
run
closure.
You can spawn a task to use the API using crate::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
Returns the position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
Panics
- Panics if the event loop is not running yet, usually when called on the
setup
closure. - Panics when called on the main thread, usually on the
run
closure.
You can spawn a task to use the API using crate::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
Returns the physical size of the window’s client area.
The client area is the content of the window, excluding the title bar and borders.
Panics
- Panics if the event loop is not running yet, usually when called on the
setup
closure. - Panics when called on the main thread, usually on the
run
closure.
You can spawn a task to use the API using crate::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
Returns the physical size of the entire window.
These dimensions include the title bar and borders. If you don’t want that (and you usually don’t), use inner_size instead.
Panics
- Panics if the event loop is not running yet, usually when called on the
setup
closure. - Panics when called on the main thread, usually on the
run
closure.
You can spawn a task to use the API using crate::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
Gets the window’s current fullscreen state.
Panics
- Panics if the event loop is not running yet, usually when called on the
setup
closure. - Panics when called on the main thread, usually on the
run
closure.
You can spawn a task to use the API using crate::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
Gets the window’s current maximized state.
Panics
- Panics if the event loop is not running yet, usually when called on the
setup
closure. - Panics when called on the main thread, usually on the
run
closure.
You can spawn a task to use the API using crate::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
Gets the window’s current decoration state.
Panics
- Panics if the event loop is not running yet, usually when called on the
setup
closure. - Panics when called on the main thread, usually on the
run
closure.
You can spawn a task to use the API using crate::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
Gets the window’s current resizable state.
Panics
- Panics if the event loop is not running yet, usually when called on the
setup
closure. - Panics when called on the main thread, usually on the
run
closure.
You can spawn a task to use the API using crate::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
Gets the window’s current vibility state.
Panics
- Panics if the event loop is not running yet, usually when called on the
setup
closure. - Panics when called on the main thread, usually on the
run
closure.
You can spawn a task to use the API using crate::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
Returns the monitor on which the window currently resides.
Returns None if current monitor can’t be detected.
Platform-specific
- Linux: Unsupported
Panics
- Panics if the event loop is not running yet, usually when called on the
setup
closure. - Panics when called on the main thread, usually on the
run
closure.
You can spawn a task to use the API using crate::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
Returns the primary monitor of the system.
Returns None if it can’t identify any monitor as a primary one.
Platform-specific
- Linux: Unsupported
Panics
- Panics if the event loop is not running yet, usually when called on the
setup
closure. - Panics when called on the main thread, usually on the
run
closure.
You can spawn a task to use the API using crate::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
Returns the list of all the monitors available on the system.
Platform-specific
- Linux: Unsupported
Panics
- Panics if the event loop is not running yet, usually when called on the
setup
closure. - Panics when called on the main thread, usually on the
run
closure.
You can spawn a task to use the API using crate::async_runtime::spawn
or std::thread::spawn
to prevent the panic.
Returns the ApplicatonWindow
from gtk crate that is used by this window.
Note that this can only be used on the main thread.
Requests user attention to the window, this has no effect if the application
is already focused. How requesting for user attention manifests is platform dependent,
see UserAttentionType
for details.
Providing None
will unset the request for user attention. Unsetting the request for
user attention might not be done automatically by the WM when the window receives input.
Platform-specific
- macOS:
None
has no effect.
Opens the dialog to prints the contents of the webview.
Currently only supported on macOS on wry
.
window.print()
works on all platforms.
Determines if this window should be resizable.
Un-maximizes this window.
Un-minimizes this window.
Determines if this window should be decorated.
Determines if this window should always be on top of other windows.
Sets this window’s minimum size.
Sets this window’s maximum size.
Sets this window’s position.
Determines if this window should be fullscreen.
Whether to show the window icon in the task bar or not.
Starts dragging the window.
Trait Implementations
Grabs the Window
from the CommandItem
. This will never fail.
Emits a event to all windows.
Emits an event to a window with the specified label.
Listen to a global event.
Listen to a global event only once.
Trigger a global event.
Fetch a single window from the manager.
Add state
to the state managed by the application.
See crate::Builder
for instructions. Read more
Gets the managed state for the type T
. Panics if the type is not managed.
Auto Trait Implementations
impl<R = Wry> !RefUnwindSafe for Window<R>
impl<R> Sync for Window<R> where
<R as Runtime>::ClipboardManager: Sync,
<R as Runtime>::Dispatcher: Sync,
<R as Runtime>::GlobalShortcutManager: Sync,
<R as Runtime>::Handle: Sync,
<R as Runtime>::TrayHandler: Sync,
impl<R> Unpin for Window<R> where
<R as Runtime>::ClipboardManager: Unpin,
<R as Runtime>::Dispatcher: Unpin,
<R as Runtime>::GlobalShortcutManager: Unpin,
<R as Runtime>::Handle: Unpin,
<R as Runtime>::TrayHandler: Unpin,
impl<R = Wry> !UnwindSafe for Window<R>
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more