pub struct WebView { /* private fields */ }Expand description
A webview showing one page.
The page is built the first time the view is painted, in the window it is painted in, and stays in that window. It sits at the element’s bounds in every frame the element is painted and is parked in every frame it is not. A parked page stays loaded.
The page takes keys while the view’s focus handle is focused, and a press in the page focuses the handle. On macOS, key equivalents (cmd or ctrl held) reach gpui’s key dispatch before the page sees them; on Windows the page takes every key while it holds focus.
gpui elements behind the page are not hovered, and gpui’s cursor over the page is the arrow. On macOS the page sets the cursor over itself.
Linux needs gpui on X11 and paints nothing under Wayland. Paints nothing off macOS, Windows and Linux.
Implementations§
Source§impl WebView
impl WebView
pub fn new( url: impl Into<String>, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
Sourcepub fn location(&self) -> Option<&str>
pub fn location(&self) -> Option<&str>
The URL the page last reported; None before its first report.
pub fn title(&self) -> &str
pub fn is_loading(&self) -> bool
Sourcepub fn with_user_agent(self, user_agent: impl Into<String>) -> Self
pub fn with_user_agent(self, user_agent: impl Into<String>) -> Self
The user agent the page is built with, in place of the platform’s. Read at the first paint. On macOS the default is Safari’s, with the installed Safari’s version.
Sourcepub fn load(&mut self, url: impl Into<String>)
pub fn load(&mut self, url: impl Into<String>)
Before the first paint, replaces the URL the page is built with. After it, navigates the page.
pub fn back(&mut self)
pub fn forward(&mut self)
pub fn reload(&mut self)
Trait Implementations§
impl EventEmitter<WebViewEvent> for WebView
Source§impl Focusable for WebView
impl Focusable for WebView
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
Auto Trait Implementations§
impl !RefUnwindSafe for WebView
impl !Send for WebView
impl !Sync for WebView
impl !UnwindSafe for WebView
impl Freeze for WebView
impl Unpin for WebView
impl UnsafeUnpin for WebView
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> 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