1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 #[unsafe(super(NSControl, NSView, NSResponder, NSObject))]
13 #[derive(Debug, PartialEq, Eq, Hash)]
14 #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
15 pub struct NSPathControl;
16);
17
18#[cfg(all(
19 feature = "NSAccessibilityProtocols",
20 feature = "NSControl",
21 feature = "NSResponder",
22 feature = "NSView"
23))]
24extern_conformance!(
25 unsafe impl NSAccessibility for NSPathControl {}
26);
27
28#[cfg(all(
29 feature = "NSAccessibilityProtocols",
30 feature = "NSControl",
31 feature = "NSResponder",
32 feature = "NSView"
33))]
34extern_conformance!(
35 unsafe impl NSAccessibilityElementProtocol for NSPathControl {}
36);
37
38#[cfg(all(
39 feature = "NSAnimation",
40 feature = "NSControl",
41 feature = "NSResponder",
42 feature = "NSView"
43))]
44extern_conformance!(
45 unsafe impl NSAnimatablePropertyContainer for NSPathControl {}
46);
47
48#[cfg(all(
49 feature = "NSAppearance",
50 feature = "NSControl",
51 feature = "NSResponder",
52 feature = "NSView"
53))]
54extern_conformance!(
55 unsafe impl NSAppearanceCustomization for NSPathControl {}
56);
57
58#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
59extern_conformance!(
60 unsafe impl NSCoding for NSPathControl {}
61);
62
63#[cfg(all(
64 feature = "NSControl",
65 feature = "NSDragging",
66 feature = "NSResponder",
67 feature = "NSView"
68))]
69extern_conformance!(
70 unsafe impl NSDraggingDestination for NSPathControl {}
71);
72
73#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
74extern_conformance!(
75 unsafe impl NSObjectProtocol for NSPathControl {}
76);
77
78#[cfg(all(
79 feature = "NSControl",
80 feature = "NSResponder",
81 feature = "NSUserInterfaceItemIdentification",
82 feature = "NSView"
83))]
84extern_conformance!(
85 unsafe impl NSUserInterfaceItemIdentification for NSPathControl {}
86);
87
88#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
89impl NSPathControl {
90 extern_methods!(
91 #[unsafe(method(isEditable))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn isEditable(&self) -> bool;
94
95 #[unsafe(method(setEditable:))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn setEditable(&self, editable: bool);
99
100 #[unsafe(method(allowedTypes))]
101 #[unsafe(method_family = none)]
102 pub unsafe fn allowedTypes(&self) -> Option<Retained<NSArray<NSString>>>;
103
104 #[unsafe(method(setAllowedTypes:))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn setAllowedTypes(&self, allowed_types: Option<&NSArray<NSString>>);
108
109 #[unsafe(method(placeholderString))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn placeholderString(&self) -> Option<Retained<NSString>>;
112
113 #[unsafe(method(setPlaceholderString:))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn setPlaceholderString(&self, placeholder_string: Option<&NSString>);
117
118 #[unsafe(method(placeholderAttributedString))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn placeholderAttributedString(&self) -> Option<Retained<NSAttributedString>>;
121
122 #[unsafe(method(setPlaceholderAttributedString:))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn setPlaceholderAttributedString(
126 &self,
127 placeholder_attributed_string: Option<&NSAttributedString>,
128 );
129
130 #[unsafe(method(URL))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
133
134 #[unsafe(method(setURL:))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn setURL(&self, url: Option<&NSURL>);
138
139 #[unsafe(method(doubleAction))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn doubleAction(&self) -> Option<Sel>;
142
143 #[unsafe(method(setDoubleAction:))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn setDoubleAction(&self, double_action: Option<Sel>);
147
148 #[cfg(feature = "NSPathCell")]
149 #[unsafe(method(pathStyle))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn pathStyle(&self) -> NSPathStyle;
152
153 #[cfg(feature = "NSPathCell")]
154 #[unsafe(method(setPathStyle:))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn setPathStyle(&self, path_style: NSPathStyle);
158
159 #[cfg(feature = "NSPathControlItem")]
160 #[unsafe(method(clickedPathItem))]
161 #[unsafe(method_family = none)]
162 pub unsafe fn clickedPathItem(&self) -> Option<Retained<NSPathControlItem>>;
163
164 #[cfg(feature = "NSPathControlItem")]
165 #[unsafe(method(pathItems))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn pathItems(&self) -> Retained<NSArray<NSPathControlItem>>;
168
169 #[cfg(feature = "NSPathControlItem")]
170 #[unsafe(method(setPathItems:))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn setPathItems(&self, path_items: &NSArray<NSPathControlItem>);
174
175 #[cfg(feature = "NSColor")]
176 #[unsafe(method(backgroundColor))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;
179
180 #[cfg(feature = "NSColor")]
181 #[unsafe(method(setBackgroundColor:))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);
185
186 #[unsafe(method(delegate))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn delegate(
189 &self,
190 ) -> Option<Retained<ProtocolObject<dyn NSPathControlDelegate>>>;
191
192 #[unsafe(method(setDelegate:))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn setDelegate(
197 &self,
198 delegate: Option<&ProtocolObject<dyn NSPathControlDelegate>>,
199 );
200
201 #[cfg(feature = "NSDragging")]
202 #[unsafe(method(setDraggingSourceOperationMask:forLocal:))]
203 #[unsafe(method_family = none)]
204 pub unsafe fn setDraggingSourceOperationMask_forLocal(
205 &self,
206 mask: NSDragOperation,
207 is_local: bool,
208 );
209
210 #[cfg(feature = "NSMenu")]
211 #[unsafe(method(menu))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn menu(&self) -> Option<Retained<NSMenu>>;
214
215 #[cfg(feature = "NSMenu")]
216 #[unsafe(method(setMenu:))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn setMenu(&self, menu: Option<&NSMenu>);
220 );
221}
222
223#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
225impl NSPathControl {
226 extern_methods!(
227 #[unsafe(method(initWithFrame:))]
228 #[unsafe(method_family = init)]
229 pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
230
231 #[unsafe(method(initWithCoder:))]
232 #[unsafe(method_family = init)]
233 pub unsafe fn initWithCoder(
234 this: Allocated<Self>,
235 coder: &NSCoder,
236 ) -> Option<Retained<Self>>;
237 );
238}
239
240#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
242impl NSPathControl {
243 extern_methods!(
244 #[unsafe(method(init))]
245 #[unsafe(method_family = init)]
246 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
247 );
248}
249
250#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
252impl NSPathControl {
253 extern_methods!(
254 #[unsafe(method(new))]
255 #[unsafe(method_family = new)]
256 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
257 );
258}
259
260extern_protocol!(
261 pub unsafe trait NSPathControlDelegate: NSObjectProtocol + MainThreadOnly {
263 #[cfg(all(
264 feature = "NSControl",
265 feature = "NSPasteboard",
266 feature = "NSPathControlItem",
267 feature = "NSResponder",
268 feature = "NSView"
269 ))]
270 #[optional]
271 #[unsafe(method(pathControl:shouldDragItem:withPasteboard:))]
272 #[unsafe(method_family = none)]
273 unsafe fn pathControl_shouldDragItem_withPasteboard(
274 &self,
275 path_control: &NSPathControl,
276 path_item: &NSPathControlItem,
277 pasteboard: &NSPasteboard,
278 ) -> bool;
279
280 #[cfg(all(
281 feature = "NSActionCell",
282 feature = "NSCell",
283 feature = "NSControl",
284 feature = "NSPasteboard",
285 feature = "NSPathComponentCell",
286 feature = "NSResponder",
287 feature = "NSTextFieldCell",
288 feature = "NSView"
289 ))]
290 #[optional]
291 #[unsafe(method(pathControl:shouldDragPathComponentCell:withPasteboard:))]
292 #[unsafe(method_family = none)]
293 unsafe fn pathControl_shouldDragPathComponentCell_withPasteboard(
294 &self,
295 path_control: &NSPathControl,
296 path_component_cell: &NSPathComponentCell,
297 pasteboard: &NSPasteboard,
298 ) -> bool;
299
300 #[cfg(all(
301 feature = "NSControl",
302 feature = "NSDragging",
303 feature = "NSResponder",
304 feature = "NSView"
305 ))]
306 #[optional]
307 #[unsafe(method(pathControl:validateDrop:))]
308 #[unsafe(method_family = none)]
309 unsafe fn pathControl_validateDrop(
310 &self,
311 path_control: &NSPathControl,
312 info: &ProtocolObject<dyn NSDraggingInfo>,
313 ) -> NSDragOperation;
314
315 #[cfg(all(
316 feature = "NSControl",
317 feature = "NSDragging",
318 feature = "NSResponder",
319 feature = "NSView"
320 ))]
321 #[optional]
322 #[unsafe(method(pathControl:acceptDrop:))]
323 #[unsafe(method_family = none)]
324 unsafe fn pathControl_acceptDrop(
325 &self,
326 path_control: &NSPathControl,
327 info: &ProtocolObject<dyn NSDraggingInfo>,
328 ) -> bool;
329
330 #[cfg(all(
331 feature = "NSControl",
332 feature = "NSOpenPanel",
333 feature = "NSPanel",
334 feature = "NSResponder",
335 feature = "NSSavePanel",
336 feature = "NSView",
337 feature = "NSWindow"
338 ))]
339 #[optional]
340 #[unsafe(method(pathControl:willDisplayOpenPanel:))]
341 #[unsafe(method_family = none)]
342 unsafe fn pathControl_willDisplayOpenPanel(
343 &self,
344 path_control: &NSPathControl,
345 open_panel: &NSOpenPanel,
346 );
347
348 #[cfg(all(
349 feature = "NSControl",
350 feature = "NSMenu",
351 feature = "NSResponder",
352 feature = "NSView"
353 ))]
354 #[optional]
355 #[unsafe(method(pathControl:willPopUpMenu:))]
356 #[unsafe(method_family = none)]
357 unsafe fn pathControl_willPopUpMenu(&self, path_control: &NSPathControl, menu: &NSMenu);
358 }
359);
360
361#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
363impl NSPathControl {
364 extern_methods!(
365 #[cfg(all(
366 feature = "NSActionCell",
367 feature = "NSCell",
368 feature = "NSPathComponentCell",
369 feature = "NSTextFieldCell"
370 ))]
371 #[deprecated = "Use the clickedPathItem property instead"]
372 #[unsafe(method(clickedPathComponentCell))]
373 #[unsafe(method_family = none)]
374 pub unsafe fn clickedPathComponentCell(&self) -> Option<Retained<NSPathComponentCell>>;
375
376 #[cfg(all(
377 feature = "NSActionCell",
378 feature = "NSCell",
379 feature = "NSPathComponentCell",
380 feature = "NSTextFieldCell"
381 ))]
382 #[deprecated = "Use the pathItems property instead"]
383 #[unsafe(method(pathComponentCells))]
384 #[unsafe(method_family = none)]
385 pub unsafe fn pathComponentCells(&self) -> Retained<NSArray<NSPathComponentCell>>;
386
387 #[cfg(all(
388 feature = "NSActionCell",
389 feature = "NSCell",
390 feature = "NSPathComponentCell",
391 feature = "NSTextFieldCell"
392 ))]
393 #[deprecated = "Use the pathItems property instead"]
394 #[unsafe(method(setPathComponentCells:))]
395 #[unsafe(method_family = none)]
396 pub unsafe fn setPathComponentCells(&self, cells: &NSArray<NSPathComponentCell>);
397 );
398}