objc2-web-kit 0.3.0

Bindings to the WebKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/webkit/wkdownload?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct WKDownload;
);

unsafe impl NSObjectProtocol for WKDownload {}

unsafe impl NSProgressReporting for WKDownload {}

impl WKDownload {
    extern_methods!(
        #[unsafe(method(originalRequest))]
        #[unsafe(method_family = none)]
        pub unsafe fn originalRequest(&self) -> Option<Retained<NSURLRequest>>;

        #[cfg(all(feature = "WKWebView", feature = "objc2-app-kit"))]
        #[cfg(target_os = "macos")]
        #[unsafe(method(webView))]
        #[unsafe(method_family = none)]
        pub unsafe fn webView(&self) -> Option<Retained<WKWebView>>;

        #[cfg(feature = "WKDownloadDelegate")]
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn WKDownloadDelegate>>>;

        #[cfg(feature = "WKDownloadDelegate")]
        /// This is a [weak property][objc2::topics::weak_property].
        /// Setter for [`delegate`][Self::delegate].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn WKDownloadDelegate>>);

        #[unsafe(method(isUserInitiated))]
        #[unsafe(method_family = none)]
        pub unsafe fn isUserInitiated(&self) -> bool;

        #[cfg(feature = "WKFrameInfo")]
        #[unsafe(method(originatingFrame))]
        #[unsafe(method_family = none)]
        pub unsafe fn originatingFrame(&self) -> Retained<WKFrameInfo>;

        #[cfg(feature = "block2")]
        #[unsafe(method(cancel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancel(
            &self,
            completion_handler: Option<&block2::Block<dyn Fn(*mut NSData)>>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl WKDownload {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}