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