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    pub static WebPreferencesChangedNotification: Option<&'static NSString>;
62}
63
64extern_class!(
65    /// [Apple's documentation](https://developer.apple.com/documentation/webkit/webpreferences?language=objc)
66    #[unsafe(super(NSObject))]
67    #[derive(Debug, PartialEq, Eq, Hash)]
68    #[deprecated]
69    pub struct WebPreferences;
70);
71
72extern_conformance!(
73    unsafe impl NSCoding for WebPreferences {}
74);
75
76extern_conformance!(
77    unsafe impl NSObjectProtocol for WebPreferences {}
78);
79
80impl WebPreferences {
81    extern_methods!(
82        #[deprecated]
83        #[unsafe(method(standardPreferences))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn standardPreferences() -> Option<Retained<WebPreferences>>;
86
87        /// Parameter `anIdentifier`: A string used to identify the WebPreferences.
88        ///
89        /// WebViews can share instances of WebPreferences by using an instance of WebPreferences with
90        /// the same identifier.  Typically, instance are not created directly.  Instead you set the preferences
91        /// identifier on a WebView.  The identifier is used as a prefix that is added to the user defaults keys
92        /// for the WebPreferences.
93        ///
94        /// Returns: Returns a new instance of WebPreferences or a previously allocated instance with the same identifier.
95        #[deprecated]
96        #[unsafe(method(initWithIdentifier:))]
97        #[unsafe(method_family = init)]
98        pub unsafe fn initWithIdentifier(
99            this: Allocated<Self>,
100            an_identifier: Option<&NSString>,
101        ) -> Option<Retained<Self>>;
102
103        /// Returns: Returns the identifier for this WebPreferences.
104        #[deprecated]
105        #[unsafe(method(identifier))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn identifier(&self) -> Retained<NSString>;
108
109        #[deprecated]
110        #[unsafe(method(standardFontFamily))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn standardFontFamily(&self) -> Retained<NSString>;
113
114        /// Setter for [`standardFontFamily`][Self::standardFontFamily].
115        #[deprecated]
116        #[unsafe(method(setStandardFontFamily:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn setStandardFontFamily(&self, standard_font_family: Option<&NSString>);
119
120        #[deprecated]
121        #[unsafe(method(fixedFontFamily))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn fixedFontFamily(&self) -> Retained<NSString>;
124
125        /// Setter for [`fixedFontFamily`][Self::fixedFontFamily].
126        #[deprecated]
127        #[unsafe(method(setFixedFontFamily:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn setFixedFontFamily(&self, fixed_font_family: Option<&NSString>);
130
131        #[deprecated]
132        #[unsafe(method(serifFontFamily))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn serifFontFamily(&self) -> Retained<NSString>;
135
136        /// Setter for [`serifFontFamily`][Self::serifFontFamily].
137        #[deprecated]
138        #[unsafe(method(setSerifFontFamily:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn setSerifFontFamily(&self, serif_font_family: Option<&NSString>);
141
142        #[deprecated]
143        #[unsafe(method(sansSerifFontFamily))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn sansSerifFontFamily(&self) -> Retained<NSString>;
146
147        /// Setter for [`sansSerifFontFamily`][Self::sansSerifFontFamily].
148        #[deprecated]
149        #[unsafe(method(setSansSerifFontFamily:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn setSansSerifFontFamily(&self, sans_serif_font_family: Option<&NSString>);
152
153        #[deprecated]
154        #[unsafe(method(cursiveFontFamily))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn cursiveFontFamily(&self) -> Retained<NSString>;
157
158        /// Setter for [`cursiveFontFamily`][Self::cursiveFontFamily].
159        #[deprecated]
160        #[unsafe(method(setCursiveFontFamily:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn setCursiveFontFamily(&self, cursive_font_family: Option<&NSString>);
163
164        #[deprecated]
165        #[unsafe(method(fantasyFontFamily))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn fantasyFontFamily(&self) -> Retained<NSString>;
168
169        /// Setter for [`fantasyFontFamily`][Self::fantasyFontFamily].
170        #[deprecated]
171        #[unsafe(method(setFantasyFontFamily:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn setFantasyFontFamily(&self, fantasy_font_family: Option<&NSString>);
174
175        #[deprecated]
176        #[unsafe(method(defaultFontSize))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn defaultFontSize(&self) -> c_int;
179
180        /// Setter for [`defaultFontSize`][Self::defaultFontSize].
181        #[deprecated]
182        #[unsafe(method(setDefaultFontSize:))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn setDefaultFontSize(&self, default_font_size: c_int);
185
186        #[deprecated]
187        #[unsafe(method(defaultFixedFontSize))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn defaultFixedFontSize(&self) -> c_int;
190
191        /// Setter for [`defaultFixedFontSize`][Self::defaultFixedFontSize].
192        #[deprecated]
193        #[unsafe(method(setDefaultFixedFontSize:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn setDefaultFixedFontSize(&self, default_fixed_font_size: c_int);
196
197        #[deprecated]
198        #[unsafe(method(minimumFontSize))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn minimumFontSize(&self) -> c_int;
201
202        /// Setter for [`minimumFontSize`][Self::minimumFontSize].
203        #[deprecated]
204        #[unsafe(method(setMinimumFontSize:))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn setMinimumFontSize(&self, minimum_font_size: c_int);
207
208        #[deprecated]
209        #[unsafe(method(minimumLogicalFontSize))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn minimumLogicalFontSize(&self) -> c_int;
212
213        /// Setter for [`minimumLogicalFontSize`][Self::minimumLogicalFontSize].
214        #[deprecated]
215        #[unsafe(method(setMinimumLogicalFontSize:))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn setMinimumLogicalFontSize(&self, minimum_logical_font_size: c_int);
218
219        #[deprecated]
220        #[unsafe(method(defaultTextEncodingName))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn defaultTextEncodingName(&self) -> Retained<NSString>;
223
224        /// Setter for [`defaultTextEncodingName`][Self::defaultTextEncodingName].
225        #[deprecated]
226        #[unsafe(method(setDefaultTextEncodingName:))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn setDefaultTextEncodingName(
229            &self,
230            default_text_encoding_name: Option<&NSString>,
231        );
232
233        #[deprecated]
234        #[unsafe(method(userStyleSheetEnabled))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn userStyleSheetEnabled(&self) -> bool;
237
238        /// Setter for [`userStyleSheetEnabled`][Self::userStyleSheetEnabled].
239        #[deprecated]
240        #[unsafe(method(setUserStyleSheetEnabled:))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn setUserStyleSheetEnabled(&self, user_style_sheet_enabled: bool);
243
244        /// The location of the user style sheet.
245        #[deprecated]
246        #[unsafe(method(userStyleSheetLocation))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn userStyleSheetLocation(&self) -> Option<Retained<NSURL>>;
249
250        /// Setter for [`userStyleSheetLocation`][Self::userStyleSheetLocation].
251        #[deprecated]
252        #[unsafe(method(setUserStyleSheetLocation:))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn setUserStyleSheetLocation(&self, user_style_sheet_location: Option<&NSURL>);
255
256        /// Deprecated function that does nothing and always returns false.
257        #[deprecated]
258        #[unsafe(method(isJavaEnabled))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn isJavaEnabled(&self) -> bool;
261
262        /// Setter for [`isJavaEnabled`][Self::isJavaEnabled].
263        #[deprecated]
264        #[unsafe(method(setJavaEnabled:))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn setJavaEnabled(&self, java_enabled: bool);
267
268        #[deprecated]
269        #[unsafe(method(isJavaScriptEnabled))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn isJavaScriptEnabled(&self) -> bool;
272
273        /// Setter for [`isJavaScriptEnabled`][Self::isJavaScriptEnabled].
274        #[deprecated]
275        #[unsafe(method(setJavaScriptEnabled:))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn setJavaScriptEnabled(&self, java_script_enabled: bool);
278
279        #[deprecated]
280        #[unsafe(method(javaScriptCanOpenWindowsAutomatically))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn javaScriptCanOpenWindowsAutomatically(&self) -> bool;
283
284        /// Setter for [`javaScriptCanOpenWindowsAutomatically`][Self::javaScriptCanOpenWindowsAutomatically].
285        #[deprecated]
286        #[unsafe(method(setJavaScriptCanOpenWindowsAutomatically:))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn setJavaScriptCanOpenWindowsAutomatically(
289            &self,
290            java_script_can_open_windows_automatically: bool,
291        );
292
293        #[deprecated]
294        #[unsafe(method(arePlugInsEnabled))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn arePlugInsEnabled(&self) -> bool;
297
298        /// Setter for [`arePlugInsEnabled`][Self::arePlugInsEnabled].
299        #[deprecated]
300        #[unsafe(method(setPlugInsEnabled:))]
301        #[unsafe(method_family = none)]
302        pub unsafe fn setPlugInsEnabled(&self, plug_ins_enabled: bool);
303
304        #[deprecated]
305        #[unsafe(method(allowsAnimatedImages))]
306        #[unsafe(method_family = none)]
307        pub unsafe fn allowsAnimatedImages(&self) -> bool;
308
309        /// Setter for [`allowsAnimatedImages`][Self::allowsAnimatedImages].
310        #[deprecated]
311        #[unsafe(method(setAllowsAnimatedImages:))]
312        #[unsafe(method_family = none)]
313        pub unsafe fn setAllowsAnimatedImages(&self, allows_animated_images: bool);
314
315        #[deprecated]
316        #[unsafe(method(allowsAnimatedImageLooping))]
317        #[unsafe(method_family = none)]
318        pub unsafe fn allowsAnimatedImageLooping(&self) -> bool;
319
320        /// Setter for [`allowsAnimatedImageLooping`][Self::allowsAnimatedImageLooping].
321        #[deprecated]
322        #[unsafe(method(setAllowsAnimatedImageLooping:))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn setAllowsAnimatedImageLooping(&self, allows_animated_image_looping: bool);
325
326        #[deprecated]
327        #[unsafe(method(loadsImagesAutomatically))]
328        #[unsafe(method_family = none)]
329        pub unsafe fn loadsImagesAutomatically(&self) -> bool;
330
331        /// Setter for [`loadsImagesAutomatically`][Self::loadsImagesAutomatically].
332        #[deprecated]
333        #[unsafe(method(setLoadsImagesAutomatically:))]
334        #[unsafe(method_family = none)]
335        pub unsafe fn setLoadsImagesAutomatically(&self, loads_images_automatically: bool);
336
337        /// If autosaves is YES the settings represented by
338        /// WebPreferences will be stored in the user defaults database.
339        #[deprecated]
340        #[unsafe(method(autosaves))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn autosaves(&self) -> bool;
343
344        /// Setter for [`autosaves`][Self::autosaves].
345        #[deprecated]
346        #[unsafe(method(setAutosaves:))]
347        #[unsafe(method_family = none)]
348        pub unsafe fn setAutosaves(&self, autosaves: bool);
349
350        #[deprecated]
351        #[unsafe(method(shouldPrintBackgrounds))]
352        #[unsafe(method_family = none)]
353        pub unsafe fn shouldPrintBackgrounds(&self) -> bool;
354
355        /// Setter for [`shouldPrintBackgrounds`][Self::shouldPrintBackgrounds].
356        #[deprecated]
357        #[unsafe(method(setShouldPrintBackgrounds:))]
358        #[unsafe(method_family = none)]
359        pub unsafe fn setShouldPrintBackgrounds(&self, should_print_backgrounds: bool);
360
361        /// If private browsing is enabled, WebKit will not store information
362        /// about sites the user visits.
363        #[deprecated]
364        #[unsafe(method(privateBrowsingEnabled))]
365        #[unsafe(method_family = none)]
366        pub unsafe fn privateBrowsingEnabled(&self) -> bool;
367
368        /// Setter for [`privateBrowsingEnabled`][Self::privateBrowsingEnabled].
369        #[deprecated]
370        #[unsafe(method(setPrivateBrowsingEnabled:))]
371        #[unsafe(method_family = none)]
372        pub unsafe fn setPrivateBrowsingEnabled(&self, private_browsing_enabled: bool);
373
374        /// If tabsToLinks is YES, the tab key will focus links and form controls.
375        /// The option key temporarily reverses this preference.
376        #[deprecated]
377        #[unsafe(method(tabsToLinks))]
378        #[unsafe(method_family = none)]
379        pub unsafe fn tabsToLinks(&self) -> bool;
380
381        /// Setter for [`tabsToLinks`][Self::tabsToLinks].
382        #[deprecated]
383        #[unsafe(method(setTabsToLinks:))]
384        #[unsafe(method_family = none)]
385        pub unsafe fn setTabsToLinks(&self, tabs_to_links: bool);
386
387        /// Whether the receiver's associated WebViews use the shared
388        /// page cache.
389        ///
390        /// Pages are cached as they are added to a WebBackForwardList, and
391        /// removed from the cache as they are removed from a WebBackForwardList. Because
392        /// the page cache is global, caching a page in one WebBackForwardList may cause
393        /// a page in another WebBackForwardList to be evicted from the cache.
394        #[deprecated]
395        #[unsafe(method(usesPageCache))]
396        #[unsafe(method_family = none)]
397        pub unsafe fn usesPageCache(&self) -> bool;
398
399        /// Setter for [`usesPageCache`][Self::usesPageCache].
400        #[deprecated]
401        #[unsafe(method(setUsesPageCache:))]
402        #[unsafe(method_family = none)]
403        pub unsafe fn setUsesPageCache(&self, uses_page_cache: bool);
404
405        /// Specifies a usage model for a WebView, which WebKit will use to
406        /// determine its caching behavior. If necessary, WebKit
407        /// will prune its caches to match cacheModel when set.
408        ///
409        ///
410        /// Research indicates that users tend to browse within clusters of
411        /// documents that hold resources in common, and to revisit previously visited
412        /// documents. WebKit and the frameworks below it include built-in caches that take
413        /// advantage of these patterns, substantially improving document load speed in
414        /// browsing situations. The WebKit cache model controls the behaviors of all of
415        /// these caches, including NSURLCache and the various WebCore caches.
416        ///
417        /// Applications with a browsing interface can improve document load speed
418        /// substantially by specifying WebCacheModelDocumentBrowser. Applications without
419        /// a browsing interface can reduce memory usage substantially by specifying
420        /// WebCacheModelDocumentViewer.
421        ///
422        /// If cacheModel is not set, WebKit will select a cache model automatically.
423        #[deprecated]
424        #[unsafe(method(cacheModel))]
425        #[unsafe(method_family = none)]
426        pub unsafe fn cacheModel(&self) -> WebCacheModel;
427
428        /// Setter for [`cacheModel`][Self::cacheModel].
429        #[deprecated]
430        #[unsafe(method(setCacheModel:))]
431        #[unsafe(method_family = none)]
432        pub unsafe fn setCacheModel(&self, cache_model: WebCacheModel);
433
434        #[deprecated]
435        #[unsafe(method(suppressesIncrementalRendering))]
436        #[unsafe(method_family = none)]
437        pub unsafe fn suppressesIncrementalRendering(&self) -> bool;
438
439        /// Setter for [`suppressesIncrementalRendering`][Self::suppressesIncrementalRendering].
440        #[deprecated]
441        #[unsafe(method(setSuppressesIncrementalRendering:))]
442        #[unsafe(method_family = none)]
443        pub unsafe fn setSuppressesIncrementalRendering(
444            &self,
445            suppresses_incremental_rendering: bool,
446        );
447
448        #[deprecated]
449        #[unsafe(method(allowsAirPlayForMediaPlayback))]
450        #[unsafe(method_family = none)]
451        pub unsafe fn allowsAirPlayForMediaPlayback(&self) -> bool;
452
453        /// Setter for [`allowsAirPlayForMediaPlayback`][Self::allowsAirPlayForMediaPlayback].
454        #[deprecated]
455        #[unsafe(method(setAllowsAirPlayForMediaPlayback:))]
456        #[unsafe(method_family = none)]
457        pub unsafe fn setAllowsAirPlayForMediaPlayback(
458            &self,
459            allows_air_play_for_media_playback: bool,
460        );
461    );
462}
463
464/// Methods declared on superclass `NSObject`.
465impl WebPreferences {
466    extern_methods!(
467        #[unsafe(method(init))]
468        #[unsafe(method_family = init)]
469        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
470
471        #[unsafe(method(new))]
472        #[unsafe(method_family = new)]
473        pub unsafe fn new() -> Retained<Self>;
474    );
475}