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::*;
#[cfg(feature = "objc2-core-foundation")]
pub type UIWindowLevel = CGFloat;
extern_class!(
#[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"))]
#[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;
#[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")]
#[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")]
#[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")]
#[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;
);
}
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIWindow {
extern_methods!(
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
);
}
#[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!(
pub unsafe trait UILayoutGuideAspectFitting: NSObjectProtocol {
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(aspectRatio))]
#[unsafe(method_family = none)]
fn aspectRatio(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setAspectRatio:))]
#[unsafe(method_family = none)]
fn setAspectRatio(&self, aspect_ratio: CGFloat);
}
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIWindow {
extern_methods!(
#[cfg(feature = "UILayoutGuide")]
#[unsafe(method(safeAreaAspectFitLayoutGuide))]
#[unsafe(method_family = none)]
pub fn safeAreaAspectFitLayoutGuide(&self) -> Retained<UILayoutGuide>;
);
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIWindowLevelNormal: UIWindowLevel;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIWindowLevelAlert: UIWindowLevel;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIWindowLevelStatusBar: UIWindowLevel;
}
extern "C" {
pub static UIWindowDidBecomeVisibleNotification: &'static NSNotificationName;
}
extern "C" {
pub static UIWindowDidBecomeHiddenNotification: &'static NSNotificationName;
}
extern "C" {
pub static UIWindowDidBecomeKeyNotification: &'static NSNotificationName;
}
extern "C" {
pub static UIWindowDidResignKeyNotification: &'static NSNotificationName;
}
extern "C" {
pub static UIKeyboardWillShowNotification: &'static NSNotificationName;
}
extern "C" {
pub static UIKeyboardDidShowNotification: &'static NSNotificationName;
}
extern "C" {
pub static UIKeyboardWillHideNotification: &'static NSNotificationName;
}
extern "C" {
pub static UIKeyboardDidHideNotification: &'static NSNotificationName;
}
extern "C" {
pub static UIKeyboardFrameBeginUserInfoKey: &'static NSString;
}
extern "C" {
pub static UIKeyboardFrameEndUserInfoKey: &'static NSString;
}
extern "C" {
pub static UIKeyboardAnimationDurationUserInfoKey: &'static NSString;
}
extern "C" {
pub static UIKeyboardAnimationCurveUserInfoKey: &'static NSString;
}
extern "C" {
pub static UIKeyboardIsLocalUserInfoKey: &'static NSString;
}
extern "C" {
pub static UIKeyboardWillChangeFrameNotification: &'static NSNotificationName;
}
extern "C" {
pub static UIKeyboardDidChangeFrameNotification: &'static NSNotificationName;
}
extern "C" {
#[deprecated]
pub static UIKeyboardCenterBeginUserInfoKey: &'static NSString;
}
extern "C" {
#[deprecated]
pub static UIKeyboardCenterEndUserInfoKey: &'static NSString;
}
extern "C" {
#[deprecated]
pub static UIKeyboardBoundsUserInfoKey: &'static NSString;
}