objc2_app_kit/generated/
NSPickerTouchBarItem.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
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspickertouchbaritemselectionmode?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSPickerTouchBarItemSelectionMode(pub NSInteger);
15impl NSPickerTouchBarItemSelectionMode {
16    #[doc(alias = "NSPickerTouchBarItemSelectionModeSelectOne")]
17    pub const SelectOne: Self = Self(0);
18    #[doc(alias = "NSPickerTouchBarItemSelectionModeSelectAny")]
19    pub const SelectAny: Self = Self(1);
20    #[doc(alias = "NSPickerTouchBarItemSelectionModeMomentary")]
21    pub const Momentary: Self = Self(2);
22}
23
24unsafe impl Encode for NSPickerTouchBarItemSelectionMode {
25    const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for NSPickerTouchBarItemSelectionMode {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspickertouchbaritemcontrolrepresentation?language=objc)
33// NS_ENUM
34#[repr(transparent)]
35#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
36pub struct NSPickerTouchBarItemControlRepresentation(pub NSInteger);
37impl NSPickerTouchBarItemControlRepresentation {
38    #[doc(alias = "NSPickerTouchBarItemControlRepresentationAutomatic")]
39    pub const Automatic: Self = Self(0);
40    #[doc(alias = "NSPickerTouchBarItemControlRepresentationExpanded")]
41    pub const Expanded: Self = Self(1);
42    #[doc(alias = "NSPickerTouchBarItemControlRepresentationCollapsed")]
43    pub const Collapsed: Self = Self(2);
44}
45
46unsafe impl Encode for NSPickerTouchBarItemControlRepresentation {
47    const ENCODING: Encoding = NSInteger::ENCODING;
48}
49
50unsafe impl RefEncode for NSPickerTouchBarItemControlRepresentation {
51    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
52}
53
54extern_class!(
55    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspickertouchbaritem?language=objc)
56    #[unsafe(super(NSTouchBarItem, NSObject))]
57    #[derive(Debug, PartialEq, Eq, Hash)]
58    #[cfg(feature = "NSTouchBarItem")]
59    pub struct NSPickerTouchBarItem;
60);
61
62#[cfg(feature = "NSTouchBarItem")]
63extern_conformance!(
64    unsafe impl NSCoding for NSPickerTouchBarItem {}
65);
66
67#[cfg(feature = "NSTouchBarItem")]
68extern_conformance!(
69    unsafe impl NSObjectProtocol for NSPickerTouchBarItem {}
70);
71
72#[cfg(feature = "NSTouchBarItem")]
73impl NSPickerTouchBarItem {
74    extern_methods!(
75        #[unsafe(method(pickerTouchBarItemWithIdentifier:labels:selectionMode:target:action:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn pickerTouchBarItemWithIdentifier_labels_selectionMode_target_action(
78            identifier: &NSTouchBarItemIdentifier,
79            labels: &NSArray<NSString>,
80            selection_mode: NSPickerTouchBarItemSelectionMode,
81            target: Option<&AnyObject>,
82            action: Option<Sel>,
83            mtm: MainThreadMarker,
84        ) -> Retained<Self>;
85
86        #[cfg(feature = "NSImage")]
87        #[unsafe(method(pickerTouchBarItemWithIdentifier:images:selectionMode:target:action:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn pickerTouchBarItemWithIdentifier_images_selectionMode_target_action(
90            identifier: &NSTouchBarItemIdentifier,
91            images: &NSArray<NSImage>,
92            selection_mode: NSPickerTouchBarItemSelectionMode,
93            target: Option<&AnyObject>,
94            action: Option<Sel>,
95            mtm: MainThreadMarker,
96        ) -> Retained<Self>;
97
98        #[unsafe(method(controlRepresentation))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn controlRepresentation(&self) -> NSPickerTouchBarItemControlRepresentation;
101
102        /// Setter for [`controlRepresentation`][Self::controlRepresentation].
103        #[unsafe(method(setControlRepresentation:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn setControlRepresentation(
106            &self,
107            control_representation: NSPickerTouchBarItemControlRepresentation,
108        );
109
110        #[unsafe(method(collapsedRepresentationLabel))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn collapsedRepresentationLabel(&self) -> Retained<NSString>;
113
114        /// Setter for [`collapsedRepresentationLabel`][Self::collapsedRepresentationLabel].
115        #[unsafe(method(setCollapsedRepresentationLabel:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn setCollapsedRepresentationLabel(
118            &self,
119            collapsed_representation_label: &NSString,
120        );
121
122        #[cfg(feature = "NSImage")]
123        #[unsafe(method(collapsedRepresentationImage))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn collapsedRepresentationImage(&self) -> Option<Retained<NSImage>>;
126
127        #[cfg(feature = "NSImage")]
128        /// Setter for [`collapsedRepresentationImage`][Self::collapsedRepresentationImage].
129        #[unsafe(method(setCollapsedRepresentationImage:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn setCollapsedRepresentationImage(
132            &self,
133            collapsed_representation_image: Option<&NSImage>,
134        );
135
136        #[unsafe(method(selectedIndex))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn selectedIndex(&self) -> NSInteger;
139
140        /// Setter for [`selectedIndex`][Self::selectedIndex].
141        #[unsafe(method(setSelectedIndex:))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn setSelectedIndex(&self, selected_index: NSInteger);
144
145        #[cfg(feature = "NSColor")]
146        #[unsafe(method(selectionColor))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn selectionColor(&self) -> Option<Retained<NSColor>>;
149
150        #[cfg(feature = "NSColor")]
151        /// Setter for [`selectionColor`][Self::selectionColor].
152        #[unsafe(method(setSelectionColor:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn setSelectionColor(&self, selection_color: Option<&NSColor>);
155
156        #[unsafe(method(selectionMode))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn selectionMode(&self) -> NSPickerTouchBarItemSelectionMode;
159
160        /// Setter for [`selectionMode`][Self::selectionMode].
161        #[unsafe(method(setSelectionMode:))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn setSelectionMode(&self, selection_mode: NSPickerTouchBarItemSelectionMode);
164
165        #[unsafe(method(numberOfOptions))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn numberOfOptions(&self) -> NSInteger;
168
169        /// Setter for [`numberOfOptions`][Self::numberOfOptions].
170        #[unsafe(method(setNumberOfOptions:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn setNumberOfOptions(&self, number_of_options: NSInteger);
173
174        #[cfg(feature = "NSImage")]
175        #[unsafe(method(setImage:atIndex:))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn setImage_atIndex(&self, image: Option<&NSImage>, index: NSInteger);
178
179        #[cfg(feature = "NSImage")]
180        #[unsafe(method(imageAtIndex:))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn imageAtIndex(&self, index: NSInteger) -> Option<Retained<NSImage>>;
183
184        #[unsafe(method(setLabel:atIndex:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn setLabel_atIndex(&self, label: &NSString, index: NSInteger);
187
188        #[unsafe(method(labelAtIndex:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn labelAtIndex(&self, index: NSInteger) -> Option<Retained<NSString>>;
191
192        #[unsafe(method(target))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
195
196        /// This is a [weak property][objc2::topics::weak_property].
197        /// Setter for [`target`][Self::target].
198        #[unsafe(method(setTarget:))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
201
202        #[unsafe(method(action))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn action(&self) -> Option<Sel>;
205
206        /// Setter for [`action`][Self::action].
207        #[unsafe(method(setAction:))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn setAction(&self, action: Option<Sel>);
210
211        #[unsafe(method(isEnabled))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn isEnabled(&self) -> bool;
214
215        /// Setter for [`isEnabled`][Self::isEnabled].
216        #[unsafe(method(setEnabled:))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn setEnabled(&self, enabled: bool);
219
220        #[unsafe(method(setEnabled:atIndex:))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn setEnabled_atIndex(&self, enabled: bool, index: NSInteger);
223
224        #[unsafe(method(isEnabledAtIndex:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn isEnabledAtIndex(&self, index: NSInteger) -> bool;
227
228        /// The localized string labelling this item during user customization. The default value is empty string.
229        #[unsafe(method(customizationLabel))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn customizationLabel(&self) -> Retained<NSString>;
232
233        /// Setter for [`customizationLabel`][Self::customizationLabel].
234        #[unsafe(method(setCustomizationLabel:))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
237    );
238}
239
240/// Methods declared on superclass `NSTouchBarItem`.
241#[cfg(feature = "NSTouchBarItem")]
242impl NSPickerTouchBarItem {
243    extern_methods!(
244        #[unsafe(method(initWithIdentifier:))]
245        #[unsafe(method_family = init)]
246        pub unsafe fn initWithIdentifier(
247            this: Allocated<Self>,
248            identifier: &NSTouchBarItemIdentifier,
249        ) -> Retained<Self>;
250
251        #[unsafe(method(initWithCoder:))]
252        #[unsafe(method_family = init)]
253        pub unsafe fn initWithCoder(
254            this: Allocated<Self>,
255            coder: &NSCoder,
256        ) -> Option<Retained<Self>>;
257
258        #[unsafe(method(init))]
259        #[unsafe(method_family = init)]
260        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
261    );
262}
263
264/// Methods declared on superclass `NSObject`.
265#[cfg(feature = "NSTouchBarItem")]
266impl NSPickerTouchBarItem {
267    extern_methods!(
268        #[unsafe(method(new))]
269        #[unsafe(method_family = new)]
270        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
271    );
272}