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 unsafe fn delegate(
35            &self,
36        ) -> Option<Retained<ProtocolObject<dyn NSSharingServicePickerTouchBarItemDelegate>>>;
37
38        #[cfg(feature = "NSSharingService")]
39        /// This is a [weak property][objc2::topics::weak_property].
40        /// Setter for [`delegate`][Self::delegate].
41        #[unsafe(method(setDelegate:))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn setDelegate(
44            &self,
45            delegate: Option<&ProtocolObject<dyn NSSharingServicePickerTouchBarItemDelegate>>,
46        );
47
48        #[unsafe(method(isEnabled))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn isEnabled(&self) -> bool;
51
52        /// Setter for [`isEnabled`][Self::isEnabled].
53        #[unsafe(method(setEnabled:))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn setEnabled(&self, enabled: bool);
56
57        #[unsafe(method(buttonTitle))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn buttonTitle(&self) -> Retained<NSString>;
60
61        /// Setter for [`buttonTitle`][Self::buttonTitle].
62        #[unsafe(method(setButtonTitle:))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn setButtonTitle(&self, button_title: &NSString);
65
66        #[cfg(feature = "NSImage")]
67        #[unsafe(method(buttonImage))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn buttonImage(&self) -> Option<Retained<NSImage>>;
70
71        #[cfg(feature = "NSImage")]
72        /// Setter for [`buttonImage`][Self::buttonImage].
73        #[unsafe(method(setButtonImage:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn setButtonImage(&self, button_image: Option<&NSImage>);
76    );
77}
78
79/// Methods declared on superclass `NSTouchBarItem`.
80#[cfg(feature = "NSTouchBarItem")]
81impl NSSharingServicePickerTouchBarItem {
82    extern_methods!(
83        #[unsafe(method(initWithIdentifier:))]
84        #[unsafe(method_family = init)]
85        pub unsafe fn initWithIdentifier(
86            this: Allocated<Self>,
87            identifier: &NSTouchBarItemIdentifier,
88        ) -> Retained<Self>;
89
90        #[unsafe(method(initWithCoder:))]
91        #[unsafe(method_family = init)]
92        pub unsafe fn initWithCoder(
93            this: Allocated<Self>,
94            coder: &NSCoder,
95        ) -> Option<Retained<Self>>;
96
97        #[unsafe(method(init))]
98        #[unsafe(method_family = init)]
99        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
100    );
101}
102
103/// Methods declared on superclass `NSObject`.
104#[cfg(feature = "NSTouchBarItem")]
105impl NSSharingServicePickerTouchBarItem {
106    extern_methods!(
107        #[unsafe(method(new))]
108        #[unsafe(method_family = new)]
109        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
110    );
111}
112
113extern_protocol!(
114    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssharingservicepickertouchbaritemdelegate?language=objc)
115    #[cfg(feature = "NSSharingService")]
116    pub unsafe trait NSSharingServicePickerTouchBarItemDelegate:
117        NSSharingServicePickerDelegate + MainThreadOnly
118    {
119        #[cfg(feature = "NSTouchBarItem")]
120        #[unsafe(method(itemsForSharingServicePickerTouchBarItem:))]
121        #[unsafe(method_family = none)]
122        unsafe fn itemsForSharingServicePickerTouchBarItem(
123            &self,
124            picker_touch_bar_item: &NSSharingServicePickerTouchBarItem,
125        ) -> Retained<NSArray>;
126    }
127);