objc2-ui-kit 0.3.2

Bindings to the UIKit framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowlevel?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "objc2-core-foundation")]
pub type UIWindowLevel = CGFloat;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindow?language=objc)
    #[unsafe(super(UIView, UIResponder, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    pub struct UIWindow;
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UIView",
    feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
    unsafe impl CALayerDelegate for UIWindow {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl NSCoding for UIWindow {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for UIWindow {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIAppearance for UIWindow {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIAppearanceContainer for UIWindow {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UICoordinateSpace for UIWindow {}
);

#[cfg(all(
    feature = "UIDynamicBehavior",
    feature = "UIResponder",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UIDynamicItem for UIWindow {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusEnvironment for UIWindow {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItem for UIWindow {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItemContainer for UIWindow {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIResponderStandardEditActions for UIWindow {}
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UITraitEnvironment for UIWindow {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIWindow {
    extern_methods!(
        #[cfg(all(feature = "UIScene", feature = "UIWindowScene"))]
        #[unsafe(method(initWithWindowScene:))]
        #[unsafe(method_family = init)]
        pub fn initWithWindowScene(
            this: Allocated<Self>,
            window_scene: &UIWindowScene,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[deprecated = "Use init(windowScene:) instead."]
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

        #[deprecated = "Use init(windowScene:) instead."]
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(all(feature = "UIScene", feature = "UIWindowScene"))]
        #[unsafe(method(windowScene))]
        #[unsafe(method_family = none)]
        pub fn windowScene(&self) -> Option<Retained<UIWindowScene>>;

        #[cfg(all(feature = "UIScene", feature = "UIWindowScene"))]
        /// Setter for [`windowScene`][Self::windowScene].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setWindowScene:))]
        #[unsafe(method_family = none)]
        pub fn setWindowScene(&self, window_scene: Option<&UIWindowScene>);

        #[unsafe(method(canResizeToFitContent))]
        #[unsafe(method_family = none)]
        pub fn canResizeToFitContent(&self) -> bool;

        /// Setter for [`canResizeToFitContent`][Self::canResizeToFitContent].
        #[unsafe(method(setCanResizeToFitContent:))]
        #[unsafe(method_family = none)]
        pub fn setCanResizeToFitContent(&self, can_resize_to_fit_content: bool);

        #[cfg(feature = "UIScreen")]
        #[unsafe(method(screen))]
        #[unsafe(method_family = none)]
        pub fn screen(&self) -> Retained<UIScreen>;

        #[cfg(feature = "UIScreen")]
        /// Setter for [`screen`][Self::screen].
        #[unsafe(method(setScreen:))]
        #[unsafe(method_family = none)]
        pub fn setScreen(&self, screen: &UIScreen);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(windowLevel))]
        #[unsafe(method_family = none)]
        pub fn windowLevel(&self) -> UIWindowLevel;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`windowLevel`][Self::windowLevel].
        #[unsafe(method(setWindowLevel:))]
        #[unsafe(method_family = none)]
        pub fn setWindowLevel(&self, window_level: UIWindowLevel);

        #[unsafe(method(isKeyWindow))]
        #[unsafe(method_family = none)]
        pub fn isKeyWindow(&self) -> bool;

        #[unsafe(method(canBecomeKeyWindow))]
        #[unsafe(method_family = none)]
        pub fn canBecomeKeyWindow(&self) -> bool;

        #[unsafe(method(becomeKeyWindow))]
        #[unsafe(method_family = none)]
        pub fn becomeKeyWindow(&self);

        #[unsafe(method(resignKeyWindow))]
        #[unsafe(method_family = none)]
        pub fn resignKeyWindow(&self);

        #[unsafe(method(makeKeyWindow))]
        #[unsafe(method_family = none)]
        pub fn makeKeyWindow(&self);

        #[unsafe(method(makeKeyAndVisible))]
        #[unsafe(method_family = none)]
        pub fn makeKeyAndVisible(&self);

        #[cfg(feature = "UIViewController")]
        #[unsafe(method(rootViewController))]
        #[unsafe(method_family = none)]
        pub fn rootViewController(&self) -> Option<Retained<UIViewController>>;

        #[cfg(feature = "UIViewController")]
        /// Setter for [`rootViewController`][Self::rootViewController].
        #[unsafe(method(setRootViewController:))]
        #[unsafe(method_family = none)]
        pub fn setRootViewController(&self, root_view_controller: Option<&UIViewController>);

        #[cfg(feature = "UIEvent")]
        #[unsafe(method(sendEvent:))]
        #[unsafe(method_family = none)]
        pub fn sendEvent(&self, event: &UIEvent);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(convertPoint:toWindow:))]
        #[unsafe(method_family = none)]
        pub fn convertPoint_toWindow(&self, point: CGPoint, window: Option<&UIWindow>) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(convertPoint:fromWindow:))]
        #[unsafe(method_family = none)]
        pub fn convertPoint_fromWindow(&self, point: CGPoint, window: Option<&UIWindow>)
            -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(convertRect:toWindow:))]
        #[unsafe(method_family = none)]
        pub fn convertRect_toWindow(&self, rect: CGRect, window: Option<&UIWindow>) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(convertRect:fromWindow:))]
        #[unsafe(method_family = none)]
        pub fn convertRect_fromWindow(&self, rect: CGRect, window: Option<&UIWindow>) -> CGRect;
    );
}

/// Methods declared on superclass `UIView`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIWindow {
    extern_methods!(
        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIWindow {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilayoutguideaspectfitting?language=objc)
    pub unsafe trait UILayoutGuideAspectFitting: NSObjectProtocol {
        #[cfg(feature = "objc2-core-foundation")]
        /// Update the aspect ratio (width / height) for the given content
        /// Defaults to 1.0. Must be > 0.0 and values may be clamped within a reasonable range of approximately 1:100 to 100:1.
        #[unsafe(method(aspectRatio))]
        #[unsafe(method_family = none)]
        fn aspectRatio(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`aspectRatio`][Self::aspectRatio].
        #[unsafe(method(setAspectRatio:))]
        #[unsafe(method_family = none)]
        fn setAspectRatio(&self, aspect_ratio: CGFloat);
    }
);

/// UIWindowLayout.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIWindow {
    extern_methods!(
        #[cfg(feature = "UILayoutGuide")]
        /// 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.
        ///
        /// 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.
        /// 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
        /// 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
        /// window.
        ///
        /// 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
        /// standard `safeAreaLayoutGuide` on each UIView which should be used for most content layout. The `safeAreaAspectFitLayoutGuide` should only be used with views
        /// 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
        /// views owned by child view controllers can significantly degrade performance and possibly raise an exception. Additionally, the safe area insets added by child view
        /// 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.
        #[unsafe(method(safeAreaAspectFitLayoutGuide))]
        #[unsafe(method_family = none)]
        pub fn safeAreaAspectFitLayoutGuide(&self) -> Retained<UILayoutGuide>;
    );
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowlevelnormal?language=objc)
    #[cfg(feature = "objc2-core-foundation")]
    pub static UIWindowLevelNormal: UIWindowLevel;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowlevelalert?language=objc)
    #[cfg(feature = "objc2-core-foundation")]
    pub static UIWindowLevelAlert: UIWindowLevel;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowlevelstatusbar?language=objc)
    #[cfg(feature = "objc2-core-foundation")]
    pub static UIWindowLevelStatusBar: UIWindowLevel;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowdidbecomevisiblenotification?language=objc)
    pub static UIWindowDidBecomeVisibleNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowdidbecomehiddennotification?language=objc)
    pub static UIWindowDidBecomeHiddenNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowdidbecomekeynotification?language=objc)
    pub static UIWindowDidBecomeKeyNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowdidresignkeynotification?language=objc)
    pub static UIWindowDidResignKeyNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardwillshownotification?language=objc)
    pub static UIKeyboardWillShowNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboarddidshownotification?language=objc)
    pub static UIKeyboardDidShowNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardwillhidenotification?language=objc)
    pub static UIKeyboardWillHideNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboarddidhidenotification?language=objc)
    pub static UIKeyboardDidHideNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardframebeginuserinfokey?language=objc)
    pub static UIKeyboardFrameBeginUserInfoKey: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardframeenduserinfokey?language=objc)
    pub static UIKeyboardFrameEndUserInfoKey: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardanimationdurationuserinfokey?language=objc)
    pub static UIKeyboardAnimationDurationUserInfoKey: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardanimationcurveuserinfokey?language=objc)
    pub static UIKeyboardAnimationCurveUserInfoKey: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardislocaluserinfokey?language=objc)
    pub static UIKeyboardIsLocalUserInfoKey: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardwillchangeframenotification?language=objc)
    pub static UIKeyboardWillChangeFrameNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboarddidchangeframenotification?language=objc)
    pub static UIKeyboardDidChangeFrameNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardcenterbeginuserinfokey?language=objc)
    #[deprecated]
    pub static UIKeyboardCenterBeginUserInfoKey: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardcenterenduserinfokey?language=objc)
    #[deprecated]
    pub static UIKeyboardCenterEndUserInfoKey: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uikeyboardboundsuserinfokey?language=objc)
    #[deprecated]
    pub static UIKeyboardBoundsUserInfoKey: &'static NSString;
}