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