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#[repr(C)]
23pub struct QLThumbnailRequest {
24 inner: [u8; 0],
25 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
26}
27
28cf_type!(
29 unsafe impl QLThumbnailRequest {}
30);
31#[cfg(feature = "objc2")]
32cf_objc2_type!(
33 unsafe impl RefEncode<"__QLThumbnailRequest"> for QLThumbnailRequest {}
34);
35
36unsafe impl ConcreteType for QLThumbnailRequest {
37 #[doc(alias = "QLThumbnailRequestGetTypeID")]
39 #[inline]
40 fn type_id() -> CFTypeID {
41 extern "C-unwind" {
42 fn QLThumbnailRequestGetTypeID() -> CFTypeID;
43 }
44 unsafe { QLThumbnailRequestGetTypeID() }
45 }
46}
47
48impl QLThumbnailRequest {
49 #[doc(alias = "QLThumbnailRequestCopyURL")]
55 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
56 #[inline]
57 pub unsafe fn url(self: &QLThumbnailRequest) -> Option<CFRetained<CFURL>> {
58 extern "C-unwind" {
59 fn QLThumbnailRequestCopyURL(thumbnail: &QLThumbnailRequest) -> Option<NonNull<CFURL>>;
60 }
61 let ret = unsafe { QLThumbnailRequestCopyURL(self) };
62 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
63 }
64
65 #[doc(alias = "QLThumbnailRequestCopyOptions")]
71 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
72 #[inline]
73 pub unsafe fn options(self: &QLThumbnailRequest) -> Option<CFRetained<CFDictionary>> {
74 extern "C-unwind" {
75 fn QLThumbnailRequestCopyOptions(
76 thumbnail: &QLThumbnailRequest,
77 ) -> Option<NonNull<CFDictionary>>;
78 }
79 let ret = unsafe { QLThumbnailRequestCopyOptions(self) };
80 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
81 }
82
83 #[doc(alias = "QLThumbnailRequestCopyContentUTI")]
89 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
90 #[inline]
91 pub unsafe fn content_uti(self: &QLThumbnailRequest) -> Option<CFRetained<CFString>> {
92 extern "C-unwind" {
93 fn QLThumbnailRequestCopyContentUTI(
94 thumbnail: &QLThumbnailRequest,
95 ) -> Option<NonNull<CFString>>;
96 }
97 let ret = unsafe { QLThumbnailRequestCopyContentUTI(self) };
98 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
99 }
100
101 #[doc(alias = "QLThumbnailRequestGetMaximumSize")]
107 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
108 #[inline]
109 pub unsafe fn maximum_size(self: &QLThumbnailRequest) -> CGSize {
110 extern "C-unwind" {
111 fn QLThumbnailRequestGetMaximumSize(thumbnail: &QLThumbnailRequest) -> CGSize;
112 }
113 unsafe { QLThumbnailRequestGetMaximumSize(self) }
114 }
115
116 #[doc(alias = "QLThumbnailRequestGetGeneratorBundle")]
120 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
121 #[inline]
122 pub unsafe fn generator_bundle(self: &QLThumbnailRequest) -> Option<CFRetained<CFBundle>> {
123 extern "C-unwind" {
124 fn QLThumbnailRequestGetGeneratorBundle(
125 thumbnail: &QLThumbnailRequest,
126 ) -> Option<NonNull<CFBundle>>;
127 }
128 let ret = unsafe { QLThumbnailRequestGetGeneratorBundle(self) };
129 ret.map(|ret| unsafe { CFRetained::retain(ret) })
130 }
131
132 #[doc(alias = "QLThumbnailRequestSetDocumentObject")]
142 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
143 #[inline]
144 pub unsafe fn set_document_object(
145 self: &QLThumbnailRequest,
146 object: *const c_void,
147 callbacks: *const CFArrayCallBacks,
148 ) {
149 extern "C-unwind" {
150 fn QLThumbnailRequestSetDocumentObject(
151 thumbnail: &QLThumbnailRequest,
152 object: *const c_void,
153 callbacks: *const CFArrayCallBacks,
154 );
155 }
156 unsafe { QLThumbnailRequestSetDocumentObject(self, object, callbacks) }
157 }
158
159 #[doc(alias = "QLThumbnailRequestGetDocumentObject")]
165 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
166 #[inline]
167 pub unsafe fn document_object(self: &QLThumbnailRequest) -> *const c_void {
168 extern "C-unwind" {
169 fn QLThumbnailRequestGetDocumentObject(thumbnail: &QLThumbnailRequest)
170 -> *const c_void;
171 }
172 unsafe { QLThumbnailRequestGetDocumentObject(self) }
173 }
174
175 #[doc(alias = "QLThumbnailRequestSetImage")]
183 #[cfg(feature = "objc2-core-graphics")]
184 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types"]
185 #[inline]
186 pub unsafe fn set_image(
187 self: &QLThumbnailRequest,
188 image: Option<&CGImage>,
189 properties: Option<&CFDictionary>,
190 ) {
191 extern "C-unwind" {
192 fn QLThumbnailRequestSetImage(
193 thumbnail: &QLThumbnailRequest,
194 image: Option<&CGImage>,
195 properties: Option<&CFDictionary>,
196 );
197 }
198 unsafe { QLThumbnailRequestSetImage(self, image, properties) }
199 }
200
201 #[doc(alias = "QLThumbnailRequestSetImageWithData")]
209 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
210 #[inline]
211 pub unsafe fn set_image_with_data(
212 self: &QLThumbnailRequest,
213 data: Option<&CFData>,
214 properties: Option<&CFDictionary>,
215 ) {
216 extern "C-unwind" {
217 fn QLThumbnailRequestSetImageWithData(
218 thumbnail: &QLThumbnailRequest,
219 data: Option<&CFData>,
220 properties: Option<&CFDictionary>,
221 );
222 }
223 unsafe { QLThumbnailRequestSetImageWithData(self, data, properties) }
224 }
225
226 #[doc(alias = "QLThumbnailRequestCreateContext")]
240 #[cfg(feature = "objc2-core-graphics")]
241 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
242 #[inline]
243 pub unsafe fn context(
244 self: &QLThumbnailRequest,
245 size: CGSize,
246 is_bitmap: bool,
247 properties: Option<&CFDictionary>,
248 ) -> Option<CFRetained<CGContext>> {
249 extern "C-unwind" {
250 fn QLThumbnailRequestCreateContext(
251 thumbnail: &QLThumbnailRequest,
252 size: CGSize,
253 is_bitmap: Boolean,
254 properties: Option<&CFDictionary>,
255 ) -> Option<NonNull<CGContext>>;
256 }
257 let ret =
258 unsafe { QLThumbnailRequestCreateContext(self, size, is_bitmap as _, properties) };
259 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
260 }
261
262 #[doc(alias = "QLThumbnailRequestFlushContext")]
268 #[cfg(feature = "objc2-core-graphics")]
269 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
270 #[inline]
271 pub unsafe fn flush_context(self: &QLThumbnailRequest, context: Option<&CGContext>) {
272 extern "C-unwind" {
273 fn QLThumbnailRequestFlushContext(
274 thumbnail: &QLThumbnailRequest,
275 context: Option<&CGContext>,
276 );
277 }
278 unsafe { QLThumbnailRequestFlushContext(self, context) }
279 }
280
281 #[doc(alias = "QLThumbnailRequestSetImageAtURL")]
289 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
290 #[inline]
291 pub unsafe fn set_image_at_url(
292 self: &QLThumbnailRequest,
293 url: Option<&CFURL>,
294 properties: Option<&CFDictionary>,
295 ) {
296 extern "C-unwind" {
297 fn QLThumbnailRequestSetImageAtURL(
298 thumbnail: &QLThumbnailRequest,
299 url: Option<&CFURL>,
300 properties: Option<&CFDictionary>,
301 );
302 }
303 unsafe { QLThumbnailRequestSetImageAtURL(self, url, properties) }
304 }
305
306 #[doc(alias = "QLThumbnailRequestSetThumbnailWithDataRepresentation")]
320 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
321 #[inline]
322 pub unsafe fn set_thumbnail_with_data_representation(
323 self: &QLThumbnailRequest,
324 data: Option<&CFData>,
325 content_type_uti: Option<&CFString>,
326 preview_properties: Option<&CFDictionary>,
327 properties: Option<&CFDictionary>,
328 ) {
329 extern "C-unwind" {
330 fn QLThumbnailRequestSetThumbnailWithDataRepresentation(
331 thumbnail: &QLThumbnailRequest,
332 data: Option<&CFData>,
333 content_type_uti: Option<&CFString>,
334 preview_properties: Option<&CFDictionary>,
335 properties: Option<&CFDictionary>,
336 );
337 }
338 unsafe {
339 QLThumbnailRequestSetThumbnailWithDataRepresentation(
340 self,
341 data,
342 content_type_uti,
343 preview_properties,
344 properties,
345 )
346 }
347 }
348
349 #[doc(alias = "QLThumbnailRequestSetThumbnailWithURLRepresentation")]
361 #[deprecated = "Use a QLThumbnailReply in a Thumbnail Extension to provide thumbnails for your file types."]
362 #[inline]
363 pub unsafe fn set_thumbnail_with_url_representation(
364 self: &QLThumbnailRequest,
365 url: Option<&CFURL>,
366 content_type_uti: Option<&CFString>,
367 preview_properties: Option<&CFDictionary>,
368 properties: Option<&CFDictionary>,
369 ) {
370 extern "C-unwind" {
371 fn QLThumbnailRequestSetThumbnailWithURLRepresentation(
372 thumbnail: &QLThumbnailRequest,
373 url: Option<&CFURL>,
374 content_type_uti: Option<&CFString>,
375 preview_properties: Option<&CFDictionary>,
376 properties: Option<&CFDictionary>,
377 );
378 }
379 unsafe {
380 QLThumbnailRequestSetThumbnailWithURLRepresentation(
381 self,
382 url,
383 content_type_uti,
384 preview_properties,
385 properties,
386 )
387 }
388 }
389
390 #[doc(alias = "QLThumbnailRequestIsCancelled")]
396 #[deprecated = "Use a QLFileThumbnailRequest in a Thumbnail Extension to provide thumbnails for your file types."]
397 #[inline]
398 pub unsafe fn is_cancelled(self: &QLThumbnailRequest) -> bool {
399 extern "C-unwind" {
400 fn QLThumbnailRequestIsCancelled(thumbnail: &QLThumbnailRequest) -> Boolean;
401 }
402 let ret = unsafe { QLThumbnailRequestIsCancelled(self) };
403 ret != 0
404 }
405}
406
407extern "C" {
408 pub static kQLThumbnailPropertyExtensionKey: Option<&'static CFString>;
412}
413
414extern "C" {
415 pub static kQLThumbnailPropertyBadgeImageKey: Option<&'static CFString>;
419}
420
421extern "C" {
422 pub static kQLThumbnailPropertyBaseBundlePathKey: Option<&'static CFString>;
429}
430
431#[repr(C)]
435pub struct QLPreviewRequest {
436 inner: [u8; 0],
437 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
438}
439
440cf_type!(
441 unsafe impl QLPreviewRequest {}
442);
443#[cfg(feature = "objc2")]
444cf_objc2_type!(
445 unsafe impl RefEncode<"__QLPreviewRequest"> for QLPreviewRequest {}
446);
447
448unsafe impl ConcreteType for QLPreviewRequest {
449 #[doc(alias = "QLPreviewRequestGetTypeID")]
451 #[inline]
452 fn type_id() -> CFTypeID {
453 extern "C-unwind" {
454 fn QLPreviewRequestGetTypeID() -> CFTypeID;
455 }
456 unsafe { QLPreviewRequestGetTypeID() }
457 }
458}
459
460extern "C" {
461 pub static kQLPreviewPropertyDisplayNameKey: Option<&'static CFString>;
465}
466
467extern "C" {
468 pub static kQLPreviewPropertyWidthKey: Option<&'static CFString>;
472}
473
474extern "C" {
475 pub static kQLPreviewPropertyHeightKey: Option<&'static CFString>;
479}
480
481extern "C" {
482 pub static kQLPreviewPropertyBaseBundlePathKey: Option<&'static CFString>;
489}
490
491extern "C" {
492 pub static kQLPreviewPropertyStringEncodingKey: Option<&'static CFString>;
496}
497
498#[repr(transparent)]
500#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
501pub struct QLPreviewPDFStyle(pub c_uint);
502impl QLPreviewPDFStyle {
503 #[doc(alias = "kQLPreviewPDFStandardStyle")]
504 pub const StandardStyle: Self = Self(0);
505 #[doc(alias = "kQLPreviewPDFPagesWithThumbnailsOnRightStyle")]
506 pub const PagesWithThumbnailsOnRightStyle: Self = Self(3);
507 #[doc(alias = "kQLPreviewPDFPagesWithThumbnailsOnLeftStyle")]
508 pub const PagesWithThumbnailsOnLeftStyle: Self = Self(4);
509}
510
511#[cfg(feature = "objc2")]
512unsafe impl Encode for QLPreviewPDFStyle {
513 const ENCODING: Encoding = c_uint::ENCODING;
514}
515
516#[cfg(feature = "objc2")]
517unsafe impl RefEncode for QLPreviewPDFStyle {
518 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
519}
520
521extern "C" {
522 pub static kQLPreviewPropertyPDFStyleKey: Option<&'static CFString>;
526}
527
528extern "C" {
529 pub static kQLPreviewOptionCursorKey: Option<&'static CFString>;
535}
536
537extern "C" {
538 pub static kQLPreviewPropertyCursorKey: Option<&'static CFString>;
543}
544
545impl QLPreviewRequest {
546 #[doc(alias = "QLPreviewRequestCopyURL")]
552 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
553 #[inline]
554 pub unsafe fn url(self: &QLPreviewRequest) -> Option<CFRetained<CFURL>> {
555 extern "C-unwind" {
556 fn QLPreviewRequestCopyURL(preview: &QLPreviewRequest) -> Option<NonNull<CFURL>>;
557 }
558 let ret = unsafe { QLPreviewRequestCopyURL(self) };
559 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
560 }
561
562 #[doc(alias = "QLPreviewRequestCopyOptions")]
568 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
569 #[inline]
570 pub unsafe fn options(self: &QLPreviewRequest) -> Option<CFRetained<CFDictionary>> {
571 extern "C-unwind" {
572 fn QLPreviewRequestCopyOptions(
573 preview: &QLPreviewRequest,
574 ) -> Option<NonNull<CFDictionary>>;
575 }
576 let ret = unsafe { QLPreviewRequestCopyOptions(self) };
577 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
578 }
579
580 #[doc(alias = "QLPreviewRequestCopyContentUTI")]
586 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
587 #[inline]
588 pub unsafe fn content_uti(self: &QLPreviewRequest) -> Option<CFRetained<CFString>> {
589 extern "C-unwind" {
590 fn QLPreviewRequestCopyContentUTI(
591 preview: &QLPreviewRequest,
592 ) -> Option<NonNull<CFString>>;
593 }
594 let ret = unsafe { QLPreviewRequestCopyContentUTI(self) };
595 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
596 }
597
598 #[doc(alias = "QLPreviewRequestGetGeneratorBundle")]
602 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
603 #[inline]
604 pub unsafe fn generator_bundle(self: &QLPreviewRequest) -> Option<CFRetained<CFBundle>> {
605 extern "C-unwind" {
606 fn QLPreviewRequestGetGeneratorBundle(
607 preview: &QLPreviewRequest,
608 ) -> Option<NonNull<CFBundle>>;
609 }
610 let ret = unsafe { QLPreviewRequestGetGeneratorBundle(self) };
611 ret.map(|ret| unsafe { CFRetained::retain(ret) })
612 }
613
614 #[doc(alias = "QLPreviewRequestSetDocumentObject")]
624 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
625 #[inline]
626 pub unsafe fn set_document_object(
627 self: &QLPreviewRequest,
628 object: *const c_void,
629 callbacks: *const CFArrayCallBacks,
630 ) {
631 extern "C-unwind" {
632 fn QLPreviewRequestSetDocumentObject(
633 preview: &QLPreviewRequest,
634 object: *const c_void,
635 callbacks: *const CFArrayCallBacks,
636 );
637 }
638 unsafe { QLPreviewRequestSetDocumentObject(self, object, callbacks) }
639 }
640
641 #[doc(alias = "QLPreviewRequestGetDocumentObject")]
647 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
648 #[inline]
649 pub unsafe fn document_object(self: &QLPreviewRequest) -> *const c_void {
650 extern "C-unwind" {
651 fn QLPreviewRequestGetDocumentObject(preview: &QLPreviewRequest) -> *const c_void;
652 }
653 unsafe { QLPreviewRequestGetDocumentObject(self) }
654 }
655
656 #[doc(alias = "QLPreviewRequestIsCancelled")]
662 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
663 #[inline]
664 pub unsafe fn is_cancelled(self: &QLPreviewRequest) -> bool {
665 extern "C-unwind" {
666 fn QLPreviewRequestIsCancelled(preview: &QLPreviewRequest) -> Boolean;
667 }
668 let ret = unsafe { QLPreviewRequestIsCancelled(self) };
669 ret != 0
670 }
671
672 #[doc(alias = "QLPreviewRequestSetDataRepresentation")]
686 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
687 #[inline]
688 pub unsafe fn set_data_representation(
689 self: &QLPreviewRequest,
690 data: Option<&CFData>,
691 content_type_uti: Option<&CFString>,
692 properties: Option<&CFDictionary>,
693 ) {
694 extern "C-unwind" {
695 fn QLPreviewRequestSetDataRepresentation(
696 preview: &QLPreviewRequest,
697 data: Option<&CFData>,
698 content_type_uti: Option<&CFString>,
699 properties: Option<&CFDictionary>,
700 );
701 }
702 unsafe { QLPreviewRequestSetDataRepresentation(self, data, content_type_uti, properties) }
703 }
704
705 #[doc(alias = "QLPreviewRequestSetURLRepresentation")]
719 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
720 #[inline]
721 pub unsafe fn set_url_representation(
722 self: &QLPreviewRequest,
723 url: Option<&CFURL>,
724 content_type_uti: Option<&CFString>,
725 properties: Option<&CFDictionary>,
726 ) {
727 extern "C-unwind" {
728 fn QLPreviewRequestSetURLRepresentation(
729 preview: &QLPreviewRequest,
730 url: Option<&CFURL>,
731 content_type_uti: Option<&CFString>,
732 properties: Option<&CFDictionary>,
733 );
734 }
735 unsafe { QLPreviewRequestSetURLRepresentation(self, url, content_type_uti, properties) }
736 }
737
738 #[doc(alias = "QLPreviewRequestCreateContext")]
748 #[cfg(feature = "objc2-core-graphics")]
749 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
750 #[inline]
751 pub unsafe fn context(
752 self: &QLPreviewRequest,
753 size: CGSize,
754 is_bitmap: bool,
755 properties: Option<&CFDictionary>,
756 ) -> Option<CFRetained<CGContext>> {
757 extern "C-unwind" {
758 fn QLPreviewRequestCreateContext(
759 preview: &QLPreviewRequest,
760 size: CGSize,
761 is_bitmap: Boolean,
762 properties: Option<&CFDictionary>,
763 ) -> Option<NonNull<CGContext>>;
764 }
765 let ret = unsafe { QLPreviewRequestCreateContext(self, size, is_bitmap as _, properties) };
766 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
767 }
768
769 #[doc(alias = "QLPreviewRequestCreatePDFContext")]
779 #[cfg(feature = "objc2-core-graphics")]
780 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
781 #[inline]
782 pub unsafe fn pdf_context(
783 self: &QLPreviewRequest,
784 media_box: *const CGRect,
785 auxiliary_info: Option<&CFDictionary>,
786 properties: Option<&CFDictionary>,
787 ) -> Option<CFRetained<CGContext>> {
788 extern "C-unwind" {
789 fn QLPreviewRequestCreatePDFContext(
790 preview: &QLPreviewRequest,
791 media_box: *const CGRect,
792 auxiliary_info: Option<&CFDictionary>,
793 properties: Option<&CFDictionary>,
794 ) -> Option<NonNull<CGContext>>;
795 }
796 let ret = unsafe {
797 QLPreviewRequestCreatePDFContext(self, media_box, auxiliary_info, properties)
798 };
799 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
800 }
801
802 #[doc(alias = "QLPreviewRequestFlushContext")]
808 #[cfg(feature = "objc2-core-graphics")]
809 #[deprecated = "Use a QLPreviewingController in a Preview Extension to provide previews for your file types."]
810 #[inline]
811 pub unsafe fn flush_context(self: &QLPreviewRequest, context: Option<&CGContext>) {
812 extern "C-unwind" {
813 fn QLPreviewRequestFlushContext(
814 preview: &QLPreviewRequest,
815 context: Option<&CGContext>,
816 );
817 }
818 unsafe { QLPreviewRequestFlushContext(self, context) }
819 }
820}
821
822extern "C" {
823 pub static kQLPreviewPropertyMIMETypeKey: Option<&'static CFString>;
827}
828
829extern "C" {
830 pub static kQLPreviewPropertyTextEncodingNameKey: Option<&'static CFString>;
834}
835
836extern "C" {
837 pub static kQLPreviewPropertyAttachmentDataKey: Option<&'static CFString>;
841}
842
843extern "C" {
844 pub static kQLPreviewPropertyAttachmentsKey: Option<&'static CFString>;
852}
853
854extern "C" {
855 pub static kQLPreviewContentIDScheme: Option<&'static CFString>;
859}
860
861#[repr(C)]
863#[derive(Clone, Copy, Debug, PartialEq)]
864pub struct QLGeneratorInterfaceStruct {
865 pub(crate) _reserved: *mut c_void,
866 pub QueryInterface:
867 Option<unsafe extern "C-unwind" fn(*mut c_void, REFIID, *mut LPVOID) -> HRESULT>,
868 pub AddRef: Option<unsafe extern "C-unwind" fn(*mut c_void) -> ULONG>,
869 pub Release: Option<unsafe extern "C-unwind" fn(*mut c_void) -> ULONG>,
870 pub GenerateThumbnailForURL: Option<
871 unsafe extern "C-unwind" fn(
872 *mut c_void,
873 *mut QLThumbnailRequest,
874 *const CFURL,
875 *const CFString,
876 *const CFDictionary,
877 CGSize,
878 ) -> OSStatus,
879 >,
880 pub CancelThumbnailGeneration:
881 Option<unsafe extern "C-unwind" fn(*mut c_void, *mut QLThumbnailRequest)>,
882 pub GeneratePreviewForURL: Option<
883 unsafe extern "C-unwind" fn(
884 *mut c_void,
885 *mut QLPreviewRequest,
886 *const CFURL,
887 *const CFString,
888 *const CFDictionary,
889 ) -> OSStatus,
890 >,
891 pub CancelPreviewGeneration:
892 Option<unsafe extern "C-unwind" fn(*mut c_void, *mut QLPreviewRequest)>,
893}
894
895#[cfg(feature = "objc2")]
896unsafe impl Encode for QLGeneratorInterfaceStruct {
897 const ENCODING: Encoding = Encoding::Struct("?", &[
898 <*mut c_void>::ENCODING,
899 <Option<unsafe extern "C-unwind" fn(*mut c_void,REFIID,*mut LPVOID,) -> HRESULT>>::ENCODING,
900 <Option<unsafe extern "C-unwind" fn(*mut c_void,) -> ULONG>>::ENCODING,
901 <Option<unsafe extern "C-unwind" fn(*mut c_void,) -> ULONG>>::ENCODING,
902 <Option<unsafe extern "C-unwind" fn(*mut c_void,*mut QLThumbnailRequest,*const CFURL,*const CFString,*const CFDictionary,CGSize,) -> OSStatus>>::ENCODING,
903 <Option<unsafe extern "C-unwind" fn(*mut c_void,*mut QLThumbnailRequest,)>>::ENCODING,
904 <Option<unsafe extern "C-unwind" fn(*mut c_void,*mut QLPreviewRequest,*const CFURL,*const CFString,*const CFDictionary,) -> OSStatus>>::ENCODING,
905 <Option<unsafe extern "C-unwind" fn(*mut c_void,*mut QLPreviewRequest,)>>::ENCODING,
906 ]);
907}
908
909#[cfg(feature = "objc2")]
910unsafe impl RefEncode for QLGeneratorInterfaceStruct {
911 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
912}
913
914#[deprecated = "renamed to `QLThumbnailRequest::url`"]
915#[inline]
916pub unsafe extern "C-unwind" fn QLThumbnailRequestCopyURL(
917 thumbnail: &QLThumbnailRequest,
918) -> Option<CFRetained<CFURL>> {
919 extern "C-unwind" {
920 fn QLThumbnailRequestCopyURL(thumbnail: &QLThumbnailRequest) -> Option<NonNull<CFURL>>;
921 }
922 let ret = unsafe { QLThumbnailRequestCopyURL(thumbnail) };
923 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
924}
925
926#[deprecated = "renamed to `QLThumbnailRequest::options`"]
927#[inline]
928pub unsafe extern "C-unwind" fn QLThumbnailRequestCopyOptions(
929 thumbnail: &QLThumbnailRequest,
930) -> Option<CFRetained<CFDictionary>> {
931 extern "C-unwind" {
932 fn QLThumbnailRequestCopyOptions(
933 thumbnail: &QLThumbnailRequest,
934 ) -> Option<NonNull<CFDictionary>>;
935 }
936 let ret = unsafe { QLThumbnailRequestCopyOptions(thumbnail) };
937 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
938}
939
940#[deprecated = "renamed to `QLThumbnailRequest::content_uti`"]
941#[inline]
942pub unsafe extern "C-unwind" fn QLThumbnailRequestCopyContentUTI(
943 thumbnail: &QLThumbnailRequest,
944) -> Option<CFRetained<CFString>> {
945 extern "C-unwind" {
946 fn QLThumbnailRequestCopyContentUTI(
947 thumbnail: &QLThumbnailRequest,
948 ) -> Option<NonNull<CFString>>;
949 }
950 let ret = unsafe { QLThumbnailRequestCopyContentUTI(thumbnail) };
951 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
952}
953
954extern "C-unwind" {
955 #[deprecated = "renamed to `QLThumbnailRequest::maximum_size`"]
956 pub fn QLThumbnailRequestGetMaximumSize(thumbnail: &QLThumbnailRequest) -> CGSize;
957}
958
959#[deprecated = "renamed to `QLThumbnailRequest::generator_bundle`"]
960#[inline]
961pub unsafe extern "C-unwind" fn QLThumbnailRequestGetGeneratorBundle(
962 thumbnail: &QLThumbnailRequest,
963) -> Option<CFRetained<CFBundle>> {
964 extern "C-unwind" {
965 fn QLThumbnailRequestGetGeneratorBundle(
966 thumbnail: &QLThumbnailRequest,
967 ) -> Option<NonNull<CFBundle>>;
968 }
969 let ret = unsafe { QLThumbnailRequestGetGeneratorBundle(thumbnail) };
970 ret.map(|ret| unsafe { CFRetained::retain(ret) })
971}
972
973extern "C-unwind" {
974 #[deprecated = "renamed to `QLThumbnailRequest::set_document_object`"]
975 pub fn QLThumbnailRequestSetDocumentObject(
976 thumbnail: &QLThumbnailRequest,
977 object: *const c_void,
978 callbacks: *const CFArrayCallBacks,
979 );
980}
981
982extern "C-unwind" {
983 #[deprecated = "renamed to `QLThumbnailRequest::document_object`"]
984 pub fn QLThumbnailRequestGetDocumentObject(thumbnail: &QLThumbnailRequest) -> *const c_void;
985}
986
987extern "C-unwind" {
988 #[cfg(feature = "objc2-core-graphics")]
989 #[deprecated = "renamed to `QLThumbnailRequest::set_image`"]
990 pub fn QLThumbnailRequestSetImage(
991 thumbnail: &QLThumbnailRequest,
992 image: Option<&CGImage>,
993 properties: Option<&CFDictionary>,
994 );
995}
996
997extern "C-unwind" {
998 #[deprecated = "renamed to `QLThumbnailRequest::set_image_with_data`"]
999 pub fn QLThumbnailRequestSetImageWithData(
1000 thumbnail: &QLThumbnailRequest,
1001 data: Option<&CFData>,
1002 properties: Option<&CFDictionary>,
1003 );
1004}
1005
1006#[cfg(feature = "objc2-core-graphics")]
1007#[deprecated = "renamed to `QLThumbnailRequest::context`"]
1008#[inline]
1009pub unsafe extern "C-unwind" fn QLThumbnailRequestCreateContext(
1010 thumbnail: &QLThumbnailRequest,
1011 size: CGSize,
1012 is_bitmap: bool,
1013 properties: Option<&CFDictionary>,
1014) -> Option<CFRetained<CGContext>> {
1015 extern "C-unwind" {
1016 fn QLThumbnailRequestCreateContext(
1017 thumbnail: &QLThumbnailRequest,
1018 size: CGSize,
1019 is_bitmap: Boolean,
1020 properties: Option<&CFDictionary>,
1021 ) -> Option<NonNull<CGContext>>;
1022 }
1023 let ret =
1024 unsafe { QLThumbnailRequestCreateContext(thumbnail, size, is_bitmap as _, properties) };
1025 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1026}
1027
1028extern "C-unwind" {
1029 #[cfg(feature = "objc2-core-graphics")]
1030 #[deprecated = "renamed to `QLThumbnailRequest::flush_context`"]
1031 pub fn QLThumbnailRequestFlushContext(
1032 thumbnail: &QLThumbnailRequest,
1033 context: Option<&CGContext>,
1034 );
1035}
1036
1037extern "C-unwind" {
1038 #[deprecated = "renamed to `QLThumbnailRequest::set_image_at_url`"]
1039 pub fn QLThumbnailRequestSetImageAtURL(
1040 thumbnail: &QLThumbnailRequest,
1041 url: Option<&CFURL>,
1042 properties: Option<&CFDictionary>,
1043 );
1044}
1045
1046extern "C-unwind" {
1047 #[deprecated = "renamed to `QLThumbnailRequest::set_thumbnail_with_data_representation`"]
1048 pub fn QLThumbnailRequestSetThumbnailWithDataRepresentation(
1049 thumbnail: &QLThumbnailRequest,
1050 data: Option<&CFData>,
1051 content_type_uti: Option<&CFString>,
1052 preview_properties: Option<&CFDictionary>,
1053 properties: Option<&CFDictionary>,
1054 );
1055}
1056
1057extern "C-unwind" {
1058 #[deprecated = "renamed to `QLThumbnailRequest::set_thumbnail_with_url_representation`"]
1059 pub fn QLThumbnailRequestSetThumbnailWithURLRepresentation(
1060 thumbnail: &QLThumbnailRequest,
1061 url: Option<&CFURL>,
1062 content_type_uti: Option<&CFString>,
1063 preview_properties: Option<&CFDictionary>,
1064 properties: Option<&CFDictionary>,
1065 );
1066}
1067
1068#[deprecated = "renamed to `QLThumbnailRequest::is_cancelled`"]
1069#[inline]
1070pub unsafe extern "C-unwind" fn QLThumbnailRequestIsCancelled(
1071 thumbnail: &QLThumbnailRequest,
1072) -> bool {
1073 extern "C-unwind" {
1074 fn QLThumbnailRequestIsCancelled(thumbnail: &QLThumbnailRequest) -> Boolean;
1075 }
1076 let ret = unsafe { QLThumbnailRequestIsCancelled(thumbnail) };
1077 ret != 0
1078}
1079
1080#[deprecated = "renamed to `QLPreviewRequest::url`"]
1081#[inline]
1082pub unsafe extern "C-unwind" fn QLPreviewRequestCopyURL(
1083 preview: &QLPreviewRequest,
1084) -> Option<CFRetained<CFURL>> {
1085 extern "C-unwind" {
1086 fn QLPreviewRequestCopyURL(preview: &QLPreviewRequest) -> Option<NonNull<CFURL>>;
1087 }
1088 let ret = unsafe { QLPreviewRequestCopyURL(preview) };
1089 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1090}
1091
1092#[deprecated = "renamed to `QLPreviewRequest::options`"]
1093#[inline]
1094pub unsafe extern "C-unwind" fn QLPreviewRequestCopyOptions(
1095 preview: &QLPreviewRequest,
1096) -> Option<CFRetained<CFDictionary>> {
1097 extern "C-unwind" {
1098 fn QLPreviewRequestCopyOptions(preview: &QLPreviewRequest)
1099 -> Option<NonNull<CFDictionary>>;
1100 }
1101 let ret = unsafe { QLPreviewRequestCopyOptions(preview) };
1102 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1103}
1104
1105#[deprecated = "renamed to `QLPreviewRequest::content_uti`"]
1106#[inline]
1107pub unsafe extern "C-unwind" fn QLPreviewRequestCopyContentUTI(
1108 preview: &QLPreviewRequest,
1109) -> Option<CFRetained<CFString>> {
1110 extern "C-unwind" {
1111 fn QLPreviewRequestCopyContentUTI(preview: &QLPreviewRequest) -> Option<NonNull<CFString>>;
1112 }
1113 let ret = unsafe { QLPreviewRequestCopyContentUTI(preview) };
1114 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1115}
1116
1117#[deprecated = "renamed to `QLPreviewRequest::generator_bundle`"]
1118#[inline]
1119pub unsafe extern "C-unwind" fn QLPreviewRequestGetGeneratorBundle(
1120 preview: &QLPreviewRequest,
1121) -> Option<CFRetained<CFBundle>> {
1122 extern "C-unwind" {
1123 fn QLPreviewRequestGetGeneratorBundle(
1124 preview: &QLPreviewRequest,
1125 ) -> Option<NonNull<CFBundle>>;
1126 }
1127 let ret = unsafe { QLPreviewRequestGetGeneratorBundle(preview) };
1128 ret.map(|ret| unsafe { CFRetained::retain(ret) })
1129}
1130
1131extern "C-unwind" {
1132 #[deprecated = "renamed to `QLPreviewRequest::set_document_object`"]
1133 pub fn QLPreviewRequestSetDocumentObject(
1134 preview: &QLPreviewRequest,
1135 object: *const c_void,
1136 callbacks: *const CFArrayCallBacks,
1137 );
1138}
1139
1140extern "C-unwind" {
1141 #[deprecated = "renamed to `QLPreviewRequest::document_object`"]
1142 pub fn QLPreviewRequestGetDocumentObject(preview: &QLPreviewRequest) -> *const c_void;
1143}
1144
1145#[deprecated = "renamed to `QLPreviewRequest::is_cancelled`"]
1146#[inline]
1147pub unsafe extern "C-unwind" fn QLPreviewRequestIsCancelled(preview: &QLPreviewRequest) -> bool {
1148 extern "C-unwind" {
1149 fn QLPreviewRequestIsCancelled(preview: &QLPreviewRequest) -> Boolean;
1150 }
1151 let ret = unsafe { QLPreviewRequestIsCancelled(preview) };
1152 ret != 0
1153}
1154
1155extern "C-unwind" {
1156 #[deprecated = "renamed to `QLPreviewRequest::set_data_representation`"]
1157 pub fn QLPreviewRequestSetDataRepresentation(
1158 preview: &QLPreviewRequest,
1159 data: Option<&CFData>,
1160 content_type_uti: Option<&CFString>,
1161 properties: Option<&CFDictionary>,
1162 );
1163}
1164
1165extern "C-unwind" {
1166 #[deprecated = "renamed to `QLPreviewRequest::set_url_representation`"]
1167 pub fn QLPreviewRequestSetURLRepresentation(
1168 preview: &QLPreviewRequest,
1169 url: Option<&CFURL>,
1170 content_type_uti: Option<&CFString>,
1171 properties: Option<&CFDictionary>,
1172 );
1173}
1174
1175#[cfg(feature = "objc2-core-graphics")]
1176#[deprecated = "renamed to `QLPreviewRequest::context`"]
1177#[inline]
1178pub unsafe extern "C-unwind" fn QLPreviewRequestCreateContext(
1179 preview: &QLPreviewRequest,
1180 size: CGSize,
1181 is_bitmap: bool,
1182 properties: Option<&CFDictionary>,
1183) -> Option<CFRetained<CGContext>> {
1184 extern "C-unwind" {
1185 fn QLPreviewRequestCreateContext(
1186 preview: &QLPreviewRequest,
1187 size: CGSize,
1188 is_bitmap: Boolean,
1189 properties: Option<&CFDictionary>,
1190 ) -> Option<NonNull<CGContext>>;
1191 }
1192 let ret = unsafe { QLPreviewRequestCreateContext(preview, size, is_bitmap as _, properties) };
1193 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1194}
1195
1196#[cfg(feature = "objc2-core-graphics")]
1197#[deprecated = "renamed to `QLPreviewRequest::pdf_context`"]
1198#[inline]
1199pub unsafe extern "C-unwind" fn QLPreviewRequestCreatePDFContext(
1200 preview: &QLPreviewRequest,
1201 media_box: *const CGRect,
1202 auxiliary_info: Option<&CFDictionary>,
1203 properties: Option<&CFDictionary>,
1204) -> Option<CFRetained<CGContext>> {
1205 extern "C-unwind" {
1206 fn QLPreviewRequestCreatePDFContext(
1207 preview: &QLPreviewRequest,
1208 media_box: *const CGRect,
1209 auxiliary_info: Option<&CFDictionary>,
1210 properties: Option<&CFDictionary>,
1211 ) -> Option<NonNull<CGContext>>;
1212 }
1213 let ret =
1214 unsafe { QLPreviewRequestCreatePDFContext(preview, media_box, auxiliary_info, properties) };
1215 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1216}
1217
1218extern "C-unwind" {
1219 #[cfg(feature = "objc2-core-graphics")]
1220 #[deprecated = "renamed to `QLPreviewRequest::flush_context`"]
1221 pub fn QLPreviewRequestFlushContext(preview: &QLPreviewRequest, context: Option<&CGContext>);
1222}