objc2_app_kit/generated/NSPreviewRepresentingActivityItem.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::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_protocol!(
10 /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspreviewrepresentableactivityitem?language=objc)
11 pub unsafe trait NSPreviewRepresentableActivityItem: NSObjectProtocol {
12 /// The item to be shared
13 #[unsafe(method(item))]
14 #[unsafe(method_family = none)]
15 unsafe fn item(&self) -> Retained<AnyObject>;
16
17 /// A string representing the name or title of the item to be shared
18 #[optional]
19 #[unsafe(method(title))]
20 #[unsafe(method_family = none)]
21 unsafe fn title(&self) -> Option<Retained<NSString>>;
22
23 /// Provides an image appropriate to represent the item.
24 ///
25 /// This image typically is a full-size representation of the content being shared.
26 /// For instance, if sharing a link to a webpage, this might be the hero image on that webpage.
27 #[optional]
28 #[unsafe(method(imageProvider))]
29 #[unsafe(method_family = none)]
30 unsafe fn imageProvider(&self) -> Option<Retained<NSItemProvider>>;
31
32 /// Provides an icon appropriate to represent the item.
33 ///
34 /// This icon typically is a thumbnail-sized representation of the source of the content.
35 /// For instance, if sharing a link to a webpage, this might be an icon representing the website overall.
36 #[optional]
37 #[unsafe(method(iconProvider))]
38 #[unsafe(method_family = none)]
39 unsafe fn iconProvider(&self) -> Option<Retained<NSItemProvider>>;
40 }
41);
42
43extern_class!(
44 /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspreviewrepresentingactivityitem?language=objc)
45 #[unsafe(super(NSObject))]
46 #[derive(Debug, PartialEq, Eq, Hash)]
47 pub struct NSPreviewRepresentingActivityItem;
48);
49
50extern_conformance!(
51 unsafe impl NSObjectProtocol for NSPreviewRepresentingActivityItem {}
52);
53
54extern_conformance!(
55 unsafe impl NSPreviewRepresentableActivityItem for NSPreviewRepresentingActivityItem {}
56);
57
58impl NSPreviewRepresentingActivityItem {
59 extern_methods!(
60 #[cfg(feature = "NSImage")]
61 /// - Parameters:
62 /// - item: The item to share
63 /// - title: A title to show in a preview
64 /// - image: An image to show in a preview
65 /// - icon: An icon to show in a preview
66 ///
67 /// For more information about the parameters, see NSPreviewRepresentableActivityItem documentation
68 #[unsafe(method(initWithItem:title:image:icon:))]
69 #[unsafe(method_family = init)]
70 pub unsafe fn initWithItem_title_image_icon(
71 this: Allocated<Self>,
72 item: &AnyObject,
73 title: Option<&NSString>,
74 image: Option<&NSImage>,
75 icon: Option<&NSImage>,
76 ) -> Retained<Self>;
77
78 /// - Parameters:
79 /// - item: The item to share
80 /// - title: A title to show in a preview
81 /// - imageProvider: An NSItemProvider which provides an image to show in a preview
82 /// - iconProvider: An NSItemProvider which provides an icon to show in a preview
83 ///
84 /// For more information about the parameters, see NSPreviewRepresentableActivityItem documentation
85 #[unsafe(method(initWithItem:title:imageProvider:iconProvider:))]
86 #[unsafe(method_family = init)]
87 pub unsafe fn initWithItem_title_imageProvider_iconProvider(
88 this: Allocated<Self>,
89 item: &AnyObject,
90 title: Option<&NSString>,
91 image_provider: Option<&NSItemProvider>,
92 icon_provider: Option<&NSItemProvider>,
93 ) -> Retained<Self>;
94
95 #[unsafe(method(init))]
96 #[unsafe(method_family = init)]
97 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
98
99 #[unsafe(method(new))]
100 #[unsafe(method_family = new)]
101 pub unsafe fn new() -> Retained<Self>;
102 );
103}