1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKInactiveSchedulingPolicy(pub NSInteger);
impl WKInactiveSchedulingPolicy {
    #[doc(alias = "WKInactiveSchedulingPolicySuspend")]
    pub const Suspend: Self = Self(0);
    #[doc(alias = "WKInactiveSchedulingPolicyThrottle")]
    pub const Throttle: Self = Self(1);
    #[doc(alias = "WKInactiveSchedulingPolicyNone")]
    pub const None: Self = Self(2);
}

unsafe impl Encode for WKInactiveSchedulingPolicy {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for WKInactiveSchedulingPolicy {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct WKPreferences;

    unsafe impl ClassType for WKPreferences {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSCoding for WKPreferences {}

unsafe impl NSObjectProtocol for WKPreferences {}

unsafe impl NSSecureCoding for WKPreferences {}

extern_methods!(
    unsafe impl WKPreferences {
        #[method(minimumFontSize)]
        pub unsafe fn minimumFontSize(&self) -> CGFloat;

        #[method(setMinimumFontSize:)]
        pub unsafe fn setMinimumFontSize(&self, minimum_font_size: CGFloat);

        #[method(javaScriptCanOpenWindowsAutomatically)]
        pub unsafe fn javaScriptCanOpenWindowsAutomatically(&self) -> bool;

        #[method(setJavaScriptCanOpenWindowsAutomatically:)]
        pub unsafe fn setJavaScriptCanOpenWindowsAutomatically(
            &self,
            java_script_can_open_windows_automatically: bool,
        );

        #[method(isFraudulentWebsiteWarningEnabled)]
        pub unsafe fn isFraudulentWebsiteWarningEnabled(&self) -> bool;

        #[method(setFraudulentWebsiteWarningEnabled:)]
        pub unsafe fn setFraudulentWebsiteWarningEnabled(
            &self,
            fraudulent_website_warning_enabled: bool,
        );

        #[method(shouldPrintBackgrounds)]
        pub unsafe fn shouldPrintBackgrounds(&self) -> bool;

        #[method(setShouldPrintBackgrounds:)]
        pub unsafe fn setShouldPrintBackgrounds(&self, should_print_backgrounds: bool);

        #[method(tabFocusesLinks)]
        pub unsafe fn tabFocusesLinks(&self) -> bool;

        #[method(setTabFocusesLinks:)]
        pub unsafe fn setTabFocusesLinks(&self, tab_focuses_links: bool);

        #[method(isTextInteractionEnabled)]
        pub unsafe fn isTextInteractionEnabled(&self) -> bool;

        #[method(setTextInteractionEnabled:)]
        pub unsafe fn setTextInteractionEnabled(&self, text_interaction_enabled: bool);

        #[method(isSiteSpecificQuirksModeEnabled)]
        pub unsafe fn isSiteSpecificQuirksModeEnabled(&self) -> bool;

        #[method(setSiteSpecificQuirksModeEnabled:)]
        pub unsafe fn setSiteSpecificQuirksModeEnabled(
            &self,
            site_specific_quirks_mode_enabled: bool,
        );

        #[method(isElementFullscreenEnabled)]
        pub unsafe fn isElementFullscreenEnabled(&self) -> bool;

        #[method(setElementFullscreenEnabled:)]
        pub unsafe fn setElementFullscreenEnabled(&self, element_fullscreen_enabled: bool);

        #[method(inactiveSchedulingPolicy)]
        pub unsafe fn inactiveSchedulingPolicy(&self) -> WKInactiveSchedulingPolicy;

        #[method(setInactiveSchedulingPolicy:)]
        pub unsafe fn setInactiveSchedulingPolicy(
            &self,
            inactive_scheduling_policy: WKInactiveSchedulingPolicy,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl WKPreferences {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

extern_methods!(
    /// WKDeprecated
    unsafe impl WKPreferences {
        #[deprecated = "Java is no longer supported"]
        #[method(javaEnabled)]
        pub unsafe fn javaEnabled(&self) -> bool;

        #[deprecated = "Java is no longer supported"]
        #[method(setJavaEnabled:)]
        pub unsafe fn setJavaEnabled(&self, java_enabled: bool);

        #[deprecated = "Plug-ins are no longer supported"]
        #[method(plugInsEnabled)]
        pub unsafe fn plugInsEnabled(&self) -> bool;

        #[deprecated = "Plug-ins are no longer supported"]
        #[method(setPlugInsEnabled:)]
        pub unsafe fn setPlugInsEnabled(&self, plug_ins_enabled: bool);

        #[deprecated = "Use WKWebpagePreferences.allowsContentJavaScript to disable content JavaScript on a per-navigation basis"]
        #[method(javaScriptEnabled)]
        pub unsafe fn javaScriptEnabled(&self) -> bool;

        #[deprecated = "Use WKWebpagePreferences.allowsContentJavaScript to disable content JavaScript on a per-navigation basis"]
        #[method(setJavaScriptEnabled:)]
        pub unsafe fn setJavaScriptEnabled(&self, java_script_enabled: bool);
    }
);