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 unsafe 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))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn parentWindow(&self) -> Option<Retained<NSWindow>>;
84
85 #[cfg(feature = "NSWindow")]
86 #[unsafe(method(setParentWindow:))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn setParentWindow(&self, parent_window: Option<&NSWindow>);
90
91 #[cfg(feature = "NSView")]
92 #[unsafe(method(contentView))]
93 #[unsafe(method_family = none)]
94 pub unsafe fn contentView(&self) -> Option<Retained<NSView>>;
95
96 #[cfg(feature = "NSView")]
97 #[unsafe(method(setContentView:))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn setContentView(&self, content_view: Option<&NSView>);
101
102 #[unsafe(method(preferredEdge))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn preferredEdge(&self) -> NSRectEdge;
105
106 #[unsafe(method(setPreferredEdge:))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn setPreferredEdge(&self, preferred_edge: NSRectEdge);
110
111 #[unsafe(method(delegate))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSDrawerDelegate>>>;
114
115 #[unsafe(method(setDelegate:))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSDrawerDelegate>>);
119
120 #[unsafe(method(open))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn open(&self);
123
124 #[unsafe(method(openOnEdge:))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn openOnEdge(&self, edge: NSRectEdge);
127
128 #[unsafe(method(close))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn close(&self);
131
132 #[unsafe(method(open:))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn open_(&self, sender: Option<&AnyObject>);
135
136 #[unsafe(method(close:))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn close_(&self, sender: Option<&AnyObject>);
139
140 #[unsafe(method(toggle:))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn toggle(&self, sender: Option<&AnyObject>);
143
144 #[unsafe(method(state))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn state(&self) -> NSInteger;
147
148 #[unsafe(method(edge))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn edge(&self) -> NSRectEdge;
151
152 #[unsafe(method(contentSize))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn contentSize(&self) -> NSSize;
155
156 #[unsafe(method(setContentSize:))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn setContentSize(&self, content_size: NSSize);
160
161 #[unsafe(method(minContentSize))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn minContentSize(&self) -> NSSize;
164
165 #[unsafe(method(setMinContentSize:))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn setMinContentSize(&self, min_content_size: NSSize);
169
170 #[unsafe(method(maxContentSize))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn maxContentSize(&self) -> NSSize;
173
174 #[unsafe(method(setMaxContentSize:))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn setMaxContentSize(&self, max_content_size: NSSize);
178
179 #[cfg(feature = "objc2-core-foundation")]
180 #[unsafe(method(leadingOffset))]
181 #[unsafe(method_family = none)]
182 pub unsafe fn leadingOffset(&self) -> CGFloat;
183
184 #[cfg(feature = "objc2-core-foundation")]
185 #[unsafe(method(setLeadingOffset:))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn setLeadingOffset(&self, leading_offset: CGFloat);
189
190 #[cfg(feature = "objc2-core-foundation")]
191 #[unsafe(method(trailingOffset))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn trailingOffset(&self) -> CGFloat;
194
195 #[cfg(feature = "objc2-core-foundation")]
196 #[unsafe(method(setTrailingOffset:))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn setTrailingOffset(&self, trailing_offset: CGFloat);
200 );
201}
202
203#[cfg(feature = "NSResponder")]
205impl NSDrawer {
206 extern_methods!(
207 #[unsafe(method(init))]
208 #[unsafe(method_family = init)]
209 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
210
211 #[unsafe(method(initWithCoder:))]
212 #[unsafe(method_family = init)]
213 pub unsafe fn initWithCoder(
214 this: Allocated<Self>,
215 coder: &NSCoder,
216 ) -> Option<Retained<Self>>;
217 );
218}
219
220#[cfg(feature = "NSResponder")]
222impl NSDrawer {
223 extern_methods!(
224 #[unsafe(method(new))]
225 #[unsafe(method_family = new)]
226 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
227 );
228}
229
230#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
232impl NSWindow {
233 extern_methods!(
234 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
235 #[unsafe(method(drawers))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn drawers(&self) -> Option<Retained<NSArray<NSDrawer>>>;
238 );
239}
240
241extern_protocol!(
242 pub unsafe trait NSDrawerDelegate: NSObjectProtocol {
244 #[cfg(feature = "NSResponder")]
245 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
246 #[optional]
247 #[unsafe(method(drawerShouldOpen:))]
248 #[unsafe(method_family = none)]
249 unsafe fn drawerShouldOpen(&self, sender: &NSDrawer) -> bool;
250
251 #[cfg(feature = "NSResponder")]
252 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
253 #[optional]
254 #[unsafe(method(drawerShouldClose:))]
255 #[unsafe(method_family = none)]
256 unsafe fn drawerShouldClose(&self, sender: &NSDrawer) -> bool;
257
258 #[cfg(feature = "NSResponder")]
259 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
260 #[optional]
261 #[unsafe(method(drawerWillResizeContents:toSize:))]
262 #[unsafe(method_family = none)]
263 unsafe fn drawerWillResizeContents_toSize(
264 &self,
265 sender: &NSDrawer,
266 content_size: NSSize,
267 ) -> NSSize;
268
269 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
270 #[optional]
271 #[unsafe(method(drawerWillOpen:))]
272 #[unsafe(method_family = none)]
273 unsafe fn drawerWillOpen(&self, notification: &NSNotification);
274
275 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
276 #[optional]
277 #[unsafe(method(drawerDidOpen:))]
278 #[unsafe(method_family = none)]
279 unsafe fn drawerDidOpen(&self, notification: &NSNotification);
280
281 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
282 #[optional]
283 #[unsafe(method(drawerWillClose:))]
284 #[unsafe(method_family = none)]
285 unsafe fn drawerWillClose(&self, notification: &NSNotification);
286
287 #[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
288 #[optional]
289 #[unsafe(method(drawerDidClose:))]
290 #[unsafe(method_family = none)]
291 unsafe fn drawerDidClose(&self, notification: &NSNotification);
292 }
293);
294
295extern "C" {
296 pub static NSDrawerWillOpenNotification: &'static NSNotificationName;
298}
299
300extern "C" {
301 pub static NSDrawerDidOpenNotification: &'static NSNotificationName;
303}
304
305extern "C" {
306 pub static NSDrawerWillCloseNotification: &'static NSNotificationName;
308}
309
310extern "C" {
311 pub static NSDrawerDidCloseNotification: &'static NSNotificationName;
313}