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")]
19extern_conformance!(
20    unsafe impl NSCopying for NSSharingServicePickerToolbarItem {}
21);
22
23#[cfg(feature = "NSToolbarItem")]
24unsafe impl CopyingHelper for NSSharingServicePickerToolbarItem {
25    type Result = Self;
26}
27
28#[cfg(feature = "NSToolbarItem")]
29extern_conformance!(
30    unsafe impl NSObjectProtocol for NSSharingServicePickerToolbarItem {}
31);
32
33#[cfg(feature = "NSToolbarItem")]
34impl NSSharingServicePickerToolbarItem {
35    extern_methods!(
36        #[cfg(feature = "NSSharingService")]
37        #[unsafe(method(delegate))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn delegate(
40            &self,
41        ) -> Option<Retained<ProtocolObject<dyn NSSharingServicePickerToolbarItemDelegate>>>;
42
43        #[cfg(feature = "NSSharingService")]
44        /// This is a [weak property][objc2::topics::weak_property].
45        /// Setter for [`delegate`][Self::delegate].
46        #[unsafe(method(setDelegate:))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn setDelegate(
49            &self,
50            delegate: Option<&ProtocolObject<dyn NSSharingServicePickerToolbarItemDelegate>>,
51        );
52    );
53}
54
55/// Methods declared on superclass `NSToolbarItem`.
56#[cfg(feature = "NSToolbarItem")]
57impl NSSharingServicePickerToolbarItem {
58    extern_methods!(
59        #[cfg(feature = "NSToolbar")]
60        /// Initialize the toolbar item with an identifier which is a development language string used by the toolbar and its delegate for identification purposes.
61        #[unsafe(method(initWithItemIdentifier:))]
62        #[unsafe(method_family = init)]
63        pub unsafe fn initWithItemIdentifier(
64            this: Allocated<Self>,
65            item_identifier: &NSToolbarItemIdentifier,
66        ) -> Retained<Self>;
67    );
68}
69
70/// Methods declared on superclass `NSObject`.
71#[cfg(feature = "NSToolbarItem")]
72impl NSSharingServicePickerToolbarItem {
73    extern_methods!(
74        #[unsafe(method(init))]
75        #[unsafe(method_family = init)]
76        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
77
78        #[unsafe(method(new))]
79        #[unsafe(method_family = new)]
80        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
81    );
82}
83
84extern_protocol!(
85    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssharingservicepickertoolbaritemdelegate?language=objc)
86    #[cfg(feature = "NSSharingService")]
87    pub unsafe trait NSSharingServicePickerToolbarItemDelegate:
88        NSSharingServicePickerDelegate + MainThreadOnly
89    {
90        #[cfg(feature = "NSToolbarItem")]
91        /// Return the items that represent the objects to be shared.
92        /// They must conform to the
93        /// <NSPasteboardWriting
94        /// > protocol or be an NSItemProvider. (e.g. NSString, NSImage, NSURL, etc.).
95        #[unsafe(method(itemsForSharingServicePickerToolbarItem:))]
96        #[unsafe(method_family = none)]
97        unsafe fn itemsForSharingServicePickerToolbarItem(
98            &self,
99            picker_toolbar_item: &NSSharingServicePickerToolbarItem,
100        ) -> Retained<NSArray>;
101    }
102);