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:))]
20 #[unsafe(method_family = none)]
21 unsafe fn restoreWindowWithIdentifier_state_completionHandler(
22 identifier: &NSUserInterfaceItemIdentifier,
23 state: &NSCoder,
24 completion_handler: &block2::DynBlock<dyn Fn(*mut NSWindow, *mut NSError)>,
25 mtm: MainThreadMarker,
26 );
27 }
28);
29
30#[cfg(feature = "NSDocumentController")]
32impl NSDocumentController {
33 extern_methods!();
34}
35
36#[cfg(feature = "NSDocumentController")]
37extern_conformance!(
38 unsafe impl NSWindowRestoration for NSDocumentController {}
39);
40
41#[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
43impl NSApplication {
44 extern_methods!(
45 #[cfg(all(
46 feature = "NSUserInterfaceItemIdentification",
47 feature = "NSWindow",
48 feature = "block2"
49 ))]
50 #[unsafe(method(restoreWindowWithIdentifier:state:completionHandler:))]
51 #[unsafe(method_family = none)]
52 pub unsafe fn restoreWindowWithIdentifier_state_completionHandler(
53 &self,
54 identifier: &NSUserInterfaceItemIdentifier,
55 state: &NSCoder,
56 completion_handler: &block2::DynBlock<dyn Fn(*mut NSWindow, *mut NSError)>,
57 ) -> bool;
58 );
59}
60
61extern "C" {
62 pub static NSApplicationDidFinishRestoringWindowsNotification: &'static NSNotificationName;
64}
65
66#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
68impl NSWindow {
69 extern_methods!(
70 #[unsafe(method(isRestorable))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn isRestorable(&self) -> bool;
73
74 #[unsafe(method(setRestorable:))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn setRestorable(&self, restorable: bool);
78
79 #[unsafe(method(restorationClass))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn restorationClass(&self) -> Option<&'static AnyClass>;
82
83 #[unsafe(method(setRestorationClass:))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn setRestorationClass(&self, restoration_class: Option<&AnyClass>);
87
88 #[unsafe(method(disableSnapshotRestoration))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn disableSnapshotRestoration(&self);
91
92 #[unsafe(method(enableSnapshotRestoration))]
93 #[unsafe(method_family = none)]
94 pub unsafe fn enableSnapshotRestoration(&self);
95 );
96}
97
98#[cfg(feature = "NSResponder")]
100impl NSResponder {
101 extern_methods!(
102 #[unsafe(method(encodeRestorableStateWithCoder:))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn encodeRestorableStateWithCoder(&self, coder: &NSCoder);
105
106 #[unsafe(method(encodeRestorableStateWithCoder:backgroundQueue:))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn encodeRestorableStateWithCoder_backgroundQueue(
109 &self,
110 coder: &NSCoder,
111 queue: &NSOperationQueue,
112 );
113
114 #[unsafe(method(restoreStateWithCoder:))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn restoreStateWithCoder(&self, coder: &NSCoder);
117
118 #[unsafe(method(invalidateRestorableState))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn invalidateRestorableState(&self);
121
122 #[unsafe(method(restorableStateKeyPaths))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn restorableStateKeyPaths(mtm: MainThreadMarker)
125 -> Retained<NSArray<NSString>>;
126
127 #[unsafe(method(allowedClassesForRestorableStateKeyPath:))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn allowedClassesForRestorableStateKeyPath(
131 key_path: &NSString,
132 mtm: MainThreadMarker,
133 ) -> Retained<NSArray<AnyClass>>;
134 );
135}
136
137#[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
139impl NSApplication {
140 extern_methods!(
141 #[unsafe(method(extendStateRestoration))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn extendStateRestoration(&self);
144
145 #[unsafe(method(completeStateRestoration))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn completeStateRestoration(&self);
148 );
149}
150
151#[cfg(feature = "NSDocument")]
153impl NSDocument {
154 extern_methods!(
155 #[cfg(all(
156 feature = "NSResponder",
157 feature = "NSUserInterfaceItemIdentification",
158 feature = "NSWindow",
159 feature = "block2"
160 ))]
161 #[unsafe(method(restoreDocumentWindowWithIdentifier:state:completionHandler:))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn restoreDocumentWindowWithIdentifier_state_completionHandler(
164 &self,
165 identifier: &NSUserInterfaceItemIdentifier,
166 state: &NSCoder,
167 completion_handler: &block2::DynBlock<dyn Fn(*mut NSWindow, *mut NSError)>,
168 );
169
170 #[unsafe(method(encodeRestorableStateWithCoder:))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn encodeRestorableStateWithCoder(&self, coder: &NSCoder);
173
174 #[unsafe(method(encodeRestorableStateWithCoder:backgroundQueue:))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn encodeRestorableStateWithCoder_backgroundQueue(
177 &self,
178 coder: &NSCoder,
179 queue: &NSOperationQueue,
180 );
181
182 #[unsafe(method(restoreStateWithCoder:))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn restoreStateWithCoder(&self, coder: &NSCoder);
185
186 #[unsafe(method(invalidateRestorableState))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn invalidateRestorableState(&self);
189
190 #[unsafe(method(restorableStateKeyPaths))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn restorableStateKeyPaths(mtm: MainThreadMarker)
193 -> Retained<NSArray<NSString>>;
194
195 #[unsafe(method(allowedClassesForRestorableStateKeyPath:))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn allowedClassesForRestorableStateKeyPath(
198 key_path: &NSString,
199 mtm: MainThreadMarker,
200 ) -> Retained<NSArray<AnyClass>>;
201 );
202}