objc2_web_kit/generated/
WKPreferences.rs1use 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#[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 #[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 #[unsafe(method(minimumFontSize))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn minimumFontSize(&self) -> CGFloat;
67
68 #[cfg(feature = "objc2-core-foundation")]
69 #[unsafe(method(setMinimumFontSize:))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn setMinimumFontSize(&self, minimum_font_size: CGFloat);
73
74 #[unsafe(method(javaScriptCanOpenWindowsAutomatically))]
79 #[unsafe(method_family = none)]
80 pub unsafe fn javaScriptCanOpenWindowsAutomatically(&self) -> bool;
81
82 #[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 #[unsafe(method(isFraudulentWebsiteWarningEnabled))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn isFraudulentWebsiteWarningEnabled(&self) -> bool;
97
98 #[unsafe(method(setFraudulentWebsiteWarningEnabled:))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn setFraudulentWebsiteWarningEnabled(
102 &self,
103 fraudulent_website_warning_enabled: bool,
104 );
105
106 #[unsafe(method(shouldPrintBackgrounds))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn shouldPrintBackgrounds(&self) -> bool;
112
113 #[unsafe(method(setShouldPrintBackgrounds:))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn setShouldPrintBackgrounds(&self, should_print_backgrounds: bool);
117
118 #[unsafe(method(tabFocusesLinks))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn tabFocusesLinks(&self) -> bool;
123
124 #[unsafe(method(setTabFocusesLinks:))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn setTabFocusesLinks(&self, tab_focuses_links: bool);
128
129 #[unsafe(method(isTextInteractionEnabled))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn isTextInteractionEnabled(&self) -> bool;
133
134 #[unsafe(method(setTextInteractionEnabled:))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn setTextInteractionEnabled(&self, text_interaction_enabled: bool);
138
139 #[unsafe(method(isSiteSpecificQuirksModeEnabled))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn isSiteSpecificQuirksModeEnabled(&self) -> bool;
145
146 #[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 #[unsafe(method(isElementFullscreenEnabled))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn isElementFullscreenEnabled(&self) -> bool;
160
161 #[unsafe(method(setElementFullscreenEnabled:))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn setElementFullscreenEnabled(&self, element_fullscreen_enabled: bool);
165
166 #[unsafe(method(inactiveSchedulingPolicy))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn inactiveSchedulingPolicy(&self) -> WKInactiveSchedulingPolicy;
172
173 #[unsafe(method(setInactiveSchedulingPolicy:))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn setInactiveSchedulingPolicy(
177 &self,
178 inactive_scheduling_policy: WKInactiveSchedulingPolicy,
179 );
180 );
181}
182
183impl 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
196impl 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 #[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 #[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 #[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 #[unsafe(method(isLookToScrollEnabled))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn isLookToScrollEnabled(&self) -> bool;
238
239 #[unsafe(method(setIsLookToScrollEnabled:))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn setIsLookToScrollEnabled(&self, is_look_to_scroll_enabled: bool);
243 );
244}