objc2_app_kit/generated/
NSSharingServicePickerTouchBarItem.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/nssharingservicepickertouchbaritem?language=objc)
12    #[unsafe(super(NSTouchBarItem, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(feature = "NSTouchBarItem")]
15    pub struct NSSharingServicePickerTouchBarItem;
16);
17
18#[cfg(feature = "NSTouchBarItem")]
19extern_conformance!(
20    unsafe impl NSCoding for NSSharingServicePickerTouchBarItem {}
21);
22
23#[cfg(feature = "NSTouchBarItem")]
24extern_conformance!(
25    unsafe impl NSObjectProtocol for NSSharingServicePickerTouchBarItem {}
26);
27
28#[cfg(feature = "NSTouchBarItem")]
29impl NSSharingServicePickerTouchBarItem {
30    extern_methods!(
31        #[cfg(feature = "NSSharingService")]
32        #[unsafe(method(delegate))]
33        #[unsafe(method_family = none)]
34        pub fn delegate(
35            &self,
36        ) -> Option<Retained<ProtocolObject<dyn NSSharingServicePickerTouchBarItemDelegate>>>;
37
38        #[cfg(feature = "NSSharingService")]
39        /// Setter for [`delegate`][Self::delegate].
40        ///
41        /// This is a [weak property][objc2::topics::weak_property].
42        #[unsafe(method(setDelegate:))]
43        #[unsafe(method_family = none)]
44        pub fn setDelegate(
45            &self,
46            delegate: Option<&ProtocolObject<dyn NSSharingServicePickerTouchBarItemDelegate>>,
47        );
48
49        #[unsafe(method(isEnabled))]
50        #[unsafe(method_family = none)]
51        pub fn isEnabled(&self) -> bool;
52
53        /// Setter for [`isEnabled`][Self::isEnabled].
54        #[unsafe(method(setEnabled:))]
55        #[unsafe(method_family = none)]
56        pub fn setEnabled(&self, enabled: bool);
57
58        #[unsafe(method(buttonTitle))]
59        #[unsafe(method_family = none)]
60        pub fn buttonTitle(&self) -> Retained<NSString>;
61
62        /// Setter for [`buttonTitle`][Self::buttonTitle].
63        ///
64        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
65        #[unsafe(method(setButtonTitle:))]
66        #[unsafe(method_family = none)]
67        pub fn setButtonTitle(&self, button_title: &NSString);
68
69        #[cfg(feature = "NSImage")]
70        #[unsafe(method(buttonImage))]
71        #[unsafe(method_family = none)]
72        pub fn buttonImage(&self) -> Option<Retained<NSImage>>;
73
74        #[cfg(feature = "NSImage")]
75        /// Setter for [`buttonImage`][Self::buttonImage].
76        #[unsafe(method(setButtonImage:))]
77        #[unsafe(method_family = none)]
78        pub fn setButtonImage(&self, button_image: Option<&NSImage>);
79    );
80}
81
82/// Methods declared on superclass `NSTouchBarItem`.
83#[cfg(feature = "NSTouchBarItem")]
84impl NSSharingServicePickerTouchBarItem {
85    extern_methods!(
86        #[unsafe(method(initWithIdentifier:))]
87        #[unsafe(method_family = init)]
88        pub fn initWithIdentifier(
89            this: Allocated<Self>,
90            identifier: &NSTouchBarItemIdentifier,
91        ) -> Retained<Self>;
92
93        /// # Safety
94        ///
95        /// `coder` possibly has further requirements.
96        #[unsafe(method(initWithCoder:))]
97        #[unsafe(method_family = init)]
98        pub unsafe fn initWithCoder(
99            this: Allocated<Self>,
100            coder: &NSCoder,
101        ) -> Option<Retained<Self>>;
102
103        #[unsafe(method(init))]
104        #[unsafe(method_family = init)]
105        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
106    );
107}
108
109/// Methods declared on superclass `NSObject`.
110#[cfg(feature = "NSTouchBarItem")]
111impl NSSharingServicePickerTouchBarItem {
112    extern_methods!(
113        #[unsafe(method(new))]
114        #[unsafe(method_family = new)]
115        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
116    );
117}
118
119extern_protocol!(
120    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssharingservicepickertouchbaritemdelegate?language=objc)
121    #[cfg(feature = "NSSharingService")]
122    pub unsafe trait NSSharingServicePickerTouchBarItemDelegate:
123        NSSharingServicePickerDelegate + MainThreadOnly
124    {
125        #[cfg(feature = "NSTouchBarItem")]
126        #[unsafe(method(itemsForSharingServicePickerTouchBarItem:))]
127        #[unsafe(method_family = none)]
128        fn itemsForSharingServicePickerTouchBarItem(
129            &self,
130            picker_touch_bar_item: &NSSharingServicePickerTouchBarItem,
131        ) -> Retained<NSArray>;
132    }
133);