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 #[unsafe(method(setExtensionBadge:))]
41 #[unsafe(method_family = none)]
42 pub unsafe fn setExtensionBadge(&self, extension_badge: &NSString);
43
44 #[unsafe(method(init))]
45 #[unsafe(method_family = init)]
46 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
47
48 #[cfg(all(
49 feature = "block2",
50 feature = "objc2-core-foundation",
51 feature = "objc2-core-graphics"
52 ))]
53 /// You can create a reply with a drawing block that will draw into a given context with the coordinate system of Core Graphics.
54 ///
55 ///
56 /// Parameter `contextSize`: The desired size of the context that will be passed to the drawing block.
57 /// 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.
58 ///
59 /// Ideally, at least either contextSize's width matches maximumSize's width or contextSize's height matches maximumSize's height.
60 /// 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)).
61 ///
62 /// 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.
63 /// Return YES if the thumbnail was successfully drawn into the context. Return NO otherwise.
64 #[unsafe(method(replyWithContextSize:drawingBlock:))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn replyWithContextSize_drawingBlock(
67 context_size: CGSize,
68 drawing_block: &block2::DynBlock<dyn Fn(NonNull<CGContext>) -> Bool>,
69 ) -> Retained<Self>;
70
71 #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
72 /// You can create a reply with a drawing block that will draw into the current context with the coordinate system of UIKit or AppKit.
73 ///
74 ///
75 /// Parameter `contextSize`: The desired size of the context that will be passed to the drawing block.
76 /// 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.
77 ///
78 /// Ideally, at least either contextSize's width matches maximumSize's width or contextSize's height matches maximumSize's height.
79 /// 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)).
80 ///
81 /// Parameter `drawingBlock`: A block that draws the thumbnail into the current context which you can access via UIGraphicsGetCurrentContext() or [NSGraphicsContext currentContext].
82 /// It is a context of type CGBitmapContext, set up to be used with the coordinate system of UIKit or AppKit.
83 /// Return YES if the thumbnail was successfully drawn into the current context. Return NO otherwise.
84 #[unsafe(method(replyWithContextSize:currentContextDrawingBlock:))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn replyWithContextSize_currentContextDrawingBlock(
87 context_size: CGSize,
88 drawing_block: &block2::DynBlock<dyn Fn() -> Bool>,
89 ) -> Retained<Self>;
90
91 /// You can create a reply object with a file URL of an image that will be used as the thumbnail.
92 /// The image will be downscaled to fit the size of the QLFileThumbnailRequest if necessary.
93 #[unsafe(method(replyWithImageFileURL:))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn replyWithImageFileURL(file_url: &NSURL) -> Retained<Self>;
96 );
97}
98
99/// Methods declared on superclass `NSObject`.
100impl QLThumbnailReply {
101 extern_methods!(
102 #[unsafe(method(new))]
103 #[unsafe(method_family = new)]
104 pub unsafe fn new() -> Retained<Self>;
105 );
106}