objc2_app_kit/generated/
NSDrawer.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdrawerstate?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSDrawerState(pub NSUInteger);
17impl NSDrawerState {
18    #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
19    #[doc(alias = "NSDrawerClosedState")]
20    pub const ClosedState: Self = Self(0);
21    #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
22    #[doc(alias = "NSDrawerOpeningState")]
23    pub const OpeningState: Self = Self(1);
24    #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
25    #[doc(alias = "NSDrawerOpenState")]
26    pub const OpenState: Self = Self(2);
27    #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
28    #[doc(alias = "NSDrawerClosingState")]
29    pub const ClosingState: Self = Self(3);
30}
31
32unsafe impl Encode for NSDrawerState {
33    const ENCODING: Encoding = NSUInteger::ENCODING;
34}
35
36unsafe impl RefEncode for NSDrawerState {
37    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_class!(
41    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdrawer?language=objc)
42    #[unsafe(super(NSResponder, NSObject))]
43    #[derive(Debug, PartialEq, Eq, Hash)]
44    #[cfg(feature = "NSResponder")]
45    #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
46    pub struct NSDrawer;
47);
48
49#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSResponder"))]
50unsafe impl NSAccessibility for NSDrawer {}
51
52#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSResponder"))]
53unsafe impl NSAccessibilityElementProtocol for NSDrawer {}
54
55#[cfg(feature = "NSResponder")]
56unsafe impl NSCoding for NSDrawer {}
57
58#[cfg(feature = "NSResponder")]
59unsafe impl NSObjectProtocol for NSDrawer {}
60
61#[cfg(feature = "NSResponder")]
62impl NSDrawer {
63    extern_methods!(
64        #[unsafe(method(initWithContentSize:preferredEdge:))]
65        #[unsafe(method_family = init)]
66        pub unsafe fn initWithContentSize_preferredEdge(
67            this: Allocated<Self>,
68            content_size: NSSize,
69            edge: NSRectEdge,
70        ) -> Retained<Self>;
71
72        #[cfg(feature = "NSWindow")]
73        #[unsafe(method(parentWindow))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn parentWindow(&self) -> Option<Retained<NSWindow>>;
76
77        #[cfg(feature = "NSWindow")]
78        /// Setter for [`parentWindow`][Self::parentWindow].
79        #[unsafe(method(setParentWindow:))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn setParentWindow(&self, parent_window: Option<&NSWindow>);
82
83        #[cfg(feature = "NSView")]
84        #[unsafe(method(contentView))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn contentView(&self) -> Option<Retained<NSView>>;
87
88        #[cfg(feature = "NSView")]
89        /// Setter for [`contentView`][Self::contentView].
90        #[unsafe(method(setContentView:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn setContentView(&self, content_view: Option<&NSView>);
93
94        #[unsafe(method(preferredEdge))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn preferredEdge(&self) -> NSRectEdge;
97
98        /// Setter for [`preferredEdge`][Self::preferredEdge].
99        #[unsafe(method(setPreferredEdge:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn setPreferredEdge(&self, preferred_edge: NSRectEdge);
102
103        #[unsafe(method(delegate))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSDrawerDelegate>>>;
106
107        /// Setter for [`delegate`][Self::delegate].
108        #[unsafe(method(setDelegate:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSDrawerDelegate>>);
111
112        #[unsafe(method(open))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn open(&self);
115
116        #[unsafe(method(openOnEdge:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn openOnEdge(&self, edge: NSRectEdge);
119
120        #[unsafe(method(close))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn close(&self);
123
124        #[unsafe(method(open:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn open_(&self, sender: Option<&AnyObject>);
127
128        #[unsafe(method(close:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn close_(&self, sender: Option<&AnyObject>);
131
132        #[unsafe(method(toggle:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn toggle(&self, sender: Option<&AnyObject>);
135
136        #[unsafe(method(state))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn state(&self) -> NSInteger;
139
140        #[unsafe(method(edge))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn edge(&self) -> NSRectEdge;
143
144        #[unsafe(method(contentSize))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn contentSize(&self) -> NSSize;
147
148        /// Setter for [`contentSize`][Self::contentSize].
149        #[unsafe(method(setContentSize:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn setContentSize(&self, content_size: NSSize);
152
153        #[unsafe(method(minContentSize))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn minContentSize(&self) -> NSSize;
156
157        /// Setter for [`minContentSize`][Self::minContentSize].
158        #[unsafe(method(setMinContentSize:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn setMinContentSize(&self, min_content_size: NSSize);
161
162        #[unsafe(method(maxContentSize))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn maxContentSize(&self) -> NSSize;
165
166        /// Setter for [`maxContentSize`][Self::maxContentSize].
167        #[unsafe(method(setMaxContentSize:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn setMaxContentSize(&self, max_content_size: NSSize);
170
171        #[cfg(feature = "objc2-core-foundation")]
172        #[unsafe(method(leadingOffset))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn leadingOffset(&self) -> CGFloat;
175
176        #[cfg(feature = "objc2-core-foundation")]
177        /// Setter for [`leadingOffset`][Self::leadingOffset].
178        #[unsafe(method(setLeadingOffset:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn setLeadingOffset(&self, leading_offset: CGFloat);
181
182        #[cfg(feature = "objc2-core-foundation")]
183        #[unsafe(method(trailingOffset))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn trailingOffset(&self) -> CGFloat;
186
187        #[cfg(feature = "objc2-core-foundation")]
188        /// Setter for [`trailingOffset`][Self::trailingOffset].
189        #[unsafe(method(setTrailingOffset:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn setTrailingOffset(&self, trailing_offset: CGFloat);
192    );
193}
194
195/// Methods declared on superclass `NSResponder`.
196#[cfg(feature = "NSResponder")]
197impl NSDrawer {
198    extern_methods!(
199        #[unsafe(method(init))]
200        #[unsafe(method_family = init)]
201        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
202
203        #[unsafe(method(initWithCoder:))]
204        #[unsafe(method_family = init)]
205        pub unsafe fn initWithCoder(
206            this: Allocated<Self>,
207            coder: &NSCoder,
208        ) -> Option<Retained<Self>>;
209    );
210}
211
212/// Methods declared on superclass `NSObject`.
213#[cfg(feature = "NSResponder")]
214impl NSDrawer {
215    extern_methods!(
216        #[unsafe(method(new))]
217        #[unsafe(method_family = new)]
218        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
219    );
220}
221
222/// NSDrawers.
223#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
224impl NSWindow {
225    extern_methods!(
226        #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
227        #[unsafe(method(drawers))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn drawers(&self) -> Option<Retained<NSArray<NSDrawer>>>;
230    );
231}
232
233extern_protocol!(
234    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdrawerdelegate?language=objc)
235    pub unsafe trait NSDrawerDelegate: NSObjectProtocol {
236        #[cfg(feature = "NSResponder")]
237        #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
238        #[optional]
239        #[unsafe(method(drawerShouldOpen:))]
240        #[unsafe(method_family = none)]
241        unsafe fn drawerShouldOpen(&self, sender: &NSDrawer) -> bool;
242
243        #[cfg(feature = "NSResponder")]
244        #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
245        #[optional]
246        #[unsafe(method(drawerShouldClose:))]
247        #[unsafe(method_family = none)]
248        unsafe fn drawerShouldClose(&self, sender: &NSDrawer) -> bool;
249
250        #[cfg(feature = "NSResponder")]
251        #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
252        #[optional]
253        #[unsafe(method(drawerWillResizeContents:toSize:))]
254        #[unsafe(method_family = none)]
255        unsafe fn drawerWillResizeContents_toSize(
256            &self,
257            sender: &NSDrawer,
258            content_size: NSSize,
259        ) -> NSSize;
260
261        #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
262        #[optional]
263        #[unsafe(method(drawerWillOpen:))]
264        #[unsafe(method_family = none)]
265        unsafe fn drawerWillOpen(&self, notification: &NSNotification);
266
267        #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
268        #[optional]
269        #[unsafe(method(drawerDidOpen:))]
270        #[unsafe(method_family = none)]
271        unsafe fn drawerDidOpen(&self, notification: &NSNotification);
272
273        #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
274        #[optional]
275        #[unsafe(method(drawerWillClose:))]
276        #[unsafe(method_family = none)]
277        unsafe fn drawerWillClose(&self, notification: &NSNotification);
278
279        #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
280        #[optional]
281        #[unsafe(method(drawerDidClose:))]
282        #[unsafe(method_family = none)]
283        unsafe fn drawerDidClose(&self, notification: &NSNotification);
284    }
285);
286
287extern "C" {
288    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdrawerwillopennotification?language=objc)
289    pub static NSDrawerWillOpenNotification: &'static NSNotificationName;
290}
291
292extern "C" {
293    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdrawerdidopennotification?language=objc)
294    pub static NSDrawerDidOpenNotification: &'static NSNotificationName;
295}
296
297extern "C" {
298    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdrawerwillclosenotification?language=objc)
299    pub static NSDrawerWillCloseNotification: &'static NSNotificationName;
300}
301
302extern "C" {
303    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdrawerdidclosenotification?language=objc)
304    pub static NSDrawerDidCloseNotification: &'static NSNotificationName;
305}