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