objc2_quick_look_thumbnailing/generated/QLThumbnailReply.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-graphics")]
9use objc2_core_graphics::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14extern_class!(
15 /// To provide a thumbnail for a request, you have to return a QLThumbnailReply object.
16 ///
17 ///
18 /// To provide a thumbnail, you have two options:
19 /// 1. Draw the thumbnail, by providing a QLThumbnailReply created with a drawing block.
20 /// 2. Pass the thumbnail file URL, by providing a QLThumbnailReply created with a file URL.
21 ///
22 /// See also [Apple's documentation](https://developer.apple.com/documentation/quicklookthumbnailing/qlthumbnailreply?language=objc)
23 #[unsafe(super(NSObject))]
24 #[derive(Debug, PartialEq, Eq, Hash)]
25 pub struct QLThumbnailReply;
26);
27
28extern_conformance!(
29 unsafe impl NSObjectProtocol for QLThumbnailReply {}
30);
31
32impl QLThumbnailReply {
33 extern_methods!(
34 /// The extensionBadge is a short string identifying the file type used as a badge when producing an icon.
35 #[unsafe(method(extensionBadge))]
36 #[unsafe(method_family = none)]
37 pub unsafe fn extensionBadge(&self) -> Retained<NSString>;
38
39 /// Setter for [`extensionBadge`][Self::extensionBadge].
40 ///
41 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
42 #[unsafe(method(setExtensionBadge:))]
43 #[unsafe(method_family = none)]
44 pub unsafe fn setExtensionBadge(&self, extension_badge: &NSString);
45
46 #[unsafe(method(init))]
47 #[unsafe(method_family = init)]
48 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
49
50 #[cfg(all(
51 feature = "block2",
52 feature = "objc2-core-foundation",
53 feature = "objc2-core-graphics"
54 ))]
55 /// You can create a reply with a drawing block that will draw into a given context with the coordinate system of Core Graphics.
56 ///
57 ///
58 /// Parameter `contextSize`: The desired size of the context that will be passed to the drawing block.
59 /// 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.
60 ///
61 /// Ideally, at least either contextSize's width matches maximumSize's width or contextSize's height matches maximumSize's height.
62 /// 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)).
63 ///
64 /// 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.
65 /// Return YES if the thumbnail was successfully drawn into the context. Return NO otherwise.
66 #[unsafe(method(replyWithContextSize:drawingBlock:))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn replyWithContextSize_drawingBlock(
69 context_size: CGSize,
70 drawing_block: &block2::DynBlock<dyn Fn(NonNull<CGContext>) -> Bool>,
71 ) -> Retained<Self>;
72
73 #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
74 /// You can create a reply with a drawing block that will draw into the current context with the coordinate system of UIKit or AppKit.
75 ///
76 ///
77 /// Parameter `contextSize`: The desired size of the context that will be passed to the drawing block.
78 /// 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.
79 ///
80 /// Ideally, at least either contextSize's width matches maximumSize's width or contextSize's height matches maximumSize's height.
81 /// 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)).
82 ///
83 /// Parameter `drawingBlock`: A block that draws the thumbnail into the current context which you can access via UIGraphicsGetCurrentContext() or [NSGraphicsContext currentContext].
84 /// It is a context of type CGBitmapContext, set up to be used with the coordinate system of UIKit or AppKit.
85 /// Return YES if the thumbnail was successfully drawn into the current context. Return NO otherwise.
86 #[unsafe(method(replyWithContextSize:currentContextDrawingBlock:))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn replyWithContextSize_currentContextDrawingBlock(
89 context_size: CGSize,
90 drawing_block: &block2::DynBlock<dyn Fn() -> Bool>,
91 ) -> Retained<Self>;
92
93 /// You can create a reply object with a file URL of an image that will be used as the thumbnail.
94 /// The image will be downscaled to fit the size of the QLFileThumbnailRequest if necessary.
95 #[unsafe(method(replyWithImageFileURL:))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn replyWithImageFileURL(file_url: &NSURL) -> Retained<Self>;
98 );
99}
100
101/// Methods declared on superclass `NSObject`.
102impl QLThumbnailReply {
103 extern_methods!(
104 #[unsafe(method(new))]
105 #[unsafe(method_family = new)]
106 pub unsafe fn new() -> Retained<Self>;
107 );
108}