objc2_quick_look_thumbnailing/generated/
QLThumbnailGenerator.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#[cfg(feature = "objc2-uniform-type-identifiers")]
8use objc2_uniform_type_identifiers::*;
9
10use crate::*;
11
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/quicklookthumbnailing/qlthumbnailgenerator?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct QLThumbnailGenerator;
17);
18
19extern_conformance!(
20    unsafe impl NSObjectProtocol for QLThumbnailGenerator {}
21);
22
23impl QLThumbnailGenerator {
24    extern_methods!(
25        #[unsafe(method(sharedGenerator))]
26        #[unsafe(method_family = none)]
27        pub unsafe fn sharedGenerator() -> Retained<QLThumbnailGenerator>;
28
29        #[cfg(all(
30            feature = "QLThumbnailGenerationRequest",
31            feature = "QLThumbnailRepresentation",
32            feature = "block2"
33        ))]
34        /// Parameter `completionHandler`: Always called when the thumbnail generation is over.
35        /// The thumbnail passed to this handler is the most representative version of the thumbnail that was successfully generated (if any).
36        /// If set, the error contains information about the issue that occurred while trying to generate the thumbnail.
37        /// QLThumbnail error codes can be found in
38        /// <QuickLookThumbnailing
39        /// /QLThumbnailErrors.h>.
40        #[unsafe(method(generateBestRepresentationForRequest:completionHandler:))]
41        #[unsafe(method_family = none)]
42        pub unsafe fn generateBestRepresentationForRequest_completionHandler(
43            &self,
44            request: &QLThumbnailGenerationRequest,
45            completion_handler: &block2::DynBlock<
46                dyn Fn(*mut QLThumbnailRepresentation, *mut NSError),
47            >,
48        );
49
50        #[cfg(all(
51            feature = "QLThumbnailGenerationRequest",
52            feature = "QLThumbnailRepresentation",
53            feature = "block2"
54        ))]
55        /// Parameter `updateHandler`: Called for the successive requested representations of a thumbnail.
56        /// If a representation was not successfully generated, this may be called with a nil representation.
57        /// If a requested more representative version was successfully generated before a less representative one, this handler will be called only for the more representative version, skipping the less representative one.
58        /// This handler is guaranteed to be called at least once, for the requested most representative version, whether a representation could be successfully generated or not.
59        /// If set, the error contains information about the issue that occurred while trying to generate the representation of the given type.
60        /// QLThumbnail error codes can be found in
61        /// <QuickLookThumbnailing
62        /// /QLThumbnailErrors.h>.
63        #[unsafe(method(generateRepresentationsForRequest:updateHandler:))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn generateRepresentationsForRequest_updateHandler(
66            &self,
67            request: &QLThumbnailGenerationRequest,
68            update_handler: Option<
69                &block2::DynBlock<
70                    dyn Fn(
71                        *mut QLThumbnailRepresentation,
72                        QLThumbnailRepresentationType,
73                        *mut NSError,
74                    ),
75                >,
76            >,
77        );
78
79        #[cfg(feature = "QLThumbnailGenerationRequest")]
80        /// Cancels the given QLThumbnailGenerationRequest.
81        ///
82        /// Parameter `request`: The request that should be cancelled.
83        #[unsafe(method(cancelRequest:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn cancelRequest(&self, request: &QLThumbnailGenerationRequest);
86
87        #[cfg(all(
88            feature = "QLThumbnailGenerationRequest",
89            feature = "block2",
90            feature = "objc2-uniform-type-identifiers"
91        ))]
92        /// Saves a thumbnail for the request on disk at fileURL.
93        /// The file saved at fileURL has to be deleted when it is not used anymore.
94        /// This is primarily intended for file provider extensions which need to upload thumbnails and have a small memory limit.
95        ///
96        ///
97        /// Parameter `contentType`: An image content type to save the thumbnail as, supported by CGImageDestination, such as UTTypePNG or UTTypeJPEG
98        ///
99        /// Parameter `completionHandler`: Always called when the thumbnail generation is over. Will contain an error if the thumbnail could not be successfully saved to disk at fileURL.
100        #[unsafe(method(saveBestRepresentationForRequest:toFileAtURL:asContentType:completionHandler:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn saveBestRepresentationForRequest_toFileAtURL_asContentType_completionHandler(
103            &self,
104            request: &QLThumbnailGenerationRequest,
105            file_url: &NSURL,
106            content_type: &UTType,
107            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
108        );
109
110        #[cfg(all(feature = "QLThumbnailGenerationRequest", feature = "block2"))]
111        /// Saves a thumbnail for the request on disk at fileURL.
112        /// The file saved at fileURL has to be deleted when it is not used anymore.
113        /// This is primarily intended for file provider extensions which need to upload thumbnails and have a small memory limit.
114        ///
115        ///
116        /// Parameter `contentType`: An image content type to save the thumbnail as, supported by CGImageDestination, such as kUTTypePNG or kUTTypeJPEG
117        ///
118        /// Parameter `completionHandler`: Always called when the thumbnail generation is over. Will contain an error if the thumbnail could not be successfully saved to disk at fileURL.
119        #[deprecated]
120        #[unsafe(method(saveBestRepresentationForRequest:toFileAtURL:withContentType:completionHandler:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn saveBestRepresentationForRequest_toFileAtURL_withContentType_completionHandler(
123            &self,
124            request: &QLThumbnailGenerationRequest,
125            file_url: &NSURL,
126            content_type: &NSString,
127            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
128        );
129    );
130}
131
132/// Methods declared on superclass `NSObject`.
133impl QLThumbnailGenerator {
134    extern_methods!(
135        #[unsafe(method(init))]
136        #[unsafe(method_family = init)]
137        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
138
139        #[unsafe(method(new))]
140        #[unsafe(method_family = new)]
141        pub unsafe fn new() -> Retained<Self>;
142    );
143}