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
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 #[unsafe(method(minimumFontSize))]
59 #[unsafe(method_family = none)]
60 pub unsafe fn minimumFontSize(&self) -> CGFloat;
61
62 #[cfg(feature = "objc2-core-foundation")]
63 #[unsafe(method(setMinimumFontSize:))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn setMinimumFontSize(&self, minimum_font_size: CGFloat);
67
68 #[unsafe(method(javaScriptCanOpenWindowsAutomatically))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn javaScriptCanOpenWindowsAutomatically(&self) -> bool;
75
76 #[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 #[unsafe(method(isFraudulentWebsiteWarningEnabled))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn isFraudulentWebsiteWarningEnabled(&self) -> bool;
91
92 #[unsafe(method(setFraudulentWebsiteWarningEnabled:))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn setFraudulentWebsiteWarningEnabled(
96 &self,
97 fraudulent_website_warning_enabled: bool,
98 );
99
100 #[unsafe(method(shouldPrintBackgrounds))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn shouldPrintBackgrounds(&self) -> bool;
106
107 #[unsafe(method(setShouldPrintBackgrounds:))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn setShouldPrintBackgrounds(&self, should_print_backgrounds: bool);
111
112 #[unsafe(method(tabFocusesLinks))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn tabFocusesLinks(&self) -> bool;
117
118 #[unsafe(method(setTabFocusesLinks:))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn setTabFocusesLinks(&self, tab_focuses_links: bool);
122
123 #[unsafe(method(isTextInteractionEnabled))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn isTextInteractionEnabled(&self) -> bool;
127
128 #[unsafe(method(setTextInteractionEnabled:))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn setTextInteractionEnabled(&self, text_interaction_enabled: bool);
132
133 #[unsafe(method(isSiteSpecificQuirksModeEnabled))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn isSiteSpecificQuirksModeEnabled(&self) -> bool;
139
140 #[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 #[unsafe(method(isElementFullscreenEnabled))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn isElementFullscreenEnabled(&self) -> bool;
154
155 #[unsafe(method(setElementFullscreenEnabled:))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn setElementFullscreenEnabled(&self, element_fullscreen_enabled: bool);
159
160 #[unsafe(method(inactiveSchedulingPolicy))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn inactiveSchedulingPolicy(&self) -> WKInactiveSchedulingPolicy;
166
167 #[unsafe(method(setInactiveSchedulingPolicy:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn setInactiveSchedulingPolicy(
171 &self,
172 inactive_scheduling_policy: WKInactiveSchedulingPolicy,
173 );
174 );
175}
176
177impl 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
190impl 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 #[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 #[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 #[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}