objc2_web_kit/generated/
WebPreferences.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// Specifies a usage model for a WebView, which WebKit will use to
11/// determine its caching behavior.
12///
13/// a fixed document -- like a splash screen, a chat document, or a word processing
14/// document -- with no UI for navigation. The WebView will behave like any other
15/// view, releasing resources when they are no longer referenced. Remote resources,
16/// if any, will be cached to disk. This is the most memory-efficient setting.
17///
18/// Examples: iChat, Mail, TextMate, Growl.
19///
20/// a browsable series of documents with a UI for navigating between them -- for
21/// example, a reference materials browser or a website designer. The WebView will
22/// cache a reasonable number of resources and previously viewed documents in
23/// memory and/or on disk.
24///
25/// Examples: Dictionary, Help Viewer, Coda.
26///
27/// application that acts as the user's primary web browser. The WebView will cache
28/// a very large number of resources and previously viewed documents in memory
29/// and/or on disk.
30///
31/// Examples: Safari, OmniWeb, Shiira.
32///
33/// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webcachemodel?language=objc)
34// NS_ENUM
35#[deprecated]
36#[repr(transparent)]
37#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
38pub struct WebCacheModel(pub NSUInteger);
39impl WebCacheModel {
40    #[doc(alias = "WebCacheModelDocumentViewer")]
41    #[deprecated]
42    pub const DocumentViewer: Self = Self(0);
43    #[doc(alias = "WebCacheModelDocumentBrowser")]
44    #[deprecated]
45    pub const DocumentBrowser: Self = Self(1);
46    #[doc(alias = "WebCacheModelPrimaryWebBrowser")]
47    #[deprecated]
48    pub const PrimaryWebBrowser: Self = Self(2);
49}
50
51unsafe impl Encode for WebCacheModel {
52    const ENCODING: Encoding = NSUInteger::ENCODING;
53}
54
55unsafe impl RefEncode for WebCacheModel {
56    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
57}
58
59extern "C" {
60    /// [Apple's documentation](https://developer.apple.com/documentation/webkit/webpreferenceschangednotification?language=objc)
61    #[deprecated]
62    pub static WebPreferencesChangedNotification: Option<&'static NSString>;
63}
64
65extern_class!(
66    /// [Apple's documentation](https://developer.apple.com/documentation/webkit/webpreferences?language=objc)
67    #[unsafe(super(NSObject))]
68    #[derive(Debug, PartialEq, Eq, Hash)]
69    #[deprecated]
70    pub struct WebPreferences;
71);
72
73extern_conformance!(
74    unsafe impl NSCoding for WebPreferences {}
75);
76
77extern_conformance!(
78    unsafe impl NSObjectProtocol for WebPreferences {}
79);
80
81impl WebPreferences {
82    extern_methods!(
83        #[deprecated]
84        #[unsafe(method(standardPreferences))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn standardPreferences() -> Option<Retained<WebPreferences>>;
87
88        /// Parameter `anIdentifier`: A string used to identify the WebPreferences.
89        ///
90        /// WebViews can share instances of WebPreferences by using an instance of WebPreferences with
91        /// the same identifier.  Typically, instance are not created directly.  Instead you set the preferences
92        /// identifier on a WebView.  The identifier is used as a prefix that is added to the user defaults keys
93        /// for the WebPreferences.
94        ///
95        /// Returns: Returns a new instance of WebPreferences or a previously allocated instance with the same identifier.
96        ///
97        /// # Safety
98        ///
99        /// `an_identifier` might not allow `None`.
100        #[deprecated]
101        #[unsafe(method(initWithIdentifier:))]
102        #[unsafe(method_family = init)]
103        pub unsafe fn initWithIdentifier(
104            this: Allocated<Self>,
105            an_identifier: Option<&NSString>,
106        ) -> Option<Retained<Self>>;
107
108        /// Returns: Returns the identifier for this WebPreferences.
109        #[deprecated]
110        #[unsafe(method(identifier))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn identifier(&self) -> Retained<NSString>;
113
114        #[deprecated]
115        #[unsafe(method(standardFontFamily))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn standardFontFamily(&self) -> Retained<NSString>;
118
119        /// Setter for [`standardFontFamily`][Self::standardFontFamily].
120        ///
121        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
122        #[deprecated]
123        #[unsafe(method(setStandardFontFamily:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setStandardFontFamily(&self, standard_font_family: Option<&NSString>);
126
127        #[deprecated]
128        #[unsafe(method(fixedFontFamily))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn fixedFontFamily(&self) -> Retained<NSString>;
131
132        /// Setter for [`fixedFontFamily`][Self::fixedFontFamily].
133        ///
134        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
135        #[deprecated]
136        #[unsafe(method(setFixedFontFamily:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setFixedFontFamily(&self, fixed_font_family: Option<&NSString>);
139
140        #[deprecated]
141        #[unsafe(method(serifFontFamily))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn serifFontFamily(&self) -> Retained<NSString>;
144
145        /// Setter for [`serifFontFamily`][Self::serifFontFamily].
146        ///
147        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
148        #[deprecated]
149        #[unsafe(method(setSerifFontFamily:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn setSerifFontFamily(&self, serif_font_family: Option<&NSString>);
152
153        #[deprecated]
154        #[unsafe(method(sansSerifFontFamily))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn sansSerifFontFamily(&self) -> Retained<NSString>;
157
158        /// Setter for [`sansSerifFontFamily`][Self::sansSerifFontFamily].
159        ///
160        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
161        #[deprecated]
162        #[unsafe(method(setSansSerifFontFamily:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn setSansSerifFontFamily(&self, sans_serif_font_family: Option<&NSString>);
165
166        #[deprecated]
167        #[unsafe(method(cursiveFontFamily))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn cursiveFontFamily(&self) -> Retained<NSString>;
170
171        /// Setter for [`cursiveFontFamily`][Self::cursiveFontFamily].
172        ///
173        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
174        #[deprecated]
175        #[unsafe(method(setCursiveFontFamily:))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn setCursiveFontFamily(&self, cursive_font_family: Option<&NSString>);
178
179        #[deprecated]
180        #[unsafe(method(fantasyFontFamily))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn fantasyFontFamily(&self) -> Retained<NSString>;
183
184        /// Setter for [`fantasyFontFamily`][Self::fantasyFontFamily].
185        ///
186        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
187        #[deprecated]
188        #[unsafe(method(setFantasyFontFamily:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn setFantasyFontFamily(&self, fantasy_font_family: Option<&NSString>);
191
192        #[deprecated]
193        #[unsafe(method(defaultFontSize))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn defaultFontSize(&self) -> c_int;
196
197        /// Setter for [`defaultFontSize`][Self::defaultFontSize].
198        #[deprecated]
199        #[unsafe(method(setDefaultFontSize:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn setDefaultFontSize(&self, default_font_size: c_int);
202
203        #[deprecated]
204        #[unsafe(method(defaultFixedFontSize))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn defaultFixedFontSize(&self) -> c_int;
207
208        /// Setter for [`defaultFixedFontSize`][Self::defaultFixedFontSize].
209        #[deprecated]
210        #[unsafe(method(setDefaultFixedFontSize:))]
211        #[unsafe(method_family = none)]
212        pub unsafe fn setDefaultFixedFontSize(&self, default_fixed_font_size: c_int);
213
214        #[deprecated]
215        #[unsafe(method(minimumFontSize))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn minimumFontSize(&self) -> c_int;
218
219        /// Setter for [`minimumFontSize`][Self::minimumFontSize].
220        #[deprecated]
221        #[unsafe(method(setMinimumFontSize:))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn setMinimumFontSize(&self, minimum_font_size: c_int);
224
225        #[deprecated]
226        #[unsafe(method(minimumLogicalFontSize))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn minimumLogicalFontSize(&self) -> c_int;
229
230        /// Setter for [`minimumLogicalFontSize`][Self::minimumLogicalFontSize].
231        #[deprecated]
232        #[unsafe(method(setMinimumLogicalFontSize:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn setMinimumLogicalFontSize(&self, minimum_logical_font_size: c_int);
235
236        #[deprecated]
237        #[unsafe(method(defaultTextEncodingName))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn defaultTextEncodingName(&self) -> Retained<NSString>;
240
241        /// Setter for [`defaultTextEncodingName`][Self::defaultTextEncodingName].
242        ///
243        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
244        #[deprecated]
245        #[unsafe(method(setDefaultTextEncodingName:))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn setDefaultTextEncodingName(
248            &self,
249            default_text_encoding_name: Option<&NSString>,
250        );
251
252        #[deprecated]
253        #[unsafe(method(userStyleSheetEnabled))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn userStyleSheetEnabled(&self) -> bool;
256
257        /// Setter for [`userStyleSheetEnabled`][Self::userStyleSheetEnabled].
258        #[deprecated]
259        #[unsafe(method(setUserStyleSheetEnabled:))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn setUserStyleSheetEnabled(&self, user_style_sheet_enabled: bool);
262
263        /// The location of the user style sheet.
264        #[deprecated]
265        #[unsafe(method(userStyleSheetLocation))]
266        #[unsafe(method_family = none)]
267        pub unsafe fn userStyleSheetLocation(&self) -> Option<Retained<NSURL>>;
268
269        /// Setter for [`userStyleSheetLocation`][Self::userStyleSheetLocation].
270        ///
271        /// # Safety
272        ///
273        /// `user_style_sheet_location` might not allow `None`.
274        #[deprecated]
275        #[unsafe(method(setUserStyleSheetLocation:))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn setUserStyleSheetLocation(&self, user_style_sheet_location: Option<&NSURL>);
278
279        /// Deprecated function that does nothing and always returns false.
280        #[deprecated]
281        #[unsafe(method(isJavaEnabled))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn isJavaEnabled(&self) -> bool;
284
285        /// Setter for [`isJavaEnabled`][Self::isJavaEnabled].
286        #[deprecated]
287        #[unsafe(method(setJavaEnabled:))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn setJavaEnabled(&self, java_enabled: bool);
290
291        #[deprecated]
292        #[unsafe(method(isJavaScriptEnabled))]
293        #[unsafe(method_family = none)]
294        pub unsafe fn isJavaScriptEnabled(&self) -> bool;
295
296        /// Setter for [`isJavaScriptEnabled`][Self::isJavaScriptEnabled].
297        #[deprecated]
298        #[unsafe(method(setJavaScriptEnabled:))]
299        #[unsafe(method_family = none)]
300        pub unsafe fn setJavaScriptEnabled(&self, java_script_enabled: bool);
301
302        #[deprecated]
303        #[unsafe(method(javaScriptCanOpenWindowsAutomatically))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn javaScriptCanOpenWindowsAutomatically(&self) -> bool;
306
307        /// Setter for [`javaScriptCanOpenWindowsAutomatically`][Self::javaScriptCanOpenWindowsAutomatically].
308        #[deprecated]
309        #[unsafe(method(setJavaScriptCanOpenWindowsAutomatically:))]
310        #[unsafe(method_family = none)]
311        pub unsafe fn setJavaScriptCanOpenWindowsAutomatically(
312            &self,
313            java_script_can_open_windows_automatically: bool,
314        );
315
316        #[deprecated]
317        #[unsafe(method(arePlugInsEnabled))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn arePlugInsEnabled(&self) -> bool;
320
321        /// Setter for [`arePlugInsEnabled`][Self::arePlugInsEnabled].
322        #[deprecated]
323        #[unsafe(method(setPlugInsEnabled:))]
324        #[unsafe(method_family = none)]
325        pub unsafe fn setPlugInsEnabled(&self, plug_ins_enabled: bool);
326
327        #[deprecated]
328        #[unsafe(method(allowsAnimatedImages))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn allowsAnimatedImages(&self) -> bool;
331
332        /// Setter for [`allowsAnimatedImages`][Self::allowsAnimatedImages].
333        #[deprecated]
334        #[unsafe(method(setAllowsAnimatedImages:))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn setAllowsAnimatedImages(&self, allows_animated_images: bool);
337
338        #[deprecated]
339        #[unsafe(method(allowsAnimatedImageLooping))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn allowsAnimatedImageLooping(&self) -> bool;
342
343        /// Setter for [`allowsAnimatedImageLooping`][Self::allowsAnimatedImageLooping].
344        #[deprecated]
345        #[unsafe(method(setAllowsAnimatedImageLooping:))]
346        #[unsafe(method_family = none)]
347        pub unsafe fn setAllowsAnimatedImageLooping(&self, allows_animated_image_looping: bool);
348
349        #[deprecated]
350        #[unsafe(method(loadsImagesAutomatically))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn loadsImagesAutomatically(&self) -> bool;
353
354        /// Setter for [`loadsImagesAutomatically`][Self::loadsImagesAutomatically].
355        #[deprecated]
356        #[unsafe(method(setLoadsImagesAutomatically:))]
357        #[unsafe(method_family = none)]
358        pub unsafe fn setLoadsImagesAutomatically(&self, loads_images_automatically: bool);
359
360        /// If autosaves is YES the settings represented by
361        /// WebPreferences will be stored in the user defaults database.
362        #[deprecated]
363        #[unsafe(method(autosaves))]
364        #[unsafe(method_family = none)]
365        pub unsafe fn autosaves(&self) -> bool;
366
367        /// Setter for [`autosaves`][Self::autosaves].
368        #[deprecated]
369        #[unsafe(method(setAutosaves:))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn setAutosaves(&self, autosaves: bool);
372
373        #[deprecated]
374        #[unsafe(method(shouldPrintBackgrounds))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn shouldPrintBackgrounds(&self) -> bool;
377
378        /// Setter for [`shouldPrintBackgrounds`][Self::shouldPrintBackgrounds].
379        #[deprecated]
380        #[unsafe(method(setShouldPrintBackgrounds:))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn setShouldPrintBackgrounds(&self, should_print_backgrounds: bool);
383
384        /// If private browsing is enabled, WebKit will not store information
385        /// about sites the user visits.
386        #[deprecated]
387        #[unsafe(method(privateBrowsingEnabled))]
388        #[unsafe(method_family = none)]
389        pub unsafe fn privateBrowsingEnabled(&self) -> bool;
390
391        /// Setter for [`privateBrowsingEnabled`][Self::privateBrowsingEnabled].
392        #[deprecated]
393        #[unsafe(method(setPrivateBrowsingEnabled:))]
394        #[unsafe(method_family = none)]
395        pub unsafe fn setPrivateBrowsingEnabled(&self, private_browsing_enabled: bool);
396
397        /// If tabsToLinks is YES, the tab key will focus links and form controls.
398        /// The option key temporarily reverses this preference.
399        #[deprecated]
400        #[unsafe(method(tabsToLinks))]
401        #[unsafe(method_family = none)]
402        pub unsafe fn tabsToLinks(&self) -> bool;
403
404        /// Setter for [`tabsToLinks`][Self::tabsToLinks].
405        #[deprecated]
406        #[unsafe(method(setTabsToLinks:))]
407        #[unsafe(method_family = none)]
408        pub unsafe fn setTabsToLinks(&self, tabs_to_links: bool);
409
410        /// Whether the receiver's associated WebViews use the shared
411        /// page cache.
412        ///
413        /// Pages are cached as they are added to a WebBackForwardList, and
414        /// removed from the cache as they are removed from a WebBackForwardList. Because
415        /// the page cache is global, caching a page in one WebBackForwardList may cause
416        /// a page in another WebBackForwardList to be evicted from the cache.
417        #[deprecated]
418        #[unsafe(method(usesPageCache))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn usesPageCache(&self) -> bool;
421
422        /// Setter for [`usesPageCache`][Self::usesPageCache].
423        #[deprecated]
424        #[unsafe(method(setUsesPageCache:))]
425        #[unsafe(method_family = none)]
426        pub unsafe fn setUsesPageCache(&self, uses_page_cache: bool);
427
428        /// Specifies a usage model for a WebView, which WebKit will use to
429        /// determine its caching behavior. If necessary, WebKit
430        /// will prune its caches to match cacheModel when set.
431        ///
432        ///
433        /// Research indicates that users tend to browse within clusters of
434        /// documents that hold resources in common, and to revisit previously visited
435        /// documents. WebKit and the frameworks below it include built-in caches that take
436        /// advantage of these patterns, substantially improving document load speed in
437        /// browsing situations. The WebKit cache model controls the behaviors of all of
438        /// these caches, including NSURLCache and the various WebCore caches.
439        ///
440        /// Applications with a browsing interface can improve document load speed
441        /// substantially by specifying WebCacheModelDocumentBrowser. Applications without
442        /// a browsing interface can reduce memory usage substantially by specifying
443        /// WebCacheModelDocumentViewer.
444        ///
445        /// If cacheModel is not set, WebKit will select a cache model automatically.
446        #[deprecated]
447        #[unsafe(method(cacheModel))]
448        #[unsafe(method_family = none)]
449        pub unsafe fn cacheModel(&self) -> WebCacheModel;
450
451        /// Setter for [`cacheModel`][Self::cacheModel].
452        #[deprecated]
453        #[unsafe(method(setCacheModel:))]
454        #[unsafe(method_family = none)]
455        pub unsafe fn setCacheModel(&self, cache_model: WebCacheModel);
456
457        #[deprecated]
458        #[unsafe(method(suppressesIncrementalRendering))]
459        #[unsafe(method_family = none)]
460        pub unsafe fn suppressesIncrementalRendering(&self) -> bool;
461
462        /// Setter for [`suppressesIncrementalRendering`][Self::suppressesIncrementalRendering].
463        #[deprecated]
464        #[unsafe(method(setSuppressesIncrementalRendering:))]
465        #[unsafe(method_family = none)]
466        pub unsafe fn setSuppressesIncrementalRendering(
467            &self,
468            suppresses_incremental_rendering: bool,
469        );
470
471        #[deprecated]
472        #[unsafe(method(allowsAirPlayForMediaPlayback))]
473        #[unsafe(method_family = none)]
474        pub unsafe fn allowsAirPlayForMediaPlayback(&self) -> bool;
475
476        /// Setter for [`allowsAirPlayForMediaPlayback`][Self::allowsAirPlayForMediaPlayback].
477        #[deprecated]
478        #[unsafe(method(setAllowsAirPlayForMediaPlayback:))]
479        #[unsafe(method_family = none)]
480        pub unsafe fn setAllowsAirPlayForMediaPlayback(
481            &self,
482            allows_air_play_for_media_playback: bool,
483        );
484    );
485}
486
487/// Methods declared on superclass `NSObject`.
488impl WebPreferences {
489    extern_methods!(
490        #[unsafe(method(init))]
491        #[unsafe(method_family = init)]
492        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
493
494        #[unsafe(method(new))]
495        #[unsafe(method_family = new)]
496        pub unsafe fn new() -> Retained<Self>;
497    );
498}