objc2_quick_look_thumbnailing/generated/
QLThumbnailRepresentation.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-app-kit")]
6#[cfg(target_os = "macos")]
7use objc2_app_kit::*;
8#[cfg(feature = "objc2-core-foundation")]
9use objc2_core_foundation::*;
10#[cfg(feature = "objc2-core-graphics")]
11use objc2_core_graphics::*;
12#[cfg(feature = "objc2-ui-kit")]
13#[cfg(any(target_os = "ios", target_os = "visionos"))]
14use objc2_ui_kit::*;
15
16use crate::*;
17
18/// [Apple's documentation](https://developer.apple.com/documentation/quicklookthumbnailing/qlthumbnailrepresentationtype?language=objc)
19// NS_ENUM
20#[repr(transparent)]
21#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
22pub struct QLThumbnailRepresentationType(pub NSInteger);
23impl QLThumbnailRepresentationType {
24    #[doc(alias = "QLThumbnailRepresentationTypeIcon")]
25    pub const Icon: Self = Self(0);
26    #[doc(alias = "QLThumbnailRepresentationTypeLowQualityThumbnail")]
27    pub const LowQualityThumbnail: Self = Self(1);
28    #[doc(alias = "QLThumbnailRepresentationTypeThumbnail")]
29    pub const Thumbnail: Self = Self(2);
30}
31
32unsafe impl Encode for QLThumbnailRepresentationType {
33    const ENCODING: Encoding = NSInteger::ENCODING;
34}
35
36unsafe impl RefEncode for QLThumbnailRepresentationType {
37    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_class!(
41    /// [Apple's documentation](https://developer.apple.com/documentation/quicklookthumbnailing/qlthumbnailrepresentation?language=objc)
42    #[unsafe(super(NSObject))]
43    #[derive(Debug, PartialEq, Eq, Hash)]
44    pub struct QLThumbnailRepresentation;
45);
46
47extern_conformance!(
48    unsafe impl NSObjectProtocol for QLThumbnailRepresentation {}
49);
50
51impl QLThumbnailRepresentation {
52    extern_methods!(
53        #[unsafe(method(type))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn r#type(&self) -> QLThumbnailRepresentationType;
56
57        #[cfg(feature = "objc2-core-graphics")]
58        /// Returns the CGImage representation of the thumbnail.
59        #[unsafe(method(CGImage))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn CGImage(&self) -> Retained<CGImage>;
62
63        #[cfg(feature = "objc2-ui-kit")]
64        #[cfg(any(target_os = "ios", target_os = "visionos"))]
65        /// Returns the UIImage representation of the thumbnail. You need to explicitly link against UIKit to use this property.
66        #[unsafe(method(UIImage))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn UIImage(&self) -> Retained<UIImage>;
69
70        #[cfg(feature = "objc2-app-kit")]
71        #[cfg(target_os = "macos")]
72        /// Returns the NSImage representation of the thumbnail. You need to explicitly link against AppKit to use this property.
73        #[unsafe(method(NSImage))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn NSImage(&self) -> Retained<NSImage>;
76
77        #[cfg(feature = "objc2-core-foundation")]
78        /// Returns the the effective rect within the thumbnail image representing the content of the document. In icon mode, this is the part of the image without all the image decorations.
79        #[unsafe(method(contentRect))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn contentRect(&self) -> CGRect;
82    );
83}
84
85/// Methods declared on superclass `NSObject`.
86impl QLThumbnailRepresentation {
87    extern_methods!(
88        #[unsafe(method(init))]
89        #[unsafe(method_family = init)]
90        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
91
92        #[unsafe(method(new))]
93        #[unsafe(method_family = new)]
94        pub unsafe fn new() -> Retained<Self>;
95    );
96}