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    #[deprecated]
21    #[doc(alias = "NSPathStyleNavigationBar")]
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))]
46unsafe impl NSAccessibility for NSPathCell {}
47
48#[cfg(all(
49    feature = "NSAccessibilityProtocols",
50    feature = "NSActionCell",
51    feature = "NSCell"
52))]
53unsafe impl NSAccessibilityElementProtocol for NSPathCell {}
54
55#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
56unsafe impl NSCoding for NSPathCell {}
57
58#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
59unsafe impl NSCopying for NSPathCell {}
60
61#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
62unsafe impl CopyingHelper for NSPathCell {
63    type Result = Self;
64}
65
66#[cfg(all(feature = "NSActionCell", feature = "NSCell", feature = "NSMenu"))]
67unsafe impl NSMenuItemValidation for NSPathCell {}
68
69#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
70unsafe impl NSObjectProtocol for NSPathCell {}
71
72#[cfg(all(feature = "NSActionCell", feature = "NSCell", feature = "NSSavePanel"))]
73unsafe impl NSOpenSavePanelDelegate for NSPathCell {}
74
75#[cfg(all(
76    feature = "NSActionCell",
77    feature = "NSCell",
78    feature = "NSUserInterfaceItemIdentification"
79))]
80unsafe impl NSUserInterfaceItemIdentification for NSPathCell {}
81
82#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
83impl NSPathCell {
84    extern_methods!(
85        #[unsafe(method(pathStyle))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn pathStyle(&self) -> NSPathStyle;
88
89        /// Setter for [`pathStyle`][Self::pathStyle].
90        #[unsafe(method(setPathStyle:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn setPathStyle(&self, path_style: NSPathStyle);
93
94        #[unsafe(method(URL))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
97
98        /// Setter for [`URL`][Self::URL].
99        #[unsafe(method(setURL:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn setURL(&self, url: Option<&NSURL>);
102
103        #[unsafe(method(setObjectValue:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn setObjectValue(&self, obj: Option<&ProtocolObject<dyn NSCopying>>);
106
107        #[unsafe(method(allowedTypes))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn allowedTypes(&self) -> Option<Retained<NSArray<NSString>>>;
110
111        /// Setter for [`allowedTypes`][Self::allowedTypes].
112        #[unsafe(method(setAllowedTypes:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setAllowedTypes(&self, allowed_types: Option<&NSArray<NSString>>);
115
116        #[unsafe(method(delegate))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSPathCellDelegate>>>;
119
120        /// This is a [weak property][objc2::topics::weak_property].
121        /// Setter for [`delegate`][Self::delegate].
122        #[unsafe(method(setDelegate:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSPathCellDelegate>>);
125
126        #[unsafe(method(pathComponentCellClass))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn pathComponentCellClass(mtm: MainThreadMarker) -> &'static AnyClass;
129
130        #[cfg(all(feature = "NSPathComponentCell", feature = "NSTextFieldCell"))]
131        #[unsafe(method(pathComponentCells))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn pathComponentCells(&self) -> Retained<NSArray<NSPathComponentCell>>;
134
135        #[cfg(all(feature = "NSPathComponentCell", feature = "NSTextFieldCell"))]
136        /// Setter for [`pathComponentCells`][Self::pathComponentCells].
137        #[unsafe(method(setPathComponentCells:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setPathComponentCells(
140            &self,
141            path_component_cells: &NSArray<NSPathComponentCell>,
142        );
143
144        #[cfg(all(
145            feature = "NSPathComponentCell",
146            feature = "NSResponder",
147            feature = "NSTextFieldCell",
148            feature = "NSView"
149        ))]
150        #[unsafe(method(rectOfPathComponentCell:withFrame:inView:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn rectOfPathComponentCell_withFrame_inView(
153            &self,
154            cell: &NSPathComponentCell,
155            frame: NSRect,
156            view: &NSView,
157        ) -> NSRect;
158
159        #[cfg(all(
160            feature = "NSPathComponentCell",
161            feature = "NSResponder",
162            feature = "NSTextFieldCell",
163            feature = "NSView"
164        ))]
165        #[unsafe(method(pathComponentCellAtPoint:withFrame:inView:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn pathComponentCellAtPoint_withFrame_inView(
168            &self,
169            point: NSPoint,
170            frame: NSRect,
171            view: &NSView,
172        ) -> Option<Retained<NSPathComponentCell>>;
173
174        #[cfg(all(feature = "NSPathComponentCell", feature = "NSTextFieldCell"))]
175        #[unsafe(method(clickedPathComponentCell))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn clickedPathComponentCell(&self) -> Option<Retained<NSPathComponentCell>>;
178
179        #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
180        #[unsafe(method(mouseEntered:withFrame:inView:))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn mouseEntered_withFrame_inView(
183            &self,
184            event: &NSEvent,
185            frame: NSRect,
186            view: &NSView,
187        );
188
189        #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
190        #[unsafe(method(mouseExited:withFrame:inView:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn mouseExited_withFrame_inView(
193            &self,
194            event: &NSEvent,
195            frame: NSRect,
196            view: &NSView,
197        );
198
199        #[unsafe(method(doubleAction))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn doubleAction(&self) -> Option<Sel>;
202
203        /// Setter for [`doubleAction`][Self::doubleAction].
204        #[unsafe(method(setDoubleAction:))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn setDoubleAction(&self, double_action: Option<Sel>);
207
208        #[cfg(feature = "NSColor")]
209        #[unsafe(method(backgroundColor))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;
212
213        #[cfg(feature = "NSColor")]
214        /// Setter for [`backgroundColor`][Self::backgroundColor].
215        #[unsafe(method(setBackgroundColor:))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);
218
219        #[unsafe(method(placeholderString))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn placeholderString(&self) -> Option<Retained<NSString>>;
222
223        /// Setter for [`placeholderString`][Self::placeholderString].
224        #[unsafe(method(setPlaceholderString:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn setPlaceholderString(&self, placeholder_string: Option<&NSString>);
227
228        #[unsafe(method(placeholderAttributedString))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn placeholderAttributedString(&self) -> Option<Retained<NSAttributedString>>;
231
232        /// Setter for [`placeholderAttributedString`][Self::placeholderAttributedString].
233        #[unsafe(method(setPlaceholderAttributedString:))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn setPlaceholderAttributedString(
236            &self,
237            placeholder_attributed_string: Option<&NSAttributedString>,
238        );
239    );
240}
241
242/// Methods declared on superclass `NSCell`.
243#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
244impl NSPathCell {
245    extern_methods!(
246        #[unsafe(method(init))]
247        #[unsafe(method_family = init)]
248        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
249
250        #[unsafe(method(initTextCell:))]
251        #[unsafe(method_family = init)]
252        pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
253
254        #[cfg(feature = "NSImage")]
255        #[unsafe(method(initImageCell:))]
256        #[unsafe(method_family = init)]
257        pub unsafe fn initImageCell(
258            this: Allocated<Self>,
259            image: Option<&NSImage>,
260        ) -> Retained<Self>;
261
262        #[unsafe(method(initWithCoder:))]
263        #[unsafe(method_family = init)]
264        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
265    );
266}
267
268/// Methods declared on superclass `NSObject`.
269#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
270impl NSPathCell {
271    extern_methods!(
272        #[unsafe(method(new))]
273        #[unsafe(method_family = new)]
274        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
275    );
276}
277
278extern_protocol!(
279    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspathcelldelegate?language=objc)
280    pub unsafe trait NSPathCellDelegate: NSObjectProtocol + MainThreadOnly {
281        #[cfg(all(
282            feature = "NSActionCell",
283            feature = "NSCell",
284            feature = "NSOpenPanel",
285            feature = "NSPanel",
286            feature = "NSResponder",
287            feature = "NSSavePanel",
288            feature = "NSWindow"
289        ))]
290        #[optional]
291        #[unsafe(method(pathCell:willDisplayOpenPanel:))]
292        #[unsafe(method_family = none)]
293        unsafe fn pathCell_willDisplayOpenPanel(
294            &self,
295            path_cell: &NSPathCell,
296            open_panel: &NSOpenPanel,
297        );
298
299        #[cfg(all(feature = "NSActionCell", feature = "NSCell", feature = "NSMenu"))]
300        #[optional]
301        #[unsafe(method(pathCell:willPopUpMenu:))]
302        #[unsafe(method_family = none)]
303        unsafe fn pathCell_willPopUpMenu(&self, path_cell: &NSPathCell, menu: &NSMenu);
304    }
305);