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        ///
105        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
106        #[unsafe(method(setContentType:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn setContentType(&self, content_type: Option<&UTType>);
109
110        #[cfg(feature = "objc2-core-foundation")]
111        /// Defaults to 0. If set, the thumbnail will have a width and height greater or equal to minimumDimension * scale.
112        /// If set and it is not possible to generate thumbnails of minimumDimension for any of the requested QLThumbnailGenerationRequestRepresentationTypes, no thumbnail will be provided.
113        #[unsafe(method(minimumDimension))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn minimumDimension(&self) -> CGFloat;
116
117        #[cfg(feature = "objc2-core-foundation")]
118        /// Setter for [`minimumDimension`][Self::minimumDimension].
119        #[unsafe(method(setMinimumDimension:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setMinimumDimension(&self, minimum_dimension: CGFloat);
122
123        /// If set to YES, this will generate something appropriate for display as a file icon,
124        /// meaning that the thumbnail might be embedded in a frame, show a curled corner, draw a background
125        /// and/or a drop shadow, as appropriate for the platform.
126        /// If set to NO, this will generate a raw undecorated thumbnail.
127        /// Defaults to NO.
128        #[unsafe(method(iconMode))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn iconMode(&self) -> bool;
131
132        /// Setter for [`iconMode`][Self::iconMode].
133        #[unsafe(method(setIconMode:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setIconMode(&self, icon_mode: bool);
136
137        #[cfg(feature = "objc2-core-foundation")]
138        #[unsafe(method(size))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn size(&self) -> CGSize;
141
142        #[cfg(feature = "objc2-core-foundation")]
143        #[unsafe(method(scale))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn scale(&self) -> CGFloat;
146
147        #[unsafe(method(representationTypes))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn representationTypes(&self)
150            -> QLThumbnailGenerationRequestRepresentationTypes;
151    );
152}