objc2_app_kit/generated/
NSPathCell.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspathstyle?language=objc)
11// NS_ENUM
12#[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    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspathcell?language=objc)
35    #[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 fn pathStyle(&self) -> NSPathStyle;
104
105        /// Setter for [`pathStyle`][Self::pathStyle].
106        #[unsafe(method(setPathStyle:))]
107        #[unsafe(method_family = none)]
108        pub fn setPathStyle(&self, path_style: NSPathStyle);
109
110        #[unsafe(method(URL))]
111        #[unsafe(method_family = none)]
112        pub fn URL(&self) -> Option<Retained<NSURL>>;
113
114        /// Setter for [`URL`][Self::URL].
115        ///
116        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
117        #[unsafe(method(setURL:))]
118        #[unsafe(method_family = none)]
119        pub fn setURL(&self, url: Option<&NSURL>);
120
121        /// # Safety
122        ///
123        /// `obj` should be of the correct type.
124        #[unsafe(method(setObjectValue:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn setObjectValue(&self, obj: Option<&ProtocolObject<dyn NSCopying>>);
127
128        #[unsafe(method(allowedTypes))]
129        #[unsafe(method_family = none)]
130        pub fn allowedTypes(&self) -> Option<Retained<NSArray<NSString>>>;
131
132        /// Setter for [`allowedTypes`][Self::allowedTypes].
133        ///
134        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
135        #[unsafe(method(setAllowedTypes:))]
136        #[unsafe(method_family = none)]
137        pub fn setAllowedTypes(&self, allowed_types: Option<&NSArray<NSString>>);
138
139        #[unsafe(method(delegate))]
140        #[unsafe(method_family = none)]
141        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSPathCellDelegate>>>;
142
143        /// Setter for [`delegate`][Self::delegate].
144        ///
145        /// This is a [weak property][objc2::topics::weak_property].
146        #[unsafe(method(setDelegate:))]
147        #[unsafe(method_family = none)]
148        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSPathCellDelegate>>);
149
150        #[unsafe(method(pathComponentCellClass))]
151        #[unsafe(method_family = none)]
152        pub fn pathComponentCellClass(mtm: MainThreadMarker) -> &'static AnyClass;
153
154        #[cfg(all(feature = "NSPathComponentCell", feature = "NSTextFieldCell"))]
155        #[unsafe(method(pathComponentCells))]
156        #[unsafe(method_family = none)]
157        pub fn pathComponentCells(&self) -> Retained<NSArray<NSPathComponentCell>>;
158
159        #[cfg(all(feature = "NSPathComponentCell", feature = "NSTextFieldCell"))]
160        /// Setter for [`pathComponentCells`][Self::pathComponentCells].
161        ///
162        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
163        #[unsafe(method(setPathComponentCells:))]
164        #[unsafe(method_family = none)]
165        pub fn setPathComponentCells(&self, path_component_cells: &NSArray<NSPathComponentCell>);
166
167        #[cfg(all(
168            feature = "NSPathComponentCell",
169            feature = "NSResponder",
170            feature = "NSTextFieldCell",
171            feature = "NSView"
172        ))]
173        #[unsafe(method(rectOfPathComponentCell:withFrame:inView:))]
174        #[unsafe(method_family = none)]
175        pub fn rectOfPathComponentCell_withFrame_inView(
176            &self,
177            cell: &NSPathComponentCell,
178            frame: NSRect,
179            view: &NSView,
180        ) -> NSRect;
181
182        #[cfg(all(
183            feature = "NSPathComponentCell",
184            feature = "NSResponder",
185            feature = "NSTextFieldCell",
186            feature = "NSView"
187        ))]
188        #[unsafe(method(pathComponentCellAtPoint:withFrame:inView:))]
189        #[unsafe(method_family = none)]
190        pub fn pathComponentCellAtPoint_withFrame_inView(
191            &self,
192            point: NSPoint,
193            frame: NSRect,
194            view: &NSView,
195        ) -> Option<Retained<NSPathComponentCell>>;
196
197        #[cfg(all(feature = "NSPathComponentCell", feature = "NSTextFieldCell"))]
198        #[unsafe(method(clickedPathComponentCell))]
199        #[unsafe(method_family = none)]
200        pub fn clickedPathComponentCell(&self) -> Option<Retained<NSPathComponentCell>>;
201
202        #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
203        #[unsafe(method(mouseEntered:withFrame:inView:))]
204        #[unsafe(method_family = none)]
205        pub fn mouseEntered_withFrame_inView(&self, event: &NSEvent, frame: NSRect, view: &NSView);
206
207        #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
208        #[unsafe(method(mouseExited:withFrame:inView:))]
209        #[unsafe(method_family = none)]
210        pub fn mouseExited_withFrame_inView(&self, event: &NSEvent, frame: NSRect, view: &NSView);
211
212        #[unsafe(method(doubleAction))]
213        #[unsafe(method_family = none)]
214        pub fn doubleAction(&self) -> Option<Sel>;
215
216        /// Setter for [`doubleAction`][Self::doubleAction].
217        ///
218        /// # Safety
219        ///
220        /// `double_action` must be a valid selector.
221        #[unsafe(method(setDoubleAction:))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn setDoubleAction(&self, double_action: Option<Sel>);
224
225        #[cfg(feature = "NSColor")]
226        #[unsafe(method(backgroundColor))]
227        #[unsafe(method_family = none)]
228        pub fn backgroundColor(&self) -> Option<Retained<NSColor>>;
229
230        #[cfg(feature = "NSColor")]
231        /// Setter for [`backgroundColor`][Self::backgroundColor].
232        ///
233        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
234        #[unsafe(method(setBackgroundColor:))]
235        #[unsafe(method_family = none)]
236        pub fn setBackgroundColor(&self, background_color: Option<&NSColor>);
237
238        #[unsafe(method(placeholderString))]
239        #[unsafe(method_family = none)]
240        pub fn placeholderString(&self) -> Option<Retained<NSString>>;
241
242        /// Setter for [`placeholderString`][Self::placeholderString].
243        ///
244        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
245        #[unsafe(method(setPlaceholderString:))]
246        #[unsafe(method_family = none)]
247        pub fn setPlaceholderString(&self, placeholder_string: Option<&NSString>);
248
249        #[unsafe(method(placeholderAttributedString))]
250        #[unsafe(method_family = none)]
251        pub fn placeholderAttributedString(&self) -> Option<Retained<NSAttributedString>>;
252
253        /// Setter for [`placeholderAttributedString`][Self::placeholderAttributedString].
254        ///
255        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
256        #[unsafe(method(setPlaceholderAttributedString:))]
257        #[unsafe(method_family = none)]
258        pub fn setPlaceholderAttributedString(
259            &self,
260            placeholder_attributed_string: Option<&NSAttributedString>,
261        );
262    );
263}
264
265/// Methods declared on superclass `NSCell`.
266#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
267impl NSPathCell {
268    extern_methods!(
269        #[unsafe(method(init))]
270        #[unsafe(method_family = init)]
271        pub fn init(this: Allocated<Self>) -> Retained<Self>;
272
273        #[unsafe(method(initTextCell:))]
274        #[unsafe(method_family = init)]
275        pub fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
276
277        #[cfg(feature = "NSImage")]
278        #[unsafe(method(initImageCell:))]
279        #[unsafe(method_family = init)]
280        pub fn initImageCell(this: Allocated<Self>, image: Option<&NSImage>) -> Retained<Self>;
281
282        /// # Safety
283        ///
284        /// `coder` possibly has further requirements.
285        #[unsafe(method(initWithCoder:))]
286        #[unsafe(method_family = init)]
287        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
288    );
289}
290
291/// Methods declared on superclass `NSObject`.
292#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
293impl NSPathCell {
294    extern_methods!(
295        #[unsafe(method(new))]
296        #[unsafe(method_family = new)]
297        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
298    );
299}
300
301extern_protocol!(
302    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspathcelldelegate?language=objc)
303    pub unsafe trait NSPathCellDelegate: NSObjectProtocol + MainThreadOnly {
304        #[cfg(all(
305            feature = "NSActionCell",
306            feature = "NSCell",
307            feature = "NSOpenPanel",
308            feature = "NSPanel",
309            feature = "NSResponder",
310            feature = "NSSavePanel",
311            feature = "NSWindow"
312        ))]
313        #[optional]
314        #[unsafe(method(pathCell:willDisplayOpenPanel:))]
315        #[unsafe(method_family = none)]
316        fn pathCell_willDisplayOpenPanel(&self, path_cell: &NSPathCell, open_panel: &NSOpenPanel);
317
318        #[cfg(all(feature = "NSActionCell", feature = "NSCell", feature = "NSMenu"))]
319        #[optional]
320        #[unsafe(method(pathCell:willPopUpMenu:))]
321        #[unsafe(method_family = none)]
322        fn pathCell_willPopUpMenu(&self, path_cell: &NSPathCell, menu: &NSMenu);
323    }
324);