objc2_app_kit/generated/
NSButtonTouchBarItem.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/nsbuttontouchbaritem?language=objc)
12    #[unsafe(super(NSTouchBarItem, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(feature = "NSTouchBarItem")]
15    pub struct NSButtonTouchBarItem;
16);
17
18#[cfg(feature = "NSTouchBarItem")]
19extern_conformance!(
20    unsafe impl NSCoding for NSButtonTouchBarItem {}
21);
22
23#[cfg(feature = "NSTouchBarItem")]
24extern_conformance!(
25    unsafe impl NSObjectProtocol for NSButtonTouchBarItem {}
26);
27
28#[cfg(feature = "NSTouchBarItem")]
29impl NSButtonTouchBarItem {
30    extern_methods!(
31        /// # Safety
32        ///
33        /// - `target` should be of the correct type.
34        /// - `action` must be a valid selector.
35        #[unsafe(method(buttonTouchBarItemWithIdentifier:title:target:action:))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn buttonTouchBarItemWithIdentifier_title_target_action(
38            identifier: &NSTouchBarItemIdentifier,
39            title: &NSString,
40            target: Option<&AnyObject>,
41            action: Option<Sel>,
42            mtm: MainThreadMarker,
43        ) -> Retained<Self>;
44
45        #[cfg(feature = "NSImage")]
46        /// # Safety
47        ///
48        /// - `target` should be of the correct type.
49        /// - `action` must be a valid selector.
50        #[unsafe(method(buttonTouchBarItemWithIdentifier:image:target:action:))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn buttonTouchBarItemWithIdentifier_image_target_action(
53            identifier: &NSTouchBarItemIdentifier,
54            image: &NSImage,
55            target: Option<&AnyObject>,
56            action: Option<Sel>,
57            mtm: MainThreadMarker,
58        ) -> Retained<Self>;
59
60        #[cfg(feature = "NSImage")]
61        /// # Safety
62        ///
63        /// - `target` should be of the correct type.
64        /// - `action` must be a valid selector.
65        #[unsafe(method(buttonTouchBarItemWithIdentifier:title:image:target:action:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn buttonTouchBarItemWithIdentifier_title_image_target_action(
68            identifier: &NSTouchBarItemIdentifier,
69            title: &NSString,
70            image: &NSImage,
71            target: Option<&AnyObject>,
72            action: Option<Sel>,
73            mtm: MainThreadMarker,
74        ) -> Retained<Self>;
75
76        #[unsafe(method(title))]
77        #[unsafe(method_family = none)]
78        pub fn title(&self) -> Retained<NSString>;
79
80        /// Setter for [`title`][Self::title].
81        ///
82        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
83        #[unsafe(method(setTitle:))]
84        #[unsafe(method_family = none)]
85        pub fn setTitle(&self, title: &NSString);
86
87        #[cfg(feature = "NSImage")]
88        #[unsafe(method(image))]
89        #[unsafe(method_family = none)]
90        pub fn image(&self) -> Option<Retained<NSImage>>;
91
92        #[cfg(feature = "NSImage")]
93        /// Setter for [`image`][Self::image].
94        #[unsafe(method(setImage:))]
95        #[unsafe(method_family = none)]
96        pub fn setImage(&self, image: Option<&NSImage>);
97
98        #[cfg(feature = "NSColor")]
99        #[unsafe(method(bezelColor))]
100        #[unsafe(method_family = none)]
101        pub fn bezelColor(&self) -> Option<Retained<NSColor>>;
102
103        #[cfg(feature = "NSColor")]
104        /// Setter for [`bezelColor`][Self::bezelColor].
105        ///
106        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
107        #[unsafe(method(setBezelColor:))]
108        #[unsafe(method_family = none)]
109        pub fn setBezelColor(&self, bezel_color: Option<&NSColor>);
110
111        #[unsafe(method(target))]
112        #[unsafe(method_family = none)]
113        pub fn target(&self) -> Option<Retained<AnyObject>>;
114
115        /// Setter for [`target`][Self::target].
116        ///
117        /// This is a [weak property][objc2::topics::weak_property].
118        ///
119        /// # Safety
120        ///
121        /// `target` should be of the correct type.
122        #[unsafe(method(setTarget:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
125
126        #[unsafe(method(action))]
127        #[unsafe(method_family = none)]
128        pub fn action(&self) -> Option<Sel>;
129
130        /// Setter for [`action`][Self::action].
131        ///
132        /// # Safety
133        ///
134        /// `action` must be a valid selector.
135        #[unsafe(method(setAction:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn setAction(&self, action: Option<Sel>);
138
139        #[unsafe(method(isEnabled))]
140        #[unsafe(method_family = none)]
141        pub fn isEnabled(&self) -> bool;
142
143        /// Setter for [`isEnabled`][Self::isEnabled].
144        #[unsafe(method(setEnabled:))]
145        #[unsafe(method_family = none)]
146        pub fn setEnabled(&self, enabled: bool);
147
148        /// The localized string labelling this item during user customization. The default value is empty string.
149        #[unsafe(method(customizationLabel))]
150        #[unsafe(method_family = none)]
151        pub fn customizationLabel(&self) -> Retained<NSString>;
152
153        /// Setter for [`customizationLabel`][Self::customizationLabel].
154        ///
155        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
156        #[unsafe(method(setCustomizationLabel:))]
157        #[unsafe(method_family = none)]
158        pub fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
159    );
160}
161
162/// Methods declared on superclass `NSTouchBarItem`.
163#[cfg(feature = "NSTouchBarItem")]
164impl NSButtonTouchBarItem {
165    extern_methods!(
166        #[unsafe(method(initWithIdentifier:))]
167        #[unsafe(method_family = init)]
168        pub fn initWithIdentifier(
169            this: Allocated<Self>,
170            identifier: &NSTouchBarItemIdentifier,
171        ) -> Retained<Self>;
172
173        /// # Safety
174        ///
175        /// `coder` possibly has further requirements.
176        #[unsafe(method(initWithCoder:))]
177        #[unsafe(method_family = init)]
178        pub unsafe fn initWithCoder(
179            this: Allocated<Self>,
180            coder: &NSCoder,
181        ) -> Option<Retained<Self>>;
182
183        #[unsafe(method(init))]
184        #[unsafe(method_family = init)]
185        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
186    );
187}
188
189/// Methods declared on superclass `NSObject`.
190#[cfg(feature = "NSTouchBarItem")]
191impl NSButtonTouchBarItem {
192    extern_methods!(
193        #[unsafe(method(new))]
194        #[unsafe(method_family = new)]
195        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
196    );
197}