1use core::ffi::*;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-app-kit")]
6#[cfg(target_os = "macos")]
7use objc2_app_kit::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12#[deprecated]
15#[repr(transparent)]
16#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
17pub struct WebViewInsertAction(pub NSInteger);
18impl WebViewInsertAction {
19 #[deprecated]
20 #[doc(alias = "WebViewInsertActionTyped")]
21 pub const Typed: Self = Self(0);
22 #[deprecated]
23 #[doc(alias = "WebViewInsertActionPasted")]
24 pub const Pasted: Self = Self(1);
25 #[deprecated]
26 #[doc(alias = "WebViewInsertActionDropped")]
27 pub const Dropped: Self = Self(2);
28}
29
30unsafe impl Encode for WebViewInsertAction {
31 const ENCODING: Encoding = NSInteger::ENCODING;
32}
33
34unsafe impl RefEncode for WebViewInsertAction {
35 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
36}
37
38extern_protocol!(
39 #[deprecated]
41 pub unsafe trait WebEditingDelegate: NSObjectProtocol {
42 #[cfg(all(
43 feature = "DOMObject",
44 feature = "DOMRange",
45 feature = "WebScriptObject",
46 feature = "WebView",
47 feature = "objc2-app-kit"
48 ))]
49 #[cfg(target_os = "macos")]
50 #[deprecated]
51 #[optional]
52 #[unsafe(method(webView:shouldBeginEditingInDOMRange:))]
53 #[unsafe(method_family = none)]
54 unsafe fn webView_shouldBeginEditingInDOMRange(
55 &self,
56 web_view: Option<&WebView>,
57 range: Option<&DOMRange>,
58 ) -> bool;
59
60 #[cfg(all(
61 feature = "DOMObject",
62 feature = "DOMRange",
63 feature = "WebScriptObject",
64 feature = "WebView",
65 feature = "objc2-app-kit"
66 ))]
67 #[cfg(target_os = "macos")]
68 #[deprecated]
69 #[optional]
70 #[unsafe(method(webView:shouldEndEditingInDOMRange:))]
71 #[unsafe(method_family = none)]
72 unsafe fn webView_shouldEndEditingInDOMRange(
73 &self,
74 web_view: Option<&WebView>,
75 range: Option<&DOMRange>,
76 ) -> bool;
77
78 #[cfg(all(
79 feature = "DOMNode",
80 feature = "DOMObject",
81 feature = "DOMRange",
82 feature = "WebScriptObject",
83 feature = "WebView",
84 feature = "objc2-app-kit"
85 ))]
86 #[cfg(target_os = "macos")]
87 #[deprecated]
88 #[optional]
89 #[unsafe(method(webView:shouldInsertNode:replacingDOMRange:givenAction:))]
90 #[unsafe(method_family = none)]
91 unsafe fn webView_shouldInsertNode_replacingDOMRange_givenAction(
92 &self,
93 web_view: Option<&WebView>,
94 node: Option<&DOMNode>,
95 range: Option<&DOMRange>,
96 action: WebViewInsertAction,
97 ) -> bool;
98
99 #[cfg(all(
100 feature = "DOMObject",
101 feature = "DOMRange",
102 feature = "WebScriptObject",
103 feature = "WebView",
104 feature = "objc2-app-kit"
105 ))]
106 #[cfg(target_os = "macos")]
107 #[deprecated]
108 #[optional]
109 #[unsafe(method(webView:shouldInsertText:replacingDOMRange:givenAction:))]
110 #[unsafe(method_family = none)]
111 unsafe fn webView_shouldInsertText_replacingDOMRange_givenAction(
112 &self,
113 web_view: Option<&WebView>,
114 text: Option<&NSString>,
115 range: Option<&DOMRange>,
116 action: WebViewInsertAction,
117 ) -> bool;
118
119 #[cfg(all(
120 feature = "DOMObject",
121 feature = "DOMRange",
122 feature = "WebScriptObject",
123 feature = "WebView",
124 feature = "objc2-app-kit"
125 ))]
126 #[cfg(target_os = "macos")]
127 #[deprecated]
128 #[optional]
129 #[unsafe(method(webView:shouldDeleteDOMRange:))]
130 #[unsafe(method_family = none)]
131 unsafe fn webView_shouldDeleteDOMRange(
132 &self,
133 web_view: Option<&WebView>,
134 range: Option<&DOMRange>,
135 ) -> bool;
136
137 #[cfg(all(
138 feature = "DOMObject",
139 feature = "DOMRange",
140 feature = "WebScriptObject",
141 feature = "WebView",
142 feature = "objc2-app-kit"
143 ))]
144 #[cfg(target_os = "macos")]
145 #[deprecated]
146 #[optional]
147 #[unsafe(method(webView:shouldChangeSelectedDOMRange:toDOMRange:affinity:stillSelecting:))]
148 #[unsafe(method_family = none)]
149 unsafe fn webView_shouldChangeSelectedDOMRange_toDOMRange_affinity_stillSelecting(
150 &self,
151 web_view: Option<&WebView>,
152 current_range: Option<&DOMRange>,
153 proposed_range: Option<&DOMRange>,
154 selection_affinity: NSSelectionAffinity,
155 flag: bool,
156 ) -> bool;
157
158 #[cfg(all(
159 feature = "DOMCSSStyleDeclaration",
160 feature = "DOMObject",
161 feature = "DOMRange",
162 feature = "WebScriptObject",
163 feature = "WebView",
164 feature = "objc2-app-kit"
165 ))]
166 #[cfg(target_os = "macos")]
167 #[deprecated]
168 #[optional]
169 #[unsafe(method(webView:shouldApplyStyle:toElementsInDOMRange:))]
170 #[unsafe(method_family = none)]
171 unsafe fn webView_shouldApplyStyle_toElementsInDOMRange(
172 &self,
173 web_view: Option<&WebView>,
174 style: Option<&DOMCSSStyleDeclaration>,
175 range: Option<&DOMRange>,
176 ) -> bool;
177
178 #[cfg(all(
179 feature = "DOMCSSStyleDeclaration",
180 feature = "DOMObject",
181 feature = "WebScriptObject",
182 feature = "WebView",
183 feature = "objc2-app-kit"
184 ))]
185 #[cfg(target_os = "macos")]
186 #[deprecated]
187 #[optional]
188 #[unsafe(method(webView:shouldChangeTypingStyle:toStyle:))]
189 #[unsafe(method_family = none)]
190 unsafe fn webView_shouldChangeTypingStyle_toStyle(
191 &self,
192 web_view: Option<&WebView>,
193 current_style: Option<&DOMCSSStyleDeclaration>,
194 proposed_style: Option<&DOMCSSStyleDeclaration>,
195 ) -> bool;
196
197 #[cfg(all(feature = "WebView", feature = "objc2-app-kit"))]
198 #[cfg(target_os = "macos")]
199 #[deprecated]
200 #[optional]
201 #[unsafe(method(webView:doCommandBySelector:))]
202 #[unsafe(method_family = none)]
203 unsafe fn webView_doCommandBySelector(
204 &self,
205 web_view: Option<&WebView>,
206 selector: Option<Sel>,
207 ) -> bool;
208
209 #[deprecated]
210 #[optional]
211 #[unsafe(method(webViewDidBeginEditing:))]
212 #[unsafe(method_family = none)]
213 unsafe fn webViewDidBeginEditing(&self, notification: Option<&NSNotification>);
214
215 #[deprecated]
216 #[optional]
217 #[unsafe(method(webViewDidChange:))]
218 #[unsafe(method_family = none)]
219 unsafe fn webViewDidChange(&self, notification: Option<&NSNotification>);
220
221 #[deprecated]
222 #[optional]
223 #[unsafe(method(webViewDidEndEditing:))]
224 #[unsafe(method_family = none)]
225 unsafe fn webViewDidEndEditing(&self, notification: Option<&NSNotification>);
226
227 #[deprecated]
228 #[optional]
229 #[unsafe(method(webViewDidChangeTypingStyle:))]
230 #[unsafe(method_family = none)]
231 unsafe fn webViewDidChangeTypingStyle(&self, notification: Option<&NSNotification>);
232
233 #[deprecated]
234 #[optional]
235 #[unsafe(method(webViewDidChangeSelection:))]
236 #[unsafe(method_family = none)]
237 unsafe fn webViewDidChangeSelection(&self, notification: Option<&NSNotification>);
238
239 #[cfg(all(feature = "WebView", feature = "objc2-app-kit"))]
240 #[cfg(target_os = "macos")]
241 #[deprecated]
242 #[optional]
243 #[unsafe(method(undoManagerForWebView:))]
244 #[unsafe(method_family = none)]
245 unsafe fn undoManagerForWebView(
246 &self,
247 web_view: Option<&WebView>,
248 ) -> Option<Retained<NSUndoManager>>;
249 }
250);