pub struct VersoviewController { /* private fields */ }
Implementations§
Source§impl VersoviewController
impl VersoviewController
Sourcepub fn new(verso_path: impl AsRef<Path>, initial_url: Url) -> Self
pub fn new(verso_path: impl AsRef<Path>, initial_url: Url) -> Self
Create a new verso instance with default settings and get the controller to it
Sourcepub fn on_close_requested(
&self,
callback: impl Fn() + Send + 'static,
) -> Result<(), Box<ErrorKind>>
pub fn on_close_requested( &self, callback: impl Fn() + Send + 'static, ) -> Result<(), Box<ErrorKind>>
Listen on close requested from the OS,
if you decide to use it, verso will not close the window by itself anymore,
so make sure you handle it properly by either do your own logic or call Self::exit
as a fallback
Navigate to url
Listen on navigation starting triggered by user click on a link, return a boolean in the callback to decide whether or not allowing this navigation
Sourcepub fn on_web_resource_requested(
&self,
callback: impl Fn(WebResourceRequest, Box<dyn FnOnce(Option<Response<Vec<u8>>>) + Send>) + Send + 'static,
) -> Result<(), Box<ErrorKind>>
pub fn on_web_resource_requested( &self, callback: impl Fn(WebResourceRequest, Box<dyn FnOnce(Option<Response<Vec<u8>>>) + Send>) + Send + 'static, ) -> Result<(), Box<ErrorKind>>
Listen on web resource requests, return a boolean in the callback to decide whether or not allowing this navigation
Sourcepub fn set_size<S: Into<Size>>(&self, size: S) -> Result<(), Box<ErrorKind>>
pub fn set_size<S: Into<Size>>(&self, size: S) -> Result<(), Box<ErrorKind>>
Sets the webview window’s size
Sourcepub fn set_position<P: Into<Position>>(
&self,
position: P,
) -> Result<(), Box<ErrorKind>>
pub fn set_position<P: Into<Position>>( &self, position: P, ) -> Result<(), Box<ErrorKind>>
Sets the webview window’s position
Sourcepub fn set_maximized(&self, maximized: bool) -> Result<(), Box<ErrorKind>>
pub fn set_maximized(&self, maximized: bool) -> Result<(), Box<ErrorKind>>
Maximize or unmaximize the window
Sourcepub fn set_minimized(&self, minimized: bool) -> Result<(), Box<ErrorKind>>
pub fn set_minimized(&self, minimized: bool) -> Result<(), Box<ErrorKind>>
Minimize or unminimize the window
Sourcepub fn set_fullscreen(&self, fullscreen: bool) -> Result<(), Box<ErrorKind>>
pub fn set_fullscreen(&self, fullscreen: bool) -> Result<(), Box<ErrorKind>>
Sets the window to fullscreen or back
Sourcepub fn start_dragging(&self) -> Result<(), Box<ErrorKind>>
pub fn start_dragging(&self) -> Result<(), Box<ErrorKind>>
Moves the window with the left mouse button until the button is released
Sourcepub fn get_position(
&self,
) -> Result<Option<PhysicalPosition<i32>>, Box<ErrorKind>>
pub fn get_position( &self, ) -> Result<Option<PhysicalPosition<i32>>, Box<ErrorKind>>
Get the window’s position,
returns None
on unsupported platforms (currently only Wayland)
Sourcepub fn is_maximized(&self) -> Result<bool, Box<ErrorKind>>
pub fn is_maximized(&self) -> Result<bool, Box<ErrorKind>>
Get if the window is currently maximized or not
Sourcepub fn is_minimized(&self) -> Result<bool, Box<ErrorKind>>
pub fn is_minimized(&self) -> Result<bool, Box<ErrorKind>>
Get if the window is currently minimized or not
Sourcepub fn is_fullscreen(&self) -> Result<bool, Box<ErrorKind>>
pub fn is_fullscreen(&self) -> Result<bool, Box<ErrorKind>>
Get if the window is currently fullscreen or not