objc2_app_kit/generated/
NSPickerTouchBarItem.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[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#[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 #[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:))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn pickerTouchBarItemWithIdentifier_labels_selectionMode_target_action(
82 identifier: &NSTouchBarItemIdentifier,
83 labels: &NSArray<NSString>,
84 selection_mode: NSPickerTouchBarItemSelectionMode,
85 target: Option<&AnyObject>,
86 action: Option<Sel>,
87 mtm: MainThreadMarker,
88 ) -> Retained<Self>;
89
90 #[cfg(feature = "NSImage")]
91 #[unsafe(method(pickerTouchBarItemWithIdentifier:images:selectionMode:target:action:))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn pickerTouchBarItemWithIdentifier_images_selectionMode_target_action(
98 identifier: &NSTouchBarItemIdentifier,
99 images: &NSArray<NSImage>,
100 selection_mode: NSPickerTouchBarItemSelectionMode,
101 target: Option<&AnyObject>,
102 action: Option<Sel>,
103 mtm: MainThreadMarker,
104 ) -> Retained<Self>;
105
106 #[unsafe(method(controlRepresentation))]
107 #[unsafe(method_family = none)]
108 pub fn controlRepresentation(&self) -> NSPickerTouchBarItemControlRepresentation;
109
110 #[unsafe(method(setControlRepresentation:))]
112 #[unsafe(method_family = none)]
113 pub fn setControlRepresentation(
114 &self,
115 control_representation: NSPickerTouchBarItemControlRepresentation,
116 );
117
118 #[unsafe(method(collapsedRepresentationLabel))]
119 #[unsafe(method_family = none)]
120 pub fn collapsedRepresentationLabel(&self) -> Retained<NSString>;
121
122 #[unsafe(method(setCollapsedRepresentationLabel:))]
126 #[unsafe(method_family = none)]
127 pub fn setCollapsedRepresentationLabel(&self, collapsed_representation_label: &NSString);
128
129 #[cfg(feature = "NSImage")]
130 #[unsafe(method(collapsedRepresentationImage))]
131 #[unsafe(method_family = none)]
132 pub fn collapsedRepresentationImage(&self) -> Option<Retained<NSImage>>;
133
134 #[cfg(feature = "NSImage")]
135 #[unsafe(method(setCollapsedRepresentationImage:))]
137 #[unsafe(method_family = none)]
138 pub fn setCollapsedRepresentationImage(
139 &self,
140 collapsed_representation_image: Option<&NSImage>,
141 );
142
143 #[unsafe(method(selectedIndex))]
144 #[unsafe(method_family = none)]
145 pub fn selectedIndex(&self) -> NSInteger;
146
147 #[unsafe(method(setSelectedIndex:))]
149 #[unsafe(method_family = none)]
150 pub fn setSelectedIndex(&self, selected_index: NSInteger);
151
152 #[cfg(feature = "NSColor")]
153 #[unsafe(method(selectionColor))]
154 #[unsafe(method_family = none)]
155 pub fn selectionColor(&self) -> Option<Retained<NSColor>>;
156
157 #[cfg(feature = "NSColor")]
158 #[unsafe(method(setSelectionColor:))]
162 #[unsafe(method_family = none)]
163 pub fn setSelectionColor(&self, selection_color: Option<&NSColor>);
164
165 #[unsafe(method(selectionMode))]
166 #[unsafe(method_family = none)]
167 pub fn selectionMode(&self) -> NSPickerTouchBarItemSelectionMode;
168
169 #[unsafe(method(setSelectionMode:))]
171 #[unsafe(method_family = none)]
172 pub fn setSelectionMode(&self, selection_mode: NSPickerTouchBarItemSelectionMode);
173
174 #[unsafe(method(numberOfOptions))]
175 #[unsafe(method_family = none)]
176 pub fn numberOfOptions(&self) -> NSInteger;
177
178 #[unsafe(method(setNumberOfOptions:))]
180 #[unsafe(method_family = none)]
181 pub fn setNumberOfOptions(&self, number_of_options: NSInteger);
182
183 #[cfg(feature = "NSImage")]
184 #[unsafe(method(setImage:atIndex:))]
185 #[unsafe(method_family = none)]
186 pub fn setImage_atIndex(&self, image: Option<&NSImage>, index: NSInteger);
187
188 #[cfg(feature = "NSImage")]
189 #[unsafe(method(imageAtIndex:))]
190 #[unsafe(method_family = none)]
191 pub fn imageAtIndex(&self, index: NSInteger) -> Option<Retained<NSImage>>;
192
193 #[unsafe(method(setLabel:atIndex:))]
194 #[unsafe(method_family = none)]
195 pub fn setLabel_atIndex(&self, label: &NSString, index: NSInteger);
196
197 #[unsafe(method(labelAtIndex:))]
198 #[unsafe(method_family = none)]
199 pub fn labelAtIndex(&self, index: NSInteger) -> Option<Retained<NSString>>;
200
201 #[unsafe(method(target))]
202 #[unsafe(method_family = none)]
203 pub fn target(&self) -> Option<Retained<AnyObject>>;
204
205 #[unsafe(method(setTarget:))]
213 #[unsafe(method_family = none)]
214 pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
215
216 #[unsafe(method(action))]
217 #[unsafe(method_family = none)]
218 pub fn action(&self) -> Option<Sel>;
219
220 #[unsafe(method(setAction:))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn setAction(&self, action: Option<Sel>);
228
229 #[unsafe(method(isEnabled))]
230 #[unsafe(method_family = none)]
231 pub fn isEnabled(&self) -> bool;
232
233 #[unsafe(method(setEnabled:))]
235 #[unsafe(method_family = none)]
236 pub fn setEnabled(&self, enabled: bool);
237
238 #[unsafe(method(setEnabled:atIndex:))]
239 #[unsafe(method_family = none)]
240 pub fn setEnabled_atIndex(&self, enabled: bool, index: NSInteger);
241
242 #[unsafe(method(isEnabledAtIndex:))]
243 #[unsafe(method_family = none)]
244 pub fn isEnabledAtIndex(&self, index: NSInteger) -> bool;
245
246 #[unsafe(method(customizationLabel))]
248 #[unsafe(method_family = none)]
249 pub fn customizationLabel(&self) -> Retained<NSString>;
250
251 #[unsafe(method(setCustomizationLabel:))]
255 #[unsafe(method_family = none)]
256 pub fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
257 );
258}
259
260#[cfg(feature = "NSTouchBarItem")]
262impl NSPickerTouchBarItem {
263 extern_methods!(
264 #[unsafe(method(initWithIdentifier:))]
265 #[unsafe(method_family = init)]
266 pub fn initWithIdentifier(
267 this: Allocated<Self>,
268 identifier: &NSTouchBarItemIdentifier,
269 ) -> Retained<Self>;
270
271 #[unsafe(method(initWithCoder:))]
275 #[unsafe(method_family = init)]
276 pub unsafe fn initWithCoder(
277 this: Allocated<Self>,
278 coder: &NSCoder,
279 ) -> Option<Retained<Self>>;
280
281 #[unsafe(method(init))]
282 #[unsafe(method_family = init)]
283 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
284 );
285}
286
287#[cfg(feature = "NSTouchBarItem")]
289impl NSPickerTouchBarItem {
290 extern_methods!(
291 #[unsafe(method(new))]
292 #[unsafe(method_family = new)]
293 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
294 );
295}