objc2_ui_kit/generated/
UIWebView.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwebviewnavigationtype?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UIWebViewNavigationType(pub NSInteger);
20impl UIWebViewNavigationType {
21    #[doc(alias = "UIWebViewNavigationTypeLinkClicked")]
22    pub const LinkClicked: Self = Self(0);
23    #[doc(alias = "UIWebViewNavigationTypeFormSubmitted")]
24    pub const FormSubmitted: Self = Self(1);
25    #[doc(alias = "UIWebViewNavigationTypeBackForward")]
26    pub const BackForward: Self = Self(2);
27    #[doc(alias = "UIWebViewNavigationTypeReload")]
28    pub const Reload: Self = Self(3);
29    #[doc(alias = "UIWebViewNavigationTypeFormResubmitted")]
30    pub const FormResubmitted: Self = Self(4);
31    #[doc(alias = "UIWebViewNavigationTypeOther")]
32    pub const Other: Self = Self(5);
33}
34
35unsafe impl Encode for UIWebViewNavigationType {
36    const ENCODING: Encoding = NSInteger::ENCODING;
37}
38
39unsafe impl RefEncode for UIWebViewNavigationType {
40    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
41}
42
43/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwebpaginationmode?language=objc)
44// NS_ENUM
45#[repr(transparent)]
46#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
47pub struct UIWebPaginationMode(pub NSInteger);
48impl UIWebPaginationMode {
49    #[doc(alias = "UIWebPaginationModeUnpaginated")]
50    pub const Unpaginated: Self = Self(0);
51    #[doc(alias = "UIWebPaginationModeLeftToRight")]
52    pub const LeftToRight: Self = Self(1);
53    #[doc(alias = "UIWebPaginationModeTopToBottom")]
54    pub const TopToBottom: Self = Self(2);
55    #[doc(alias = "UIWebPaginationModeBottomToTop")]
56    pub const BottomToTop: Self = Self(3);
57    #[doc(alias = "UIWebPaginationModeRightToLeft")]
58    pub const RightToLeft: Self = Self(4);
59}
60
61unsafe impl Encode for UIWebPaginationMode {
62    const ENCODING: Encoding = NSInteger::ENCODING;
63}
64
65unsafe impl RefEncode for UIWebPaginationMode {
66    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
67}
68
69/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwebpaginationbreakingmode?language=objc)
70// NS_ENUM
71#[repr(transparent)]
72#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
73pub struct UIWebPaginationBreakingMode(pub NSInteger);
74impl UIWebPaginationBreakingMode {
75    #[doc(alias = "UIWebPaginationBreakingModePage")]
76    pub const Page: Self = Self(0);
77    #[doc(alias = "UIWebPaginationBreakingModeColumn")]
78    pub const Column: Self = Self(1);
79}
80
81unsafe impl Encode for UIWebPaginationBreakingMode {
82    const ENCODING: Encoding = NSInteger::ENCODING;
83}
84
85unsafe impl RefEncode for UIWebPaginationBreakingMode {
86    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
87}
88
89extern_class!(
90    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwebview?language=objc)
91    #[unsafe(super(UIView, UIResponder, NSObject))]
92    #[thread_kind = MainThreadOnly]
93    #[derive(Debug, PartialEq, Eq, Hash)]
94    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
95    #[deprecated = "No longer supported; please adopt WKWebView."]
96    pub struct UIWebView;
97);
98
99#[cfg(all(
100    feature = "UIResponder",
101    feature = "UIView",
102    feature = "objc2-quartz-core"
103))]
104#[cfg(not(target_os = "watchos"))]
105unsafe impl CALayerDelegate for UIWebView {}
106
107#[cfg(all(feature = "UIResponder", feature = "UIView"))]
108unsafe impl NSCoding for UIWebView {}
109
110#[cfg(all(feature = "UIResponder", feature = "UIView"))]
111unsafe impl NSObjectProtocol for UIWebView {}
112
113#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
114unsafe impl UIAppearance for UIWebView {}
115
116#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
117unsafe impl UIAppearanceContainer for UIWebView {}
118
119#[cfg(all(feature = "UIResponder", feature = "UIView"))]
120unsafe impl UICoordinateSpace for UIWebView {}
121
122#[cfg(all(
123    feature = "UIDynamicBehavior",
124    feature = "UIResponder",
125    feature = "UIView"
126))]
127unsafe impl UIDynamicItem for UIWebView {}
128
129#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
130unsafe impl UIFocusEnvironment for UIWebView {}
131
132#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
133unsafe impl UIFocusItem for UIWebView {}
134
135#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
136unsafe impl UIFocusItemContainer for UIWebView {}
137
138#[cfg(all(feature = "UIResponder", feature = "UIView"))]
139unsafe impl UIResponderStandardEditActions for UIWebView {}
140
141#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
142unsafe impl UIScrollViewDelegate for UIWebView {}
143
144#[cfg(all(
145    feature = "UIResponder",
146    feature = "UITraitCollection",
147    feature = "UIView"
148))]
149unsafe impl UITraitEnvironment for UIWebView {}
150
151#[cfg(all(feature = "UIResponder", feature = "UIView"))]
152impl UIWebView {
153    extern_methods!(
154        #[deprecated = "No longer supported; please adopt WKWebView."]
155        #[unsafe(method(delegate))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIWebViewDelegate>>>;
158
159        /// Setter for [`delegate`][Self::delegate].
160        #[deprecated = "No longer supported; please adopt WKWebView."]
161        #[unsafe(method(setDelegate:))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UIWebViewDelegate>>);
164
165        #[cfg(feature = "UIScrollView")]
166        #[unsafe(method(scrollView))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn scrollView(&self) -> Retained<UIScrollView>;
169
170        #[deprecated = "No longer supported; please adopt WKWebView."]
171        #[unsafe(method(loadRequest:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn loadRequest(&self, request: &NSURLRequest);
174
175        #[deprecated = "No longer supported; please adopt WKWebView."]
176        #[unsafe(method(loadHTMLString:baseURL:))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn loadHTMLString_baseURL(&self, string: &NSString, base_url: Option<&NSURL>);
179
180        #[deprecated = "No longer supported; please adopt WKWebView."]
181        #[unsafe(method(loadData:MIMEType:textEncodingName:baseURL:))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn loadData_MIMEType_textEncodingName_baseURL(
184            &self,
185            data: &NSData,
186            mime_type: &NSString,
187            text_encoding_name: &NSString,
188            base_url: &NSURL,
189        );
190
191        #[deprecated = "No longer supported; please adopt WKWebView."]
192        #[unsafe(method(request))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn request(&self) -> Option<Retained<NSURLRequest>>;
195
196        #[deprecated = "No longer supported; please adopt WKWebView."]
197        #[unsafe(method(reload))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn reload(&self);
200
201        #[deprecated = "No longer supported; please adopt WKWebView."]
202        #[unsafe(method(stopLoading))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn stopLoading(&self);
205
206        #[deprecated = "No longer supported; please adopt WKWebView."]
207        #[unsafe(method(goBack))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn goBack(&self);
210
211        #[deprecated = "No longer supported; please adopt WKWebView."]
212        #[unsafe(method(goForward))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn goForward(&self);
215
216        #[deprecated = "No longer supported; please adopt WKWebView."]
217        #[unsafe(method(canGoBack))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn canGoBack(&self) -> bool;
220
221        #[deprecated = "No longer supported; please adopt WKWebView."]
222        #[unsafe(method(canGoForward))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn canGoForward(&self) -> bool;
225
226        #[deprecated = "No longer supported; please adopt WKWebView."]
227        #[unsafe(method(isLoading))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn isLoading(&self) -> bool;
230
231        #[deprecated = "No longer supported; please adopt WKWebView."]
232        #[unsafe(method(stringByEvaluatingJavaScriptFromString:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn stringByEvaluatingJavaScriptFromString(
235            &self,
236            script: &NSString,
237        ) -> Option<Retained<NSString>>;
238
239        #[deprecated = "No longer supported; please adopt WKWebView."]
240        #[unsafe(method(scalesPageToFit))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn scalesPageToFit(&self) -> bool;
243
244        /// Setter for [`scalesPageToFit`][Self::scalesPageToFit].
245        #[deprecated = "No longer supported; please adopt WKWebView."]
246        #[unsafe(method(setScalesPageToFit:))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn setScalesPageToFit(&self, scales_page_to_fit: bool);
249
250        #[deprecated]
251        #[unsafe(method(detectsPhoneNumbers))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn detectsPhoneNumbers(&self) -> bool;
254
255        /// Setter for [`detectsPhoneNumbers`][Self::detectsPhoneNumbers].
256        #[deprecated]
257        #[unsafe(method(setDetectsPhoneNumbers:))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn setDetectsPhoneNumbers(&self, detects_phone_numbers: bool);
260
261        #[cfg(feature = "UIDataDetectors")]
262        #[unsafe(method(dataDetectorTypes))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn dataDetectorTypes(&self) -> UIDataDetectorTypes;
265
266        #[cfg(feature = "UIDataDetectors")]
267        /// Setter for [`dataDetectorTypes`][Self::dataDetectorTypes].
268        #[unsafe(method(setDataDetectorTypes:))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn setDataDetectorTypes(&self, data_detector_types: UIDataDetectorTypes);
271
272        #[unsafe(method(allowsInlineMediaPlayback))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn allowsInlineMediaPlayback(&self) -> bool;
275
276        /// Setter for [`allowsInlineMediaPlayback`][Self::allowsInlineMediaPlayback].
277        #[unsafe(method(setAllowsInlineMediaPlayback:))]
278        #[unsafe(method_family = none)]
279        pub unsafe fn setAllowsInlineMediaPlayback(&self, allows_inline_media_playback: bool);
280
281        #[unsafe(method(mediaPlaybackRequiresUserAction))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn mediaPlaybackRequiresUserAction(&self) -> bool;
284
285        /// Setter for [`mediaPlaybackRequiresUserAction`][Self::mediaPlaybackRequiresUserAction].
286        #[unsafe(method(setMediaPlaybackRequiresUserAction:))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn setMediaPlaybackRequiresUserAction(
289            &self,
290            media_playback_requires_user_action: bool,
291        );
292
293        #[unsafe(method(mediaPlaybackAllowsAirPlay))]
294        #[unsafe(method_family = none)]
295        pub unsafe fn mediaPlaybackAllowsAirPlay(&self) -> bool;
296
297        /// Setter for [`mediaPlaybackAllowsAirPlay`][Self::mediaPlaybackAllowsAirPlay].
298        #[unsafe(method(setMediaPlaybackAllowsAirPlay:))]
299        #[unsafe(method_family = none)]
300        pub unsafe fn setMediaPlaybackAllowsAirPlay(&self, media_playback_allows_air_play: bool);
301
302        #[unsafe(method(suppressesIncrementalRendering))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn suppressesIncrementalRendering(&self) -> bool;
305
306        /// Setter for [`suppressesIncrementalRendering`][Self::suppressesIncrementalRendering].
307        #[unsafe(method(setSuppressesIncrementalRendering:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn setSuppressesIncrementalRendering(
310            &self,
311            suppresses_incremental_rendering: bool,
312        );
313
314        #[unsafe(method(keyboardDisplayRequiresUserAction))]
315        #[unsafe(method_family = none)]
316        pub unsafe fn keyboardDisplayRequiresUserAction(&self) -> bool;
317
318        /// Setter for [`keyboardDisplayRequiresUserAction`][Self::keyboardDisplayRequiresUserAction].
319        #[unsafe(method(setKeyboardDisplayRequiresUserAction:))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn setKeyboardDisplayRequiresUserAction(
322            &self,
323            keyboard_display_requires_user_action: bool,
324        );
325
326        #[unsafe(method(paginationMode))]
327        #[unsafe(method_family = none)]
328        pub unsafe fn paginationMode(&self) -> UIWebPaginationMode;
329
330        /// Setter for [`paginationMode`][Self::paginationMode].
331        #[unsafe(method(setPaginationMode:))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn setPaginationMode(&self, pagination_mode: UIWebPaginationMode);
334
335        #[unsafe(method(paginationBreakingMode))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn paginationBreakingMode(&self) -> UIWebPaginationBreakingMode;
338
339        /// Setter for [`paginationBreakingMode`][Self::paginationBreakingMode].
340        #[unsafe(method(setPaginationBreakingMode:))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn setPaginationBreakingMode(
343            &self,
344            pagination_breaking_mode: UIWebPaginationBreakingMode,
345        );
346
347        #[cfg(feature = "objc2-core-foundation")]
348        #[unsafe(method(pageLength))]
349        #[unsafe(method_family = none)]
350        pub unsafe fn pageLength(&self) -> CGFloat;
351
352        #[cfg(feature = "objc2-core-foundation")]
353        /// Setter for [`pageLength`][Self::pageLength].
354        #[unsafe(method(setPageLength:))]
355        #[unsafe(method_family = none)]
356        pub unsafe fn setPageLength(&self, page_length: CGFloat);
357
358        #[cfg(feature = "objc2-core-foundation")]
359        #[unsafe(method(gapBetweenPages))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn gapBetweenPages(&self) -> CGFloat;
362
363        #[cfg(feature = "objc2-core-foundation")]
364        /// Setter for [`gapBetweenPages`][Self::gapBetweenPages].
365        #[unsafe(method(setGapBetweenPages:))]
366        #[unsafe(method_family = none)]
367        pub unsafe fn setGapBetweenPages(&self, gap_between_pages: CGFloat);
368
369        #[unsafe(method(pageCount))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn pageCount(&self) -> NSUInteger;
372
373        #[unsafe(method(allowsPictureInPictureMediaPlayback))]
374        #[unsafe(method_family = none)]
375        pub unsafe fn allowsPictureInPictureMediaPlayback(&self) -> bool;
376
377        /// Setter for [`allowsPictureInPictureMediaPlayback`][Self::allowsPictureInPictureMediaPlayback].
378        #[unsafe(method(setAllowsPictureInPictureMediaPlayback:))]
379        #[unsafe(method_family = none)]
380        pub unsafe fn setAllowsPictureInPictureMediaPlayback(
381            &self,
382            allows_picture_in_picture_media_playback: bool,
383        );
384
385        #[unsafe(method(allowsLinkPreview))]
386        #[unsafe(method_family = none)]
387        pub unsafe fn allowsLinkPreview(&self) -> bool;
388
389        /// Setter for [`allowsLinkPreview`][Self::allowsLinkPreview].
390        #[unsafe(method(setAllowsLinkPreview:))]
391        #[unsafe(method_family = none)]
392        pub unsafe fn setAllowsLinkPreview(&self, allows_link_preview: bool);
393    );
394}
395
396/// Methods declared on superclass `UIView`.
397#[cfg(all(feature = "UIResponder", feature = "UIView"))]
398impl UIWebView {
399    extern_methods!(
400        #[cfg(feature = "objc2-core-foundation")]
401        #[unsafe(method(initWithFrame:))]
402        #[unsafe(method_family = init)]
403        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
404
405        #[unsafe(method(initWithCoder:))]
406        #[unsafe(method_family = init)]
407        pub unsafe fn initWithCoder(
408            this: Allocated<Self>,
409            coder: &NSCoder,
410        ) -> Option<Retained<Self>>;
411    );
412}
413
414/// Methods declared on superclass `NSObject`.
415#[cfg(all(feature = "UIResponder", feature = "UIView"))]
416impl UIWebView {
417    extern_methods!(
418        #[unsafe(method(init))]
419        #[unsafe(method_family = init)]
420        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
421
422        #[unsafe(method(new))]
423        #[unsafe(method_family = new)]
424        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
425    );
426}
427
428extern_protocol!(
429    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwebviewdelegate?language=objc)
430    pub unsafe trait UIWebViewDelegate: NSObjectProtocol + MainThreadOnly {
431        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
432        #[deprecated = "No longer supported."]
433        #[optional]
434        #[unsafe(method(webView:shouldStartLoadWithRequest:navigationType:))]
435        #[unsafe(method_family = none)]
436        unsafe fn webView_shouldStartLoadWithRequest_navigationType(
437            &self,
438            web_view: &UIWebView,
439            request: &NSURLRequest,
440            navigation_type: UIWebViewNavigationType,
441        ) -> bool;
442
443        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
444        #[deprecated = "No longer supported."]
445        #[optional]
446        #[unsafe(method(webViewDidStartLoad:))]
447        #[unsafe(method_family = none)]
448        unsafe fn webViewDidStartLoad(&self, web_view: &UIWebView);
449
450        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
451        #[deprecated = "No longer supported."]
452        #[optional]
453        #[unsafe(method(webViewDidFinishLoad:))]
454        #[unsafe(method_family = none)]
455        unsafe fn webViewDidFinishLoad(&self, web_view: &UIWebView);
456
457        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
458        #[deprecated = "No longer supported."]
459        #[optional]
460        #[unsafe(method(webView:didFailLoadWithError:))]
461        #[unsafe(method_family = none)]
462        unsafe fn webView_didFailLoadWithError(&self, web_view: &UIWebView, error: &NSError);
463    }
464);