objc2_web_kit/generated/
WKPreferences.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/webkit/wkinactiveschedulingpolicy?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct WKInactiveSchedulingPolicy(pub NSInteger);
17impl WKInactiveSchedulingPolicy {
18    #[doc(alias = "WKInactiveSchedulingPolicySuspend")]
19    pub const Suspend: Self = Self(0);
20    #[doc(alias = "WKInactiveSchedulingPolicyThrottle")]
21    pub const Throttle: Self = Self(1);
22    #[doc(alias = "WKInactiveSchedulingPolicyNone")]
23    pub const None: Self = Self(2);
24}
25
26unsafe impl Encode for WKInactiveSchedulingPolicy {
27    const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for WKInactiveSchedulingPolicy {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34extern_class!(
35    /// A WKPreferences object encapsulates the preference settings for a web
36    /// view. The preferences object associated with a web view is specified by
37    /// its web view configuration.
38    ///
39    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkpreferences?language=objc)
40    #[unsafe(super(NSObject))]
41    #[thread_kind = MainThreadOnly]
42    #[derive(Debug, PartialEq, Eq, Hash)]
43    pub struct WKPreferences;
44);
45
46unsafe impl NSCoding for WKPreferences {}
47
48unsafe impl NSObjectProtocol for WKPreferences {}
49
50unsafe impl NSSecureCoding for WKPreferences {}
51
52impl WKPreferences {
53    extern_methods!(
54        #[cfg(feature = "objc2-core-foundation")]
55        /// The minimum font size in points.
56        ///
57        /// The default value is 0.
58        #[unsafe(method(minimumFontSize))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn minimumFontSize(&self) -> CGFloat;
61
62        #[cfg(feature = "objc2-core-foundation")]
63        /// Setter for [`minimumFontSize`][Self::minimumFontSize].
64        #[unsafe(method(setMinimumFontSize:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn setMinimumFontSize(&self, minimum_font_size: CGFloat);
67
68        /// A Boolean value indicating whether JavaScript can open
69        /// windows without user interaction.
70        ///
71        /// The default value is NO in iOS and YES in OS X.
72        #[unsafe(method(javaScriptCanOpenWindowsAutomatically))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn javaScriptCanOpenWindowsAutomatically(&self) -> bool;
75
76        /// Setter for [`javaScriptCanOpenWindowsAutomatically`][Self::javaScriptCanOpenWindowsAutomatically].
77        #[unsafe(method(setJavaScriptCanOpenWindowsAutomatically:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn setJavaScriptCanOpenWindowsAutomatically(
80            &self,
81            java_script_can_open_windows_automatically: bool,
82        );
83
84        /// A Boolean value indicating whether warnings should be
85        /// shown for suspected fraudulent content such as phishing or malware.
86        ///
87        /// The default value is YES.
88        #[unsafe(method(isFraudulentWebsiteWarningEnabled))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn isFraudulentWebsiteWarningEnabled(&self) -> bool;
91
92        /// Setter for [`isFraudulentWebsiteWarningEnabled`][Self::isFraudulentWebsiteWarningEnabled].
93        #[unsafe(method(setFraudulentWebsiteWarningEnabled:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn setFraudulentWebsiteWarningEnabled(
96            &self,
97            fraudulent_website_warning_enabled: bool,
98        );
99
100        /// A Boolean value indicating whether the web view should include backgrounds when printing.
101        ///
102        /// The default value is `NO`.
103        #[unsafe(method(shouldPrintBackgrounds))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn shouldPrintBackgrounds(&self) -> bool;
106
107        /// Setter for [`shouldPrintBackgrounds`][Self::shouldPrintBackgrounds].
108        #[unsafe(method(setShouldPrintBackgrounds:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn setShouldPrintBackgrounds(&self, should_print_backgrounds: bool);
111
112        /// If tabFocusesLinks is YES, the tab key will focus links and form controls.
113        /// The Option key temporarily reverses this preference.
114        #[unsafe(method(tabFocusesLinks))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn tabFocusesLinks(&self) -> bool;
117
118        /// Setter for [`tabFocusesLinks`][Self::tabFocusesLinks].
119        #[unsafe(method(setTabFocusesLinks:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setTabFocusesLinks(&self, tab_focuses_links: bool);
122
123        /// A Boolean value indicating whether text interaction is disabled.
124        #[unsafe(method(isTextInteractionEnabled))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn isTextInteractionEnabled(&self) -> bool;
127
128        /// Setter for [`isTextInteractionEnabled`][Self::isTextInteractionEnabled].
129        #[unsafe(method(setTextInteractionEnabled:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn setTextInteractionEnabled(&self, text_interaction_enabled: bool);
132
133        /// A Boolean value indicating whether WebKit will apply built-in workarounds (quirks)
134        /// to improve compatibility with certain known websites. You can disable site-specific quirks
135        /// to help test your website without these workarounds. Enabled by default.
136        #[unsafe(method(isSiteSpecificQuirksModeEnabled))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn isSiteSpecificQuirksModeEnabled(&self) -> bool;
139
140        /// Setter for [`isSiteSpecificQuirksModeEnabled`][Self::isSiteSpecificQuirksModeEnabled].
141        #[unsafe(method(setSiteSpecificQuirksModeEnabled:))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn setSiteSpecificQuirksModeEnabled(
144            &self,
145            site_specific_quirks_mode_enabled: bool,
146        );
147
148        /// A Boolean value indicating whether Fullscreen API is enabled.
149        ///
150        /// The default value is NO. We can set it to YES to enable support for the fullscreen API.
151        #[unsafe(method(isElementFullscreenEnabled))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn isElementFullscreenEnabled(&self) -> bool;
154
155        /// Setter for [`isElementFullscreenEnabled`][Self::isElementFullscreenEnabled].
156        #[unsafe(method(setElementFullscreenEnabled:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn setElementFullscreenEnabled(&self, element_fullscreen_enabled: bool);
159
160        /// Specify the scheduling policy for the web view when it is inactive
161        /// and detached from the view hierarchy. Web views are not considered idle when playing media or loading web pages.
162        /// A suspended web view will pause JavaScript execution and page layout.
163        #[unsafe(method(inactiveSchedulingPolicy))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn inactiveSchedulingPolicy(&self) -> WKInactiveSchedulingPolicy;
166
167        /// Setter for [`inactiveSchedulingPolicy`][Self::inactiveSchedulingPolicy].
168        #[unsafe(method(setInactiveSchedulingPolicy:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn setInactiveSchedulingPolicy(
171            &self,
172            inactive_scheduling_policy: WKInactiveSchedulingPolicy,
173        );
174    );
175}
176
177/// Methods declared on superclass `NSObject`.
178impl WKPreferences {
179    extern_methods!(
180        #[unsafe(method(init))]
181        #[unsafe(method_family = init)]
182        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
183
184        #[unsafe(method(new))]
185        #[unsafe(method_family = new)]
186        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
187    );
188}
189
190/// WKDeprecated.
191impl WKPreferences {
192    extern_methods!(
193        #[deprecated = "Java is no longer supported"]
194        #[unsafe(method(javaEnabled))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn javaEnabled(&self) -> bool;
197
198        /// Setter for [`javaEnabled`][Self::javaEnabled].
199        #[deprecated = "Java is no longer supported"]
200        #[unsafe(method(setJavaEnabled:))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn setJavaEnabled(&self, java_enabled: bool);
203
204        #[deprecated = "Plug-ins are no longer supported"]
205        #[unsafe(method(plugInsEnabled))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn plugInsEnabled(&self) -> bool;
208
209        /// Setter for [`plugInsEnabled`][Self::plugInsEnabled].
210        #[deprecated = "Plug-ins are no longer supported"]
211        #[unsafe(method(setPlugInsEnabled:))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn setPlugInsEnabled(&self, plug_ins_enabled: bool);
214
215        #[deprecated = "Use WKWebpagePreferences.allowsContentJavaScript to disable content JavaScript on a per-navigation basis"]
216        #[unsafe(method(javaScriptEnabled))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn javaScriptEnabled(&self) -> bool;
219
220        /// Setter for [`javaScriptEnabled`][Self::javaScriptEnabled].
221        #[deprecated = "Use WKWebpagePreferences.allowsContentJavaScript to disable content JavaScript on a per-navigation basis"]
222        #[unsafe(method(setJavaScriptEnabled:))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn setJavaScriptEnabled(&self, java_script_enabled: bool);
225    );
226}