use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-cloud-kit")]
use objc2_cloud_kit::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[unsafe(super(UIScene, UIResponder, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "UIResponder", feature = "UIScene"))]
pub struct UIWindowScene;
);
#[cfg(all(feature = "UIResponder", feature = "UIScene"))]
extern_conformance!(
unsafe impl NSObjectProtocol for UIWindowScene {}
);
#[cfg(all(feature = "UIResponder", feature = "UIScene"))]
extern_conformance!(
unsafe impl UIResponderStandardEditActions for UIWindowScene {}
);
#[cfg(all(feature = "UIResponder", feature = "UIScene"))]
impl UIWindowScene {
extern_methods!(
#[cfg(feature = "UIScreen")]
#[unsafe(method(screen))]
#[unsafe(method_family = none)]
pub fn screen(&self) -> Retained<UIScreen>;
#[cfg(feature = "UIOrientation")]
#[deprecated = "Use effectiveGeometry.interfaceOrientation instead."]
#[unsafe(method(interfaceOrientation))]
#[unsafe(method_family = none)]
pub fn interfaceOrientation(&self) -> UIInterfaceOrientation;
#[cfg(feature = "UIView")]
#[deprecated = "Use effectiveGeometry.coordinateSpace instead."]
#[unsafe(method(coordinateSpace))]
#[unsafe(method_family = none)]
pub fn coordinateSpace(&self) -> Retained<ProtocolObject<dyn UICoordinateSpace>>;
#[cfg(feature = "UITraitCollection")]
#[unsafe(method(traitCollection))]
#[unsafe(method_family = none)]
pub fn traitCollection(&self) -> Retained<UITraitCollection>;
#[cfg(all(feature = "UIWindowSceneGeometryPreferences", feature = "block2"))]
#[unsafe(method(requestGeometryUpdateWithPreferences:errorHandler:))]
#[unsafe(method_family = none)]
pub fn requestGeometryUpdateWithPreferences_errorHandler(
&self,
geometry_preferences: &UIWindowSceneGeometryPreferences,
error_handler: Option<&block2::DynBlock<dyn Fn(NonNull<NSError>)>>,
);
#[cfg(feature = "UIWindowSceneGeometry")]
#[unsafe(method(effectiveGeometry))]
#[unsafe(method_family = none)]
pub fn effectiveGeometry(&self) -> Retained<UIWindowSceneGeometry>;
#[cfg(feature = "UISceneSizeRestrictions")]
#[unsafe(method(sizeRestrictions))]
#[unsafe(method_family = none)]
pub fn sizeRestrictions(&self) -> Option<Retained<UISceneSizeRestrictions>>;
#[cfg(all(feature = "UIView", feature = "UIWindow"))]
#[unsafe(method(windows))]
#[unsafe(method_family = none)]
pub fn windows(&self) -> Retained<NSArray<UIWindow>>;
#[cfg(all(feature = "UIView", feature = "UIWindow"))]
#[unsafe(method(keyWindow))]
#[unsafe(method_family = none)]
pub fn keyWindow(&self) -> Option<Retained<UIWindow>>;
#[cfg(feature = "UIActivityItemsConfigurationReading")]
#[unsafe(method(activityItemsConfigurationSource))]
#[unsafe(method_family = none)]
pub fn activityItemsConfigurationSource(
&self,
) -> Option<Retained<ProtocolObject<dyn UIActivityItemsConfigurationProviding>>>;
#[cfg(feature = "UIActivityItemsConfigurationReading")]
#[unsafe(method(setActivityItemsConfigurationSource:))]
#[unsafe(method_family = none)]
pub fn setActivityItemsConfigurationSource(
&self,
activity_items_configuration_source: Option<
&ProtocolObject<dyn UIActivityItemsConfigurationProviding>,
>,
);
#[cfg(feature = "UISceneWindowingBehaviors")]
#[unsafe(method(windowingBehaviors))]
#[unsafe(method_family = none)]
pub fn windowingBehaviors(&self) -> Option<Retained<UISceneWindowingBehaviors>>;
#[unsafe(method(isFullScreen))]
#[unsafe(method_family = none)]
pub fn isFullScreen(&self) -> bool;
);
}
#[cfg(all(feature = "UIResponder", feature = "UIScene"))]
impl UIWindowScene {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(feature = "UISceneOptions", feature = "UISceneSession"))]
#[unsafe(method(initWithSession:connectionOptions:))]
#[unsafe(method_family = init)]
pub fn initWithSession_connectionOptions(
this: Allocated<Self>,
session: &UISceneSession,
connection_options: &UISceneConnectionOptions,
) -> Retained<Self>;
);
}
#[cfg(all(feature = "UIResponder", feature = "UIScene"))]
impl UIWindowScene {
extern_methods!(
#[cfg(feature = "UITraitCollection")]
#[unsafe(method(traitOverrides))]
#[unsafe(method_family = none)]
pub fn traitOverrides(&self) -> Retained<ProtocolObject<dyn UITraitOverrides>>;
);
}
#[cfg(all(
feature = "UIResponder",
feature = "UIScene",
feature = "UITraitCollection"
))]
extern_conformance!(
unsafe impl UITraitChangeObservable for UIWindowScene {}
);
#[cfg(all(
feature = "UIResponder",
feature = "UIScene",
feature = "UITraitCollection"
))]
extern_conformance!(
unsafe impl UITraitEnvironment for UIWindowScene {}
);
extern_protocol!(
#[cfg(feature = "UIScene")]
pub unsafe trait UIWindowSceneDelegate: UISceneDelegate + MainThreadOnly {
#[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
#[optional]
#[unsafe(method(window))]
#[unsafe(method_family = none)]
fn window(&self) -> Option<Retained<UIWindow>>;
#[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
#[optional]
#[unsafe(method(setWindow:))]
#[unsafe(method_family = none)]
fn setWindow(&self, window: Option<&UIWindow>);
#[cfg(all(
feature = "UIOrientation",
feature = "UIResponder",
feature = "UITraitCollection",
feature = "UIView"
))]
#[deprecated = "Use windowScene(_: didUpdateEffectiveGeometry:) to be notified of the scene's geometry changes, or use traits whose values are inherited from the scene via the traitCollection of views and view controllers instead."]
#[optional]
#[unsafe(method(windowScene:didUpdateCoordinateSpace:interfaceOrientation:traitCollection:))]
#[unsafe(method_family = none)]
fn windowScene_didUpdateCoordinateSpace_interfaceOrientation_traitCollection(
&self,
window_scene: &UIWindowScene,
previous_coordinate_space: &ProtocolObject<dyn UICoordinateSpace>,
previous_interface_orientation: UIInterfaceOrientation,
previous_trait_collection: &UITraitCollection,
);
#[cfg(all(feature = "UIResponder", feature = "UIWindowSceneGeometry"))]
#[optional]
#[unsafe(method(windowScene:didUpdateEffectiveGeometry:))]
#[unsafe(method_family = none)]
fn windowScene_didUpdateEffectiveGeometry(
&self,
window_scene: &UIWindowScene,
previous_effective_geometry: &UIWindowSceneGeometry,
);
#[cfg(all(
feature = "UIApplicationShortcutItem",
feature = "UIResponder",
feature = "block2"
))]
#[optional]
#[unsafe(method(windowScene:performActionForShortcutItem:completionHandler:))]
#[unsafe(method_family = none)]
fn windowScene_performActionForShortcutItem_completionHandler(
&self,
window_scene: &UIWindowScene,
shortcut_item: &UIApplicationShortcutItem,
completion_handler: &block2::DynBlock<dyn Fn(Bool)>,
);
#[cfg(all(feature = "UIResponder", feature = "objc2-cloud-kit"))]
#[optional]
#[unsafe(method(windowScene:userDidAcceptCloudKitShareWithMetadata:))]
#[unsafe(method_family = none)]
fn windowScene_userDidAcceptCloudKitShareWithMetadata(
&self,
window_scene: &UIWindowScene,
cloud_kit_share_metadata: &CKShareMetadata,
);
#[cfg(all(feature = "UIResponder", feature = "UISceneWindowingControlStyle"))]
#[optional]
#[unsafe(method(preferredWindowingControlStyleForScene:))]
#[unsafe(method_family = none)]
fn preferredWindowingControlStyleForScene(
&self,
window_scene: &UIWindowScene,
) -> Retained<UISceneWindowingControlStyle>;
}
);
extern "C" {
#[cfg(feature = "UISceneDefinitions")]
pub static UIWindowSceneSessionRoleApplication: &'static UISceneSessionRole;
}
extern "C" {
#[cfg(feature = "UISceneDefinitions")]
pub static UIWindowSceneSessionRoleExternalDisplayNonInteractive: &'static UISceneSessionRole;
}
extern "C" {
#[cfg(feature = "UISceneDefinitions")]
#[deprecated]
pub static UIWindowSceneSessionRoleExternalDisplay: &'static UISceneSessionRole;
}
extern "C" {
#[cfg(feature = "UISceneDefinitions")]
pub static UIWindowSceneSessionRoleVolumetricApplication: &'static UISceneSessionRole;
}
extern "C" {
#[cfg(feature = "UISceneDefinitions")]
pub static UIWindowSceneSessionRoleAssistiveAccessApplication: &'static UISceneSessionRole;
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIWindowSceneDismissalAnimation(pub NSInteger);
impl UIWindowSceneDismissalAnimation {
#[doc(alias = "UIWindowSceneDismissalAnimationStandard")]
pub const Standard: Self = Self(1);
#[doc(alias = "UIWindowSceneDismissalAnimationCommit")]
pub const Commit: Self = Self(2);
#[doc(alias = "UIWindowSceneDismissalAnimationDecline")]
pub const Decline: Self = Self(3);
}
unsafe impl Encode for UIWindowSceneDismissalAnimation {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIWindowSceneDismissalAnimation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(UISceneDestructionRequestOptions, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UISceneOptions")]
pub struct UIWindowSceneDestructionRequestOptions;
);
#[cfg(feature = "UISceneOptions")]
extern_conformance!(
unsafe impl NSObjectProtocol for UIWindowSceneDestructionRequestOptions {}
);
#[cfg(feature = "UISceneOptions")]
impl UIWindowSceneDestructionRequestOptions {
extern_methods!(
#[unsafe(method(windowDismissalAnimation))]
#[unsafe(method_family = none)]
pub fn windowDismissalAnimation(&self) -> UIWindowSceneDismissalAnimation;
#[unsafe(method(setWindowDismissalAnimation:))]
#[unsafe(method_family = none)]
pub fn setWindowDismissalAnimation(
&self,
window_dismissal_animation: UIWindowSceneDismissalAnimation,
);
);
}
#[cfg(feature = "UISceneOptions")]
impl UIWindowSceneDestructionRequestOptions {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}