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 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 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 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 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 ///
69 /// # Safety
70 ///
71 /// `item` should be of the correct type.
72 #[unsafe(method(initWithItem:title:image:icon:))]
73 #[unsafe(method_family = init)]
74 pub unsafe fn initWithItem_title_image_icon(
75 this: Allocated<Self>,
76 item: &AnyObject,
77 title: Option<&NSString>,
78 image: Option<&NSImage>,
79 icon: Option<&NSImage>,
80 ) -> Retained<Self>;
81
82 /// - Parameters:
83 /// - item: The item to share
84 /// - title: A title to show in a preview
85 /// - imageProvider: An NSItemProvider which provides an image to show in a preview
86 /// - iconProvider: An NSItemProvider which provides an icon to show in a preview
87 ///
88 /// For more information about the parameters, see NSPreviewRepresentableActivityItem documentation
89 ///
90 /// # Safety
91 ///
92 /// `item` should be of the correct type.
93 #[unsafe(method(initWithItem:title:imageProvider:iconProvider:))]
94 #[unsafe(method_family = init)]
95 pub unsafe fn initWithItem_title_imageProvider_iconProvider(
96 this: Allocated<Self>,
97 item: &AnyObject,
98 title: Option<&NSString>,
99 image_provider: Option<&NSItemProvider>,
100 icon_provider: Option<&NSItemProvider>,
101 ) -> Retained<Self>;
102
103 #[unsafe(method(init))]
104 #[unsafe(method_family = init)]
105 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
106
107 #[unsafe(method(new))]
108 #[unsafe(method_family = new)]
109 pub unsafe fn new() -> Retained<Self>;
110 );
111}