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"))]
35unsafe impl CALayerDelegate for UIWindow {}
36
37#[cfg(all(feature = "UIResponder", feature = "UIView"))]
38unsafe impl NSCoding for UIWindow {}
39
40#[cfg(all(feature = "UIResponder", feature = "UIView"))]
41unsafe impl NSObjectProtocol for UIWindow {}
42
43#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
44unsafe impl UIAppearance for UIWindow {}
45
46#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
47unsafe impl UIAppearanceContainer for UIWindow {}
48
49#[cfg(all(feature = "UIResponder", feature = "UIView"))]
50unsafe impl UICoordinateSpace for UIWindow {}
51
52#[cfg(all(
53 feature = "UIDynamicBehavior",
54 feature = "UIResponder",
55 feature = "UIView"
56))]
57unsafe impl UIDynamicItem for UIWindow {}
58
59#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
60unsafe impl UIFocusEnvironment for UIWindow {}
61
62#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
63unsafe impl UIFocusItem for UIWindow {}
64
65#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
66unsafe impl UIFocusItemContainer for UIWindow {}
67
68#[cfg(all(feature = "UIResponder", feature = "UIView"))]
69unsafe impl UIResponderStandardEditActions for UIWindow {}
70
71#[cfg(all(
72 feature = "UIResponder",
73 feature = "UITraitCollection",
74 feature = "UIView"
75))]
76unsafe impl UITraitEnvironment for UIWindow {}
77
78#[cfg(all(feature = "UIResponder", feature = "UIView"))]
79impl UIWindow {
80 extern_methods!(
81 #[cfg(all(feature = "UIScene", feature = "UIWindowScene"))]
82 #[unsafe(method(initWithWindowScene:))]
83 #[unsafe(method_family = init)]
84 pub unsafe fn initWithWindowScene(
85 this: Allocated<Self>,
86 window_scene: &UIWindowScene,
87 ) -> Retained<Self>;
88
89 #[cfg(all(feature = "UIScene", feature = "UIWindowScene"))]
90 #[unsafe(method(windowScene))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn windowScene(&self) -> Option<Retained<UIWindowScene>>;
93
94 #[cfg(all(feature = "UIScene", feature = "UIWindowScene"))]
95 #[unsafe(method(setWindowScene:))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn setWindowScene(&self, window_scene: Option<&UIWindowScene>);
100
101 #[unsafe(method(canResizeToFitContent))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn canResizeToFitContent(&self) -> bool;
104
105 #[unsafe(method(setCanResizeToFitContent:))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn setCanResizeToFitContent(&self, can_resize_to_fit_content: bool);
109
110 #[cfg(feature = "UIScreen")]
111 #[unsafe(method(screen))]
112 #[unsafe(method_family = none)]
113 pub fn screen(&self) -> Retained<UIScreen>;
114
115 #[cfg(feature = "UIScreen")]
116 #[unsafe(method(setScreen:))]
118 #[unsafe(method_family = none)]
119 pub fn setScreen(&self, screen: &UIScreen);
120
121 #[cfg(feature = "objc2-core-foundation")]
122 #[unsafe(method(windowLevel))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn windowLevel(&self) -> UIWindowLevel;
125
126 #[cfg(feature = "objc2-core-foundation")]
127 #[unsafe(method(setWindowLevel:))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn setWindowLevel(&self, window_level: UIWindowLevel);
131
132 #[unsafe(method(isKeyWindow))]
133 #[unsafe(method_family = none)]
134 pub fn isKeyWindow(&self) -> bool;
135
136 #[unsafe(method(canBecomeKeyWindow))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn canBecomeKeyWindow(&self) -> bool;
139
140 #[unsafe(method(becomeKeyWindow))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn becomeKeyWindow(&self);
143
144 #[unsafe(method(resignKeyWindow))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn resignKeyWindow(&self);
147
148 #[unsafe(method(makeKeyWindow))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn makeKeyWindow(&self);
151
152 #[unsafe(method(makeKeyAndVisible))]
153 #[unsafe(method_family = none)]
154 pub fn makeKeyAndVisible(&self);
155
156 #[cfg(feature = "UIViewController")]
157 #[unsafe(method(rootViewController))]
158 #[unsafe(method_family = none)]
159 pub fn rootViewController(&self) -> Option<Retained<UIViewController>>;
160
161 #[cfg(feature = "UIViewController")]
162 #[unsafe(method(setRootViewController:))]
164 #[unsafe(method_family = none)]
165 pub fn setRootViewController(&self, root_view_controller: Option<&UIViewController>);
166
167 #[cfg(feature = "UIEvent")]
168 #[unsafe(method(sendEvent:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn sendEvent(&self, event: &UIEvent);
171
172 #[cfg(feature = "objc2-core-foundation")]
173 #[unsafe(method(convertPoint:toWindow:))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn convertPoint_toWindow(
176 &self,
177 point: CGPoint,
178 window: Option<&UIWindow>,
179 ) -> CGPoint;
180
181 #[cfg(feature = "objc2-core-foundation")]
182 #[unsafe(method(convertPoint:fromWindow:))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn convertPoint_fromWindow(
185 &self,
186 point: CGPoint,
187 window: Option<&UIWindow>,
188 ) -> CGPoint;
189
190 #[cfg(feature = "objc2-core-foundation")]
191 #[unsafe(method(convertRect:toWindow:))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn convertRect_toWindow(
194 &self,
195 rect: CGRect,
196 window: Option<&UIWindow>,
197 ) -> CGRect;
198
199 #[cfg(feature = "objc2-core-foundation")]
200 #[unsafe(method(convertRect:fromWindow:))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn convertRect_fromWindow(
203 &self,
204 rect: CGRect,
205 window: Option<&UIWindow>,
206 ) -> CGRect;
207 );
208}
209
210#[cfg(all(feature = "UIResponder", feature = "UIView"))]
212impl UIWindow {
213 extern_methods!(
214 #[cfg(feature = "objc2-core-foundation")]
215 #[unsafe(method(initWithFrame:))]
216 #[unsafe(method_family = init)]
217 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
218
219 #[unsafe(method(initWithCoder:))]
220 #[unsafe(method_family = init)]
221 pub unsafe fn initWithCoder(
222 this: Allocated<Self>,
223 coder: &NSCoder,
224 ) -> Option<Retained<Self>>;
225 );
226}
227
228#[cfg(all(feature = "UIResponder", feature = "UIView"))]
230impl UIWindow {
231 extern_methods!(
232 #[unsafe(method(init))]
233 #[unsafe(method_family = init)]
234 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
235
236 #[unsafe(method(new))]
237 #[unsafe(method_family = new)]
238 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
239 );
240}
241
242extern_protocol!(
243 pub unsafe trait UILayoutGuideAspectFitting: NSObjectProtocol {
245 #[cfg(feature = "objc2-core-foundation")]
246 #[unsafe(method(aspectRatio))]
249 #[unsafe(method_family = none)]
250 unsafe fn aspectRatio(&self) -> CGFloat;
251
252 #[cfg(feature = "objc2-core-foundation")]
253 #[unsafe(method(setAspectRatio:))]
255 #[unsafe(method_family = none)]
256 unsafe fn setAspectRatio(&self, aspect_ratio: CGFloat);
257 }
258);
259
260#[cfg(all(feature = "UIResponder", feature = "UIView"))]
262impl UIWindow {
263 extern_methods!(
264 #[cfg(feature = "UILayoutGuide")]
265 #[unsafe(method(safeAreaAspectFitLayoutGuide))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn safeAreaAspectFitLayoutGuide(&self) -> Retained<UILayoutGuide>;
280 );
281}
282
283extern "C" {
284 #[cfg(feature = "objc2-core-foundation")]
286 pub static UIWindowLevelNormal: UIWindowLevel;
287}
288
289extern "C" {
290 #[cfg(feature = "objc2-core-foundation")]
292 pub static UIWindowLevelAlert: UIWindowLevel;
293}
294
295extern "C" {
296 #[cfg(feature = "objc2-core-foundation")]
298 pub static UIWindowLevelStatusBar: UIWindowLevel;
299}
300
301extern "C" {
302 pub static UIWindowDidBecomeVisibleNotification: &'static NSNotificationName;
304}
305
306extern "C" {
307 pub static UIWindowDidBecomeHiddenNotification: &'static NSNotificationName;
309}
310
311extern "C" {
312 pub static UIWindowDidBecomeKeyNotification: &'static NSNotificationName;
314}
315
316extern "C" {
317 pub static UIWindowDidResignKeyNotification: &'static NSNotificationName;
319}
320
321extern "C" {
322 pub static UIKeyboardWillShowNotification: &'static NSNotificationName;
324}
325
326extern "C" {
327 pub static UIKeyboardDidShowNotification: &'static NSNotificationName;
329}
330
331extern "C" {
332 pub static UIKeyboardWillHideNotification: &'static NSNotificationName;
334}
335
336extern "C" {
337 pub static UIKeyboardDidHideNotification: &'static NSNotificationName;
339}
340
341extern "C" {
342 pub static UIKeyboardFrameBeginUserInfoKey: &'static NSString;
344}
345
346extern "C" {
347 pub static UIKeyboardFrameEndUserInfoKey: &'static NSString;
349}
350
351extern "C" {
352 pub static UIKeyboardAnimationDurationUserInfoKey: &'static NSString;
354}
355
356extern "C" {
357 pub static UIKeyboardAnimationCurveUserInfoKey: &'static NSString;
359}
360
361extern "C" {
362 pub static UIKeyboardIsLocalUserInfoKey: &'static NSString;
364}
365
366extern "C" {
367 pub static UIKeyboardWillChangeFrameNotification: &'static NSNotificationName;
369}
370
371extern "C" {
372 pub static UIKeyboardDidChangeFrameNotification: &'static NSNotificationName;
374}
375
376extern "C" {
377 pub static UIKeyboardCenterBeginUserInfoKey: &'static NSString;
379}
380
381extern "C" {
382 pub static UIKeyboardCenterEndUserInfoKey: &'static NSString;
384}
385
386extern "C" {
387 pub static UIKeyboardBoundsUserInfoKey: &'static NSString;
389}