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"))]
105extern_conformance!(
106    unsafe impl CALayerDelegate for UIWebView {}
107);
108
109#[cfg(all(feature = "UIResponder", feature = "UIView"))]
110extern_conformance!(
111    unsafe impl NSCoding for UIWebView {}
112);
113
114#[cfg(all(feature = "UIResponder", feature = "UIView"))]
115extern_conformance!(
116    unsafe impl NSObjectProtocol for UIWebView {}
117);
118
119#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
120extern_conformance!(
121    unsafe impl UIAppearance for UIWebView {}
122);
123
124#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
125extern_conformance!(
126    unsafe impl UIAppearanceContainer for UIWebView {}
127);
128
129#[cfg(all(feature = "UIResponder", feature = "UIView"))]
130extern_conformance!(
131    unsafe impl UICoordinateSpace for UIWebView {}
132);
133
134#[cfg(all(
135    feature = "UIDynamicBehavior",
136    feature = "UIResponder",
137    feature = "UIView"
138))]
139extern_conformance!(
140    unsafe impl UIDynamicItem for UIWebView {}
141);
142
143#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
144extern_conformance!(
145    unsafe impl UIFocusEnvironment for UIWebView {}
146);
147
148#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
149extern_conformance!(
150    unsafe impl UIFocusItem for UIWebView {}
151);
152
153#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
154extern_conformance!(
155    unsafe impl UIFocusItemContainer for UIWebView {}
156);
157
158#[cfg(all(feature = "UIResponder", feature = "UIView"))]
159extern_conformance!(
160    unsafe impl UIResponderStandardEditActions for UIWebView {}
161);
162
163#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
164extern_conformance!(
165    unsafe impl UIScrollViewDelegate for UIWebView {}
166);
167
168#[cfg(all(
169    feature = "UIResponder",
170    feature = "UITraitCollection",
171    feature = "UIView"
172))]
173extern_conformance!(
174    unsafe impl UITraitEnvironment for UIWebView {}
175);
176
177#[cfg(all(feature = "UIResponder", feature = "UIView"))]
178impl UIWebView {
179    extern_methods!(
180        /// # Safety
181        ///
182        /// This is not retained internally, you must ensure the object is still alive.
183        #[deprecated = "No longer supported; please adopt WKWebView."]
184        #[unsafe(method(delegate))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIWebViewDelegate>>>;
187
188        /// Setter for [`delegate`][Self::delegate].
189        ///
190        /// # Safety
191        ///
192        /// This is unretained, you must ensure the object is kept alive while in use.
193        #[deprecated = "No longer supported; please adopt WKWebView."]
194        #[unsafe(method(setDelegate:))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UIWebViewDelegate>>);
197
198        #[cfg(feature = "UIScrollView")]
199        #[unsafe(method(scrollView))]
200        #[unsafe(method_family = none)]
201        pub fn scrollView(&self) -> Retained<UIScrollView>;
202
203        #[deprecated = "No longer supported; please adopt WKWebView."]
204        #[unsafe(method(loadRequest:))]
205        #[unsafe(method_family = none)]
206        pub fn loadRequest(&self, request: &NSURLRequest);
207
208        #[deprecated = "No longer supported; please adopt WKWebView."]
209        #[unsafe(method(loadHTMLString:baseURL:))]
210        #[unsafe(method_family = none)]
211        pub fn loadHTMLString_baseURL(&self, string: &NSString, base_url: Option<&NSURL>);
212
213        #[deprecated = "No longer supported; please adopt WKWebView."]
214        #[unsafe(method(loadData:MIMEType:textEncodingName:baseURL:))]
215        #[unsafe(method_family = none)]
216        pub fn loadData_MIMEType_textEncodingName_baseURL(
217            &self,
218            data: &NSData,
219            mime_type: &NSString,
220            text_encoding_name: &NSString,
221            base_url: &NSURL,
222        );
223
224        #[deprecated = "No longer supported; please adopt WKWebView."]
225        #[unsafe(method(request))]
226        #[unsafe(method_family = none)]
227        pub fn request(&self) -> Option<Retained<NSURLRequest>>;
228
229        #[deprecated = "No longer supported; please adopt WKWebView."]
230        #[unsafe(method(reload))]
231        #[unsafe(method_family = none)]
232        pub fn reload(&self);
233
234        #[deprecated = "No longer supported; please adopt WKWebView."]
235        #[unsafe(method(stopLoading))]
236        #[unsafe(method_family = none)]
237        pub fn stopLoading(&self);
238
239        #[deprecated = "No longer supported; please adopt WKWebView."]
240        #[unsafe(method(goBack))]
241        #[unsafe(method_family = none)]
242        pub fn goBack(&self);
243
244        #[deprecated = "No longer supported; please adopt WKWebView."]
245        #[unsafe(method(goForward))]
246        #[unsafe(method_family = none)]
247        pub fn goForward(&self);
248
249        #[deprecated = "No longer supported; please adopt WKWebView."]
250        #[unsafe(method(canGoBack))]
251        #[unsafe(method_family = none)]
252        pub fn canGoBack(&self) -> bool;
253
254        #[deprecated = "No longer supported; please adopt WKWebView."]
255        #[unsafe(method(canGoForward))]
256        #[unsafe(method_family = none)]
257        pub fn canGoForward(&self) -> bool;
258
259        #[deprecated = "No longer supported; please adopt WKWebView."]
260        #[unsafe(method(isLoading))]
261        #[unsafe(method_family = none)]
262        pub fn isLoading(&self) -> bool;
263
264        #[deprecated = "No longer supported; please adopt WKWebView."]
265        #[unsafe(method(stringByEvaluatingJavaScriptFromString:))]
266        #[unsafe(method_family = none)]
267        pub fn stringByEvaluatingJavaScriptFromString(
268            &self,
269            script: &NSString,
270        ) -> Option<Retained<NSString>>;
271
272        #[deprecated = "No longer supported; please adopt WKWebView."]
273        #[unsafe(method(scalesPageToFit))]
274        #[unsafe(method_family = none)]
275        pub fn scalesPageToFit(&self) -> bool;
276
277        /// Setter for [`scalesPageToFit`][Self::scalesPageToFit].
278        #[deprecated = "No longer supported; please adopt WKWebView."]
279        #[unsafe(method(setScalesPageToFit:))]
280        #[unsafe(method_family = none)]
281        pub fn setScalesPageToFit(&self, scales_page_to_fit: bool);
282
283        #[deprecated]
284        #[unsafe(method(detectsPhoneNumbers))]
285        #[unsafe(method_family = none)]
286        pub fn detectsPhoneNumbers(&self) -> bool;
287
288        /// Setter for [`detectsPhoneNumbers`][Self::detectsPhoneNumbers].
289        #[deprecated]
290        #[unsafe(method(setDetectsPhoneNumbers:))]
291        #[unsafe(method_family = none)]
292        pub fn setDetectsPhoneNumbers(&self, detects_phone_numbers: bool);
293
294        #[cfg(feature = "UIDataDetectors")]
295        #[unsafe(method(dataDetectorTypes))]
296        #[unsafe(method_family = none)]
297        pub fn dataDetectorTypes(&self) -> UIDataDetectorTypes;
298
299        #[cfg(feature = "UIDataDetectors")]
300        /// Setter for [`dataDetectorTypes`][Self::dataDetectorTypes].
301        #[unsafe(method(setDataDetectorTypes:))]
302        #[unsafe(method_family = none)]
303        pub fn setDataDetectorTypes(&self, data_detector_types: UIDataDetectorTypes);
304
305        #[unsafe(method(allowsInlineMediaPlayback))]
306        #[unsafe(method_family = none)]
307        pub fn allowsInlineMediaPlayback(&self) -> bool;
308
309        /// Setter for [`allowsInlineMediaPlayback`][Self::allowsInlineMediaPlayback].
310        #[unsafe(method(setAllowsInlineMediaPlayback:))]
311        #[unsafe(method_family = none)]
312        pub fn setAllowsInlineMediaPlayback(&self, allows_inline_media_playback: bool);
313
314        #[unsafe(method(mediaPlaybackRequiresUserAction))]
315        #[unsafe(method_family = none)]
316        pub fn mediaPlaybackRequiresUserAction(&self) -> bool;
317
318        /// Setter for [`mediaPlaybackRequiresUserAction`][Self::mediaPlaybackRequiresUserAction].
319        #[unsafe(method(setMediaPlaybackRequiresUserAction:))]
320        #[unsafe(method_family = none)]
321        pub fn setMediaPlaybackRequiresUserAction(&self, media_playback_requires_user_action: bool);
322
323        #[unsafe(method(mediaPlaybackAllowsAirPlay))]
324        #[unsafe(method_family = none)]
325        pub fn mediaPlaybackAllowsAirPlay(&self) -> bool;
326
327        /// Setter for [`mediaPlaybackAllowsAirPlay`][Self::mediaPlaybackAllowsAirPlay].
328        #[unsafe(method(setMediaPlaybackAllowsAirPlay:))]
329        #[unsafe(method_family = none)]
330        pub fn setMediaPlaybackAllowsAirPlay(&self, media_playback_allows_air_play: bool);
331
332        #[unsafe(method(suppressesIncrementalRendering))]
333        #[unsafe(method_family = none)]
334        pub fn suppressesIncrementalRendering(&self) -> bool;
335
336        /// Setter for [`suppressesIncrementalRendering`][Self::suppressesIncrementalRendering].
337        #[unsafe(method(setSuppressesIncrementalRendering:))]
338        #[unsafe(method_family = none)]
339        pub fn setSuppressesIncrementalRendering(&self, suppresses_incremental_rendering: bool);
340
341        #[unsafe(method(keyboardDisplayRequiresUserAction))]
342        #[unsafe(method_family = none)]
343        pub fn keyboardDisplayRequiresUserAction(&self) -> bool;
344
345        /// Setter for [`keyboardDisplayRequiresUserAction`][Self::keyboardDisplayRequiresUserAction].
346        #[unsafe(method(setKeyboardDisplayRequiresUserAction:))]
347        #[unsafe(method_family = none)]
348        pub fn setKeyboardDisplayRequiresUserAction(
349            &self,
350            keyboard_display_requires_user_action: bool,
351        );
352
353        #[unsafe(method(paginationMode))]
354        #[unsafe(method_family = none)]
355        pub fn paginationMode(&self) -> UIWebPaginationMode;
356
357        /// Setter for [`paginationMode`][Self::paginationMode].
358        #[unsafe(method(setPaginationMode:))]
359        #[unsafe(method_family = none)]
360        pub fn setPaginationMode(&self, pagination_mode: UIWebPaginationMode);
361
362        #[unsafe(method(paginationBreakingMode))]
363        #[unsafe(method_family = none)]
364        pub fn paginationBreakingMode(&self) -> UIWebPaginationBreakingMode;
365
366        /// Setter for [`paginationBreakingMode`][Self::paginationBreakingMode].
367        #[unsafe(method(setPaginationBreakingMode:))]
368        #[unsafe(method_family = none)]
369        pub fn setPaginationBreakingMode(
370            &self,
371            pagination_breaking_mode: UIWebPaginationBreakingMode,
372        );
373
374        #[cfg(feature = "objc2-core-foundation")]
375        #[unsafe(method(pageLength))]
376        #[unsafe(method_family = none)]
377        pub fn pageLength(&self) -> CGFloat;
378
379        #[cfg(feature = "objc2-core-foundation")]
380        /// Setter for [`pageLength`][Self::pageLength].
381        #[unsafe(method(setPageLength:))]
382        #[unsafe(method_family = none)]
383        pub fn setPageLength(&self, page_length: CGFloat);
384
385        #[cfg(feature = "objc2-core-foundation")]
386        #[unsafe(method(gapBetweenPages))]
387        #[unsafe(method_family = none)]
388        pub fn gapBetweenPages(&self) -> CGFloat;
389
390        #[cfg(feature = "objc2-core-foundation")]
391        /// Setter for [`gapBetweenPages`][Self::gapBetweenPages].
392        #[unsafe(method(setGapBetweenPages:))]
393        #[unsafe(method_family = none)]
394        pub fn setGapBetweenPages(&self, gap_between_pages: CGFloat);
395
396        #[unsafe(method(pageCount))]
397        #[unsafe(method_family = none)]
398        pub fn pageCount(&self) -> NSUInteger;
399
400        #[unsafe(method(allowsPictureInPictureMediaPlayback))]
401        #[unsafe(method_family = none)]
402        pub fn allowsPictureInPictureMediaPlayback(&self) -> bool;
403
404        /// Setter for [`allowsPictureInPictureMediaPlayback`][Self::allowsPictureInPictureMediaPlayback].
405        #[unsafe(method(setAllowsPictureInPictureMediaPlayback:))]
406        #[unsafe(method_family = none)]
407        pub fn setAllowsPictureInPictureMediaPlayback(
408            &self,
409            allows_picture_in_picture_media_playback: bool,
410        );
411
412        #[unsafe(method(allowsLinkPreview))]
413        #[unsafe(method_family = none)]
414        pub fn allowsLinkPreview(&self) -> bool;
415
416        /// Setter for [`allowsLinkPreview`][Self::allowsLinkPreview].
417        #[unsafe(method(setAllowsLinkPreview:))]
418        #[unsafe(method_family = none)]
419        pub fn setAllowsLinkPreview(&self, allows_link_preview: bool);
420    );
421}
422
423/// Methods declared on superclass `UIView`.
424#[cfg(all(feature = "UIResponder", feature = "UIView"))]
425impl UIWebView {
426    extern_methods!(
427        #[cfg(feature = "objc2-core-foundation")]
428        #[unsafe(method(initWithFrame:))]
429        #[unsafe(method_family = init)]
430        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
431
432        /// # Safety
433        ///
434        /// `coder` possibly has further requirements.
435        #[unsafe(method(initWithCoder:))]
436        #[unsafe(method_family = init)]
437        pub unsafe fn initWithCoder(
438            this: Allocated<Self>,
439            coder: &NSCoder,
440        ) -> Option<Retained<Self>>;
441
442        #[unsafe(method(init))]
443        #[unsafe(method_family = init)]
444        pub fn init(this: Allocated<Self>) -> Retained<Self>;
445    );
446}
447
448/// Methods declared on superclass `NSObject`.
449#[cfg(all(feature = "UIResponder", feature = "UIView"))]
450impl UIWebView {
451    extern_methods!(
452        #[unsafe(method(new))]
453        #[unsafe(method_family = new)]
454        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
455    );
456}
457
458extern_protocol!(
459    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwebviewdelegate?language=objc)
460    pub unsafe trait UIWebViewDelegate: NSObjectProtocol + MainThreadOnly {
461        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
462        #[deprecated = "No longer supported."]
463        #[optional]
464        #[unsafe(method(webView:shouldStartLoadWithRequest:navigationType:))]
465        #[unsafe(method_family = none)]
466        fn webView_shouldStartLoadWithRequest_navigationType(
467            &self,
468            web_view: &UIWebView,
469            request: &NSURLRequest,
470            navigation_type: UIWebViewNavigationType,
471        ) -> bool;
472
473        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
474        #[deprecated = "No longer supported."]
475        #[optional]
476        #[unsafe(method(webViewDidStartLoad:))]
477        #[unsafe(method_family = none)]
478        fn webViewDidStartLoad(&self, web_view: &UIWebView);
479
480        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
481        #[deprecated = "No longer supported."]
482        #[optional]
483        #[unsafe(method(webViewDidFinishLoad:))]
484        #[unsafe(method_family = none)]
485        fn webViewDidFinishLoad(&self, web_view: &UIWebView);
486
487        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
488        #[deprecated = "No longer supported."]
489        #[optional]
490        #[unsafe(method(webView:didFailLoadWithError:))]
491        #[unsafe(method_family = none)]
492        fn webView_didFailLoadWithError(&self, web_view: &UIWebView, error: &NSError);
493    }
494);