objc2_web_kit/generated/
WebEditingDelegate.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use 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/// [Apple's documentation](https://developer.apple.com/documentation/webkit/webviewinsertaction?language=objc)
13// NS_ENUM
14#[deprecated]
15#[repr(transparent)]
16#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
17pub struct WebViewInsertAction(pub NSInteger);
18impl WebViewInsertAction {
19    #[doc(alias = "WebViewInsertActionTyped")]
20    #[deprecated]
21    pub const Typed: Self = Self(0);
22    #[doc(alias = "WebViewInsertActionPasted")]
23    #[deprecated]
24    pub const Pasted: Self = Self(1);
25    #[doc(alias = "WebViewInsertActionDropped")]
26    #[deprecated]
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    /// [Apple's documentation](https://developer.apple.com/documentation/webkit/webeditingdelegate?language=objc)
40    #[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        /// # Safety
51        ///
52        /// - `web_view` might not allow `None`.
53        /// - `range` might not allow `None`.
54        #[deprecated]
55        #[optional]
56        #[unsafe(method(webView:shouldBeginEditingInDOMRange:))]
57        #[unsafe(method_family = none)]
58        unsafe fn webView_shouldBeginEditingInDOMRange(
59            &self,
60            web_view: Option<&WebView>,
61            range: Option<&DOMRange>,
62        ) -> bool;
63
64        #[cfg(all(
65            feature = "DOMObject",
66            feature = "DOMRange",
67            feature = "WebScriptObject",
68            feature = "WebView",
69            feature = "objc2-app-kit"
70        ))]
71        #[cfg(target_os = "macos")]
72        /// # Safety
73        ///
74        /// - `web_view` might not allow `None`.
75        /// - `range` might not allow `None`.
76        #[deprecated]
77        #[optional]
78        #[unsafe(method(webView:shouldEndEditingInDOMRange:))]
79        #[unsafe(method_family = none)]
80        unsafe fn webView_shouldEndEditingInDOMRange(
81            &self,
82            web_view: Option<&WebView>,
83            range: Option<&DOMRange>,
84        ) -> bool;
85
86        #[cfg(all(
87            feature = "DOMNode",
88            feature = "DOMObject",
89            feature = "DOMRange",
90            feature = "WebScriptObject",
91            feature = "WebView",
92            feature = "objc2-app-kit"
93        ))]
94        #[cfg(target_os = "macos")]
95        /// # Safety
96        ///
97        /// - `web_view` might not allow `None`.
98        /// - `node` might not allow `None`.
99        /// - `range` might not allow `None`.
100        #[deprecated]
101        #[optional]
102        #[unsafe(method(webView:shouldInsertNode:replacingDOMRange:givenAction:))]
103        #[unsafe(method_family = none)]
104        unsafe fn webView_shouldInsertNode_replacingDOMRange_givenAction(
105            &self,
106            web_view: Option<&WebView>,
107            node: Option<&DOMNode>,
108            range: Option<&DOMRange>,
109            action: WebViewInsertAction,
110        ) -> bool;
111
112        #[cfg(all(
113            feature = "DOMObject",
114            feature = "DOMRange",
115            feature = "WebScriptObject",
116            feature = "WebView",
117            feature = "objc2-app-kit"
118        ))]
119        #[cfg(target_os = "macos")]
120        /// # Safety
121        ///
122        /// - `web_view` might not allow `None`.
123        /// - `text` might not allow `None`.
124        /// - `range` might not allow `None`.
125        #[deprecated]
126        #[optional]
127        #[unsafe(method(webView:shouldInsertText:replacingDOMRange:givenAction:))]
128        #[unsafe(method_family = none)]
129        unsafe fn webView_shouldInsertText_replacingDOMRange_givenAction(
130            &self,
131            web_view: Option<&WebView>,
132            text: Option<&NSString>,
133            range: Option<&DOMRange>,
134            action: WebViewInsertAction,
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        /// # Safety
146        ///
147        /// - `web_view` might not allow `None`.
148        /// - `range` might not allow `None`.
149        #[deprecated]
150        #[optional]
151        #[unsafe(method(webView:shouldDeleteDOMRange:))]
152        #[unsafe(method_family = none)]
153        unsafe fn webView_shouldDeleteDOMRange(
154            &self,
155            web_view: Option<&WebView>,
156            range: Option<&DOMRange>,
157        ) -> bool;
158
159        #[cfg(all(
160            feature = "DOMObject",
161            feature = "DOMRange",
162            feature = "WebScriptObject",
163            feature = "WebView",
164            feature = "objc2-app-kit"
165        ))]
166        #[cfg(target_os = "macos")]
167        /// # Safety
168        ///
169        /// - `web_view` might not allow `None`.
170        /// - `current_range` might not allow `None`.
171        /// - `proposed_range` might not allow `None`.
172        #[deprecated]
173        #[optional]
174        #[unsafe(method(webView:shouldChangeSelectedDOMRange:toDOMRange:affinity:stillSelecting:))]
175        #[unsafe(method_family = none)]
176        unsafe fn webView_shouldChangeSelectedDOMRange_toDOMRange_affinity_stillSelecting(
177            &self,
178            web_view: Option<&WebView>,
179            current_range: Option<&DOMRange>,
180            proposed_range: Option<&DOMRange>,
181            selection_affinity: NSSelectionAffinity,
182            flag: bool,
183        ) -> bool;
184
185        #[cfg(all(
186            feature = "DOMCSSStyleDeclaration",
187            feature = "DOMObject",
188            feature = "DOMRange",
189            feature = "WebScriptObject",
190            feature = "WebView",
191            feature = "objc2-app-kit"
192        ))]
193        #[cfg(target_os = "macos")]
194        /// # Safety
195        ///
196        /// - `web_view` might not allow `None`.
197        /// - `style` might not allow `None`.
198        /// - `range` might not allow `None`.
199        #[deprecated]
200        #[optional]
201        #[unsafe(method(webView:shouldApplyStyle:toElementsInDOMRange:))]
202        #[unsafe(method_family = none)]
203        unsafe fn webView_shouldApplyStyle_toElementsInDOMRange(
204            &self,
205            web_view: Option<&WebView>,
206            style: Option<&DOMCSSStyleDeclaration>,
207            range: Option<&DOMRange>,
208        ) -> bool;
209
210        #[cfg(all(
211            feature = "DOMCSSStyleDeclaration",
212            feature = "DOMObject",
213            feature = "WebScriptObject",
214            feature = "WebView",
215            feature = "objc2-app-kit"
216        ))]
217        #[cfg(target_os = "macos")]
218        /// # Safety
219        ///
220        /// - `web_view` might not allow `None`.
221        /// - `current_style` might not allow `None`.
222        /// - `proposed_style` might not allow `None`.
223        #[deprecated]
224        #[optional]
225        #[unsafe(method(webView:shouldChangeTypingStyle:toStyle:))]
226        #[unsafe(method_family = none)]
227        unsafe fn webView_shouldChangeTypingStyle_toStyle(
228            &self,
229            web_view: Option<&WebView>,
230            current_style: Option<&DOMCSSStyleDeclaration>,
231            proposed_style: Option<&DOMCSSStyleDeclaration>,
232        ) -> bool;
233
234        #[cfg(all(feature = "WebView", feature = "objc2-app-kit"))]
235        #[cfg(target_os = "macos")]
236        /// # Safety
237        ///
238        /// - `web_view` might not allow `None`.
239        /// - `selector` must be a valid selector.
240        #[deprecated]
241        #[optional]
242        #[unsafe(method(webView:doCommandBySelector:))]
243        #[unsafe(method_family = none)]
244        unsafe fn webView_doCommandBySelector(
245            &self,
246            web_view: Option<&WebView>,
247            selector: Option<Sel>,
248        ) -> bool;
249
250        /// # Safety
251        ///
252        /// `notification` might not allow `None`.
253        #[deprecated]
254        #[optional]
255        #[unsafe(method(webViewDidBeginEditing:))]
256        #[unsafe(method_family = none)]
257        unsafe fn webViewDidBeginEditing(&self, notification: Option<&NSNotification>);
258
259        /// # Safety
260        ///
261        /// `notification` might not allow `None`.
262        #[deprecated]
263        #[optional]
264        #[unsafe(method(webViewDidChange:))]
265        #[unsafe(method_family = none)]
266        unsafe fn webViewDidChange(&self, notification: Option<&NSNotification>);
267
268        /// # Safety
269        ///
270        /// `notification` might not allow `None`.
271        #[deprecated]
272        #[optional]
273        #[unsafe(method(webViewDidEndEditing:))]
274        #[unsafe(method_family = none)]
275        unsafe fn webViewDidEndEditing(&self, notification: Option<&NSNotification>);
276
277        /// # Safety
278        ///
279        /// `notification` might not allow `None`.
280        #[deprecated]
281        #[optional]
282        #[unsafe(method(webViewDidChangeTypingStyle:))]
283        #[unsafe(method_family = none)]
284        unsafe fn webViewDidChangeTypingStyle(&self, notification: Option<&NSNotification>);
285
286        /// # Safety
287        ///
288        /// `notification` might not allow `None`.
289        #[deprecated]
290        #[optional]
291        #[unsafe(method(webViewDidChangeSelection:))]
292        #[unsafe(method_family = none)]
293        unsafe fn webViewDidChangeSelection(&self, notification: Option<&NSNotification>);
294
295        #[cfg(all(feature = "WebView", feature = "objc2-app-kit"))]
296        #[cfg(target_os = "macos")]
297        /// # Safety
298        ///
299        /// `web_view` might not allow `None`.
300        #[deprecated]
301        #[optional]
302        #[unsafe(method(undoManagerForWebView:))]
303        #[unsafe(method_family = none)]
304        unsafe fn undoManagerForWebView(
305            &self,
306            web_view: Option<&WebView>,
307            mtm: MainThreadMarker,
308        ) -> Option<Retained<NSUndoManager>>;
309    }
310);