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