1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10#[cfg(feature = "objc2-core-graphics")]
11use objc2_core_graphics::*;
12
13use crate::*;
14
15pub const kQLReturnMask: c_uint = 0xaf00;
17pub const kQLReturnHasMore: c_uint = kQLReturnMask | 10;
19#[doc(alias = "QLThumbnailRequestRef")]
23#[repr(C)]
24pub struct QLThumbnailRequest {
25 inner: [u8; 0],
26 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
27}
28
29cf_type!(
30 unsafe impl QLThumbnailRequest {}
31);
32#[cfg(feature = "objc2")]
33cf_objc2_type!(
34 unsafe impl RefEncode<"__QLThumbnailRequest"> for QLThumbnailRequest {}
35);
36
37unsafe impl ConcreteType for QLThumbnailRequest {
38 #[doc(alias = "QLThumbnailRequestGetTypeID")]
40 #[inline]
41 fn type_id() -> CFTypeID {
42 extern "C-unwind" {
43 fn QLThumbnailRequestGetTypeID() -> CFTypeID;
44 }
45 unsafe { QLThumbnailRequestGetTypeID() }
46 }
47}
48
49impl QLThumbnailRequest {
50 #[doc(alias = "QLThumbnailRequestCopyURL")]
56 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
57 #[inline]
58 pub unsafe fn url(&self) -> Option<CFRetained<CFURL>> {
59 extern "C-unwind" {
60 fn QLThumbnailRequestCopyURL(thumbnail: &QLThumbnailRequest) -> Option<NonNull<CFURL>>;
61 }
62 let ret = unsafe { QLThumbnailRequestCopyURL(self) };
63 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
64 }
65
66 #[doc(alias = "QLThumbnailRequestCopyOptions")]
72 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
73 #[inline]
74 pub unsafe fn options(&self) -> Option<CFRetained<CFDictionary>> {
75 extern "C-unwind" {
76 fn QLThumbnailRequestCopyOptions(
77 thumbnail: &QLThumbnailRequest,
78 ) -> Option<NonNull<CFDictionary>>;
79 }
80 let ret = unsafe { QLThumbnailRequestCopyOptions(self) };
81 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
82 }
83
84 #[doc(alias = "QLThumbnailRequestCopyContentUTI")]
90 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
91 #[inline]
92 pub unsafe fn content_uti(&self) -> Option<CFRetained<CFString>> {
93 extern "C-unwind" {
94 fn QLThumbnailRequestCopyContentUTI(
95 thumbnail: &QLThumbnailRequest,
96 ) -> Option<NonNull<CFString>>;
97 }
98 let ret = unsafe { QLThumbnailRequestCopyContentUTI(self) };
99 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
100 }
101
102 #[doc(alias = "QLThumbnailRequestGetMaximumSize")]
108 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
109 #[inline]
110 pub unsafe fn maximum_size(&self) -> CGSize {
111 extern "C-unwind" {
112 fn QLThumbnailRequestGetMaximumSize(thumbnail: &QLThumbnailRequest) -> CGSize;
113 }
114 unsafe { QLThumbnailRequestGetMaximumSize(self) }
115 }
116
117 #[doc(alias = "QLThumbnailRequestGetGeneratorBundle")]
121 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
122 #[inline]
123 pub unsafe fn generator_bundle(&self) -> Option<CFRetained<CFBundle>> {
124 extern "C-unwind" {
125 fn QLThumbnailRequestGetGeneratorBundle(
126 thumbnail: &QLThumbnailRequest,
127 ) -> Option<NonNull<CFBundle>>;
128 }
129 let ret = unsafe { QLThumbnailRequestGetGeneratorBundle(self) };
130 ret.map(|ret| unsafe { CFRetained::retain(ret) })
131 }
132
133 #[doc(alias = "QLThumbnailRequestSetDocumentObject")]
148 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
149 #[inline]
150 pub unsafe fn set_document_object(
151 &self,
152 object: *const c_void,
153 callbacks: *const CFArrayCallBacks,
154 ) {
155 extern "C-unwind" {
156 fn QLThumbnailRequestSetDocumentObject(
157 thumbnail: &QLThumbnailRequest,
158 object: *const c_void,
159 callbacks: *const CFArrayCallBacks,
160 );
161 }
162 unsafe { QLThumbnailRequestSetDocumentObject(self, object, callbacks) }
163 }
164
165 #[doc(alias = "QLThumbnailRequestGetDocumentObject")]
171 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
172 #[inline]
173 pub unsafe fn document_object(&self) -> *const c_void {
174 extern "C-unwind" {
175 fn QLThumbnailRequestGetDocumentObject(thumbnail: &QLThumbnailRequest)
176 -> *const c_void;
177 }
178 unsafe { QLThumbnailRequestGetDocumentObject(self) }
179 }
180
181 #[doc(alias = "QLThumbnailRequestSetImage")]
195 #[cfg(feature = "objc2-core-graphics")]
196 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types"]
197 #[inline]
198 pub unsafe fn set_image(&self, image: Option<&CGImage>, properties: Option<&CFDictionary>) {
199 extern "C-unwind" {
200 fn QLThumbnailRequestSetImage(
201 thumbnail: &QLThumbnailRequest,
202 image: Option<&CGImage>,
203 properties: Option<&CFDictionary>,
204 );
205 }
206 unsafe { QLThumbnailRequestSetImage(self, image, properties) }
207 }
208
209 #[doc(alias = "QLThumbnailRequestSetImageWithData")]
223 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
224 #[inline]
225 pub unsafe fn set_image_with_data(
226 &self,
227 data: Option<&CFData>,
228 properties: Option<&CFDictionary>,
229 ) {
230 extern "C-unwind" {
231 fn QLThumbnailRequestSetImageWithData(
232 thumbnail: &QLThumbnailRequest,
233 data: Option<&CFData>,
234 properties: Option<&CFDictionary>,
235 );
236 }
237 unsafe { QLThumbnailRequestSetImageWithData(self, data, properties) }
238 }
239
240 #[doc(alias = "QLThumbnailRequestCreateContext")]
259 #[cfg(feature = "objc2-core-graphics")]
260 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
261 #[inline]
262 pub unsafe fn context(
263 &self,
264 size: CGSize,
265 is_bitmap: bool,
266 properties: Option<&CFDictionary>,
267 ) -> Option<CFRetained<CGContext>> {
268 extern "C-unwind" {
269 fn QLThumbnailRequestCreateContext(
270 thumbnail: &QLThumbnailRequest,
271 size: CGSize,
272 is_bitmap: Boolean,
273 properties: Option<&CFDictionary>,
274 ) -> Option<NonNull<CGContext>>;
275 }
276 let ret =
277 unsafe { QLThumbnailRequestCreateContext(self, size, is_bitmap as _, properties) };
278 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
279 }
280
281 #[doc(alias = "QLThumbnailRequestFlushContext")]
291 #[cfg(feature = "objc2-core-graphics")]
292 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
293 #[inline]
294 pub unsafe fn flush_context(&self, context: Option<&CGContext>) {
295 extern "C-unwind" {
296 fn QLThumbnailRequestFlushContext(
297 thumbnail: &QLThumbnailRequest,
298 context: Option<&CGContext>,
299 );
300 }
301 unsafe { QLThumbnailRequestFlushContext(self, context) }
302 }
303
304 #[doc(alias = "QLThumbnailRequestSetImageAtURL")]
318 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
319 #[inline]
320 pub unsafe fn set_image_at_url(&self, url: Option<&CFURL>, properties: Option<&CFDictionary>) {
321 extern "C-unwind" {
322 fn QLThumbnailRequestSetImageAtURL(
323 thumbnail: &QLThumbnailRequest,
324 url: Option<&CFURL>,
325 properties: Option<&CFDictionary>,
326 );
327 }
328 unsafe { QLThumbnailRequestSetImageAtURL(self, url, properties) }
329 }
330
331 #[doc(alias = "QLThumbnailRequestSetThumbnailWithDataRepresentation")]
354 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
355 #[inline]
356 pub unsafe fn set_thumbnail_with_data_representation(
357 &self,
358 data: Option<&CFData>,
359 content_type_uti: Option<&CFString>,
360 preview_properties: Option<&CFDictionary>,
361 properties: Option<&CFDictionary>,
362 ) {
363 extern "C-unwind" {
364 fn QLThumbnailRequestSetThumbnailWithDataRepresentation(
365 thumbnail: &QLThumbnailRequest,
366 data: Option<&CFData>,
367 content_type_uti: Option<&CFString>,
368 preview_properties: Option<&CFDictionary>,
369 properties: Option<&CFDictionary>,
370 );
371 }
372 unsafe {
373 QLThumbnailRequestSetThumbnailWithDataRepresentation(
374 self,
375 data,
376 content_type_uti,
377 preview_properties,
378 properties,
379 )
380 }
381 }
382
383 #[doc(alias = "QLThumbnailRequestSetThumbnailWithURLRepresentation")]
404 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
405 #[inline]
406 pub unsafe fn set_thumbnail_with_url_representation(
407 &self,
408 url: Option<&CFURL>,
409 content_type_uti: Option<&CFString>,
410 preview_properties: Option<&CFDictionary>,
411 properties: Option<&CFDictionary>,
412 ) {
413 extern "C-unwind" {
414 fn QLThumbnailRequestSetThumbnailWithURLRepresentation(
415 thumbnail: &QLThumbnailRequest,
416 url: Option<&CFURL>,
417 content_type_uti: Option<&CFString>,
418 preview_properties: Option<&CFDictionary>,
419 properties: Option<&CFDictionary>,
420 );
421 }
422 unsafe {
423 QLThumbnailRequestSetThumbnailWithURLRepresentation(
424 self,
425 url,
426 content_type_uti,
427 preview_properties,
428 properties,
429 )
430 }
431 }
432
433 #[doc(alias = "QLThumbnailRequestIsCancelled")]
439 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
440 #[inline]
441 pub unsafe fn is_cancelled(&self) -> bool {
442 extern "C-unwind" {
443 fn QLThumbnailRequestIsCancelled(thumbnail: &QLThumbnailRequest) -> Boolean;
444 }
445 let ret = unsafe { QLThumbnailRequestIsCancelled(self) };
446 ret != 0
447 }
448}
449
450extern "C" {
451 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
455 pub static kQLThumbnailPropertyExtensionKey: Option<&'static CFString>;
456}
457
458extern "C" {
459 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
463 pub static kQLThumbnailPropertyBadgeImageKey: Option<&'static CFString>;
464}
465
466extern "C" {
467 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
474 pub static kQLThumbnailPropertyBaseBundlePathKey: Option<&'static CFString>;
475}
476
477#[doc(alias = "QLPreviewRequestRef")]
481#[repr(C)]
482pub struct QLPreviewRequest {
483 inner: [u8; 0],
484 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
485}
486
487cf_type!(
488 unsafe impl QLPreviewRequest {}
489);
490#[cfg(feature = "objc2")]
491cf_objc2_type!(
492 unsafe impl RefEncode<"__QLPreviewRequest"> for QLPreviewRequest {}
493);
494
495unsafe impl ConcreteType for QLPreviewRequest {
496 #[doc(alias = "QLPreviewRequestGetTypeID")]
498 #[inline]
499 fn type_id() -> CFTypeID {
500 extern "C-unwind" {
501 fn QLPreviewRequestGetTypeID() -> CFTypeID;
502 }
503 unsafe { QLPreviewRequestGetTypeID() }
504 }
505}
506
507extern "C" {
508 #[deprecated = "Use the title property of your QLPreviewingController in a Preview Extension."]
512 pub static kQLPreviewPropertyDisplayNameKey: Option<&'static CFString>;
513}
514
515extern "C" {
516 #[deprecated = "Use the preferredContentSize property of your QLPreviewingController in a Preview Extension."]
520 pub static kQLPreviewPropertyWidthKey: Option<&'static CFString>;
521}
522
523extern "C" {
524 #[deprecated = "Use the preferredContentSize property of your QLPreviewingController in a Preview Extension."]
528 pub static kQLPreviewPropertyHeightKey: Option<&'static CFString>;
529}
530
531extern "C" {
532 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
539 pub static kQLPreviewPropertyBaseBundlePathKey: Option<&'static CFString>;
540}
541
542extern "C" {
543 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
547 pub static kQLPreviewPropertyStringEncodingKey: Option<&'static CFString>;
548}
549
550#[repr(transparent)]
552#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
553pub struct QLPreviewPDFStyle(pub c_uint);
554impl QLPreviewPDFStyle {
555 #[doc(alias = "kQLPreviewPDFStandardStyle")]
556 pub const StandardStyle: Self = Self(0);
557 #[doc(alias = "kQLPreviewPDFPagesWithThumbnailsOnRightStyle")]
558 pub const PagesWithThumbnailsOnRightStyle: Self = Self(3);
559 #[doc(alias = "kQLPreviewPDFPagesWithThumbnailsOnLeftStyle")]
560 pub const PagesWithThumbnailsOnLeftStyle: Self = Self(4);
561}
562
563#[cfg(feature = "objc2")]
564unsafe impl Encode for QLPreviewPDFStyle {
565 const ENCODING: Encoding = c_uint::ENCODING;
566}
567
568#[cfg(feature = "objc2")]
569unsafe impl RefEncode for QLPreviewPDFStyle {
570 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
571}
572
573extern "C" {
574 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
578 pub static kQLPreviewPropertyPDFStyleKey: Option<&'static CFString>;
579}
580
581extern "C" {
582 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
588 pub static kQLPreviewOptionCursorKey: Option<&'static CFString>;
589}
590
591extern "C" {
592 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
597 pub static kQLPreviewPropertyCursorKey: Option<&'static CFString>;
598}
599
600impl QLPreviewRequest {
601 #[doc(alias = "QLPreviewRequestCopyURL")]
607 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
608 #[inline]
609 pub unsafe fn url(&self) -> Option<CFRetained<CFURL>> {
610 extern "C-unwind" {
611 fn QLPreviewRequestCopyURL(preview: &QLPreviewRequest) -> Option<NonNull<CFURL>>;
612 }
613 let ret = unsafe { QLPreviewRequestCopyURL(self) };
614 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
615 }
616
617 #[doc(alias = "QLPreviewRequestCopyOptions")]
623 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
624 #[inline]
625 pub unsafe fn options(&self) -> Option<CFRetained<CFDictionary>> {
626 extern "C-unwind" {
627 fn QLPreviewRequestCopyOptions(
628 preview: &QLPreviewRequest,
629 ) -> Option<NonNull<CFDictionary>>;
630 }
631 let ret = unsafe { QLPreviewRequestCopyOptions(self) };
632 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
633 }
634
635 #[doc(alias = "QLPreviewRequestCopyContentUTI")]
641 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
642 #[inline]
643 pub unsafe fn content_uti(&self) -> Option<CFRetained<CFString>> {
644 extern "C-unwind" {
645 fn QLPreviewRequestCopyContentUTI(
646 preview: &QLPreviewRequest,
647 ) -> Option<NonNull<CFString>>;
648 }
649 let ret = unsafe { QLPreviewRequestCopyContentUTI(self) };
650 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
651 }
652
653 #[doc(alias = "QLPreviewRequestGetGeneratorBundle")]
657 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
658 #[inline]
659 pub unsafe fn generator_bundle(&self) -> Option<CFRetained<CFBundle>> {
660 extern "C-unwind" {
661 fn QLPreviewRequestGetGeneratorBundle(
662 preview: &QLPreviewRequest,
663 ) -> Option<NonNull<CFBundle>>;
664 }
665 let ret = unsafe { QLPreviewRequestGetGeneratorBundle(self) };
666 ret.map(|ret| unsafe { CFRetained::retain(ret) })
667 }
668
669 #[doc(alias = "QLPreviewRequestSetDocumentObject")]
684 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
685 #[inline]
686 pub unsafe fn set_document_object(
687 &self,
688 object: *const c_void,
689 callbacks: *const CFArrayCallBacks,
690 ) {
691 extern "C-unwind" {
692 fn QLPreviewRequestSetDocumentObject(
693 preview: &QLPreviewRequest,
694 object: *const c_void,
695 callbacks: *const CFArrayCallBacks,
696 );
697 }
698 unsafe { QLPreviewRequestSetDocumentObject(self, object, callbacks) }
699 }
700
701 #[doc(alias = "QLPreviewRequestGetDocumentObject")]
707 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
708 #[inline]
709 pub unsafe fn document_object(&self) -> *const c_void {
710 extern "C-unwind" {
711 fn QLPreviewRequestGetDocumentObject(preview: &QLPreviewRequest) -> *const c_void;
712 }
713 unsafe { QLPreviewRequestGetDocumentObject(self) }
714 }
715
716 #[doc(alias = "QLPreviewRequestIsCancelled")]
722 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
723 #[inline]
724 pub unsafe fn is_cancelled(&self) -> bool {
725 extern "C-unwind" {
726 fn QLPreviewRequestIsCancelled(preview: &QLPreviewRequest) -> Boolean;
727 }
728 let ret = unsafe { QLPreviewRequestIsCancelled(self) };
729 ret != 0
730 }
731
732 #[doc(alias = "QLPreviewRequestSetDataRepresentation")]
753 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
754 #[inline]
755 pub unsafe fn set_data_representation(
756 &self,
757 data: Option<&CFData>,
758 content_type_uti: Option<&CFString>,
759 properties: Option<&CFDictionary>,
760 ) {
761 extern "C-unwind" {
762 fn QLPreviewRequestSetDataRepresentation(
763 preview: &QLPreviewRequest,
764 data: Option<&CFData>,
765 content_type_uti: Option<&CFString>,
766 properties: Option<&CFDictionary>,
767 );
768 }
769 unsafe { QLPreviewRequestSetDataRepresentation(self, data, content_type_uti, properties) }
770 }
771
772 #[doc(alias = "QLPreviewRequestSetURLRepresentation")]
793 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
794 #[inline]
795 pub unsafe fn set_url_representation(
796 &self,
797 url: Option<&CFURL>,
798 content_type_uti: Option<&CFString>,
799 properties: Option<&CFDictionary>,
800 ) {
801 extern "C-unwind" {
802 fn QLPreviewRequestSetURLRepresentation(
803 preview: &QLPreviewRequest,
804 url: Option<&CFURL>,
805 content_type_uti: Option<&CFString>,
806 properties: Option<&CFDictionary>,
807 );
808 }
809 unsafe { QLPreviewRequestSetURLRepresentation(self, url, content_type_uti, properties) }
810 }
811
812 #[doc(alias = "QLPreviewRequestCreateContext")]
827 #[cfg(feature = "objc2-core-graphics")]
828 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
829 #[inline]
830 pub unsafe fn context(
831 &self,
832 size: CGSize,
833 is_bitmap: bool,
834 properties: Option<&CFDictionary>,
835 ) -> Option<CFRetained<CGContext>> {
836 extern "C-unwind" {
837 fn QLPreviewRequestCreateContext(
838 preview: &QLPreviewRequest,
839 size: CGSize,
840 is_bitmap: Boolean,
841 properties: Option<&CFDictionary>,
842 ) -> Option<NonNull<CGContext>>;
843 }
844 let ret = unsafe { QLPreviewRequestCreateContext(self, size, is_bitmap as _, properties) };
845 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
846 }
847
848 #[doc(alias = "QLPreviewRequestCreatePDFContext")]
866 #[cfg(feature = "objc2-core-graphics")]
867 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
868 #[inline]
869 pub unsafe fn pdf_context(
870 &self,
871 media_box: *const CGRect,
872 auxiliary_info: Option<&CFDictionary>,
873 properties: Option<&CFDictionary>,
874 ) -> Option<CFRetained<CGContext>> {
875 extern "C-unwind" {
876 fn QLPreviewRequestCreatePDFContext(
877 preview: &QLPreviewRequest,
878 media_box: *const CGRect,
879 auxiliary_info: Option<&CFDictionary>,
880 properties: Option<&CFDictionary>,
881 ) -> Option<NonNull<CGContext>>;
882 }
883 let ret = unsafe {
884 QLPreviewRequestCreatePDFContext(self, media_box, auxiliary_info, properties)
885 };
886 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
887 }
888
889 #[doc(alias = "QLPreviewRequestFlushContext")]
899 #[cfg(feature = "objc2-core-graphics")]
900 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
901 #[inline]
902 pub unsafe fn flush_context(&self, context: Option<&CGContext>) {
903 extern "C-unwind" {
904 fn QLPreviewRequestFlushContext(
905 preview: &QLPreviewRequest,
906 context: Option<&CGContext>,
907 );
908 }
909 unsafe { QLPreviewRequestFlushContext(self, context) }
910 }
911}
912
913extern "C" {
914 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
918 pub static kQLPreviewPropertyMIMETypeKey: Option<&'static CFString>;
919}
920
921extern "C" {
922 pub static kQLPreviewPropertyTextEncodingNameKey: Option<&'static CFString>;
926}
927
928extern "C" {
929 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
933 pub static kQLPreviewPropertyAttachmentDataKey: Option<&'static CFString>;
934}
935
936extern "C" {
937 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
945 pub static kQLPreviewPropertyAttachmentsKey: Option<&'static CFString>;
946}
947
948extern "C" {
949 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
953 pub static kQLPreviewContentIDScheme: Option<&'static CFString>;
954}
955
956#[repr(C)]
958#[allow(unpredictable_function_pointer_comparisons)]
959#[derive(Clone, Copy, Debug, PartialEq)]
960pub struct QLGeneratorInterfaceStruct {
961 pub(crate) _reserved: *mut c_void,
962 pub QueryInterface:
963 Option<unsafe extern "C-unwind" fn(*mut c_void, REFIID, *mut LPVOID) -> HRESULT>,
964 pub AddRef: Option<unsafe extern "C-unwind" fn(*mut c_void) -> ULONG>,
965 pub Release: Option<unsafe extern "C-unwind" fn(*mut c_void) -> ULONG>,
966 pub GenerateThumbnailForURL: Option<
967 unsafe extern "C-unwind" fn(
968 *mut c_void,
969 *mut QLThumbnailRequest,
970 *const CFURL,
971 *const CFString,
972 *const CFDictionary,
973 CGSize,
974 ) -> OSStatus,
975 >,
976 pub CancelThumbnailGeneration:
977 Option<unsafe extern "C-unwind" fn(*mut c_void, *mut QLThumbnailRequest)>,
978 pub GeneratePreviewForURL: Option<
979 unsafe extern "C-unwind" fn(
980 *mut c_void,
981 *mut QLPreviewRequest,
982 *const CFURL,
983 *const CFString,
984 *const CFDictionary,
985 ) -> OSStatus,
986 >,
987 pub CancelPreviewGeneration:
988 Option<unsafe extern "C-unwind" fn(*mut c_void, *mut QLPreviewRequest)>,
989}
990
991#[cfg(feature = "objc2")]
992unsafe impl Encode for QLGeneratorInterfaceStruct {
993 const ENCODING: Encoding = Encoding::Struct("?", &[
994 <*mut c_void>::ENCODING,
995 <Option<unsafe extern "C-unwind" fn(*mut c_void,REFIID,*mut LPVOID,) -> HRESULT>>::ENCODING,
996 <Option<unsafe extern "C-unwind" fn(*mut c_void,) -> ULONG>>::ENCODING,
997 <Option<unsafe extern "C-unwind" fn(*mut c_void,) -> ULONG>>::ENCODING,
998 <Option<unsafe extern "C-unwind" fn(*mut c_void,*mut QLThumbnailRequest,*const CFURL,*const CFString,*const CFDictionary,CGSize,) -> OSStatus>>::ENCODING,
999 <Option<unsafe extern "C-unwind" fn(*mut c_void,*mut QLThumbnailRequest,)>>::ENCODING,
1000 <Option<unsafe extern "C-unwind" fn(*mut c_void,*mut QLPreviewRequest,*const CFURL,*const CFString,*const CFDictionary,) -> OSStatus>>::ENCODING,
1001 <Option<unsafe extern "C-unwind" fn(*mut c_void,*mut QLPreviewRequest,)>>::ENCODING,
1002 ]);
1003}
1004
1005#[cfg(feature = "objc2")]
1006unsafe impl RefEncode for QLGeneratorInterfaceStruct {
1007 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1008}
1009
1010#[deprecated = "renamed to `QLThumbnailRequest::url`"]
1011#[inline]
1012pub unsafe extern "C-unwind" fn QLThumbnailRequestCopyURL(
1013 thumbnail: &QLThumbnailRequest,
1014) -> Option<CFRetained<CFURL>> {
1015 extern "C-unwind" {
1016 fn QLThumbnailRequestCopyURL(thumbnail: &QLThumbnailRequest) -> Option<NonNull<CFURL>>;
1017 }
1018 let ret = unsafe { QLThumbnailRequestCopyURL(thumbnail) };
1019 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1020}
1021
1022#[deprecated = "renamed to `QLThumbnailRequest::options`"]
1023#[inline]
1024pub unsafe extern "C-unwind" fn QLThumbnailRequestCopyOptions(
1025 thumbnail: &QLThumbnailRequest,
1026) -> Option<CFRetained<CFDictionary>> {
1027 extern "C-unwind" {
1028 fn QLThumbnailRequestCopyOptions(
1029 thumbnail: &QLThumbnailRequest,
1030 ) -> Option<NonNull<CFDictionary>>;
1031 }
1032 let ret = unsafe { QLThumbnailRequestCopyOptions(thumbnail) };
1033 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1034}
1035
1036#[deprecated = "renamed to `QLThumbnailRequest::content_uti`"]
1037#[inline]
1038pub unsafe extern "C-unwind" fn QLThumbnailRequestCopyContentUTI(
1039 thumbnail: &QLThumbnailRequest,
1040) -> Option<CFRetained<CFString>> {
1041 extern "C-unwind" {
1042 fn QLThumbnailRequestCopyContentUTI(
1043 thumbnail: &QLThumbnailRequest,
1044 ) -> Option<NonNull<CFString>>;
1045 }
1046 let ret = unsafe { QLThumbnailRequestCopyContentUTI(thumbnail) };
1047 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1048}
1049
1050extern "C-unwind" {
1051 #[deprecated = "renamed to `QLThumbnailRequest::maximum_size`"]
1052 pub fn QLThumbnailRequestGetMaximumSize(thumbnail: &QLThumbnailRequest) -> CGSize;
1053}
1054
1055#[deprecated = "renamed to `QLThumbnailRequest::generator_bundle`"]
1056#[inline]
1057pub unsafe extern "C-unwind" fn QLThumbnailRequestGetGeneratorBundle(
1058 thumbnail: &QLThumbnailRequest,
1059) -> Option<CFRetained<CFBundle>> {
1060 extern "C-unwind" {
1061 fn QLThumbnailRequestGetGeneratorBundle(
1062 thumbnail: &QLThumbnailRequest,
1063 ) -> Option<NonNull<CFBundle>>;
1064 }
1065 let ret = unsafe { QLThumbnailRequestGetGeneratorBundle(thumbnail) };
1066 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1067}
1068
1069extern "C-unwind" {
1070 #[deprecated = "renamed to `QLThumbnailRequest::set_document_object`"]
1071 pub fn QLThumbnailRequestSetDocumentObject(
1072 thumbnail: &QLThumbnailRequest,
1073 object: *const c_void,
1074 callbacks: *const CFArrayCallBacks,
1075 );
1076}
1077
1078extern "C-unwind" {
1079 #[deprecated = "renamed to `QLThumbnailRequest::document_object`"]
1080 pub fn QLThumbnailRequestGetDocumentObject(thumbnail: &QLThumbnailRequest) -> *const c_void;
1081}
1082
1083extern "C-unwind" {
1084 #[cfg(feature = "objc2-core-graphics")]
1085 #[deprecated = "renamed to `QLThumbnailRequest::set_image`"]
1086 pub fn QLThumbnailRequestSetImage(
1087 thumbnail: &QLThumbnailRequest,
1088 image: Option<&CGImage>,
1089 properties: Option<&CFDictionary>,
1090 );
1091}
1092
1093extern "C-unwind" {
1094 #[deprecated = "renamed to `QLThumbnailRequest::set_image_with_data`"]
1095 pub fn QLThumbnailRequestSetImageWithData(
1096 thumbnail: &QLThumbnailRequest,
1097 data: Option<&CFData>,
1098 properties: Option<&CFDictionary>,
1099 );
1100}
1101
1102#[cfg(feature = "objc2-core-graphics")]
1103#[deprecated = "renamed to `QLThumbnailRequest::context`"]
1104#[inline]
1105pub unsafe extern "C-unwind" fn QLThumbnailRequestCreateContext(
1106 thumbnail: &QLThumbnailRequest,
1107 size: CGSize,
1108 is_bitmap: bool,
1109 properties: Option<&CFDictionary>,
1110) -> Option<CFRetained<CGContext>> {
1111 extern "C-unwind" {
1112 fn QLThumbnailRequestCreateContext(
1113 thumbnail: &QLThumbnailRequest,
1114 size: CGSize,
1115 is_bitmap: Boolean,
1116 properties: Option<&CFDictionary>,
1117 ) -> Option<NonNull<CGContext>>;
1118 }
1119 let ret =
1120 unsafe { QLThumbnailRequestCreateContext(thumbnail, size, is_bitmap as _, properties) };
1121 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1122}
1123
1124extern "C-unwind" {
1125 #[cfg(feature = "objc2-core-graphics")]
1126 #[deprecated = "renamed to `QLThumbnailRequest::flush_context`"]
1127 pub fn QLThumbnailRequestFlushContext(
1128 thumbnail: &QLThumbnailRequest,
1129 context: Option<&CGContext>,
1130 );
1131}
1132
1133extern "C-unwind" {
1134 #[deprecated = "renamed to `QLThumbnailRequest::set_image_at_url`"]
1135 pub fn QLThumbnailRequestSetImageAtURL(
1136 thumbnail: &QLThumbnailRequest,
1137 url: Option<&CFURL>,
1138 properties: Option<&CFDictionary>,
1139 );
1140}
1141
1142extern "C-unwind" {
1143 #[deprecated = "renamed to `QLThumbnailRequest::set_thumbnail_with_data_representation`"]
1144 pub fn QLThumbnailRequestSetThumbnailWithDataRepresentation(
1145 thumbnail: &QLThumbnailRequest,
1146 data: Option<&CFData>,
1147 content_type_uti: Option<&CFString>,
1148 preview_properties: Option<&CFDictionary>,
1149 properties: Option<&CFDictionary>,
1150 );
1151}
1152
1153extern "C-unwind" {
1154 #[deprecated = "renamed to `QLThumbnailRequest::set_thumbnail_with_url_representation`"]
1155 pub fn QLThumbnailRequestSetThumbnailWithURLRepresentation(
1156 thumbnail: &QLThumbnailRequest,
1157 url: Option<&CFURL>,
1158 content_type_uti: Option<&CFString>,
1159 preview_properties: Option<&CFDictionary>,
1160 properties: Option<&CFDictionary>,
1161 );
1162}
1163
1164#[deprecated = "renamed to `QLThumbnailRequest::is_cancelled`"]
1165#[inline]
1166pub unsafe extern "C-unwind" fn QLThumbnailRequestIsCancelled(
1167 thumbnail: &QLThumbnailRequest,
1168) -> bool {
1169 extern "C-unwind" {
1170 fn QLThumbnailRequestIsCancelled(thumbnail: &QLThumbnailRequest) -> Boolean;
1171 }
1172 let ret = unsafe { QLThumbnailRequestIsCancelled(thumbnail) };
1173 ret != 0
1174}
1175
1176#[deprecated = "renamed to `QLPreviewRequest::url`"]
1177#[inline]
1178pub unsafe extern "C-unwind" fn QLPreviewRequestCopyURL(
1179 preview: &QLPreviewRequest,
1180) -> Option<CFRetained<CFURL>> {
1181 extern "C-unwind" {
1182 fn QLPreviewRequestCopyURL(preview: &QLPreviewRequest) -> Option<NonNull<CFURL>>;
1183 }
1184 let ret = unsafe { QLPreviewRequestCopyURL(preview) };
1185 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1186}
1187
1188#[deprecated = "renamed to `QLPreviewRequest::options`"]
1189#[inline]
1190pub unsafe extern "C-unwind" fn QLPreviewRequestCopyOptions(
1191 preview: &QLPreviewRequest,
1192) -> Option<CFRetained<CFDictionary>> {
1193 extern "C-unwind" {
1194 fn QLPreviewRequestCopyOptions(preview: &QLPreviewRequest)
1195 -> Option<NonNull<CFDictionary>>;
1196 }
1197 let ret = unsafe { QLPreviewRequestCopyOptions(preview) };
1198 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1199}
1200
1201#[deprecated = "renamed to `QLPreviewRequest::content_uti`"]
1202#[inline]
1203pub unsafe extern "C-unwind" fn QLPreviewRequestCopyContentUTI(
1204 preview: &QLPreviewRequest,
1205) -> Option<CFRetained<CFString>> {
1206 extern "C-unwind" {
1207 fn QLPreviewRequestCopyContentUTI(preview: &QLPreviewRequest) -> Option<NonNull<CFString>>;
1208 }
1209 let ret = unsafe { QLPreviewRequestCopyContentUTI(preview) };
1210 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1211}
1212
1213#[deprecated = "renamed to `QLPreviewRequest::generator_bundle`"]
1214#[inline]
1215pub unsafe extern "C-unwind" fn QLPreviewRequestGetGeneratorBundle(
1216 preview: &QLPreviewRequest,
1217) -> Option<CFRetained<CFBundle>> {
1218 extern "C-unwind" {
1219 fn QLPreviewRequestGetGeneratorBundle(
1220 preview: &QLPreviewRequest,
1221 ) -> Option<NonNull<CFBundle>>;
1222 }
1223 let ret = unsafe { QLPreviewRequestGetGeneratorBundle(preview) };
1224 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1225}
1226
1227extern "C-unwind" {
1228 #[deprecated = "renamed to `QLPreviewRequest::set_document_object`"]
1229 pub fn QLPreviewRequestSetDocumentObject(
1230 preview: &QLPreviewRequest,
1231 object: *const c_void,
1232 callbacks: *const CFArrayCallBacks,
1233 );
1234}
1235
1236extern "C-unwind" {
1237 #[deprecated = "renamed to `QLPreviewRequest::document_object`"]
1238 pub fn QLPreviewRequestGetDocumentObject(preview: &QLPreviewRequest) -> *const c_void;
1239}
1240
1241#[deprecated = "renamed to `QLPreviewRequest::is_cancelled`"]
1242#[inline]
1243pub unsafe extern "C-unwind" fn QLPreviewRequestIsCancelled(preview: &QLPreviewRequest) -> bool {
1244 extern "C-unwind" {
1245 fn QLPreviewRequestIsCancelled(preview: &QLPreviewRequest) -> Boolean;
1246 }
1247 let ret = unsafe { QLPreviewRequestIsCancelled(preview) };
1248 ret != 0
1249}
1250
1251extern "C-unwind" {
1252 #[deprecated = "renamed to `QLPreviewRequest::set_data_representation`"]
1253 pub fn QLPreviewRequestSetDataRepresentation(
1254 preview: &QLPreviewRequest,
1255 data: Option<&CFData>,
1256 content_type_uti: Option<&CFString>,
1257 properties: Option<&CFDictionary>,
1258 );
1259}
1260
1261extern "C-unwind" {
1262 #[deprecated = "renamed to `QLPreviewRequest::set_url_representation`"]
1263 pub fn QLPreviewRequestSetURLRepresentation(
1264 preview: &QLPreviewRequest,
1265 url: Option<&CFURL>,
1266 content_type_uti: Option<&CFString>,
1267 properties: Option<&CFDictionary>,
1268 );
1269}
1270
1271#[cfg(feature = "objc2-core-graphics")]
1272#[deprecated = "renamed to `QLPreviewRequest::context`"]
1273#[inline]
1274pub unsafe extern "C-unwind" fn QLPreviewRequestCreateContext(
1275 preview: &QLPreviewRequest,
1276 size: CGSize,
1277 is_bitmap: bool,
1278 properties: Option<&CFDictionary>,
1279) -> Option<CFRetained<CGContext>> {
1280 extern "C-unwind" {
1281 fn QLPreviewRequestCreateContext(
1282 preview: &QLPreviewRequest,
1283 size: CGSize,
1284 is_bitmap: Boolean,
1285 properties: Option<&CFDictionary>,
1286 ) -> Option<NonNull<CGContext>>;
1287 }
1288 let ret = unsafe { QLPreviewRequestCreateContext(preview, size, is_bitmap as _, properties) };
1289 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1290}
1291
1292#[cfg(feature = "objc2-core-graphics")]
1293#[deprecated = "renamed to `QLPreviewRequest::pdf_context`"]
1294#[inline]
1295pub unsafe extern "C-unwind" fn QLPreviewRequestCreatePDFContext(
1296 preview: &QLPreviewRequest,
1297 media_box: *const CGRect,
1298 auxiliary_info: Option<&CFDictionary>,
1299 properties: Option<&CFDictionary>,
1300) -> Option<CFRetained<CGContext>> {
1301 extern "C-unwind" {
1302 fn QLPreviewRequestCreatePDFContext(
1303 preview: &QLPreviewRequest,
1304 media_box: *const CGRect,
1305 auxiliary_info: Option<&CFDictionary>,
1306 properties: Option<&CFDictionary>,
1307 ) -> Option<NonNull<CGContext>>;
1308 }
1309 let ret =
1310 unsafe { QLPreviewRequestCreatePDFContext(preview, media_box, auxiliary_info, properties) };
1311 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1312}
1313
1314extern "C-unwind" {
1315 #[cfg(feature = "objc2-core-graphics")]
1316 #[deprecated = "renamed to `QLPreviewRequest::flush_context`"]
1317 pub fn QLPreviewRequestFlushContext(preview: &QLPreviewRequest, context: Option<&CGContext>);
1318}