objc2_ui_kit/generated/
UIWindow.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use 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/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowlevel?language=objc)
16// NS_TYPED_EXTENSIBLE_ENUM
17#[cfg(feature = "objc2-core-foundation")]
18pub type UIWindowLevel = CGFloat;
19
20extern_class!(
21    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindow?language=objc)
22    #[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        /// This is a [weak property][objc2::topics::weak_property].
120        /// Setter for [`windowScene`][Self::windowScene].
121        #[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        /// Setter for [`canResizeToFitContent`][Self::canResizeToFitContent].
130        #[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        /// Setter for [`screen`][Self::screen].
141        #[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        /// Setter for [`windowLevel`][Self::windowLevel].
152        #[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        /// Setter for [`rootViewController`][Self::rootViewController].
187        #[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/// Methods declared on superclass `UIView`.
235#[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/// Methods declared on superclass `NSObject`.
253#[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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilayoutguideaspectfitting?language=objc)
268    pub unsafe trait UILayoutGuideAspectFitting: NSObjectProtocol {
269        #[cfg(feature = "objc2-core-foundation")]
270        /// Update the aspect ratio (width / height) for the given content
271        /// Defaults to 1.0. Must be > 0.0 and values may be clamped within a reasonable range of approximately 1:100 to 100:1.
272        #[unsafe(method(aspectRatio))]
273        #[unsafe(method_family = none)]
274        unsafe fn aspectRatio(&self) -> CGFloat;
275
276        #[cfg(feature = "objc2-core-foundation")]
277        /// Setter for [`aspectRatio`][Self::aspectRatio].
278        #[unsafe(method(setAspectRatio:))]
279        #[unsafe(method_family = none)]
280        unsafe fn setAspectRatio(&self, aspect_ratio: CGFloat);
281    }
282);
283
284/// UIWindowLayout.
285#[cfg(all(feature = "UIResponder", feature = "UIView"))]
286impl UIWindow {
287    extern_methods!(
288        #[cfg(feature = "UILayoutGuide")]
289        /// This layout guide is designed specifically for full-screen media content, and attaching constraints from deep in the window's view hierarchy will raise an exception.
290        ///
291        /// This guide provides a layout area for placing media content of a given aspect ratio (width over height) such that the content will be completely visible within the window.
292        /// Compared to the standard `safeAreaLayoutGuide` on a view, this guide takes into account the aspect ratio of the content, allowing it the maximum size within the window's
293        /// true safe area, including the actual shape of the screen when that is the only factor contributing to the safe area. The rect defined by this guide will be centered within the
294        /// window.
295        ///
296        /// This layout guide should only be used for fixed aspect ratio content that is intended to fill the window (such as image or video content) and is not a replacement for the
297        /// standard `safeAreaLayoutGuide` on each UIView which should be used for most content layout. The `safeAreaAspectFitLayoutGuide` should only be used with views
298        /// that are direct subviews of, or very close descendants of, the guide's window. Creating constraints from this layout guide to views deeper in the view hierarchy or across
299        /// views owned by child view controllers can significantly degrade performance and possibly raise an exception. Additionally, the safe area insets added by child view
300        /// controllers will not be reflected in these cases. For anything other than full-screen/window media content, the standard `safeAreaLayoutGuide` on UIView should be used.
301        #[unsafe(method(safeAreaAspectFitLayoutGuide))]
302        #[unsafe(method_family = none)]
303        pub unsafe fn safeAreaAspectFitLayoutGuide(&self) -> Retained<UILayoutGuide>;
304    );
305}
306
307extern "C" {
308    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowlevelnormal?language=objc)
309    #[cfg(feature = "objc2-core-foundation")]
310    pub static UIWindowLevelNormal: UIWindowLevel;
311}
312
313extern "C" {
314    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowlevelalert?language=objc)
315    #[cfg(feature = "objc2-core-foundation")]
316    pub static UIWindowLevelAlert: UIWindowLevel;
317}
318
319extern "C" {
320    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowlevelstatusbar?language=objc)
321    #[cfg(feature = "objc2-core-foundation")]
322    pub static UIWindowLevelStatusBar: UIWindowLevel;
323}
324
325extern "C" {
326    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowdidbecomevisiblenotification?language=objc)
327    pub static UIWindowDidBecomeVisibleNotification: &'static NSNotificationName;
328}
329
330extern "C" {
331    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowdidbecomehiddennotification?language=objc)
332    pub static UIWindowDidBecomeHiddenNotification: &'static NSNotificationName;
333}
334
335extern "C" {
336    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowdidbecomekeynotification?language=objc)
337    pub static UIWindowDidBecomeKeyNotification: &'static NSNotificationName;
338}
339
340extern "C" {
341    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowdidresignkeynotification?language=objc)
342    pub static UIWindowDidResignKeyNotification: &'static NSNotificationName;
343}
344
345extern "C" {
346    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardwillshownotification?language=objc)
347    pub static UIKeyboardWillShowNotification: &'static NSNotificationName;
348}
349
350extern "C" {
351    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboarddidshownotification?language=objc)
352    pub static UIKeyboardDidShowNotification: &'static NSNotificationName;
353}
354
355extern "C" {
356    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardwillhidenotification?language=objc)
357    pub static UIKeyboardWillHideNotification: &'static NSNotificationName;
358}
359
360extern "C" {
361    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboarddidhidenotification?language=objc)
362    pub static UIKeyboardDidHideNotification: &'static NSNotificationName;
363}
364
365extern "C" {
366    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardframebeginuserinfokey?language=objc)
367    pub static UIKeyboardFrameBeginUserInfoKey: &'static NSString;
368}
369
370extern "C" {
371    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardframeenduserinfokey?language=objc)
372    pub static UIKeyboardFrameEndUserInfoKey: &'static NSString;
373}
374
375extern "C" {
376    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardanimationdurationuserinfokey?language=objc)
377    pub static UIKeyboardAnimationDurationUserInfoKey: &'static NSString;
378}
379
380extern "C" {
381    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardanimationcurveuserinfokey?language=objc)
382    pub static UIKeyboardAnimationCurveUserInfoKey: &'static NSString;
383}
384
385extern "C" {
386    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardislocaluserinfokey?language=objc)
387    pub static UIKeyboardIsLocalUserInfoKey: &'static NSString;
388}
389
390extern "C" {
391    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardwillchangeframenotification?language=objc)
392    pub static UIKeyboardWillChangeFrameNotification: &'static NSNotificationName;
393}
394
395extern "C" {
396    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboarddidchangeframenotification?language=objc)
397    pub static UIKeyboardDidChangeFrameNotification: &'static NSNotificationName;
398}
399
400extern "C" {
401    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardcenterbeginuserinfokey?language=objc)
402    pub static UIKeyboardCenterBeginUserInfoKey: &'static NSString;
403}
404
405extern "C" {
406    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardcenterenduserinfokey?language=objc)
407    pub static UIKeyboardCenterEndUserInfoKey: &'static NSString;
408}
409
410extern "C" {
411    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardboundsuserinfokey?language=objc)
412    pub static UIKeyboardBoundsUserInfoKey: &'static NSString;
413}