objc2_quick_look_ui/generated/
QLPreviewingController.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
10/// A type that defines a block used to load a Quick Look preview item.
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/quicklookui/qlpreviewitemloadingblock?language=objc)
13#[deprecated = "Use void (^)(NSError * _Nullable) instead"]
14#[cfg(feature = "block2")]
15pub type QLPreviewItemLoadingBlock = *mut block2::DynBlock<dyn Fn(*mut NSError)>;
16
17extern_protocol!(
18    /// A protocol for implementing a custom controller to create previews of files.
19    ///
20    /// A controller that implements the
21    /// <doc
22    /// ://com.apple.documentation/documentation/quicklook/qlpreviewingcontroller> protocol must at least implement
23    /// <doc
24    /// ://com.apple.documentation/documentation//quicklook/qlpreviewingcontroller/2882042-preparepreviewofsearchableitem> or
25    /// <doc
26    /// ://com.apple.documentation/documentation/quicklook/qlpreviewingcontroller/2867936-preparepreviewoffile>.
27    ///
28    /// See also [Apple's documentation](https://developer.apple.com/documentation/quicklookui/qlpreviewingcontroller?language=objc)
29    pub unsafe trait QLPreviewingController: NSObjectProtocol {
30        #[cfg(feature = "block2")]
31        /// Prepares the preview for a file by using the data from Spotlight’s searchable item.
32        ///
33        /// The operating system calls this method only once from the main thread before it presents the previewing controller. To avoid blocking the main thread, don’t perform long-running or resource-intensive work.
34        /// - Parameters:
35        /// - identifier: The identifier of the searchable item.
36        /// - queryString: A search string to associate with the searchable item.
37        /// - handler: A completion handler that notifies the platform that a preview is available. The operating system shows a loading spinner, so call the handler as soon as possible. You can call the completion handler asynchronously after returning from the callback.
38        #[optional]
39        #[unsafe(method(preparePreviewOfSearchableItemWithIdentifier:queryString:completionHandler:))]
40        #[unsafe(method_family = none)]
41        unsafe fn preparePreviewOfSearchableItemWithIdentifier_queryString_completionHandler(
42            &self,
43            identifier: &NSString,
44            query_string: Option<&NSString>,
45            handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
46        );
47
48        #[cfg(feature = "block2")]
49        /// Prepares the preview of a file at the specified file’s URL.
50        ///
51        /// The operating system calls this method only once from the main thread before it presents the previewing controller. To avoid blocking the main thread, don’t perform long-running or resource-intensive work.
52        ///
53        /// When preparing and displaying the view controller, avoid holding open a file descriptors while the user is previewing the file.
54        ///
55        /// - Parameters:
56        /// - url: The URL of the file to preview.
57        /// - handler: A completion handler that notifies the platform that a preview is available. The operating system shows a loading spinner, so call the handler as soon as possible. You can call the completion handler asynchronously after returning from the callback.
58        #[optional]
59        #[unsafe(method(preparePreviewOfFileAtURL:completionHandler:))]
60        #[unsafe(method_family = none)]
61        unsafe fn preparePreviewOfFileAtURL_completionHandler(
62            &self,
63            url: &NSURL,
64            handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
65        );
66
67        #[cfg(all(
68            feature = "QLFilePreviewRequest",
69            feature = "QLPreviewReply",
70            feature = "block2"
71        ))]
72        /// Prepares the preview of a file identified within a file preview request.
73        ///
74        /// - Parameters:
75        /// - request: The file preview request that identifies the content to preview.
76        /// - handler: The closure to call with a
77        /// <doc
78        /// ://com.apple.documentation/documentation/quicklook/qlpreviewreply> for the system to display as the preview.
79        #[optional]
80        #[unsafe(method(providePreviewForFileRequest:completionHandler:))]
81        #[unsafe(method_family = none)]
82        unsafe fn providePreviewForFileRequest_completionHandler(
83            &self,
84            request: &QLFilePreviewRequest,
85            handler: &block2::DynBlock<dyn Fn(*mut QLPreviewReply, *mut NSError)>,
86        );
87    }
88);