objc2_app_kit/generated/
NSDrawer.rs1use 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#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSDrawerState(pub NSUInteger);
17impl NSDrawerState {
18 #[doc(alias = "NSDrawerClosedState")]
19 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
20 pub const ClosedState: Self = Self(0);
21 #[doc(alias = "NSDrawerOpeningState")]
22 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
23 pub const OpeningState: Self = Self(1);
24 #[doc(alias = "NSDrawerOpenState")]
25 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
26 pub const OpenState: Self = Self(2);
27 #[doc(alias = "NSDrawerClosingState")]
28 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
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 #[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"))]
50extern_conformance!(
51 unsafe impl NSAccessibility for NSDrawer {}
52);
53
54#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSResponder"))]
55extern_conformance!(
56 unsafe impl NSAccessibilityElementProtocol for NSDrawer {}
57);
58
59#[cfg(feature = "NSResponder")]
60extern_conformance!(
61 unsafe impl NSCoding for NSDrawer {}
62);
63
64#[cfg(feature = "NSResponder")]
65extern_conformance!(
66 unsafe impl NSObjectProtocol for NSDrawer {}
67);
68
69#[cfg(feature = "NSResponder")]
70impl NSDrawer {
71 extern_methods!(
72 #[unsafe(method(initWithContentSize:preferredEdge:))]
73 #[unsafe(method_family = init)]
74 pub fn initWithContentSize_preferredEdge(
75 this: Allocated<Self>,
76 content_size: NSSize,
77 edge: NSRectEdge,
78 ) -> Retained<Self>;
79
80 #[cfg(feature = "NSWindow")]
81 #[unsafe(method(parentWindow))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn parentWindow(&self) -> Option<Retained<NSWindow>>;
87
88 #[cfg(feature = "NSWindow")]
89 #[unsafe(method(setParentWindow:))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn setParentWindow(&self, parent_window: Option<&NSWindow>);
97
98 #[cfg(feature = "NSView")]
99 #[unsafe(method(contentView))]
100 #[unsafe(method_family = none)]
101 pub fn contentView(&self) -> Option<Retained<NSView>>;
102
103 #[cfg(feature = "NSView")]
104 #[unsafe(method(setContentView:))]
106 #[unsafe(method_family = none)]
107 pub fn setContentView(&self, content_view: Option<&NSView>);
108
109 #[unsafe(method(preferredEdge))]
110 #[unsafe(method_family = none)]
111 pub fn preferredEdge(&self) -> NSRectEdge;
112
113 #[unsafe(method(setPreferredEdge:))]
115 #[unsafe(method_family = none)]
116 pub fn setPreferredEdge(&self, preferred_edge: NSRectEdge);
117
118 #[unsafe(method(delegate))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSDrawerDelegate>>>;
124
125 #[unsafe(method(setDelegate:))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSDrawerDelegate>>);
133
134 #[unsafe(method(open))]
135 #[unsafe(method_family = none)]
136 pub fn open(&self);
137
138 #[unsafe(method(openOnEdge:))]
139 #[unsafe(method_family = none)]
140 pub fn openOnEdge(&self, edge: NSRectEdge);
141
142 #[unsafe(method(close))]
143 #[unsafe(method_family = none)]
144 pub fn close(&self);
145
146 #[unsafe(method(open:))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn open_(&self, sender: Option<&AnyObject>);
152
153 #[unsafe(method(close:))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn close_(&self, sender: Option<&AnyObject>);
159
160 #[unsafe(method(toggle:))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn toggle(&self, sender: Option<&AnyObject>);
166
167 #[unsafe(method(state))]
168 #[unsafe(method_family = none)]
169 pub fn state(&self) -> NSInteger;
170
171 #[unsafe(method(edge))]
172 #[unsafe(method_family = none)]
173 pub fn edge(&self) -> NSRectEdge;
174
175 #[unsafe(method(contentSize))]
176 #[unsafe(method_family = none)]
177 pub fn contentSize(&self) -> NSSize;
178
179 #[unsafe(method(setContentSize:))]
181 #[unsafe(method_family = none)]
182 pub fn setContentSize(&self, content_size: NSSize);
183
184 #[unsafe(method(minContentSize))]
185 #[unsafe(method_family = none)]
186 pub fn minContentSize(&self) -> NSSize;
187
188 #[unsafe(method(setMinContentSize:))]
190 #[unsafe(method_family = none)]
191 pub fn setMinContentSize(&self, min_content_size: NSSize);
192
193 #[unsafe(method(maxContentSize))]
194 #[unsafe(method_family = none)]
195 pub fn maxContentSize(&self) -> NSSize;
196
197 #[unsafe(method(setMaxContentSize:))]
199 #[unsafe(method_family = none)]
200 pub fn setMaxContentSize(&self, max_content_size: NSSize);
201
202 #[cfg(feature = "objc2-core-foundation")]
203 #[unsafe(method(leadingOffset))]
204 #[unsafe(method_family = none)]
205 pub fn leadingOffset(&self) -> CGFloat;
206
207 #[cfg(feature = "objc2-core-foundation")]
208 #[unsafe(method(setLeadingOffset:))]
210 #[unsafe(method_family = none)]
211 pub fn setLeadingOffset(&self, leading_offset: CGFloat);
212
213 #[cfg(feature = "objc2-core-foundation")]
214 #[unsafe(method(trailingOffset))]
215 #[unsafe(method_family = none)]
216 pub fn trailingOffset(&self) -> CGFloat;
217
218 #[cfg(feature = "objc2-core-foundation")]
219 #[unsafe(method(setTrailingOffset:))]
221 #[unsafe(method_family = none)]
222 pub fn setTrailingOffset(&self, trailing_offset: CGFloat);
223 );
224}
225
226#[cfg(feature = "NSResponder")]
228impl NSDrawer {
229 extern_methods!(
230 #[unsafe(method(init))]
231 #[unsafe(method_family = init)]
232 pub fn init(this: Allocated<Self>) -> Retained<Self>;
233
234 #[unsafe(method(initWithCoder:))]
238 #[unsafe(method_family = init)]
239 pub unsafe fn initWithCoder(
240 this: Allocated<Self>,
241 coder: &NSCoder,
242 ) -> Option<Retained<Self>>;
243 );
244}
245
246#[cfg(feature = "NSResponder")]
248impl NSDrawer {
249 extern_methods!(
250 #[unsafe(method(new))]
251 #[unsafe(method_family = new)]
252 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
253 );
254}
255
256#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
258impl NSWindow {
259 extern_methods!(
260 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
261 #[unsafe(method(drawers))]
262 #[unsafe(method_family = none)]
263 pub fn drawers(&self) -> Option<Retained<NSArray<NSDrawer>>>;
264 );
265}
266
267extern_protocol!(
268 pub unsafe trait NSDrawerDelegate: NSObjectProtocol {
270 #[cfg(feature = "NSResponder")]
271 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
272 #[optional]
273 #[unsafe(method(drawerShouldOpen:))]
274 #[unsafe(method_family = none)]
275 fn drawerShouldOpen(&self, sender: &NSDrawer) -> bool;
276
277 #[cfg(feature = "NSResponder")]
278 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
279 #[optional]
280 #[unsafe(method(drawerShouldClose:))]
281 #[unsafe(method_family = none)]
282 fn drawerShouldClose(&self, sender: &NSDrawer) -> bool;
283
284 #[cfg(feature = "NSResponder")]
285 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
286 #[optional]
287 #[unsafe(method(drawerWillResizeContents:toSize:))]
288 #[unsafe(method_family = none)]
289 fn drawerWillResizeContents_toSize(
290 &self,
291 sender: &NSDrawer,
292 content_size: NSSize,
293 ) -> NSSize;
294
295 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
296 #[optional]
297 #[unsafe(method(drawerWillOpen:))]
298 #[unsafe(method_family = none)]
299 fn drawerWillOpen(&self, notification: &NSNotification);
300
301 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
302 #[optional]
303 #[unsafe(method(drawerDidOpen:))]
304 #[unsafe(method_family = none)]
305 fn drawerDidOpen(&self, notification: &NSNotification);
306
307 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
308 #[optional]
309 #[unsafe(method(drawerWillClose:))]
310 #[unsafe(method_family = none)]
311 fn drawerWillClose(&self, notification: &NSNotification);
312
313 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
314 #[optional]
315 #[unsafe(method(drawerDidClose:))]
316 #[unsafe(method_family = none)]
317 fn drawerDidClose(&self, notification: &NSNotification);
318 }
319);
320
321extern "C" {
322 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
324 pub static NSDrawerWillOpenNotification: &'static NSNotificationName;
325}
326
327extern "C" {
328 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
330 pub static NSDrawerDidOpenNotification: &'static NSNotificationName;
331}
332
333extern "C" {
334 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
336 pub static NSDrawerWillCloseNotification: &'static NSNotificationName;
337}
338
339extern "C" {
340 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
342 pub static NSDrawerDidCloseNotification: &'static NSNotificationName;
343}