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")]
63unsafe impl NSCoding for NSPickerTouchBarItem {}
64
65#[cfg(feature = "NSTouchBarItem")]
66unsafe impl NSObjectProtocol for NSPickerTouchBarItem {}
67
68#[cfg(feature = "NSTouchBarItem")]
69impl NSPickerTouchBarItem {
70 extern_methods!(
71 #[unsafe(method(pickerTouchBarItemWithIdentifier:labels:selectionMode:target:action:))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn pickerTouchBarItemWithIdentifier_labels_selectionMode_target_action(
74 identifier: &NSTouchBarItemIdentifier,
75 labels: &NSArray<NSString>,
76 selection_mode: NSPickerTouchBarItemSelectionMode,
77 target: Option<&AnyObject>,
78 action: Option<Sel>,
79 mtm: MainThreadMarker,
80 ) -> Retained<Self>;
81
82 #[cfg(feature = "NSImage")]
83 #[unsafe(method(pickerTouchBarItemWithIdentifier:images:selectionMode:target:action:))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn pickerTouchBarItemWithIdentifier_images_selectionMode_target_action(
86 identifier: &NSTouchBarItemIdentifier,
87 images: &NSArray<NSImage>,
88 selection_mode: NSPickerTouchBarItemSelectionMode,
89 target: Option<&AnyObject>,
90 action: Option<Sel>,
91 mtm: MainThreadMarker,
92 ) -> Retained<Self>;
93
94 #[unsafe(method(controlRepresentation))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn controlRepresentation(&self) -> NSPickerTouchBarItemControlRepresentation;
97
98 #[unsafe(method(setControlRepresentation:))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn setControlRepresentation(
102 &self,
103 control_representation: NSPickerTouchBarItemControlRepresentation,
104 );
105
106 #[unsafe(method(collapsedRepresentationLabel))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn collapsedRepresentationLabel(&self) -> Retained<NSString>;
109
110 #[unsafe(method(setCollapsedRepresentationLabel:))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn setCollapsedRepresentationLabel(
114 &self,
115 collapsed_representation_label: &NSString,
116 );
117
118 #[cfg(feature = "NSImage")]
119 #[unsafe(method(collapsedRepresentationImage))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn collapsedRepresentationImage(&self) -> Option<Retained<NSImage>>;
122
123 #[cfg(feature = "NSImage")]
124 #[unsafe(method(setCollapsedRepresentationImage:))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn setCollapsedRepresentationImage(
128 &self,
129 collapsed_representation_image: Option<&NSImage>,
130 );
131
132 #[unsafe(method(selectedIndex))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn selectedIndex(&self) -> NSInteger;
135
136 #[unsafe(method(setSelectedIndex:))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn setSelectedIndex(&self, selected_index: NSInteger);
140
141 #[cfg(feature = "NSColor")]
142 #[unsafe(method(selectionColor))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn selectionColor(&self) -> Option<Retained<NSColor>>;
145
146 #[cfg(feature = "NSColor")]
147 #[unsafe(method(setSelectionColor:))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn setSelectionColor(&self, selection_color: Option<&NSColor>);
151
152 #[unsafe(method(selectionMode))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn selectionMode(&self) -> NSPickerTouchBarItemSelectionMode;
155
156 #[unsafe(method(setSelectionMode:))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn setSelectionMode(&self, selection_mode: NSPickerTouchBarItemSelectionMode);
160
161 #[unsafe(method(numberOfOptions))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn numberOfOptions(&self) -> NSInteger;
164
165 #[unsafe(method(setNumberOfOptions:))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn setNumberOfOptions(&self, number_of_options: NSInteger);
169
170 #[cfg(feature = "NSImage")]
171 #[unsafe(method(setImage:atIndex:))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn setImage_atIndex(&self, image: Option<&NSImage>, index: NSInteger);
174
175 #[cfg(feature = "NSImage")]
176 #[unsafe(method(imageAtIndex:))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn imageAtIndex(&self, index: NSInteger) -> Option<Retained<NSImage>>;
179
180 #[unsafe(method(setLabel:atIndex:))]
181 #[unsafe(method_family = none)]
182 pub unsafe fn setLabel_atIndex(&self, label: &NSString, index: NSInteger);
183
184 #[unsafe(method(labelAtIndex:))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn labelAtIndex(&self, index: NSInteger) -> Option<Retained<NSString>>;
187
188 #[unsafe(method(target))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
191
192 #[unsafe(method(setTarget:))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
197
198 #[unsafe(method(action))]
199 #[unsafe(method_family = none)]
200 pub unsafe fn action(&self) -> Option<Sel>;
201
202 #[unsafe(method(setAction:))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn setAction(&self, action: Option<Sel>);
206
207 #[unsafe(method(isEnabled))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn isEnabled(&self) -> bool;
210
211 #[unsafe(method(setEnabled:))]
213 #[unsafe(method_family = none)]
214 pub unsafe fn setEnabled(&self, enabled: bool);
215
216 #[unsafe(method(setEnabled:atIndex:))]
217 #[unsafe(method_family = none)]
218 pub unsafe fn setEnabled_atIndex(&self, enabled: bool, index: NSInteger);
219
220 #[unsafe(method(isEnabledAtIndex:))]
221 #[unsafe(method_family = none)]
222 pub unsafe fn isEnabledAtIndex(&self, index: NSInteger) -> bool;
223
224 #[unsafe(method(customizationLabel))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn customizationLabel(&self) -> Retained<NSString>;
228
229 #[unsafe(method(setCustomizationLabel:))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
233 );
234}
235
236#[cfg(feature = "NSTouchBarItem")]
238impl NSPickerTouchBarItem {
239 extern_methods!(
240 #[unsafe(method(initWithIdentifier:))]
241 #[unsafe(method_family = init)]
242 pub unsafe fn initWithIdentifier(
243 this: Allocated<Self>,
244 identifier: &NSTouchBarItemIdentifier,
245 ) -> Retained<Self>;
246
247 #[unsafe(method(initWithCoder:))]
248 #[unsafe(method_family = init)]
249 pub unsafe fn initWithCoder(
250 this: Allocated<Self>,
251 coder: &NSCoder,
252 ) -> Option<Retained<Self>>;
253
254 #[unsafe(method(init))]
255 #[unsafe(method_family = init)]
256 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
257 );
258}
259
260#[cfg(feature = "NSTouchBarItem")]
262impl NSPickerTouchBarItem {
263 extern_methods!(
264 #[unsafe(method(new))]
265 #[unsafe(method_family = new)]
266 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
267 );
268}