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 fn isEditable(&self) -> bool;
94
95 #[unsafe(method(setEditable:))]
97 #[unsafe(method_family = none)]
98 pub fn setEditable(&self, editable: bool);
99
100 #[unsafe(method(allowedTypes))]
101 #[unsafe(method_family = none)]
102 pub fn allowedTypes(&self) -> Option<Retained<NSArray<NSString>>>;
103
104 #[unsafe(method(setAllowedTypes:))]
108 #[unsafe(method_family = none)]
109 pub fn setAllowedTypes(&self, allowed_types: Option<&NSArray<NSString>>);
110
111 #[unsafe(method(placeholderString))]
112 #[unsafe(method_family = none)]
113 pub fn placeholderString(&self) -> Option<Retained<NSString>>;
114
115 #[unsafe(method(setPlaceholderString:))]
119 #[unsafe(method_family = none)]
120 pub fn setPlaceholderString(&self, placeholder_string: Option<&NSString>);
121
122 #[unsafe(method(placeholderAttributedString))]
123 #[unsafe(method_family = none)]
124 pub fn placeholderAttributedString(&self) -> Option<Retained<NSAttributedString>>;
125
126 #[unsafe(method(setPlaceholderAttributedString:))]
130 #[unsafe(method_family = none)]
131 pub fn setPlaceholderAttributedString(
132 &self,
133 placeholder_attributed_string: Option<&NSAttributedString>,
134 );
135
136 #[unsafe(method(URL))]
137 #[unsafe(method_family = none)]
138 pub fn URL(&self) -> Option<Retained<NSURL>>;
139
140 #[unsafe(method(setURL:))]
144 #[unsafe(method_family = none)]
145 pub fn setURL(&self, url: Option<&NSURL>);
146
147 #[unsafe(method(doubleAction))]
148 #[unsafe(method_family = none)]
149 pub fn doubleAction(&self) -> Option<Sel>;
150
151 #[unsafe(method(setDoubleAction:))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn setDoubleAction(&self, double_action: Option<Sel>);
159
160 #[cfg(feature = "NSPathCell")]
161 #[unsafe(method(pathStyle))]
162 #[unsafe(method_family = none)]
163 pub fn pathStyle(&self) -> NSPathStyle;
164
165 #[cfg(feature = "NSPathCell")]
166 #[unsafe(method(setPathStyle:))]
168 #[unsafe(method_family = none)]
169 pub fn setPathStyle(&self, path_style: NSPathStyle);
170
171 #[cfg(feature = "NSPathControlItem")]
172 #[unsafe(method(clickedPathItem))]
173 #[unsafe(method_family = none)]
174 pub fn clickedPathItem(&self) -> Option<Retained<NSPathControlItem>>;
175
176 #[cfg(feature = "NSPathControlItem")]
177 #[unsafe(method(pathItems))]
178 #[unsafe(method_family = none)]
179 pub fn pathItems(&self) -> Retained<NSArray<NSPathControlItem>>;
180
181 #[cfg(feature = "NSPathControlItem")]
182 #[unsafe(method(setPathItems:))]
186 #[unsafe(method_family = none)]
187 pub fn setPathItems(&self, path_items: &NSArray<NSPathControlItem>);
188
189 #[cfg(feature = "NSColor")]
190 #[unsafe(method(backgroundColor))]
191 #[unsafe(method_family = none)]
192 pub fn backgroundColor(&self) -> Option<Retained<NSColor>>;
193
194 #[cfg(feature = "NSColor")]
195 #[unsafe(method(setBackgroundColor:))]
199 #[unsafe(method_family = none)]
200 pub fn setBackgroundColor(&self, background_color: Option<&NSColor>);
201
202 #[unsafe(method(delegate))]
203 #[unsafe(method_family = none)]
204 pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSPathControlDelegate>>>;
205
206 #[unsafe(method(setDelegate:))]
210 #[unsafe(method_family = none)]
211 pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSPathControlDelegate>>);
212
213 #[cfg(feature = "NSDragging")]
214 #[unsafe(method(setDraggingSourceOperationMask:forLocal:))]
215 #[unsafe(method_family = none)]
216 pub fn setDraggingSourceOperationMask_forLocal(
217 &self,
218 mask: NSDragOperation,
219 is_local: bool,
220 );
221
222 #[cfg(feature = "NSMenu")]
223 #[unsafe(method(menu))]
224 #[unsafe(method_family = none)]
225 pub fn menu(&self) -> Option<Retained<NSMenu>>;
226
227 #[cfg(feature = "NSMenu")]
228 #[unsafe(method(setMenu:))]
230 #[unsafe(method_family = none)]
231 pub fn setMenu(&self, menu: Option<&NSMenu>);
232 );
233}
234
235#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
237impl NSPathControl {
238 extern_methods!(
239 #[unsafe(method(initWithFrame:))]
240 #[unsafe(method_family = init)]
241 pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
242
243 #[unsafe(method(initWithCoder:))]
247 #[unsafe(method_family = init)]
248 pub unsafe fn initWithCoder(
249 this: Allocated<Self>,
250 coder: &NSCoder,
251 ) -> Option<Retained<Self>>;
252 );
253}
254
255#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
257impl NSPathControl {
258 extern_methods!(
259 #[unsafe(method(init))]
260 #[unsafe(method_family = init)]
261 pub fn init(this: Allocated<Self>) -> Retained<Self>;
262 );
263}
264
265#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
267impl NSPathControl {
268 extern_methods!(
269 #[unsafe(method(new))]
270 #[unsafe(method_family = new)]
271 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
272 );
273}
274
275extern_protocol!(
276 pub unsafe trait NSPathControlDelegate: NSObjectProtocol + MainThreadOnly {
278 #[cfg(all(
279 feature = "NSControl",
280 feature = "NSPasteboard",
281 feature = "NSPathControlItem",
282 feature = "NSResponder",
283 feature = "NSView"
284 ))]
285 #[optional]
286 #[unsafe(method(pathControl:shouldDragItem:withPasteboard:))]
287 #[unsafe(method_family = none)]
288 fn pathControl_shouldDragItem_withPasteboard(
289 &self,
290 path_control: &NSPathControl,
291 path_item: &NSPathControlItem,
292 pasteboard: &NSPasteboard,
293 ) -> bool;
294
295 #[cfg(all(
296 feature = "NSActionCell",
297 feature = "NSCell",
298 feature = "NSControl",
299 feature = "NSPasteboard",
300 feature = "NSPathComponentCell",
301 feature = "NSResponder",
302 feature = "NSTextFieldCell",
303 feature = "NSView"
304 ))]
305 #[optional]
306 #[unsafe(method(pathControl:shouldDragPathComponentCell:withPasteboard:))]
307 #[unsafe(method_family = none)]
308 fn pathControl_shouldDragPathComponentCell_withPasteboard(
309 &self,
310 path_control: &NSPathControl,
311 path_component_cell: &NSPathComponentCell,
312 pasteboard: &NSPasteboard,
313 ) -> bool;
314
315 #[cfg(all(
316 feature = "NSControl",
317 feature = "NSDragging",
318 feature = "NSResponder",
319 feature = "NSView"
320 ))]
321 #[optional]
322 #[unsafe(method(pathControl:validateDrop:))]
323 #[unsafe(method_family = none)]
324 fn pathControl_validateDrop(
325 &self,
326 path_control: &NSPathControl,
327 info: &ProtocolObject<dyn NSDraggingInfo>,
328 ) -> NSDragOperation;
329
330 #[cfg(all(
331 feature = "NSControl",
332 feature = "NSDragging",
333 feature = "NSResponder",
334 feature = "NSView"
335 ))]
336 #[optional]
337 #[unsafe(method(pathControl:acceptDrop:))]
338 #[unsafe(method_family = none)]
339 fn pathControl_acceptDrop(
340 &self,
341 path_control: &NSPathControl,
342 info: &ProtocolObject<dyn NSDraggingInfo>,
343 ) -> bool;
344
345 #[cfg(all(
346 feature = "NSControl",
347 feature = "NSOpenPanel",
348 feature = "NSPanel",
349 feature = "NSResponder",
350 feature = "NSSavePanel",
351 feature = "NSView",
352 feature = "NSWindow"
353 ))]
354 #[optional]
355 #[unsafe(method(pathControl:willDisplayOpenPanel:))]
356 #[unsafe(method_family = none)]
357 fn pathControl_willDisplayOpenPanel(
358 &self,
359 path_control: &NSPathControl,
360 open_panel: &NSOpenPanel,
361 );
362
363 #[cfg(all(
364 feature = "NSControl",
365 feature = "NSMenu",
366 feature = "NSResponder",
367 feature = "NSView"
368 ))]
369 #[optional]
370 #[unsafe(method(pathControl:willPopUpMenu:))]
371 #[unsafe(method_family = none)]
372 fn pathControl_willPopUpMenu(&self, path_control: &NSPathControl, menu: &NSMenu);
373 }
374);
375
376#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
378impl NSPathControl {
379 extern_methods!(
380 #[cfg(all(
381 feature = "NSActionCell",
382 feature = "NSCell",
383 feature = "NSPathComponentCell",
384 feature = "NSTextFieldCell"
385 ))]
386 #[deprecated = "Use the clickedPathItem property instead"]
387 #[unsafe(method(clickedPathComponentCell))]
388 #[unsafe(method_family = none)]
389 pub fn clickedPathComponentCell(&self) -> Option<Retained<NSPathComponentCell>>;
390
391 #[cfg(all(
392 feature = "NSActionCell",
393 feature = "NSCell",
394 feature = "NSPathComponentCell",
395 feature = "NSTextFieldCell"
396 ))]
397 #[deprecated = "Use the pathItems property instead"]
398 #[unsafe(method(pathComponentCells))]
399 #[unsafe(method_family = none)]
400 pub fn pathComponentCells(&self) -> Retained<NSArray<NSPathComponentCell>>;
401
402 #[cfg(all(
403 feature = "NSActionCell",
404 feature = "NSCell",
405 feature = "NSPathComponentCell",
406 feature = "NSTextFieldCell"
407 ))]
408 #[deprecated = "Use the pathItems property instead"]
409 #[unsafe(method(setPathComponentCells:))]
410 #[unsafe(method_family = none)]
411 pub fn setPathComponentCells(&self, cells: &NSArray<NSPathComponentCell>);
412 );
413}