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
46extern_conformance!(
47    unsafe impl NSCoding for WKPreferences {}
48);
49
50extern_conformance!(
51    unsafe impl NSObjectProtocol for WKPreferences {}
52);
53
54extern_conformance!(
55    unsafe impl NSSecureCoding for WKPreferences {}
56);
57
58impl WKPreferences {
59    extern_methods!(
60        #[cfg(feature = "objc2-core-foundation")]
61        /// The minimum font size in points.
62        ///
63        /// The default value is 0.
64        #[unsafe(method(minimumFontSize))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn minimumFontSize(&self) -> CGFloat;
67
68        #[cfg(feature = "objc2-core-foundation")]
69        /// Setter for [`minimumFontSize`][Self::minimumFontSize].
70        #[unsafe(method(setMinimumFontSize:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn setMinimumFontSize(&self, minimum_font_size: CGFloat);
73
74        /// A Boolean value indicating whether JavaScript can open
75        /// windows without user interaction.
76        ///
77        /// The default value is NO in iOS and YES in OS X.
78        #[unsafe(method(javaScriptCanOpenWindowsAutomatically))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn javaScriptCanOpenWindowsAutomatically(&self) -> bool;
81
82        /// Setter for [`javaScriptCanOpenWindowsAutomatically`][Self::javaScriptCanOpenWindowsAutomatically].
83        #[unsafe(method(setJavaScriptCanOpenWindowsAutomatically:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn setJavaScriptCanOpenWindowsAutomatically(
86            &self,
87            java_script_can_open_windows_automatically: bool,
88        );
89
90        /// A Boolean value indicating whether warnings should be
91        /// shown for suspected fraudulent content such as phishing or malware.
92        ///
93        /// The default value is YES.
94        #[unsafe(method(isFraudulentWebsiteWarningEnabled))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn isFraudulentWebsiteWarningEnabled(&self) -> bool;
97
98        /// Setter for [`isFraudulentWebsiteWarningEnabled`][Self::isFraudulentWebsiteWarningEnabled].
99        #[unsafe(method(setFraudulentWebsiteWarningEnabled:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn setFraudulentWebsiteWarningEnabled(
102            &self,
103            fraudulent_website_warning_enabled: bool,
104        );
105
106        /// A Boolean value indicating whether the web view should include backgrounds when printing.
107        ///
108        /// The default value is `NO`.
109        #[unsafe(method(shouldPrintBackgrounds))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn shouldPrintBackgrounds(&self) -> bool;
112
113        /// Setter for [`shouldPrintBackgrounds`][Self::shouldPrintBackgrounds].
114        #[unsafe(method(setShouldPrintBackgrounds:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setShouldPrintBackgrounds(&self, should_print_backgrounds: bool);
117
118        /// If tabFocusesLinks is YES, the tab key will focus links and form controls.
119        /// The Option key temporarily reverses this preference.
120        #[unsafe(method(tabFocusesLinks))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn tabFocusesLinks(&self) -> bool;
123
124        /// Setter for [`tabFocusesLinks`][Self::tabFocusesLinks].
125        #[unsafe(method(setTabFocusesLinks:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn setTabFocusesLinks(&self, tab_focuses_links: bool);
128
129        /// A Boolean value indicating whether text interaction is disabled.
130        #[unsafe(method(isTextInteractionEnabled))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn isTextInteractionEnabled(&self) -> bool;
133
134        /// Setter for [`isTextInteractionEnabled`][Self::isTextInteractionEnabled].
135        #[unsafe(method(setTextInteractionEnabled:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn setTextInteractionEnabled(&self, text_interaction_enabled: bool);
138
139        /// A Boolean value indicating whether WebKit will apply built-in workarounds (quirks)
140        /// to improve compatibility with certain known websites. You can disable site-specific quirks
141        /// to help test your website without these workarounds. Enabled by default.
142        #[unsafe(method(isSiteSpecificQuirksModeEnabled))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn isSiteSpecificQuirksModeEnabled(&self) -> bool;
145
146        /// Setter for [`isSiteSpecificQuirksModeEnabled`][Self::isSiteSpecificQuirksModeEnabled].
147        #[unsafe(method(setSiteSpecificQuirksModeEnabled:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn setSiteSpecificQuirksModeEnabled(
150            &self,
151            site_specific_quirks_mode_enabled: bool,
152        );
153
154        /// A Boolean value indicating whether Fullscreen API is enabled.
155        ///
156        /// The default value is NO. We can set it to YES to enable support for the fullscreen API.
157        #[unsafe(method(isElementFullscreenEnabled))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn isElementFullscreenEnabled(&self) -> bool;
160
161        /// Setter for [`isElementFullscreenEnabled`][Self::isElementFullscreenEnabled].
162        #[unsafe(method(setElementFullscreenEnabled:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn setElementFullscreenEnabled(&self, element_fullscreen_enabled: bool);
165
166        /// Specify the scheduling policy for the web view when it is inactive
167        /// and detached from the view hierarchy. Web views are not considered idle when playing media or loading web pages.
168        /// A suspended web view will pause JavaScript execution and page layout.
169        #[unsafe(method(inactiveSchedulingPolicy))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn inactiveSchedulingPolicy(&self) -> WKInactiveSchedulingPolicy;
172
173        /// Setter for [`inactiveSchedulingPolicy`][Self::inactiveSchedulingPolicy].
174        #[unsafe(method(setInactiveSchedulingPolicy:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn setInactiveSchedulingPolicy(
177            &self,
178            inactive_scheduling_policy: WKInactiveSchedulingPolicy,
179        );
180    );
181}
182
183/// Methods declared on superclass `NSObject`.
184impl WKPreferences {
185    extern_methods!(
186        #[unsafe(method(init))]
187        #[unsafe(method_family = init)]
188        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
189
190        #[unsafe(method(new))]
191        #[unsafe(method_family = new)]
192        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
193    );
194}
195
196/// WKDeprecated.
197impl WKPreferences {
198    extern_methods!(
199        #[deprecated = "Java is no longer supported"]
200        #[unsafe(method(javaEnabled))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn javaEnabled(&self) -> bool;
203
204        /// Setter for [`javaEnabled`][Self::javaEnabled].
205        #[deprecated = "Java is no longer supported"]
206        #[unsafe(method(setJavaEnabled:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn setJavaEnabled(&self, java_enabled: bool);
209
210        #[deprecated = "Plug-ins are no longer supported"]
211        #[unsafe(method(plugInsEnabled))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn plugInsEnabled(&self) -> bool;
214
215        /// Setter for [`plugInsEnabled`][Self::plugInsEnabled].
216        #[deprecated = "Plug-ins are no longer supported"]
217        #[unsafe(method(setPlugInsEnabled:))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn setPlugInsEnabled(&self, plug_ins_enabled: bool);
220
221        #[deprecated = "Use WKWebpagePreferences.allowsContentJavaScript to disable content JavaScript on a per-navigation basis"]
222        #[unsafe(method(javaScriptEnabled))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn javaScriptEnabled(&self) -> bool;
225
226        /// Setter for [`javaScriptEnabled`][Self::javaScriptEnabled].
227        #[deprecated = "Use WKWebpagePreferences.allowsContentJavaScript to disable content JavaScript on a per-navigation basis"]
228        #[unsafe(method(setJavaScriptEnabled:))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn setJavaScriptEnabled(&self, java_script_enabled: bool);
231
232        /// A Boolean value indicating whether LookToScroll is enabled.
233        ///
234        /// The default value is `NO`.
235        #[unsafe(method(isLookToScrollEnabled))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn isLookToScrollEnabled(&self) -> bool;
238
239        /// Setter for [`isLookToScrollEnabled`][Self::isLookToScrollEnabled].
240        #[unsafe(method(setIsLookToScrollEnabled:))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn setIsLookToScrollEnabled(&self, is_look_to_scroll_enabled: bool);
243    );
244}