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
50unsafe impl NSObjectProtocol for NSPreviewRepresentingActivityItem {}
51
52unsafe impl NSPreviewRepresentableActivityItem for NSPreviewRepresentingActivityItem {}
53
54impl NSPreviewRepresentingActivityItem {
55    extern_methods!(
56        #[cfg(feature = "NSImage")]
57        /// - Parameters:
58        /// - item: The item to share
59        /// - title: A title to show in a preview
60        /// - image: An image to show in a preview
61        /// - icon: An icon to show in a preview
62        ///
63        /// For more information about the parameters, see NSPreviewRepresentableActivityItem documentation
64        #[unsafe(method(initWithItem:title:image:icon:))]
65        #[unsafe(method_family = init)]
66        pub unsafe fn initWithItem_title_image_icon(
67            this: Allocated<Self>,
68            item: &AnyObject,
69            title: Option<&NSString>,
70            image: Option<&NSImage>,
71            icon: Option<&NSImage>,
72        ) -> Retained<Self>;
73
74        /// - Parameters:
75        /// - item: The item to share
76        /// - title: A title to show in a preview
77        /// - imageProvider: An NSItemProvider which provides an image to show in a preview
78        /// - iconProvider: An NSItemProvider which provides an icon to show in a preview
79        ///
80        /// For more information about the parameters, see NSPreviewRepresentableActivityItem documentation
81        #[unsafe(method(initWithItem:title:imageProvider:iconProvider:))]
82        #[unsafe(method_family = init)]
83        pub unsafe fn initWithItem_title_imageProvider_iconProvider(
84            this: Allocated<Self>,
85            item: &AnyObject,
86            title: Option<&NSString>,
87            image_provider: Option<&NSItemProvider>,
88            icon_provider: Option<&NSItemProvider>,
89        ) -> Retained<Self>;
90
91        #[unsafe(method(init))]
92        #[unsafe(method_family = init)]
93        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
94
95        #[unsafe(method(new))]
96        #[unsafe(method_family = new)]
97        pub unsafe fn new() -> Retained<Self>;
98    );
99}