#[repr(C)]pub struct WebPreferences { /* private fields */ }
WebPreferences
only.Expand description
Implementations§
Source§impl WebPreferences
impl WebPreferences
pub unsafe fn standardPreferences() -> Option<Retained<WebPreferences>>
Sourcepub unsafe fn initWithIdentifier(
this: Allocated<Self>,
an_identifier: Option<&NSString>,
) -> Option<Retained<Self>>
👎Deprecated
pub unsafe fn initWithIdentifier( this: Allocated<Self>, an_identifier: Option<&NSString>, ) -> Option<Retained<Self>>
Parameter anIdentifier
: A string used to identify the WebPreferences.
WebViews can share instances of WebPreferences by using an instance of WebPreferences with the same identifier. Typically, instance are not created directly. Instead you set the preferences identifier on a WebView. The identifier is used as a prefix that is added to the user defaults keys for the WebPreferences.
Returns: Returns a new instance of WebPreferences or a previously allocated instance with the same identifier.
Sourcepub unsafe fn identifier(&self) -> Retained<NSString>
👎Deprecated
pub unsafe fn identifier(&self) -> Retained<NSString>
Returns: Returns the identifier for this WebPreferences.
pub unsafe fn standardFontFamily(&self) -> Retained<NSString>
Sourcepub unsafe fn setStandardFontFamily(
&self,
standard_font_family: Option<&NSString>,
)
👎Deprecated
pub unsafe fn setStandardFontFamily( &self, standard_font_family: Option<&NSString>, )
Setter for standardFontFamily
.
pub unsafe fn fixedFontFamily(&self) -> Retained<NSString>
Sourcepub unsafe fn setFixedFontFamily(&self, fixed_font_family: Option<&NSString>)
👎Deprecated
pub unsafe fn setFixedFontFamily(&self, fixed_font_family: Option<&NSString>)
Setter for fixedFontFamily
.
pub unsafe fn serifFontFamily(&self) -> Retained<NSString>
Sourcepub unsafe fn setSerifFontFamily(&self, serif_font_family: Option<&NSString>)
👎Deprecated
pub unsafe fn setSerifFontFamily(&self, serif_font_family: Option<&NSString>)
Setter for serifFontFamily
.
pub unsafe fn sansSerifFontFamily(&self) -> Retained<NSString>
Sourcepub unsafe fn setSansSerifFontFamily(
&self,
sans_serif_font_family: Option<&NSString>,
)
👎Deprecated
pub unsafe fn setSansSerifFontFamily( &self, sans_serif_font_family: Option<&NSString>, )
Setter for sansSerifFontFamily
.
pub unsafe fn cursiveFontFamily(&self) -> Retained<NSString>
Sourcepub unsafe fn setCursiveFontFamily(
&self,
cursive_font_family: Option<&NSString>,
)
👎Deprecated
pub unsafe fn setCursiveFontFamily( &self, cursive_font_family: Option<&NSString>, )
Setter for cursiveFontFamily
.
pub unsafe fn fantasyFontFamily(&self) -> Retained<NSString>
Sourcepub unsafe fn setFantasyFontFamily(
&self,
fantasy_font_family: Option<&NSString>,
)
👎Deprecated
pub unsafe fn setFantasyFontFamily( &self, fantasy_font_family: Option<&NSString>, )
Setter for fantasyFontFamily
.
pub unsafe fn defaultFontSize(&self) -> c_int
Sourcepub unsafe fn setDefaultFontSize(&self, default_font_size: c_int)
👎Deprecated
pub unsafe fn setDefaultFontSize(&self, default_font_size: c_int)
Setter for defaultFontSize
.
pub unsafe fn defaultFixedFontSize(&self) -> c_int
Sourcepub unsafe fn setDefaultFixedFontSize(&self, default_fixed_font_size: c_int)
👎Deprecated
pub unsafe fn setDefaultFixedFontSize(&self, default_fixed_font_size: c_int)
Setter for defaultFixedFontSize
.
pub unsafe fn minimumFontSize(&self) -> c_int
Sourcepub unsafe fn setMinimumFontSize(&self, minimum_font_size: c_int)
👎Deprecated
pub unsafe fn setMinimumFontSize(&self, minimum_font_size: c_int)
Setter for minimumFontSize
.
pub unsafe fn minimumLogicalFontSize(&self) -> c_int
Sourcepub unsafe fn setMinimumLogicalFontSize(&self, minimum_logical_font_size: c_int)
👎Deprecated
pub unsafe fn setMinimumLogicalFontSize(&self, minimum_logical_font_size: c_int)
Setter for minimumLogicalFontSize
.
pub unsafe fn defaultTextEncodingName(&self) -> Retained<NSString>
Sourcepub unsafe fn setDefaultTextEncodingName(
&self,
default_text_encoding_name: Option<&NSString>,
)
👎Deprecated
pub unsafe fn setDefaultTextEncodingName( &self, default_text_encoding_name: Option<&NSString>, )
Setter for defaultTextEncodingName
.
pub unsafe fn userStyleSheetEnabled(&self) -> bool
Sourcepub unsafe fn setUserStyleSheetEnabled(&self, user_style_sheet_enabled: bool)
👎Deprecated
pub unsafe fn setUserStyleSheetEnabled(&self, user_style_sheet_enabled: bool)
Setter for userStyleSheetEnabled
.
Sourcepub unsafe fn userStyleSheetLocation(&self) -> Option<Retained<NSURL>>
👎Deprecated
pub unsafe fn userStyleSheetLocation(&self) -> Option<Retained<NSURL>>
The location of the user style sheet.
Sourcepub unsafe fn setUserStyleSheetLocation(
&self,
user_style_sheet_location: Option<&NSURL>,
)
👎Deprecated
pub unsafe fn setUserStyleSheetLocation( &self, user_style_sheet_location: Option<&NSURL>, )
Setter for userStyleSheetLocation
.
Sourcepub unsafe fn isJavaEnabled(&self) -> bool
👎Deprecated
pub unsafe fn isJavaEnabled(&self) -> bool
Deprecated function that does nothing and always returns false.
Sourcepub unsafe fn setJavaEnabled(&self, java_enabled: bool)
👎Deprecated
pub unsafe fn setJavaEnabled(&self, java_enabled: bool)
Setter for isJavaEnabled
.
pub unsafe fn isJavaScriptEnabled(&self) -> bool
Sourcepub unsafe fn setJavaScriptEnabled(&self, java_script_enabled: bool)
👎Deprecated
pub unsafe fn setJavaScriptEnabled(&self, java_script_enabled: bool)
Setter for isJavaScriptEnabled
.
pub unsafe fn javaScriptCanOpenWindowsAutomatically(&self) -> bool
Sourcepub unsafe fn setJavaScriptCanOpenWindowsAutomatically(
&self,
java_script_can_open_windows_automatically: bool,
)
👎Deprecated
pub unsafe fn setJavaScriptCanOpenWindowsAutomatically( &self, java_script_can_open_windows_automatically: bool, )
Setter for javaScriptCanOpenWindowsAutomatically
.
pub unsafe fn arePlugInsEnabled(&self) -> bool
Sourcepub unsafe fn setPlugInsEnabled(&self, plug_ins_enabled: bool)
👎Deprecated
pub unsafe fn setPlugInsEnabled(&self, plug_ins_enabled: bool)
Setter for arePlugInsEnabled
.
pub unsafe fn allowsAnimatedImages(&self) -> bool
Sourcepub unsafe fn setAllowsAnimatedImages(&self, allows_animated_images: bool)
👎Deprecated
pub unsafe fn setAllowsAnimatedImages(&self, allows_animated_images: bool)
Setter for allowsAnimatedImages
.
pub unsafe fn allowsAnimatedImageLooping(&self) -> bool
Sourcepub unsafe fn setAllowsAnimatedImageLooping(
&self,
allows_animated_image_looping: bool,
)
👎Deprecated
pub unsafe fn setAllowsAnimatedImageLooping( &self, allows_animated_image_looping: bool, )
Setter for allowsAnimatedImageLooping
.
pub unsafe fn loadsImagesAutomatically(&self) -> bool
Sourcepub unsafe fn setLoadsImagesAutomatically(
&self,
loads_images_automatically: bool,
)
👎Deprecated
pub unsafe fn setLoadsImagesAutomatically( &self, loads_images_automatically: bool, )
Setter for loadsImagesAutomatically
.
Sourcepub unsafe fn autosaves(&self) -> bool
👎Deprecated
pub unsafe fn autosaves(&self) -> bool
If autosaves is YES the settings represented by WebPreferences will be stored in the user defaults database.
Sourcepub unsafe fn setAutosaves(&self, autosaves: bool)
👎Deprecated
pub unsafe fn setAutosaves(&self, autosaves: bool)
Setter for autosaves
.
pub unsafe fn shouldPrintBackgrounds(&self) -> bool
Sourcepub unsafe fn setShouldPrintBackgrounds(&self, should_print_backgrounds: bool)
👎Deprecated
pub unsafe fn setShouldPrintBackgrounds(&self, should_print_backgrounds: bool)
Setter for shouldPrintBackgrounds
.
Sourcepub unsafe fn privateBrowsingEnabled(&self) -> bool
👎Deprecated
pub unsafe fn privateBrowsingEnabled(&self) -> bool
If private browsing is enabled, WebKit will not store information about sites the user visits.
Sourcepub unsafe fn setPrivateBrowsingEnabled(&self, private_browsing_enabled: bool)
👎Deprecated
pub unsafe fn setPrivateBrowsingEnabled(&self, private_browsing_enabled: bool)
Setter for privateBrowsingEnabled
.
Sourcepub unsafe fn tabsToLinks(&self) -> bool
👎Deprecated
pub unsafe fn tabsToLinks(&self) -> bool
If tabsToLinks is YES, the tab key will focus links and form controls. The option key temporarily reverses this preference.
Sourcepub unsafe fn setTabsToLinks(&self, tabs_to_links: bool)
👎Deprecated
pub unsafe fn setTabsToLinks(&self, tabs_to_links: bool)
Setter for tabsToLinks
.
Sourcepub unsafe fn usesPageCache(&self) -> bool
👎Deprecated
pub unsafe fn usesPageCache(&self) -> bool
Whether the receiver’s associated WebViews use the shared page cache.
Pages are cached as they are added to a WebBackForwardList, and removed from the cache as they are removed from a WebBackForwardList. Because the page cache is global, caching a page in one WebBackForwardList may cause a page in another WebBackForwardList to be evicted from the cache.
Sourcepub unsafe fn setUsesPageCache(&self, uses_page_cache: bool)
👎Deprecated
pub unsafe fn setUsesPageCache(&self, uses_page_cache: bool)
Setter for usesPageCache
.
Sourcepub unsafe fn cacheModel(&self) -> WebCacheModel
👎Deprecated
pub unsafe fn cacheModel(&self) -> WebCacheModel
Specifies a usage model for a WebView, which WebKit will use to determine its caching behavior. If necessary, WebKit will prune its caches to match cacheModel when set.
Research indicates that users tend to browse within clusters of documents that hold resources in common, and to revisit previously visited documents. WebKit and the frameworks below it include built-in caches that take advantage of these patterns, substantially improving document load speed in browsing situations. The WebKit cache model controls the behaviors of all of these caches, including NSURLCache and the various WebCore caches.
Applications with a browsing interface can improve document load speed substantially by specifying WebCacheModelDocumentBrowser. Applications without a browsing interface can reduce memory usage substantially by specifying WebCacheModelDocumentViewer.
If cacheModel is not set, WebKit will select a cache model automatically.
Sourcepub unsafe fn setCacheModel(&self, cache_model: WebCacheModel)
👎Deprecated
pub unsafe fn setCacheModel(&self, cache_model: WebCacheModel)
Setter for cacheModel
.
pub unsafe fn suppressesIncrementalRendering(&self) -> bool
Sourcepub unsafe fn setSuppressesIncrementalRendering(
&self,
suppresses_incremental_rendering: bool,
)
👎Deprecated
pub unsafe fn setSuppressesIncrementalRendering( &self, suppresses_incremental_rendering: bool, )
Setter for suppressesIncrementalRendering
.
pub unsafe fn allowsAirPlayForMediaPlayback(&self) -> bool
Sourcepub unsafe fn setAllowsAirPlayForMediaPlayback(
&self,
allows_air_play_for_media_playback: bool,
)
👎Deprecated
pub unsafe fn setAllowsAirPlayForMediaPlayback( &self, allows_air_play_for_media_playback: bool, )
Setter for allowsAirPlayForMediaPlayback
.
Methods from Deref<Target = NSObject>§
Sourcepub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
Handle messages the object doesn’t recognize.
See Apple’s documentation for details.
Methods from Deref<Target = AnyObject>§
Sourcepub fn class(&self) -> &'static AnyClass
pub fn class(&self) -> &'static AnyClass
Dynamically find the class of this object.
§Example
Check that an instance of NSObject
has the precise class NSObject
.
use objc2::ClassType;
use objc2::runtime::NSObject;
let obj = NSObject::new();
assert_eq!(obj.class(), NSObject::class());
Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load
instead.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load
instead.Use Ivar::load
instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T
.
See Ivar::load_ptr
for details surrounding this.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
Attempt to downcast the object to a class of type T
.
This is the reference-variant. Use Retained::downcast
if you want
to convert a retained object to another type.
§Mutable classes
Some classes have immutable and mutable variants, such as NSString
and NSMutableString
.
When some Objective-C API signature says it gives you an immutable class, it generally expects you to not mutate that, even though it may technically be mutable “under the hood”.
So using this method to convert a NSString
to a NSMutableString
,
while not unsound, is generally frowned upon unless you created the
string yourself, or the API explicitly documents the string to be
mutable.
See Apple’s documentation on mutability and on
isKindOfClass:
for more details.
§Generic classes
Objective-C generics are called “lightweight generics”, and that’s because they aren’t exposed in the runtime. This makes it impossible to safely downcast to generic collections, so this is disallowed by this method.
You can, however, safely downcast to generic collections where all the
type-parameters are AnyObject
.
§Panics
This works internally by calling isKindOfClass:
. That means that the
object must have the instance method of that name, and an exception
will be thrown (if CoreFoundation is linked) or the process will abort
if that is not the case. In the vast majority of cases, you don’t need
to worry about this, since both root objects NSObject
and
NSProxy
implement this method.
§Examples
Cast an NSString
back and forth from NSObject
.
use objc2::rc::Retained;
use objc2_foundation::{NSObject, NSString};
let obj: Retained<NSObject> = NSString::new().into_super();
let string = obj.downcast_ref::<NSString>().unwrap();
// Or with `downcast`, if we do not need the object afterwards
let string = obj.downcast::<NSString>().unwrap();
Try (and fail) to cast an NSObject
to an NSString
.
use objc2_foundation::{NSObject, NSString};
let obj = NSObject::new();
assert!(obj.downcast_ref::<NSString>().is_none());
Try to cast to an array of strings.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
// This is invalid and doesn't type check.
let arr = arr.downcast_ref::<NSArray<NSString>>();
This fails to compile, since it would require enumerating over the array to ensure that each element is of the desired type, which is a performance pitfall.
Downcast when processing each element instead.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
for elem in arr {
if let Some(data) = elem.downcast_ref::<NSString>() {
// handle `data`
}
}
Trait Implementations§
Source§impl AsRef<AnyObject> for WebPreferences
impl AsRef<AnyObject> for WebPreferences
Source§impl AsRef<NSObject> for WebPreferences
impl AsRef<NSObject> for WebPreferences
Source§impl AsRef<WebPreferences> for WebPreferences
impl AsRef<WebPreferences> for WebPreferences
Source§impl Borrow<AnyObject> for WebPreferences
impl Borrow<AnyObject> for WebPreferences
Source§impl Borrow<NSObject> for WebPreferences
impl Borrow<NSObject> for WebPreferences
Source§impl ClassType for WebPreferences
impl ClassType for WebPreferences
Source§const NAME: &'static str = "WebPreferences"
const NAME: &'static str = "WebPreferences"
Source§type ThreadKind = <<WebPreferences as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<WebPreferences as ClassType>::Super as ClassType>::ThreadKind
Source§impl Debug for WebPreferences
impl Debug for WebPreferences
Source§impl Deref for WebPreferences
impl Deref for WebPreferences
Source§impl Hash for WebPreferences
impl Hash for WebPreferences
Source§impl Message for WebPreferences
impl Message for WebPreferences
Source§impl NSCoding for WebPreferences
impl NSCoding for WebPreferences
Source§impl NSObjectProtocol for WebPreferences
impl NSObjectProtocol for WebPreferences
Source§fn isEqual(&self, other: Option<&AnyObject>) -> bool
fn isEqual(&self, other: Option<&AnyObject>) -> bool
Source§fn hash(&self) -> usize
fn hash(&self) -> usize
Source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
Source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
isKindOfClass
directly, or cast your objects with AnyObject::downcast_ref