objc2_web_kit/generated/
WKDownload.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/webkit/wkdownload?language=objc)
12    #[unsafe(super(NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct WKDownload;
16);
17
18unsafe impl NSObjectProtocol for WKDownload {}
19
20unsafe impl NSProgressReporting for WKDownload {}
21
22impl WKDownload {
23    extern_methods!(
24        #[unsafe(method(originalRequest))]
25        #[unsafe(method_family = none)]
26        pub unsafe fn originalRequest(&self) -> Option<Retained<NSURLRequest>>;
27
28        #[cfg(all(feature = "WKWebView", feature = "objc2-app-kit"))]
29        #[cfg(target_os = "macos")]
30        #[unsafe(method(webView))]
31        #[unsafe(method_family = none)]
32        pub unsafe fn webView(&self) -> Option<Retained<WKWebView>>;
33
34        #[cfg(feature = "WKDownloadDelegate")]
35        #[unsafe(method(delegate))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn WKDownloadDelegate>>>;
38
39        #[cfg(feature = "WKDownloadDelegate")]
40        /// This is a [weak property][objc2::topics::weak_property].
41        /// Setter for [`delegate`][Self::delegate].
42        #[unsafe(method(setDelegate:))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn WKDownloadDelegate>>);
45
46        #[unsafe(method(isUserInitiated))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn isUserInitiated(&self) -> bool;
49
50        #[cfg(feature = "WKFrameInfo")]
51        #[unsafe(method(originatingFrame))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn originatingFrame(&self) -> Retained<WKFrameInfo>;
54
55        #[cfg(feature = "block2")]
56        #[unsafe(method(cancel:))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn cancel(
59            &self,
60            completion_handler: Option<&block2::Block<dyn Fn(*mut NSData)>>,
61        );
62    );
63}
64
65/// Methods declared on superclass `NSObject`.
66impl WKDownload {
67    extern_methods!(
68        #[unsafe(method(init))]
69        #[unsafe(method_family = init)]
70        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
71
72        #[unsafe(method(new))]
73        #[unsafe(method_family = new)]
74        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
75    );
76}