objc2_quick_look_thumbnailing/generated/
QLThumbnailGenerationRequest.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::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-uniform-type-identifiers")]
10use objc2_uniform_type_identifiers::*;
11
12use crate::*;
13
14/// [Apple's documentation](https://developer.apple.com/documentation/quicklookthumbnailing/qlthumbnailgenerationrequestrepresentationtypes?language=objc)
15// NS_OPTIONS
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct QLThumbnailGenerationRequestRepresentationTypes(pub NSUInteger);
19bitflags::bitflags! {
20    impl QLThumbnailGenerationRequestRepresentationTypes: NSUInteger {
21        #[doc(alias = "QLThumbnailGenerationRequestRepresentationTypeIcon")]
22        const Icon = 1<<0;
23        #[doc(alias = "QLThumbnailGenerationRequestRepresentationTypeLowQualityThumbnail")]
24        const LowQualityThumbnail = 1<<1;
25        #[doc(alias = "QLThumbnailGenerationRequestRepresentationTypeThumbnail")]
26        const Thumbnail = 1<<2;
27        #[doc(alias = "QLThumbnailGenerationRequestRepresentationTypeAll")]
28        const All = NSUIntegerMax as _;
29    }
30}
31
32unsafe impl Encode for QLThumbnailGenerationRequestRepresentationTypes {
33    const ENCODING: Encoding = NSUInteger::ENCODING;
34}
35
36unsafe impl RefEncode for QLThumbnailGenerationRequestRepresentationTypes {
37    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_class!(
41    /// [Apple's documentation](https://developer.apple.com/documentation/quicklookthumbnailing/qlthumbnailgenerationrequest?language=objc)
42    #[unsafe(super(NSObject))]
43    #[derive(Debug, PartialEq, Eq, Hash)]
44    pub struct QLThumbnailGenerationRequest;
45);
46
47extern_conformance!(
48    unsafe impl NSCoding for QLThumbnailGenerationRequest {}
49);
50
51extern_conformance!(
52    unsafe impl NSCopying for QLThumbnailGenerationRequest {}
53);
54
55unsafe impl CopyingHelper for QLThumbnailGenerationRequest {
56    type Result = Self;
57}
58
59extern_conformance!(
60    unsafe impl NSObjectProtocol for QLThumbnailGenerationRequest {}
61);
62
63extern_conformance!(
64    unsafe impl NSSecureCoding for QLThumbnailGenerationRequest {}
65);
66
67impl QLThumbnailGenerationRequest {
68    extern_methods!(
69        #[unsafe(method(init))]
70        #[unsafe(method_family = init)]
71        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
72
73        #[unsafe(method(new))]
74        #[unsafe(method_family = new)]
75        pub unsafe fn new() -> Retained<Self>;
76
77        #[cfg(feature = "objc2-core-foundation")]
78        /// Parameter `url`: The url of the file on disk for which a thumbnail is requested.
79        ///
80        /// Parameter `size`: The desired size of the thumbnails that should be generated.
81        ///
82        /// Parameter `scale`: The desired scale of the thumbnails that should be generated. This will usually be the scale of the screen.
83        /// You can for instance pass a scale different from the one of the screen if you would like to save generated thumbnails to a server to later download them on devices with a different screen scale.
84        ///
85        /// Parameter `representationTypes`: The desired successive representations of the thumbnail that should be generated when possible.
86        #[unsafe(method(initWithFileAtURL:size:scale:representationTypes:))]
87        #[unsafe(method_family = init)]
88        pub unsafe fn initWithFileAtURL_size_scale_representationTypes(
89            this: Allocated<Self>,
90            url: &NSURL,
91            size: CGSize,
92            scale: CGFloat,
93            representation_types: QLThumbnailGenerationRequestRepresentationTypes,
94        ) -> Retained<Self>;
95
96        #[cfg(feature = "objc2-uniform-type-identifiers")]
97        /// The content type of the file being thumbnailed is used to determine the provider of the thumbnail and the icon styles applied if iconMode is requested. By default the content type is derived from the file extension. Setting this property will override the derived content type. This is useful for files that don't have meaningful extensions but for which you may already know the content type.
98        #[unsafe(method(contentType))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn contentType(&self) -> Retained<UTType>;
101
102        #[cfg(feature = "objc2-uniform-type-identifiers")]
103        /// Setter for [`contentType`][Self::contentType].
104        #[unsafe(method(setContentType:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn setContentType(&self, content_type: Option<&UTType>);
107
108        #[cfg(feature = "objc2-core-foundation")]
109        /// Defaults to 0. If set, the thumbnail will have a width and height greater or equal to minimumDimension * scale.
110        /// If set and it is not possible to generate thumbnails of minimumDimension for any of the requested QLThumbnailGenerationRequestRepresentationTypes, no thumbnail will be provided.
111        #[unsafe(method(minimumDimension))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn minimumDimension(&self) -> CGFloat;
114
115        #[cfg(feature = "objc2-core-foundation")]
116        /// Setter for [`minimumDimension`][Self::minimumDimension].
117        #[unsafe(method(setMinimumDimension:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn setMinimumDimension(&self, minimum_dimension: CGFloat);
120
121        /// If set to YES, this will generate something appropriate for display as a file icon,
122        /// meaning that the thumbnail might be embedded in a frame, show a curled corner, draw a background
123        /// and/or a drop shadow, as appropriate for the platform.
124        /// If set to NO, this will generate a raw undecorated thumbnail.
125        /// Defaults to NO.
126        #[unsafe(method(iconMode))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn iconMode(&self) -> bool;
129
130        /// Setter for [`iconMode`][Self::iconMode].
131        #[unsafe(method(setIconMode:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn setIconMode(&self, icon_mode: bool);
134
135        #[cfg(feature = "objc2-core-foundation")]
136        #[unsafe(method(size))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn size(&self) -> CGSize;
139
140        #[cfg(feature = "objc2-core-foundation")]
141        #[unsafe(method(scale))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn scale(&self) -> CGFloat;
144
145        #[unsafe(method(representationTypes))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn representationTypes(&self)
148            -> QLThumbnailGenerationRequestRepresentationTypes;
149    );
150}