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 unsafe fn initWithWindowScene(
109 this: Allocated<Self>,
110 window_scene: &UIWindowScene,
111 ) -> Retained<Self>;
112
113 #[cfg(all(feature = "UIScene", feature = "UIWindowScene"))]
114 #[unsafe(method(windowScene))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn windowScene(&self) -> Option<Retained<UIWindowScene>>;
117
118 #[cfg(all(feature = "UIScene", feature = "UIWindowScene"))]
119 #[unsafe(method(setWindowScene:))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn setWindowScene(&self, window_scene: Option<&UIWindowScene>);
124
125 #[unsafe(method(canResizeToFitContent))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn canResizeToFitContent(&self) -> bool;
128
129 #[unsafe(method(setCanResizeToFitContent:))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn setCanResizeToFitContent(&self, can_resize_to_fit_content: bool);
133
134 #[cfg(feature = "UIScreen")]
135 #[unsafe(method(screen))]
136 #[unsafe(method_family = none)]
137 pub fn screen(&self) -> Retained<UIScreen>;
138
139 #[cfg(feature = "UIScreen")]
140 #[unsafe(method(setScreen:))]
142 #[unsafe(method_family = none)]
143 pub fn setScreen(&self, screen: &UIScreen);
144
145 #[cfg(feature = "objc2-core-foundation")]
146 #[unsafe(method(windowLevel))]
147 #[unsafe(method_family = none)]
148 pub unsafe fn windowLevel(&self) -> UIWindowLevel;
149
150 #[cfg(feature = "objc2-core-foundation")]
151 #[unsafe(method(setWindowLevel:))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn setWindowLevel(&self, window_level: UIWindowLevel);
155
156 #[unsafe(method(isKeyWindow))]
157 #[unsafe(method_family = none)]
158 pub fn isKeyWindow(&self) -> bool;
159
160 #[unsafe(method(canBecomeKeyWindow))]
161 #[unsafe(method_family = none)]
162 pub unsafe fn canBecomeKeyWindow(&self) -> bool;
163
164 #[unsafe(method(becomeKeyWindow))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn becomeKeyWindow(&self);
167
168 #[unsafe(method(resignKeyWindow))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn resignKeyWindow(&self);
171
172 #[unsafe(method(makeKeyWindow))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn makeKeyWindow(&self);
175
176 #[unsafe(method(makeKeyAndVisible))]
177 #[unsafe(method_family = none)]
178 pub fn makeKeyAndVisible(&self);
179
180 #[cfg(feature = "UIViewController")]
181 #[unsafe(method(rootViewController))]
182 #[unsafe(method_family = none)]
183 pub fn rootViewController(&self) -> Option<Retained<UIViewController>>;
184
185 #[cfg(feature = "UIViewController")]
186 #[unsafe(method(setRootViewController:))]
188 #[unsafe(method_family = none)]
189 pub fn setRootViewController(&self, root_view_controller: Option<&UIViewController>);
190
191 #[cfg(feature = "UIEvent")]
192 #[unsafe(method(sendEvent:))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn sendEvent(&self, event: &UIEvent);
195
196 #[cfg(feature = "objc2-core-foundation")]
197 #[unsafe(method(convertPoint:toWindow:))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn convertPoint_toWindow(
200 &self,
201 point: CGPoint,
202 window: Option<&UIWindow>,
203 ) -> CGPoint;
204
205 #[cfg(feature = "objc2-core-foundation")]
206 #[unsafe(method(convertPoint:fromWindow:))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn convertPoint_fromWindow(
209 &self,
210 point: CGPoint,
211 window: Option<&UIWindow>,
212 ) -> CGPoint;
213
214 #[cfg(feature = "objc2-core-foundation")]
215 #[unsafe(method(convertRect:toWindow:))]
216 #[unsafe(method_family = none)]
217 pub unsafe fn convertRect_toWindow(
218 &self,
219 rect: CGRect,
220 window: Option<&UIWindow>,
221 ) -> CGRect;
222
223 #[cfg(feature = "objc2-core-foundation")]
224 #[unsafe(method(convertRect:fromWindow:))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn convertRect_fromWindow(
227 &self,
228 rect: CGRect,
229 window: Option<&UIWindow>,
230 ) -> CGRect;
231 );
232}
233
234#[cfg(all(feature = "UIResponder", feature = "UIView"))]
236impl UIWindow {
237 extern_methods!(
238 #[cfg(feature = "objc2-core-foundation")]
239 #[unsafe(method(initWithFrame:))]
240 #[unsafe(method_family = init)]
241 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
242
243 #[unsafe(method(initWithCoder:))]
244 #[unsafe(method_family = init)]
245 pub unsafe fn initWithCoder(
246 this: Allocated<Self>,
247 coder: &NSCoder,
248 ) -> Option<Retained<Self>>;
249 );
250}
251
252#[cfg(all(feature = "UIResponder", feature = "UIView"))]
254impl UIWindow {
255 extern_methods!(
256 #[unsafe(method(init))]
257 #[unsafe(method_family = init)]
258 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
259
260 #[unsafe(method(new))]
261 #[unsafe(method_family = new)]
262 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
263 );
264}
265
266extern_protocol!(
267 pub unsafe trait UILayoutGuideAspectFitting: NSObjectProtocol {
269 #[cfg(feature = "objc2-core-foundation")]
270 #[unsafe(method(aspectRatio))]
273 #[unsafe(method_family = none)]
274 unsafe fn aspectRatio(&self) -> CGFloat;
275
276 #[cfg(feature = "objc2-core-foundation")]
277 #[unsafe(method(setAspectRatio:))]
279 #[unsafe(method_family = none)]
280 unsafe fn setAspectRatio(&self, aspect_ratio: CGFloat);
281 }
282);
283
284#[cfg(all(feature = "UIResponder", feature = "UIView"))]
286impl UIWindow {
287 extern_methods!(
288 #[cfg(feature = "UILayoutGuide")]
289 #[unsafe(method(safeAreaAspectFitLayoutGuide))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn safeAreaAspectFitLayoutGuide(&self) -> Retained<UILayoutGuide>;
304 );
305}
306
307extern "C" {
308 #[cfg(feature = "objc2-core-foundation")]
310 pub static UIWindowLevelNormal: UIWindowLevel;
311}
312
313extern "C" {
314 #[cfg(feature = "objc2-core-foundation")]
316 pub static UIWindowLevelAlert: UIWindowLevel;
317}
318
319extern "C" {
320 #[cfg(feature = "objc2-core-foundation")]
322 pub static UIWindowLevelStatusBar: UIWindowLevel;
323}
324
325extern "C" {
326 pub static UIWindowDidBecomeVisibleNotification: &'static NSNotificationName;
328}
329
330extern "C" {
331 pub static UIWindowDidBecomeHiddenNotification: &'static NSNotificationName;
333}
334
335extern "C" {
336 pub static UIWindowDidBecomeKeyNotification: &'static NSNotificationName;
338}
339
340extern "C" {
341 pub static UIWindowDidResignKeyNotification: &'static NSNotificationName;
343}
344
345extern "C" {
346 pub static UIKeyboardWillShowNotification: &'static NSNotificationName;
348}
349
350extern "C" {
351 pub static UIKeyboardDidShowNotification: &'static NSNotificationName;
353}
354
355extern "C" {
356 pub static UIKeyboardWillHideNotification: &'static NSNotificationName;
358}
359
360extern "C" {
361 pub static UIKeyboardDidHideNotification: &'static NSNotificationName;
363}
364
365extern "C" {
366 pub static UIKeyboardFrameBeginUserInfoKey: &'static NSString;
368}
369
370extern "C" {
371 pub static UIKeyboardFrameEndUserInfoKey: &'static NSString;
373}
374
375extern "C" {
376 pub static UIKeyboardAnimationDurationUserInfoKey: &'static NSString;
378}
379
380extern "C" {
381 pub static UIKeyboardAnimationCurveUserInfoKey: &'static NSString;
383}
384
385extern "C" {
386 pub static UIKeyboardIsLocalUserInfoKey: &'static NSString;
388}
389
390extern "C" {
391 pub static UIKeyboardWillChangeFrameNotification: &'static NSNotificationName;
393}
394
395extern "C" {
396 pub static UIKeyboardDidChangeFrameNotification: &'static NSNotificationName;
398}
399
400extern "C" {
401 pub static UIKeyboardCenterBeginUserInfoKey: &'static NSString;
403}
404
405extern "C" {
406 pub static UIKeyboardCenterEndUserInfoKey: &'static NSString;
408}
409
410extern "C" {
411 pub static UIKeyboardBoundsUserInfoKey: &'static NSString;
413}