use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIWebViewNavigationType(pub NSInteger);
impl UIWebViewNavigationType {
#[doc(alias = "UIWebViewNavigationTypeLinkClicked")]
pub const LinkClicked: Self = Self(0);
#[doc(alias = "UIWebViewNavigationTypeFormSubmitted")]
pub const FormSubmitted: Self = Self(1);
#[doc(alias = "UIWebViewNavigationTypeBackForward")]
pub const BackForward: Self = Self(2);
#[doc(alias = "UIWebViewNavigationTypeReload")]
pub const Reload: Self = Self(3);
#[doc(alias = "UIWebViewNavigationTypeFormResubmitted")]
pub const FormResubmitted: Self = Self(4);
#[doc(alias = "UIWebViewNavigationTypeOther")]
pub const Other: Self = Self(5);
}
unsafe impl Encode for UIWebViewNavigationType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIWebViewNavigationType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIWebPaginationMode(pub NSInteger);
impl UIWebPaginationMode {
#[doc(alias = "UIWebPaginationModeUnpaginated")]
pub const Unpaginated: Self = Self(0);
#[doc(alias = "UIWebPaginationModeLeftToRight")]
pub const LeftToRight: Self = Self(1);
#[doc(alias = "UIWebPaginationModeTopToBottom")]
pub const TopToBottom: Self = Self(2);
#[doc(alias = "UIWebPaginationModeBottomToTop")]
pub const BottomToTop: Self = Self(3);
#[doc(alias = "UIWebPaginationModeRightToLeft")]
pub const RightToLeft: Self = Self(4);
}
unsafe impl Encode for UIWebPaginationMode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIWebPaginationMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIWebPaginationBreakingMode(pub NSInteger);
impl UIWebPaginationBreakingMode {
#[doc(alias = "UIWebPaginationBreakingModePage")]
pub const Page: Self = Self(0);
#[doc(alias = "UIWebPaginationBreakingModeColumn")]
pub const Column: Self = Self(1);
}
unsafe impl Encode for UIWebPaginationBreakingMode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIWebPaginationBreakingMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(UIView, UIResponder, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[deprecated = "No longer supported; please adopt WKWebView."]
pub struct UIWebView;
);
#[cfg(all(
feature = "UIResponder",
feature = "UIView",
feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
unsafe impl CALayerDelegate for UIWebView {}
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl NSCoding for UIWebView {}
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl NSObjectProtocol for UIWebView {}
);
#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIAppearance for UIWebView {}
);
#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIAppearanceContainer for UIWebView {}
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UICoordinateSpace for UIWebView {}
);
#[cfg(all(
feature = "UIDynamicBehavior",
feature = "UIResponder",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UIDynamicItem for UIWebView {}
);
#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIFocusEnvironment for UIWebView {}
);
#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIFocusItem for UIWebView {}
);
#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIFocusItemContainer for UIWebView {}
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
unsafe impl UIResponderStandardEditActions for UIWebView {}
);
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
extern_conformance!(
unsafe impl UIScrollViewDelegate for UIWebView {}
);
#[cfg(all(
feature = "UIResponder",
feature = "UITraitCollection",
feature = "UIView"
))]
extern_conformance!(
unsafe impl UITraitEnvironment for UIWebView {}
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIWebView {
extern_methods!(
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIWebViewDelegate>>>;
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UIWebViewDelegate>>);
#[cfg(feature = "UIScrollView")]
#[unsafe(method(scrollView))]
#[unsafe(method_family = none)]
pub fn scrollView(&self) -> Retained<UIScrollView>;
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(loadRequest:))]
#[unsafe(method_family = none)]
pub fn loadRequest(&self, request: &NSURLRequest);
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(loadHTMLString:baseURL:))]
#[unsafe(method_family = none)]
pub fn loadHTMLString_baseURL(&self, string: &NSString, base_url: Option<&NSURL>);
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(loadData:MIMEType:textEncodingName:baseURL:))]
#[unsafe(method_family = none)]
pub fn loadData_MIMEType_textEncodingName_baseURL(
&self,
data: &NSData,
mime_type: &NSString,
text_encoding_name: &NSString,
base_url: &NSURL,
);
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(request))]
#[unsafe(method_family = none)]
pub fn request(&self) -> Option<Retained<NSURLRequest>>;
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(reload))]
#[unsafe(method_family = none)]
pub fn reload(&self);
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(stopLoading))]
#[unsafe(method_family = none)]
pub fn stopLoading(&self);
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(goBack))]
#[unsafe(method_family = none)]
pub fn goBack(&self);
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(goForward))]
#[unsafe(method_family = none)]
pub fn goForward(&self);
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(canGoBack))]
#[unsafe(method_family = none)]
pub fn canGoBack(&self) -> bool;
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(canGoForward))]
#[unsafe(method_family = none)]
pub fn canGoForward(&self) -> bool;
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(isLoading))]
#[unsafe(method_family = none)]
pub fn isLoading(&self) -> bool;
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(stringByEvaluatingJavaScriptFromString:))]
#[unsafe(method_family = none)]
pub fn stringByEvaluatingJavaScriptFromString(
&self,
script: &NSString,
) -> Option<Retained<NSString>>;
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(scalesPageToFit))]
#[unsafe(method_family = none)]
pub fn scalesPageToFit(&self) -> bool;
#[deprecated = "No longer supported; please adopt WKWebView."]
#[unsafe(method(setScalesPageToFit:))]
#[unsafe(method_family = none)]
pub fn setScalesPageToFit(&self, scales_page_to_fit: bool);
#[deprecated]
#[unsafe(method(detectsPhoneNumbers))]
#[unsafe(method_family = none)]
pub fn detectsPhoneNumbers(&self) -> bool;
#[deprecated]
#[unsafe(method(setDetectsPhoneNumbers:))]
#[unsafe(method_family = none)]
pub fn setDetectsPhoneNumbers(&self, detects_phone_numbers: bool);
#[cfg(feature = "UIDataDetectors")]
#[unsafe(method(dataDetectorTypes))]
#[unsafe(method_family = none)]
pub fn dataDetectorTypes(&self) -> UIDataDetectorTypes;
#[cfg(feature = "UIDataDetectors")]
#[unsafe(method(setDataDetectorTypes:))]
#[unsafe(method_family = none)]
pub fn setDataDetectorTypes(&self, data_detector_types: UIDataDetectorTypes);
#[unsafe(method(allowsInlineMediaPlayback))]
#[unsafe(method_family = none)]
pub fn allowsInlineMediaPlayback(&self) -> bool;
#[unsafe(method(setAllowsInlineMediaPlayback:))]
#[unsafe(method_family = none)]
pub fn setAllowsInlineMediaPlayback(&self, allows_inline_media_playback: bool);
#[unsafe(method(mediaPlaybackRequiresUserAction))]
#[unsafe(method_family = none)]
pub fn mediaPlaybackRequiresUserAction(&self) -> bool;
#[unsafe(method(setMediaPlaybackRequiresUserAction:))]
#[unsafe(method_family = none)]
pub fn setMediaPlaybackRequiresUserAction(&self, media_playback_requires_user_action: bool);
#[unsafe(method(mediaPlaybackAllowsAirPlay))]
#[unsafe(method_family = none)]
pub fn mediaPlaybackAllowsAirPlay(&self) -> bool;
#[unsafe(method(setMediaPlaybackAllowsAirPlay:))]
#[unsafe(method_family = none)]
pub fn setMediaPlaybackAllowsAirPlay(&self, media_playback_allows_air_play: bool);
#[unsafe(method(suppressesIncrementalRendering))]
#[unsafe(method_family = none)]
pub fn suppressesIncrementalRendering(&self) -> bool;
#[unsafe(method(setSuppressesIncrementalRendering:))]
#[unsafe(method_family = none)]
pub fn setSuppressesIncrementalRendering(&self, suppresses_incremental_rendering: bool);
#[unsafe(method(keyboardDisplayRequiresUserAction))]
#[unsafe(method_family = none)]
pub fn keyboardDisplayRequiresUserAction(&self) -> bool;
#[unsafe(method(setKeyboardDisplayRequiresUserAction:))]
#[unsafe(method_family = none)]
pub fn setKeyboardDisplayRequiresUserAction(
&self,
keyboard_display_requires_user_action: bool,
);
#[unsafe(method(paginationMode))]
#[unsafe(method_family = none)]
pub fn paginationMode(&self) -> UIWebPaginationMode;
#[unsafe(method(setPaginationMode:))]
#[unsafe(method_family = none)]
pub fn setPaginationMode(&self, pagination_mode: UIWebPaginationMode);
#[unsafe(method(paginationBreakingMode))]
#[unsafe(method_family = none)]
pub fn paginationBreakingMode(&self) -> UIWebPaginationBreakingMode;
#[unsafe(method(setPaginationBreakingMode:))]
#[unsafe(method_family = none)]
pub fn setPaginationBreakingMode(
&self,
pagination_breaking_mode: UIWebPaginationBreakingMode,
);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(pageLength))]
#[unsafe(method_family = none)]
pub fn pageLength(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setPageLength:))]
#[unsafe(method_family = none)]
pub fn setPageLength(&self, page_length: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(gapBetweenPages))]
#[unsafe(method_family = none)]
pub fn gapBetweenPages(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setGapBetweenPages:))]
#[unsafe(method_family = none)]
pub fn setGapBetweenPages(&self, gap_between_pages: CGFloat);
#[unsafe(method(pageCount))]
#[unsafe(method_family = none)]
pub fn pageCount(&self) -> NSUInteger;
#[unsafe(method(allowsPictureInPictureMediaPlayback))]
#[unsafe(method_family = none)]
pub fn allowsPictureInPictureMediaPlayback(&self) -> bool;
#[unsafe(method(setAllowsPictureInPictureMediaPlayback:))]
#[unsafe(method_family = none)]
pub fn setAllowsPictureInPictureMediaPlayback(
&self,
allows_picture_in_picture_media_playback: bool,
);
#[unsafe(method(allowsLinkPreview))]
#[unsafe(method_family = none)]
pub fn allowsLinkPreview(&self) -> bool;
#[unsafe(method(setAllowsLinkPreview:))]
#[unsafe(method_family = none)]
pub fn setAllowsLinkPreview(&self, allows_link_preview: bool);
);
}
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIWebView {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithFrame:))]
#[unsafe(method_family = init)]
pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIWebView {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_protocol!(
pub unsafe trait UIWebViewDelegate: NSObjectProtocol + MainThreadOnly {
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[deprecated = "No longer supported."]
#[optional]
#[unsafe(method(webView:shouldStartLoadWithRequest:navigationType:))]
#[unsafe(method_family = none)]
fn webView_shouldStartLoadWithRequest_navigationType(
&self,
web_view: &UIWebView,
request: &NSURLRequest,
navigation_type: UIWebViewNavigationType,
) -> bool;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[deprecated = "No longer supported."]
#[optional]
#[unsafe(method(webViewDidStartLoad:))]
#[unsafe(method_family = none)]
fn webViewDidStartLoad(&self, web_view: &UIWebView);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[deprecated = "No longer supported."]
#[optional]
#[unsafe(method(webViewDidFinishLoad:))]
#[unsafe(method_family = none)]
fn webViewDidFinishLoad(&self, web_view: &UIWebView);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[deprecated = "No longer supported."]
#[optional]
#[unsafe(method(webView:didFailLoadWithError:))]
#[unsafe(method_family = none)]
fn webView_didFailLoadWithError(&self, web_view: &UIWebView, error: &NSError);
}
);