objc2_web_kit/generated/
WebDocument.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
12extern_protocol!(
13    /// Protocol implemented by the document view of WebFrameView
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webdocumentview?language=objc)
16    #[deprecated]
17    pub unsafe trait WebDocumentView: NSObjectProtocol {
18        #[cfg(feature = "WebDataSource")]
19        /// Called when the corresponding data source has been created.
20        ///
21        /// Parameter `dataSource`: The corresponding data source.
22        ///
23        /// # Safety
24        ///
25        /// `data_source` might not allow `None`.
26        #[deprecated]
27        #[unsafe(method(setDataSource:))]
28        #[unsafe(method_family = none)]
29        unsafe fn setDataSource(&self, data_source: Option<&WebDataSource>);
30
31        #[cfg(feature = "WebDataSource")]
32        /// Called when the corresponding data source has received data.
33        ///
34        /// Parameter `dataSource`: The corresponding data source.
35        ///
36        /// # Safety
37        ///
38        /// `data_source` might not allow `None`.
39        #[deprecated]
40        #[unsafe(method(dataSourceUpdated:))]
41        #[unsafe(method_family = none)]
42        unsafe fn dataSourceUpdated(&self, data_source: Option<&WebDataSource>);
43
44        /// Called when WebKit has determined that the document view needs to layout.
45        /// This method should simply set a flag and call layout from drawRect if the flag is YES.
46        ///
47        /// Parameter `flag`: YES to cause a layout, no to not cause a layout.
48        #[deprecated]
49        #[unsafe(method(setNeedsLayout:))]
50        #[unsafe(method_family = none)]
51        unsafe fn setNeedsLayout(&self, flag: bool);
52
53        /// Called when the document view must immediately layout. For simple views,
54        /// setting the frame is a sufficient implementation of this method.
55        #[deprecated]
56        #[unsafe(method(layout))]
57        #[unsafe(method_family = none)]
58        unsafe fn layout(&self);
59
60        #[cfg(feature = "objc2-app-kit")]
61        #[cfg(target_os = "macos")]
62        /// Parameter `hostWindow`: The host window for the document view.
63        ///
64        /// Called before the host window is set on the parent web view.
65        ///
66        /// # Safety
67        ///
68        /// `host_window` might not allow `None`.
69        #[deprecated]
70        #[unsafe(method(viewWillMoveToHostWindow:))]
71        #[unsafe(method_family = none)]
72        unsafe fn viewWillMoveToHostWindow(&self, host_window: Option<&NSWindow>);
73
74        /// Called after the host window is set on the parent web view.
75        #[deprecated]
76        #[unsafe(method(viewDidMoveToHostWindow))]
77        #[unsafe(method_family = none)]
78        unsafe fn viewDidMoveToHostWindow(&self);
79    }
80);
81
82extern_protocol!(
83    /// Optional protocol for searching document view of WebFrameView.
84    ///
85    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webdocumentsearching?language=objc)
86    #[deprecated]
87    pub unsafe trait WebDocumentSearching: NSObjectProtocol {
88        /// Searches a document view for a string and highlights the string if it is found.
89        ///
90        /// Parameter `string`: The string to search for.
91        ///
92        /// Parameter `forward`: YES to search forward, NO to seach backwards.
93        ///
94        /// Parameter `caseFlag`: YES to for case-sensitive search, NO for case-insensitive search.
95        ///
96        /// Parameter `wrapFlag`: YES to wrap around, NO to avoid wrapping.
97        ///
98        /// Returns: YES if found, NO if not found.
99        ///
100        /// # Safety
101        ///
102        /// `string` might not allow `None`.
103        #[deprecated]
104        #[unsafe(method(searchFor:direction:caseSensitive:wrap:))]
105        #[unsafe(method_family = none)]
106        unsafe fn searchFor_direction_caseSensitive_wrap(
107            &self,
108            string: Option<&NSString>,
109            forward: bool,
110            case_flag: bool,
111            wrap_flag: bool,
112        ) -> bool;
113    }
114);
115
116extern_protocol!(
117    /// Optional protocol for supporting text operations.
118    ///
119    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webdocumenttext?language=objc)
120    #[deprecated]
121    pub unsafe trait WebDocumentText: NSObjectProtocol {
122        /// Returns: YES if the document view support text encoding, NO if it doesn't.
123        #[deprecated]
124        #[unsafe(method(supportsTextEncoding))]
125        #[unsafe(method_family = none)]
126        unsafe fn supportsTextEncoding(&self) -> bool;
127
128        /// Returns: String that represents the entire document.
129        #[deprecated]
130        #[unsafe(method(string))]
131        #[unsafe(method_family = none)]
132        unsafe fn string(&self) -> Option<Retained<NSString>>;
133
134        /// Returns: Attributed string that represents the entire document.
135        #[deprecated]
136        #[unsafe(method(attributedString))]
137        #[unsafe(method_family = none)]
138        unsafe fn attributedString(&self) -> Option<Retained<NSAttributedString>>;
139
140        /// Returns: String that represents the current selection.
141        #[deprecated]
142        #[unsafe(method(selectedString))]
143        #[unsafe(method_family = none)]
144        unsafe fn selectedString(&self) -> Option<Retained<NSString>>;
145
146        /// Returns: Attributed string that represents the current selection.
147        #[deprecated]
148        #[unsafe(method(selectedAttributedString))]
149        #[unsafe(method_family = none)]
150        unsafe fn selectedAttributedString(&self) -> Option<Retained<NSAttributedString>>;
151
152        /// Selects all the text in the document.
153        #[deprecated]
154        #[unsafe(method(selectAll))]
155        #[unsafe(method_family = none)]
156        unsafe fn selectAll(&self);
157
158        /// Causes a text selection to lose its selection.
159        #[deprecated]
160        #[unsafe(method(deselectAll))]
161        #[unsafe(method_family = none)]
162        unsafe fn deselectAll(&self);
163    }
164);
165
166extern_protocol!(
167    /// Protocol implemented by the document representation of a data source.
168    ///
169    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webdocumentrepresentation?language=objc)
170    #[deprecated]
171    pub unsafe trait WebDocumentRepresentation: NSObjectProtocol {
172        #[cfg(feature = "WebDataSource")]
173        /// Called soon after the document representation is created.
174        ///
175        /// Parameter `dataSource`: The data source that is set.
176        ///
177        /// # Safety
178        ///
179        /// `data_source` might not allow `None`.
180        #[deprecated]
181        #[unsafe(method(setDataSource:))]
182        #[unsafe(method_family = none)]
183        unsafe fn setDataSource(&self, data_source: Option<&WebDataSource>);
184
185        #[cfg(feature = "WebDataSource")]
186        /// Called when the data source has received data.
187        ///
188        /// Parameter `data`: The data that the data source has received.
189        ///
190        /// Parameter `dataSource`: The data source that has received data.
191        ///
192        /// # Safety
193        ///
194        /// - `data` might not allow `None`.
195        /// - `data_source` might not allow `None`.
196        #[deprecated]
197        #[unsafe(method(receivedData:withDataSource:))]
198        #[unsafe(method_family = none)]
199        unsafe fn receivedData_withDataSource(
200            &self,
201            data: Option<&NSData>,
202            data_source: Option<&WebDataSource>,
203        );
204
205        #[cfg(feature = "WebDataSource")]
206        /// Called when the data source has received an error.
207        ///
208        /// Parameter `error`: The error that the data source has received.
209        ///
210        /// Parameter `dataSource`: The data source that has received the error.
211        ///
212        /// # Safety
213        ///
214        /// - `error` might not allow `None`.
215        /// - `data_source` might not allow `None`.
216        #[deprecated]
217        #[unsafe(method(receivedError:withDataSource:))]
218        #[unsafe(method_family = none)]
219        unsafe fn receivedError_withDataSource(
220            &self,
221            error: Option<&NSError>,
222            data_source: Option<&WebDataSource>,
223        );
224
225        #[cfg(feature = "WebDataSource")]
226        /// Called when the data source has finished loading.
227        ///
228        /// Parameter `dataSource`: The datasource that has finished loading.
229        ///
230        /// # Safety
231        ///
232        /// `data_source` might not allow `None`.
233        #[deprecated]
234        #[unsafe(method(finishedLoadingWithDataSource:))]
235        #[unsafe(method_family = none)]
236        unsafe fn finishedLoadingWithDataSource(&self, data_source: Option<&WebDataSource>);
237
238        /// Returns: Returns true if the representation can provide document source.
239        #[deprecated]
240        #[unsafe(method(canProvideDocumentSource))]
241        #[unsafe(method_family = none)]
242        unsafe fn canProvideDocumentSource(&self) -> bool;
243
244        /// Returns: Returns the textual source representation of the document.  For HTML documents
245        /// this is the original HTML source.
246        #[deprecated]
247        #[unsafe(method(documentSource))]
248        #[unsafe(method_family = none)]
249        unsafe fn documentSource(&self) -> Option<Retained<NSString>>;
250
251        /// Returns: Return the title for the document.
252        #[deprecated]
253        #[unsafe(method(title))]
254        #[unsafe(method_family = none)]
255        unsafe fn title(&self) -> Option<Retained<NSString>>;
256    }
257);