objc2_app_kit/generated/
NSSharingServicePickerToolbarItem.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssharingservicepickertoolbaritem?language=objc)
12    #[unsafe(super(NSToolbarItem, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(feature = "NSToolbarItem")]
15    pub struct NSSharingServicePickerToolbarItem;
16);
17
18#[cfg(feature = "NSToolbarItem")]
19unsafe impl NSCopying for NSSharingServicePickerToolbarItem {}
20
21#[cfg(feature = "NSToolbarItem")]
22unsafe impl CopyingHelper for NSSharingServicePickerToolbarItem {
23    type Result = Self;
24}
25
26#[cfg(feature = "NSToolbarItem")]
27unsafe impl NSObjectProtocol for NSSharingServicePickerToolbarItem {}
28
29#[cfg(feature = "NSToolbarItem")]
30impl NSSharingServicePickerToolbarItem {
31    extern_methods!(
32        #[cfg(feature = "NSSharingService")]
33        #[unsafe(method(delegate))]
34        #[unsafe(method_family = none)]
35        pub unsafe fn delegate(
36            &self,
37        ) -> Option<Retained<ProtocolObject<dyn NSSharingServicePickerToolbarItemDelegate>>>;
38
39        #[cfg(feature = "NSSharingService")]
40        /// This is a [weak property][objc2::topics::weak_property].
41        /// Setter for [`delegate`][Self::delegate].
42        #[unsafe(method(setDelegate:))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn setDelegate(
45            &self,
46            delegate: Option<&ProtocolObject<dyn NSSharingServicePickerToolbarItemDelegate>>,
47        );
48    );
49}
50
51/// Methods declared on superclass `NSToolbarItem`.
52#[cfg(feature = "NSToolbarItem")]
53impl NSSharingServicePickerToolbarItem {
54    extern_methods!(
55        #[cfg(feature = "NSToolbar")]
56        /// Initialize the toolbar item with an identifier which is a development language string used by the toolbar and its delegate for identification purposes.
57        #[unsafe(method(initWithItemIdentifier:))]
58        #[unsafe(method_family = init)]
59        pub unsafe fn initWithItemIdentifier(
60            this: Allocated<Self>,
61            item_identifier: &NSToolbarItemIdentifier,
62        ) -> Retained<Self>;
63    );
64}
65
66/// Methods declared on superclass `NSObject`.
67#[cfg(feature = "NSToolbarItem")]
68impl NSSharingServicePickerToolbarItem {
69    extern_methods!(
70        #[unsafe(method(init))]
71        #[unsafe(method_family = init)]
72        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
73
74        #[unsafe(method(new))]
75        #[unsafe(method_family = new)]
76        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
77    );
78}
79
80extern_protocol!(
81    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssharingservicepickertoolbaritemdelegate?language=objc)
82    #[cfg(feature = "NSSharingService")]
83    pub unsafe trait NSSharingServicePickerToolbarItemDelegate:
84        NSSharingServicePickerDelegate + MainThreadOnly
85    {
86        #[cfg(feature = "NSToolbarItem")]
87        /// Return the items that represent the objects to be shared.
88        /// They must conform to the
89        /// <NSPasteboardWriting
90        /// > protocol or be an NSItemProvider. (e.g. NSString, NSImage, NSURL, etc.).
91        #[unsafe(method(itemsForSharingServicePickerToolbarItem:))]
92        #[unsafe(method_family = none)]
93        unsafe fn itemsForSharingServicePickerToolbarItem(
94            &self,
95            picker_toolbar_item: &NSSharingServicePickerToolbarItem,
96        ) -> Retained<NSArray>;
97    }
98);