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