objc2_ui_kit/generated/
UIWindow.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#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15#[cfg(feature = "objc2-core-foundation")]
18pub type UIWindowLevel = CGFloat;
19
20extern_class!(
21 #[unsafe(super(UIView, UIResponder, NSObject))]
23 #[thread_kind = MainThreadOnly]
24 #[derive(Debug, PartialEq, Eq, Hash)]
25 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
26 pub struct UIWindow;
27);
28
29#[cfg(all(
30 feature = "UIResponder",
31 feature = "UIView",
32 feature = "objc2-quartz-core"
33))]
34#[cfg(not(target_os = "watchos"))]
35extern_conformance!(
36 unsafe impl CALayerDelegate for UIWindow {}
37);
38
39#[cfg(all(feature = "UIResponder", feature = "UIView"))]
40extern_conformance!(
41 unsafe impl NSCoding for UIWindow {}
42);
43
44#[cfg(all(feature = "UIResponder", feature = "UIView"))]
45extern_conformance!(
46 unsafe impl NSObjectProtocol for UIWindow {}
47);
48
49#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
50extern_conformance!(
51 unsafe impl UIAppearance for UIWindow {}
52);
53
54#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
55extern_conformance!(
56 unsafe impl UIAppearanceContainer for UIWindow {}
57);
58
59#[cfg(all(feature = "UIResponder", feature = "UIView"))]
60extern_conformance!(
61 unsafe impl UICoordinateSpace for UIWindow {}
62);
63
64#[cfg(all(
65 feature = "UIDynamicBehavior",
66 feature = "UIResponder",
67 feature = "UIView"
68))]
69extern_conformance!(
70 unsafe impl UIDynamicItem for UIWindow {}
71);
72
73#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
74extern_conformance!(
75 unsafe impl UIFocusEnvironment for UIWindow {}
76);
77
78#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
79extern_conformance!(
80 unsafe impl UIFocusItem for UIWindow {}
81);
82
83#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
84extern_conformance!(
85 unsafe impl UIFocusItemContainer for UIWindow {}
86);
87
88#[cfg(all(feature = "UIResponder", feature = "UIView"))]
89extern_conformance!(
90 unsafe impl UIResponderStandardEditActions for UIWindow {}
91);
92
93#[cfg(all(
94 feature = "UIResponder",
95 feature = "UITraitCollection",
96 feature = "UIView"
97))]
98extern_conformance!(
99 unsafe impl UITraitEnvironment for UIWindow {}
100);
101
102#[cfg(all(feature = "UIResponder", feature = "UIView"))]
103impl UIWindow {
104 extern_methods!(
105 #[cfg(all(feature = "UIScene", feature = "UIWindowScene"))]
106 #[unsafe(method(initWithWindowScene:))]
107 #[unsafe(method_family = init)]
108 pub fn initWithWindowScene(
109 this: Allocated<Self>,
110 window_scene: &UIWindowScene,
111 ) -> Retained<Self>;
112
113 #[cfg(feature = "objc2-core-foundation")]
114 #[deprecated = "Use init(windowScene:) instead."]
115 #[unsafe(method(initWithFrame:))]
116 #[unsafe(method_family = init)]
117 pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
118
119 #[deprecated = "Use init(windowScene:) instead."]
120 #[unsafe(method(init))]
121 #[unsafe(method_family = init)]
122 pub fn init(this: Allocated<Self>) -> Retained<Self>;
123
124 #[cfg(all(feature = "UIScene", feature = "UIWindowScene"))]
125 #[unsafe(method(windowScene))]
126 #[unsafe(method_family = none)]
127 pub fn windowScene(&self) -> Option<Retained<UIWindowScene>>;
128
129 #[cfg(all(feature = "UIScene", feature = "UIWindowScene"))]
130 #[unsafe(method(setWindowScene:))]
134 #[unsafe(method_family = none)]
135 pub fn setWindowScene(&self, window_scene: Option<&UIWindowScene>);
136
137 #[unsafe(method(canResizeToFitContent))]
138 #[unsafe(method_family = none)]
139 pub fn canResizeToFitContent(&self) -> bool;
140
141 #[unsafe(method(setCanResizeToFitContent:))]
143 #[unsafe(method_family = none)]
144 pub fn setCanResizeToFitContent(&self, can_resize_to_fit_content: bool);
145
146 #[cfg(feature = "UIScreen")]
147 #[unsafe(method(screen))]
148 #[unsafe(method_family = none)]
149 pub fn screen(&self) -> Retained<UIScreen>;
150
151 #[cfg(feature = "UIScreen")]
152 #[unsafe(method(setScreen:))]
154 #[unsafe(method_family = none)]
155 pub fn setScreen(&self, screen: &UIScreen);
156
157 #[cfg(feature = "objc2-core-foundation")]
158 #[unsafe(method(windowLevel))]
159 #[unsafe(method_family = none)]
160 pub fn windowLevel(&self) -> UIWindowLevel;
161
162 #[cfg(feature = "objc2-core-foundation")]
163 #[unsafe(method(setWindowLevel:))]
165 #[unsafe(method_family = none)]
166 pub fn setWindowLevel(&self, window_level: UIWindowLevel);
167
168 #[unsafe(method(isKeyWindow))]
169 #[unsafe(method_family = none)]
170 pub fn isKeyWindow(&self) -> bool;
171
172 #[unsafe(method(canBecomeKeyWindow))]
173 #[unsafe(method_family = none)]
174 pub fn canBecomeKeyWindow(&self) -> bool;
175
176 #[unsafe(method(becomeKeyWindow))]
177 #[unsafe(method_family = none)]
178 pub fn becomeKeyWindow(&self);
179
180 #[unsafe(method(resignKeyWindow))]
181 #[unsafe(method_family = none)]
182 pub fn resignKeyWindow(&self);
183
184 #[unsafe(method(makeKeyWindow))]
185 #[unsafe(method_family = none)]
186 pub fn makeKeyWindow(&self);
187
188 #[unsafe(method(makeKeyAndVisible))]
189 #[unsafe(method_family = none)]
190 pub fn makeKeyAndVisible(&self);
191
192 #[cfg(feature = "UIViewController")]
193 #[unsafe(method(rootViewController))]
194 #[unsafe(method_family = none)]
195 pub fn rootViewController(&self) -> Option<Retained<UIViewController>>;
196
197 #[cfg(feature = "UIViewController")]
198 #[unsafe(method(setRootViewController:))]
200 #[unsafe(method_family = none)]
201 pub fn setRootViewController(&self, root_view_controller: Option<&UIViewController>);
202
203 #[cfg(feature = "UIEvent")]
204 #[unsafe(method(sendEvent:))]
205 #[unsafe(method_family = none)]
206 pub fn sendEvent(&self, event: &UIEvent);
207
208 #[cfg(feature = "objc2-core-foundation")]
209 #[unsafe(method(convertPoint:toWindow:))]
210 #[unsafe(method_family = none)]
211 pub fn convertPoint_toWindow(&self, point: CGPoint, window: Option<&UIWindow>) -> CGPoint;
212
213 #[cfg(feature = "objc2-core-foundation")]
214 #[unsafe(method(convertPoint:fromWindow:))]
215 #[unsafe(method_family = none)]
216 pub fn convertPoint_fromWindow(&self, point: CGPoint, window: Option<&UIWindow>)
217 -> CGPoint;
218
219 #[cfg(feature = "objc2-core-foundation")]
220 #[unsafe(method(convertRect:toWindow:))]
221 #[unsafe(method_family = none)]
222 pub fn convertRect_toWindow(&self, rect: CGRect, window: Option<&UIWindow>) -> CGRect;
223
224 #[cfg(feature = "objc2-core-foundation")]
225 #[unsafe(method(convertRect:fromWindow:))]
226 #[unsafe(method_family = none)]
227 pub fn convertRect_fromWindow(&self, rect: CGRect, window: Option<&UIWindow>) -> CGRect;
228 );
229}
230
231#[cfg(all(feature = "UIResponder", feature = "UIView"))]
233impl UIWindow {
234 extern_methods!(
235 #[unsafe(method(initWithCoder:))]
239 #[unsafe(method_family = init)]
240 pub unsafe fn initWithCoder(
241 this: Allocated<Self>,
242 coder: &NSCoder,
243 ) -> Option<Retained<Self>>;
244 );
245}
246
247#[cfg(all(feature = "UIResponder", feature = "UIView"))]
249impl UIWindow {
250 extern_methods!(
251 #[unsafe(method(new))]
252 #[unsafe(method_family = new)]
253 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
254 );
255}
256
257extern_protocol!(
258 pub unsafe trait UILayoutGuideAspectFitting: NSObjectProtocol {
260 #[cfg(feature = "objc2-core-foundation")]
261 #[unsafe(method(aspectRatio))]
264 #[unsafe(method_family = none)]
265 fn aspectRatio(&self) -> CGFloat;
266
267 #[cfg(feature = "objc2-core-foundation")]
268 #[unsafe(method(setAspectRatio:))]
270 #[unsafe(method_family = none)]
271 fn setAspectRatio(&self, aspect_ratio: CGFloat);
272 }
273);
274
275#[cfg(all(feature = "UIResponder", feature = "UIView"))]
277impl UIWindow {
278 extern_methods!(
279 #[cfg(feature = "UILayoutGuide")]
280 #[unsafe(method(safeAreaAspectFitLayoutGuide))]
293 #[unsafe(method_family = none)]
294 pub fn safeAreaAspectFitLayoutGuide(&self) -> Retained<UILayoutGuide>;
295 );
296}
297
298extern "C" {
299 #[cfg(feature = "objc2-core-foundation")]
301 pub static UIWindowLevelNormal: UIWindowLevel;
302}
303
304extern "C" {
305 #[cfg(feature = "objc2-core-foundation")]
307 pub static UIWindowLevelAlert: UIWindowLevel;
308}
309
310extern "C" {
311 #[cfg(feature = "objc2-core-foundation")]
313 pub static UIWindowLevelStatusBar: UIWindowLevel;
314}
315
316extern "C" {
317 pub static UIWindowDidBecomeVisibleNotification: &'static NSNotificationName;
319}
320
321extern "C" {
322 pub static UIWindowDidBecomeHiddenNotification: &'static NSNotificationName;
324}
325
326extern "C" {
327 pub static UIWindowDidBecomeKeyNotification: &'static NSNotificationName;
329}
330
331extern "C" {
332 pub static UIWindowDidResignKeyNotification: &'static NSNotificationName;
334}
335
336extern "C" {
337 pub static UIKeyboardWillShowNotification: &'static NSNotificationName;
339}
340
341extern "C" {
342 pub static UIKeyboardDidShowNotification: &'static NSNotificationName;
344}
345
346extern "C" {
347 pub static UIKeyboardWillHideNotification: &'static NSNotificationName;
349}
350
351extern "C" {
352 pub static UIKeyboardDidHideNotification: &'static NSNotificationName;
354}
355
356extern "C" {
357 pub static UIKeyboardFrameBeginUserInfoKey: &'static NSString;
359}
360
361extern "C" {
362 pub static UIKeyboardFrameEndUserInfoKey: &'static NSString;
364}
365
366extern "C" {
367 pub static UIKeyboardAnimationDurationUserInfoKey: &'static NSString;
369}
370
371extern "C" {
372 pub static UIKeyboardAnimationCurveUserInfoKey: &'static NSString;
374}
375
376extern "C" {
377 pub static UIKeyboardIsLocalUserInfoKey: &'static NSString;
379}
380
381extern "C" {
382 pub static UIKeyboardWillChangeFrameNotification: &'static NSNotificationName;
384}
385
386extern "C" {
387 pub static UIKeyboardDidChangeFrameNotification: &'static NSNotificationName;
389}
390
391extern "C" {
392 #[deprecated]
394 pub static UIKeyboardCenterBeginUserInfoKey: &'static NSString;
395}
396
397extern "C" {
398 #[deprecated]
400 pub static UIKeyboardCenterEndUserInfoKey: &'static NSString;
401}
402
403extern "C" {
404 #[deprecated]
406 pub static UIKeyboardBoundsUserInfoKey: &'static NSString;
407}