objc2_app_kit/generated/
NSWindowRestoration.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_protocol!(
11 pub unsafe trait NSWindowRestoration: NSObjectProtocol + MainThreadOnly {
13 #[cfg(all(
14 feature = "NSResponder",
15 feature = "NSUserInterfaceItemIdentification",
16 feature = "NSWindow",
17 feature = "block2"
18 ))]
19 #[unsafe(method(restoreWindowWithIdentifier:state:completionHandler:))]
23 #[unsafe(method_family = none)]
24 unsafe fn restoreWindowWithIdentifier_state_completionHandler(
25 identifier: &NSUserInterfaceItemIdentifier,
26 state: &NSCoder,
27 completion_handler: &block2::DynBlock<dyn Fn(*mut NSWindow, *mut NSError)>,
28 mtm: MainThreadMarker,
29 );
30 }
31);
32
33#[cfg(feature = "NSDocumentController")]
35impl NSDocumentController {
36 extern_methods!();
37}
38
39#[cfg(feature = "NSDocumentController")]
40extern_conformance!(
41 unsafe impl NSWindowRestoration for NSDocumentController {}
42);
43
44#[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
46impl NSApplication {
47 extern_methods!(
48 #[cfg(all(
49 feature = "NSUserInterfaceItemIdentification",
50 feature = "NSWindow",
51 feature = "block2"
52 ))]
53 #[unsafe(method(restoreWindowWithIdentifier:state:completionHandler:))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn restoreWindowWithIdentifier_state_completionHandler(
59 &self,
60 identifier: &NSUserInterfaceItemIdentifier,
61 state: &NSCoder,
62 completion_handler: &block2::DynBlock<dyn Fn(*mut NSWindow, *mut NSError)>,
63 ) -> bool;
64 );
65}
66
67extern "C" {
68 pub static NSApplicationDidFinishRestoringWindowsNotification: &'static NSNotificationName;
70}
71
72#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
74impl NSWindow {
75 extern_methods!(
76 #[unsafe(method(isRestorable))]
77 #[unsafe(method_family = none)]
78 pub fn isRestorable(&self) -> bool;
79
80 #[unsafe(method(setRestorable:))]
82 #[unsafe(method_family = none)]
83 pub fn setRestorable(&self, restorable: bool);
84
85 #[unsafe(method(restorationClass))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn restorationClass(&self) -> Option<&'static AnyClass>;
91
92 #[unsafe(method(setRestorationClass:))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn setRestorationClass(&self, restoration_class: Option<&AnyClass>);
101
102 #[unsafe(method(disableSnapshotRestoration))]
103 #[unsafe(method_family = none)]
104 pub fn disableSnapshotRestoration(&self);
105
106 #[unsafe(method(enableSnapshotRestoration))]
107 #[unsafe(method_family = none)]
108 pub fn enableSnapshotRestoration(&self);
109 );
110}
111
112#[cfg(feature = "NSResponder")]
114impl NSResponder {
115 extern_methods!(
116 #[unsafe(method(encodeRestorableStateWithCoder:))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn encodeRestorableStateWithCoder(&self, coder: &NSCoder);
122
123 #[unsafe(method(encodeRestorableStateWithCoder:backgroundQueue:))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn encodeRestorableStateWithCoder_backgroundQueue(
130 &self,
131 coder: &NSCoder,
132 queue: &NSOperationQueue,
133 );
134
135 #[unsafe(method(restoreStateWithCoder:))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn restoreStateWithCoder(&self, coder: &NSCoder);
141
142 #[unsafe(method(invalidateRestorableState))]
143 #[unsafe(method_family = none)]
144 pub fn invalidateRestorableState(&self);
145
146 #[unsafe(method(restorableStateKeyPaths))]
147 #[unsafe(method_family = none)]
148 pub fn restorableStateKeyPaths(mtm: MainThreadMarker) -> Retained<NSArray<NSString>>;
149
150 #[unsafe(method(allowedClassesForRestorableStateKeyPath:))]
152 #[unsafe(method_family = none)]
153 pub fn allowedClassesForRestorableStateKeyPath(
154 key_path: &NSString,
155 mtm: MainThreadMarker,
156 ) -> Retained<NSArray<AnyClass>>;
157 );
158}
159
160#[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
162impl NSApplication {
163 extern_methods!(
164 #[unsafe(method(extendStateRestoration))]
165 #[unsafe(method_family = none)]
166 pub fn extendStateRestoration(&self);
167
168 #[unsafe(method(completeStateRestoration))]
169 #[unsafe(method_family = none)]
170 pub fn completeStateRestoration(&self);
171 );
172}
173
174#[cfg(feature = "NSDocument")]
176impl NSDocument {
177 extern_methods!(
178 #[cfg(all(
179 feature = "NSResponder",
180 feature = "NSUserInterfaceItemIdentification",
181 feature = "NSWindow",
182 feature = "block2"
183 ))]
184 #[unsafe(method(restoreDocumentWindowWithIdentifier:state:completionHandler:))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn restoreDocumentWindowWithIdentifier_state_completionHandler(
190 &self,
191 identifier: &NSUserInterfaceItemIdentifier,
192 state: &NSCoder,
193 completion_handler: &block2::DynBlock<dyn Fn(*mut NSWindow, *mut NSError)>,
194 );
195
196 #[unsafe(method(encodeRestorableStateWithCoder:))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn encodeRestorableStateWithCoder(&self, coder: &NSCoder);
202
203 #[unsafe(method(encodeRestorableStateWithCoder:backgroundQueue:))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn encodeRestorableStateWithCoder_backgroundQueue(
210 &self,
211 coder: &NSCoder,
212 queue: &NSOperationQueue,
213 );
214
215 #[unsafe(method(restoreStateWithCoder:))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn restoreStateWithCoder(&self, coder: &NSCoder);
221
222 #[unsafe(method(invalidateRestorableState))]
223 #[unsafe(method_family = none)]
224 pub fn invalidateRestorableState(&self);
225
226 #[unsafe(method(restorableStateKeyPaths))]
227 #[unsafe(method_family = none)]
228 pub fn restorableStateKeyPaths(mtm: MainThreadMarker) -> Retained<NSArray<NSString>>;
229
230 #[unsafe(method(allowedClassesForRestorableStateKeyPath:))]
231 #[unsafe(method_family = none)]
232 pub fn allowedClassesForRestorableStateKeyPath(
233 key_path: &NSString,
234 mtm: MainThreadMarker,
235 ) -> Retained<NSArray<AnyClass>>;
236 );
237}