objc2_quick_look_ui/generated/QLPreviewItem.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use objc2::__framework_prelude::*;
4use objc2_foundation::*;
5
6use crate::*;
7
8extern_protocol!(
9 /// A protocol that defines a set of properties you implement to make a preview of your application’s content.
10 ///
11 /// Implement the properties in this protocol to make your application’s content visible in a Quick Look preview. Use
12 /// <doc
13 /// ://com.apple.documentation/documentation/quicklook/qlpreviewcontroller> to display a Quick Look preview on iOS, ``QLPreviewPanel`` and ``QLPreviewView`` on macOS.
14 ///
15 /// The properties in the ``QLPreviewItem`` protocol are also declared as a category on the ``NSURL`` class. As a result, you can use
16 /// <doc
17 /// ://com.apple.documentation/documentation/foundation/nsurl> objects directly as preview items — provided that you want to use the default titles of those items. The default title for an NSURL object is the last path component of an item’s URL.
18 /// To supply custom titles for preview objects, implement a class conforming to this protocol, supplying the title with the ``previewItemTitle`` property.
19 ///
20 /// See also [Apple's documentation](https://developer.apple.com/documentation/quicklookui/qlpreviewitem?language=objc)
21 pub unsafe trait QLPreviewItem: NSObjectProtocol {
22 /// The URL of the item to preview.
23 ///
24 /// <doc
25 /// ://com.apple.documentation/documentation/quicklook/qlpreviewcontroller> uses this property to get an item’s URL. In typical use, you’d implement a getter method in your preview item class to provide this value.
26 ///
27 /// The value of this property must be a file-type URL.
28 ///
29 /// If the item isn’t available for preview, this property’s getter method should return ``nil``. In this case, the
30 /// <doc
31 /// ://com.apple.documentation/documentation/quicklook/qlpreviewcontroller> displays a “loading” view. Use
32 /// <doc
33 /// ://com.apple.documentation/documentation/quicklook/qlpreviewcontroller/1617011-refreshcurrentpreviewitem> to reload the item once the URL content is available.
34 #[unsafe(method(previewItemURL))]
35 #[unsafe(method_family = none)]
36 unsafe fn previewItemURL(&self) -> Option<Retained<NSURL>>;
37
38 /// The title to display for the preview item.
39 ///
40 /// If you don’t implement a getter method for this property, or if your method returns ``nil``, Quick Look examines the URL or content of the previewed item to determine an appropriate title. Return a ``non-nil`` value for this property to provide a custom title.
41 #[optional]
42 #[unsafe(method(previewItemTitle))]
43 #[unsafe(method_family = none)]
44 unsafe fn previewItemTitle(&self) -> Option<Retained<NSString>>;
45
46 /// The display state for the preview item.
47 ///
48 /// The display state is an opaque object used by the preview panel. You
49 /// typically use the ``QuickLookUI/QLPreviewPanel`` method
50 /// ``QuickLookUI/QLPreviewPanel/displayState`` to retrieve the display state
51 /// which you save for later use in the preview item. This way you can preserve
52 /// the display state when the panel moves from or to another controller.
53 ///
54 /// This property is optional.
55 #[optional]
56 #[unsafe(method(previewItemDisplayState))]
57 #[unsafe(method_family = none)]
58 unsafe fn previewItemDisplayState(&self) -> Option<Retained<AnyObject>>;
59 }
60);
61
62extern_conformance!(
63 unsafe impl QLPreviewItem for NSURL {}
64);