Struct webkit2gtk::builders::WebViewBuilder
source · [−]pub struct WebViewBuilder { /* private fields */ }
Expand description
A builder-pattern type to construct WebView
objects.
Implementations
sourceimpl WebViewBuilder
impl WebViewBuilder
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new WebViewBuilder
.
sourcepub fn automation_presentation_type(
self,
automation_presentation_type: AutomationBrowsingContextPresentation
) -> Self
Available on crate feature v2_28
only.
pub fn automation_presentation_type(
self,
automation_presentation_type: AutomationBrowsingContextPresentation
) -> Self
v2_28
only.The AutomationBrowsingContextPresentation
of WebView
. This should only be used when
creating a new WebView
as a response to signal::AutomationSession::create-web-view
signal request. If the new WebView was added to a new tab of current browsing context window
AutomationBrowsingContextPresentation::Tab
should be used.
sourcepub fn camera_capture_state(
self,
camera_capture_state: MediaCaptureState
) -> Self
Available on crate feature v2_34
only.
pub fn camera_capture_state(
self,
camera_capture_state: MediaCaptureState
) -> Self
v2_34
only.Capture state of the camera device. Whenever the user grants a media-request sent by the web
page, requesting video capture capabilities (navigator.mediaDevices.getUserMedia({video: true})
) this property will be set to MediaCaptureState::Active
.
The application can monitor this property and provide a visual indicator allowing to optionally
deactivate or mute the capture device by setting this property respectively to
MediaCaptureState::None
or MediaCaptureState::Muted
.
If the capture state of the device is set to MediaCaptureState::None
the web-page
can still re-request the permission to the user. Permission desision caching is left to the
application.
sourcepub fn default_content_security_policy(
self,
default_content_security_policy: &str
) -> Self
Available on crate feature v2_38
only.
pub fn default_content_security_policy(
self,
default_content_security_policy: &str
) -> Self
v2_38
only.The default Content-Security-Policy used by the webview as if it were set by an HTTP header.
This applies to all content loaded including through navigation or via the various
webkit_web_view_load_* APIs. However do note that many WebKit APIs bypass
Content-Security-Policy in general such as UserContentManager
and
WebViewExt::run_javascript()
.
Policies are additive so if a website sets its own policy it still applies on top of the policy set here.
sourcepub fn display_capture_state(
self,
display_capture_state: MediaCaptureState
) -> Self
Available on crate feature v2_34
only.
pub fn display_capture_state(
self,
display_capture_state: MediaCaptureState
) -> Self
v2_34
only.Capture state of the display device. Whenever the user grants a media-request sent by the web
page, requesting screencasting capabilities (navigator.mediaDevices.getDisplayMedia() this property will be set to [
MediaCaptureState::Active`]crate::MediaCaptureState::Active.
The application can monitor this property and provide a visual indicator allowing to
optionally deactivate or mute the capture device by setting this property respectively to
MediaCaptureState::None
or MediaCaptureState::Muted
.
If the capture state of the device is set to MediaCaptureState::None
the web-page
can still re-request the permission to the user. Permission desision caching is left to the
application.
sourcepub fn editable(self, editable: bool) -> Self
Available on crate feature v2_8
only.
pub fn editable(self, editable: bool) -> Self
v2_8
only.Whether the pages loaded inside WebView
are editable. For more
information see WebViewExt::set_editable()
.
sourcepub fn is_controlled_by_automation(
self,
is_controlled_by_automation: bool
) -> Self
Available on crate feature v2_18
only.
pub fn is_controlled_by_automation(
self,
is_controlled_by_automation: bool
) -> Self
v2_18
only.sourcepub fn is_ephemeral(self, is_ephemeral: bool) -> Self
Available on crate feature v2_16
only.
pub fn is_ephemeral(self, is_ephemeral: bool) -> Self
v2_16
only.Whether the WebView
is ephemeral. An ephemeral web view never writes
website data to the client storage, no matter what WebsiteDataManager
its context is using. This is normally used to implement private browsing mode.
This is a G_PARAM_CONSTRUCT_ONLY
property, so you have to create an ephemeral
WebView
and it can’t be changed. The ephemeral WebsiteDataManager
created for the WebView
will inherit the network settings from the
WebContext
’s WebsiteDataManager
. To use different settings
you can get the WebsiteDataManager
with WebViewExt::website_data_manager()
and set the new ones.
Note that all WebView
s created with an ephemeral WebContext
will be ephemeral automatically.
See also WebContext::new_ephemeral()
.
sourcepub fn microphone_capture_state(
self,
microphone_capture_state: MediaCaptureState
) -> Self
Available on crate feature v2_34
only.
pub fn microphone_capture_state(
self,
microphone_capture_state: MediaCaptureState
) -> Self
v2_34
only.Capture state of the microphone device. Whenever the user grants a media-request sent by the web
page, requesting audio capture capabilities (navigator.mediaDevices.getUserMedia({audio: true})
) this property will be set to MediaCaptureState::Active
.
The application can monitor this property and provide a visual indicator allowing to
optionally deactivate or mute the capture device by setting this property respectively to
MediaCaptureState::None
or MediaCaptureState::Muted
.
If the capture state of the device is set to MediaCaptureState::None
the web-page
can still re-request the permission to the user. Permission desision caching is left to the
application.
Available on crate feature v2_4
only.
v2_4
only.The related WebView
used when creating the view to share the
same web process. This property is not readable because the related
web view is only valid during the object construction.
sourcepub fn settings(self, settings: &impl IsA<Settings>) -> Self
Available on crate feature v2_6
only.
pub fn settings(self, settings: &impl IsA<Settings>) -> Self
v2_6
only.The Settings
of the view.
sourcepub fn user_content_manager(
self,
user_content_manager: &impl IsA<UserContentManager>
) -> Self
Available on crate feature v2_6
only.
pub fn user_content_manager(
self,
user_content_manager: &impl IsA<UserContentManager>
) -> Self
v2_6
only.The UserContentManager
of the view.
sourcepub fn web_context(self, web_context: &impl IsA<WebContext>) -> Self
pub fn web_context(self, web_context: &impl IsA<WebContext>) -> Self
The WebContext
of the view.
sourcepub fn website_policies(
self,
website_policies: &impl IsA<WebsitePolicies>
) -> Self
Available on crate feature v2_30
only.
pub fn website_policies(
self,
website_policies: &impl IsA<WebsitePolicies>
) -> Self
v2_30
only.The WebsitePolicies
for the view.
sourcepub fn zoom_level(self, zoom_level: f64) -> Self
pub fn zoom_level(self, zoom_level: f64) -> Self
The zoom level of the WebView
content.
See WebViewExt::set_zoom_level()
for more details.
sourcepub fn can_focus(self, can_focus: bool) -> Self
pub fn can_focus(self, can_focus: bool) -> Self
Whether the widget or any of its descendents can accept the input focus.
This property is meant to be set by widget implementations, typically in their instance init function.
sourcepub fn can_target(self, can_target: bool) -> Self
pub fn can_target(self, can_target: bool) -> Self
Whether the widget can receive pointer events.
sourcepub fn css_classes(self, css_classes: Vec<String>) -> Self
pub fn css_classes(self, css_classes: Vec<String>) -> Self
A list of css classes applied to this widget.
sourcepub fn css_name(self, css_name: &str) -> Self
pub fn css_name(self, css_name: &str) -> Self
The name of this widget in the CSS tree.
This property is meant to be set by widget implementations, typically in their instance init function.
sourcepub fn focus_on_click(self, focus_on_click: bool) -> Self
pub fn focus_on_click(self, focus_on_click: bool) -> Self
Whether the widget should grab focus when it is clicked with the mouse.
This property is only relevant for widgets that can take focus.
sourcepub fn focusable(self, focusable: bool) -> Self
pub fn focusable(self, focusable: bool) -> Self
Whether this widget itself will accept the input focus.
sourcepub fn has_tooltip(self, has_tooltip: bool) -> Self
pub fn has_tooltip(self, has_tooltip: bool) -> Self
Enables or disables the emission of the ::query-tooltip signal on widget
.
A value of true
indicates that widget
can have a tooltip, in this case
the widget will be queried using [signalGtk
::query-tooltip] to
determine whether it will provide a tooltip or not.
sourcepub fn height_request(self, height_request: i32) -> Self
pub fn height_request(self, height_request: i32) -> Self
Override for height request of the widget.
If this is -1, the natural request will be used.
sourcepub fn hexpand_set(self, hexpand_set: bool) -> Self
pub fn hexpand_set(self, hexpand_set: bool) -> Self
Whether to use the hexpand
property.
sourcepub fn margin_bottom(self, margin_bottom: i32) -> Self
pub fn margin_bottom(self, margin_bottom: i32) -> Self
Margin on bottom side of widget.
This property adds margin outside of the widget’s normal size
request, the margin will be added in addition to the size from
[methodGtk
.set_size_request] for example.
sourcepub fn margin_end(self, margin_end: i32) -> Self
pub fn margin_end(self, margin_end: i32) -> Self
Margin on end of widget, horizontally.
This property supports left-to-right and right-to-left text directions.
This property adds margin outside of the widget’s normal size
request, the margin will be added in addition to the size from
[methodGtk
.set_size_request] for example.
sourcepub fn margin_start(self, margin_start: i32) -> Self
pub fn margin_start(self, margin_start: i32) -> Self
Margin on start of widget, horizontally.
This property supports left-to-right and right-to-left text directions.
This property adds margin outside of the widget’s normal size
request, the margin will be added in addition to the size from
[methodGtk
.set_size_request] for example.
sourcepub fn margin_top(self, margin_top: i32) -> Self
pub fn margin_top(self, margin_top: i32) -> Self
Margin on top side of widget.
This property adds margin outside of the widget’s normal size
request, the margin will be added in addition to the size from
[methodGtk
.set_size_request] for example.
sourcepub fn receives_default(self, receives_default: bool) -> Self
pub fn receives_default(self, receives_default: bool) -> Self
Whether the widget will receive the default action when it is focused.
sourcepub fn tooltip_markup(self, tooltip_markup: &str) -> Self
pub fn tooltip_markup(self, tooltip_markup: &str) -> Self
Sets the text of tooltip to be the given string, which is marked up with Pango markup.
Also see [methodGtk
.set_markup].
This is a convenience property which will take care of getting the
tooltip shown if the given string is not None
:
[propertyGtk
:has-tooltip] will automatically be set to true
and there will be taken care of [signalGtk
::query-tooltip] in
the default signal handler.
Note that if both [propertyGtk
:tooltip-text] and
[propertyGtk
:tooltip-markup] are set, the last one wins.
sourcepub fn tooltip_text(self, tooltip_text: &str) -> Self
pub fn tooltip_text(self, tooltip_text: &str) -> Self
Sets the text of tooltip to be the given string.
Also see [methodGtk
.set_text].
This is a convenience property which will take care of getting the
tooltip shown if the given string is not None
:
[propertyGtk
:has-tooltip] will automatically be set to true
and there will be taken care of [signalGtk
::query-tooltip] in
the default signal handler.
Note that if both [propertyGtk
:tooltip-text] and
[propertyGtk
:tooltip-markup] are set, the last one wins.
sourcepub fn vexpand_set(self, vexpand_set: bool) -> Self
pub fn vexpand_set(self, vexpand_set: bool) -> Self
Whether to use the vexpand
property.
sourcepub fn width_request(self, width_request: i32) -> Self
pub fn width_request(self, width_request: i32) -> Self
Override for width request of the widget.
If this is -1, the natural request will be used.
Trait Implementations
sourceimpl Clone for WebViewBuilder
impl Clone for WebViewBuilder
sourcefn clone(&self) -> WebViewBuilder
fn clone(&self) -> WebViewBuilder
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more