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
//! 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// To provide a thumbnail for a request, you have to return a QLThumbnailReply object.
///
///
/// To provide a thumbnail, you have two options:
/// 1. Draw the thumbnail, by providing a QLThumbnailReply created with a drawing block.
/// 2. Pass the thumbnail file URL, by providing a QLThumbnailReply created with a file URL.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/quicklookthumbnailing/qlthumbnailreply?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct QLThumbnailReply;
);
extern_conformance!(
unsafe impl NSObjectProtocol for QLThumbnailReply {}
);
impl QLThumbnailReply {
extern_methods!(
/// The extensionBadge is a short string identifying the file type used as a badge when producing an icon.
#[unsafe(method(extensionBadge))]
#[unsafe(method_family = none)]
pub unsafe fn extensionBadge(&self) -> Retained<NSString>;
/// Setter for [`extensionBadge`][Self::extensionBadge].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setExtensionBadge:))]
#[unsafe(method_family = none)]
pub unsafe fn setExtensionBadge(&self, extension_badge: &NSString);
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(
feature = "block2",
feature = "objc2-core-foundation",
feature = "objc2-core-graphics"
))]
/// You can create a reply with a drawing block that will draw into a given context with the coordinate system of Core Graphics.
///
///
/// Parameter `contextSize`: The desired size of the context that will be passed to the drawing block.
/// It should be as close as possible to the maximumSize of the QLFileThumbnailRequest and it has to be greater than or equal to its minimumSize.
///
/// Ideally, at least either contextSize's width matches maximumSize's width or contextSize's height matches maximumSize's height.
/// The context size will be scaled to QLFileThumbnailRequest's scale value (if you pass (x, y), the size of the context will be (scale * x, scale * y)).
///
/// Parameter `drawingBlock`: The thumbnail should be drawn into the context passed to this block. It is a context of type CGBitmapContext, set up to be used with the coordinate system of Core Graphics.
/// Return YES if the thumbnail was successfully drawn into the context. Return NO otherwise.
#[unsafe(method(replyWithContextSize:drawingBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn replyWithContextSize_drawingBlock(
context_size: CGSize,
drawing_block: &block2::DynBlock<dyn Fn(NonNull<CGContext>) -> Bool>,
) -> Retained<Self>;
#[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
/// You can create a reply with a drawing block that will draw into the current context with the coordinate system of UIKit or AppKit.
///
///
/// Parameter `contextSize`: The desired size of the context that will be passed to the drawing block.
/// It should be as close as possible to the maximumSize of the QLFileThumbnailRequest and it has to be greater than or equal to its minimumSize.
///
/// Ideally, at least either contextSize's width matches maximumSize's width or contextSize's height matches maximumSize's height.
/// The context size will be scaled to QLFileThumbnailRequest's scale value (if you pass (x, y), the size of the context will be (scale * x, scale * y)).
///
/// Parameter `drawingBlock`: A block that draws the thumbnail into the current context which you can access via UIGraphicsGetCurrentContext() or [NSGraphicsContext currentContext].
/// It is a context of type CGBitmapContext, set up to be used with the coordinate system of UIKit or AppKit.
/// Return YES if the thumbnail was successfully drawn into the current context. Return NO otherwise.
#[unsafe(method(replyWithContextSize:currentContextDrawingBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn replyWithContextSize_currentContextDrawingBlock(
context_size: CGSize,
drawing_block: &block2::DynBlock<dyn Fn() -> Bool>,
) -> Retained<Self>;
/// You can create a reply object with a file URL of an image that will be used as the thumbnail.
/// The image will be downscaled to fit the size of the QLFileThumbnailRequest if necessary.
#[unsafe(method(replyWithImageFileURL:))]
#[unsafe(method_family = none)]
pub unsafe fn replyWithImageFileURL(file_url: &NSURL) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl QLThumbnailReply {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}