1use 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 NSPathStyle(pub NSInteger);
15impl NSPathStyle {
16 #[doc(alias = "NSPathStyleStandard")]
17 pub const Standard: Self = Self(0);
18 #[doc(alias = "NSPathStylePopUp")]
19 pub const PopUp: Self = Self(2);
20 #[doc(alias = "NSPathStyleNavigationBar")]
21 #[deprecated]
22 pub const NavigationBar: Self = Self(1);
23}
24
25unsafe impl Encode for NSPathStyle {
26 const ENCODING: Encoding = NSInteger::ENCODING;
27}
28
29unsafe impl RefEncode for NSPathStyle {
30 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
31}
32
33extern_class!(
34 #[unsafe(super(NSActionCell, NSCell, NSObject))]
36 #[derive(Debug, PartialEq, Eq, Hash)]
37 #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
38 pub struct NSPathCell;
39);
40
41#[cfg(all(
42 feature = "NSAccessibilityProtocols",
43 feature = "NSActionCell",
44 feature = "NSCell"
45))]
46extern_conformance!(
47 unsafe impl NSAccessibility for NSPathCell {}
48);
49
50#[cfg(all(
51 feature = "NSAccessibilityProtocols",
52 feature = "NSActionCell",
53 feature = "NSCell"
54))]
55extern_conformance!(
56 unsafe impl NSAccessibilityElementProtocol for NSPathCell {}
57);
58
59#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
60extern_conformance!(
61 unsafe impl NSCoding for NSPathCell {}
62);
63
64#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
65extern_conformance!(
66 unsafe impl NSCopying for NSPathCell {}
67);
68
69#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
70unsafe impl CopyingHelper for NSPathCell {
71 type Result = Self;
72}
73
74#[cfg(all(feature = "NSActionCell", feature = "NSCell", feature = "NSMenu"))]
75extern_conformance!(
76 unsafe impl NSMenuItemValidation for NSPathCell {}
77);
78
79#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
80extern_conformance!(
81 unsafe impl NSObjectProtocol for NSPathCell {}
82);
83
84#[cfg(all(feature = "NSActionCell", feature = "NSCell", feature = "NSSavePanel"))]
85extern_conformance!(
86 unsafe impl NSOpenSavePanelDelegate for NSPathCell {}
87);
88
89#[cfg(all(
90 feature = "NSActionCell",
91 feature = "NSCell",
92 feature = "NSUserInterfaceItemIdentification"
93))]
94extern_conformance!(
95 unsafe impl NSUserInterfaceItemIdentification for NSPathCell {}
96);
97
98#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
99impl NSPathCell {
100 extern_methods!(
101 #[unsafe(method(pathStyle))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn pathStyle(&self) -> NSPathStyle;
104
105 #[unsafe(method(setPathStyle:))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn setPathStyle(&self, path_style: NSPathStyle);
109
110 #[unsafe(method(URL))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
113
114 #[unsafe(method(setURL:))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn setURL(&self, url: Option<&NSURL>);
118
119 #[unsafe(method(setObjectValue:))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn setObjectValue(&self, obj: Option<&ProtocolObject<dyn NSCopying>>);
122
123 #[unsafe(method(allowedTypes))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn allowedTypes(&self) -> Option<Retained<NSArray<NSString>>>;
126
127 #[unsafe(method(setAllowedTypes:))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn setAllowedTypes(&self, allowed_types: Option<&NSArray<NSString>>);
131
132 #[unsafe(method(delegate))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSPathCellDelegate>>>;
135
136 #[unsafe(method(setDelegate:))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSPathCellDelegate>>);
141
142 #[unsafe(method(pathComponentCellClass))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn pathComponentCellClass(mtm: MainThreadMarker) -> &'static AnyClass;
145
146 #[cfg(all(feature = "NSPathComponentCell", feature = "NSTextFieldCell"))]
147 #[unsafe(method(pathComponentCells))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn pathComponentCells(&self) -> Retained<NSArray<NSPathComponentCell>>;
150
151 #[cfg(all(feature = "NSPathComponentCell", feature = "NSTextFieldCell"))]
152 #[unsafe(method(setPathComponentCells:))]
154 #[unsafe(method_family = none)]
155 pub unsafe fn setPathComponentCells(
156 &self,
157 path_component_cells: &NSArray<NSPathComponentCell>,
158 );
159
160 #[cfg(all(
161 feature = "NSPathComponentCell",
162 feature = "NSResponder",
163 feature = "NSTextFieldCell",
164 feature = "NSView"
165 ))]
166 #[unsafe(method(rectOfPathComponentCell:withFrame:inView:))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn rectOfPathComponentCell_withFrame_inView(
169 &self,
170 cell: &NSPathComponentCell,
171 frame: NSRect,
172 view: &NSView,
173 ) -> NSRect;
174
175 #[cfg(all(
176 feature = "NSPathComponentCell",
177 feature = "NSResponder",
178 feature = "NSTextFieldCell",
179 feature = "NSView"
180 ))]
181 #[unsafe(method(pathComponentCellAtPoint:withFrame:inView:))]
182 #[unsafe(method_family = none)]
183 pub unsafe fn pathComponentCellAtPoint_withFrame_inView(
184 &self,
185 point: NSPoint,
186 frame: NSRect,
187 view: &NSView,
188 ) -> Option<Retained<NSPathComponentCell>>;
189
190 #[cfg(all(feature = "NSPathComponentCell", feature = "NSTextFieldCell"))]
191 #[unsafe(method(clickedPathComponentCell))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn clickedPathComponentCell(&self) -> Option<Retained<NSPathComponentCell>>;
194
195 #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
196 #[unsafe(method(mouseEntered:withFrame:inView:))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn mouseEntered_withFrame_inView(
199 &self,
200 event: &NSEvent,
201 frame: NSRect,
202 view: &NSView,
203 );
204
205 #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
206 #[unsafe(method(mouseExited:withFrame:inView:))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn mouseExited_withFrame_inView(
209 &self,
210 event: &NSEvent,
211 frame: NSRect,
212 view: &NSView,
213 );
214
215 #[unsafe(method(doubleAction))]
216 #[unsafe(method_family = none)]
217 pub unsafe fn doubleAction(&self) -> Option<Sel>;
218
219 #[unsafe(method(setDoubleAction:))]
221 #[unsafe(method_family = none)]
222 pub unsafe fn setDoubleAction(&self, double_action: Option<Sel>);
223
224 #[cfg(feature = "NSColor")]
225 #[unsafe(method(backgroundColor))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;
228
229 #[cfg(feature = "NSColor")]
230 #[unsafe(method(setBackgroundColor:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);
234
235 #[unsafe(method(placeholderString))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn placeholderString(&self) -> Option<Retained<NSString>>;
238
239 #[unsafe(method(setPlaceholderString:))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn setPlaceholderString(&self, placeholder_string: Option<&NSString>);
243
244 #[unsafe(method(placeholderAttributedString))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn placeholderAttributedString(&self) -> Option<Retained<NSAttributedString>>;
247
248 #[unsafe(method(setPlaceholderAttributedString:))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn setPlaceholderAttributedString(
252 &self,
253 placeholder_attributed_string: Option<&NSAttributedString>,
254 );
255 );
256}
257
258#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
260impl NSPathCell {
261 extern_methods!(
262 #[unsafe(method(init))]
263 #[unsafe(method_family = init)]
264 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
265
266 #[unsafe(method(initTextCell:))]
267 #[unsafe(method_family = init)]
268 pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
269
270 #[cfg(feature = "NSImage")]
271 #[unsafe(method(initImageCell:))]
272 #[unsafe(method_family = init)]
273 pub unsafe fn initImageCell(
274 this: Allocated<Self>,
275 image: Option<&NSImage>,
276 ) -> Retained<Self>;
277
278 #[unsafe(method(initWithCoder:))]
279 #[unsafe(method_family = init)]
280 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
281 );
282}
283
284#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
286impl NSPathCell {
287 extern_methods!(
288 #[unsafe(method(new))]
289 #[unsafe(method_family = new)]
290 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
291 );
292}
293
294extern_protocol!(
295 pub unsafe trait NSPathCellDelegate: NSObjectProtocol + MainThreadOnly {
297 #[cfg(all(
298 feature = "NSActionCell",
299 feature = "NSCell",
300 feature = "NSOpenPanel",
301 feature = "NSPanel",
302 feature = "NSResponder",
303 feature = "NSSavePanel",
304 feature = "NSWindow"
305 ))]
306 #[optional]
307 #[unsafe(method(pathCell:willDisplayOpenPanel:))]
308 #[unsafe(method_family = none)]
309 unsafe fn pathCell_willDisplayOpenPanel(
310 &self,
311 path_cell: &NSPathCell,
312 open_panel: &NSOpenPanel,
313 );
314
315 #[cfg(all(feature = "NSActionCell", feature = "NSCell", feature = "NSMenu"))]
316 #[optional]
317 #[unsafe(method(pathCell:willPopUpMenu:))]
318 #[unsafe(method_family = none)]
319 unsafe fn pathCell_willPopUpMenu(&self, path_cell: &NSPathCell, menu: &NSMenu);
320 }
321);