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::*;
extern "C" {
#[deprecated = "Use UISceneDelegate or related notifications to be informed of connecting scenes from other screens"]
pub static UIScreenDidConnectNotification: &'static NSNotificationName;
}
extern "C" {
#[deprecated = "Use UISceneDelegate or related notifications to be informed of disconnecting scenes from other screens"]
pub static UIScreenDidDisconnectNotification: &'static NSNotificationName;
}
extern "C" {
pub static UIScreenModeDidChangeNotification: &'static NSNotificationName;
}
extern "C" {
pub static UIScreenBrightnessDidChangeNotification: &'static NSNotificationName;
}
extern "C" {
pub static UIScreenCapturedDidChangeNotification: &'static NSNotificationName;
}
extern "C" {
pub static UIScreenReferenceDisplayModeStatusDidChangeNotification: &'static NSNotificationName;
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIScreenOverscanCompensation(pub NSInteger);
impl UIScreenOverscanCompensation {
#[doc(alias = "UIScreenOverscanCompensationScale")]
pub const Scale: Self = Self(0);
#[doc(alias = "UIScreenOverscanCompensationInsetBounds")]
pub const InsetBounds: Self = Self(1);
#[doc(alias = "UIScreenOverscanCompensationNone")]
pub const None: Self = Self(2);
#[doc(alias = "UIScreenOverscanCompensationInsetApplicationFrame")]
#[deprecated]
pub const InsetApplicationFrame: Self = Self(2);
}
unsafe impl Encode for UIScreenOverscanCompensation {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIScreenOverscanCompensation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIScreenReferenceDisplayModeStatus(pub NSInteger);
impl UIScreenReferenceDisplayModeStatus {
#[doc(alias = "UIScreenReferenceDisplayModeStatusNotSupported")]
pub const NotSupported: Self = Self(0);
#[doc(alias = "UIScreenReferenceDisplayModeStatusNotEnabled")]
pub const NotEnabled: Self = Self(1);
#[doc(alias = "UIScreenReferenceDisplayModeStatusLimited")]
pub const Limited: Self = Self(2);
#[doc(alias = "UIScreenReferenceDisplayModeStatusEnabled")]
pub const Enabled: Self = Self(3);
}
unsafe impl Encode for UIScreenReferenceDisplayModeStatus {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIScreenReferenceDisplayModeStatus {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIScreen;
);
extern_conformance!(
unsafe impl NSObjectProtocol for UIScreen {}
);
#[cfg(feature = "UITraitCollection")]
extern_conformance!(
unsafe impl UITraitEnvironment for UIScreen {}
);
impl UIScreen {
extern_methods!(
#[deprecated = "Use UIApplication.shared.openSessions to find open sessions with scenes from other screens"]
#[unsafe(method(screens))]
#[unsafe(method_family = none)]
pub fn screens(mtm: MainThreadMarker) -> Retained<NSArray<UIScreen>>;
#[deprecated = "Use a UIScreen instance found through context instead (i.e, view.window.windowScene.screen), or for properties like UIScreen.scale with trait equivalents, use a traitCollection found through context."]
#[unsafe(method(mainScreen))]
#[unsafe(method_family = none)]
pub fn mainScreen(mtm: MainThreadMarker) -> Retained<UIScreen>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(bounds))]
#[unsafe(method_family = none)]
pub fn bounds(&self) -> CGRect;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(scale))]
#[unsafe(method_family = none)]
pub fn scale(&self) -> CGFloat;
#[cfg(feature = "UIScreenMode")]
#[unsafe(method(availableModes))]
#[unsafe(method_family = none)]
pub fn availableModes(&self) -> Retained<NSArray<UIScreenMode>>;
#[cfg(feature = "UIScreenMode")]
#[unsafe(method(preferredMode))]
#[unsafe(method_family = none)]
pub fn preferredMode(&self) -> Option<Retained<UIScreenMode>>;
#[cfg(feature = "UIScreenMode")]
#[unsafe(method(currentMode))]
#[unsafe(method_family = none)]
pub fn currentMode(&self) -> Option<Retained<UIScreenMode>>;
#[cfg(feature = "UIScreenMode")]
#[unsafe(method(setCurrentMode:))]
#[unsafe(method_family = none)]
pub fn setCurrentMode(&self, current_mode: Option<&UIScreenMode>);
#[unsafe(method(overscanCompensation))]
#[unsafe(method_family = none)]
pub fn overscanCompensation(&self) -> UIScreenOverscanCompensation;
#[unsafe(method(setOverscanCompensation:))]
#[unsafe(method_family = none)]
pub fn setOverscanCompensation(&self, overscan_compensation: UIScreenOverscanCompensation);
#[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
#[unsafe(method(overscanCompensationInsets))]
#[unsafe(method_family = none)]
pub fn overscanCompensationInsets(&self) -> UIEdgeInsets;
#[unsafe(method(mirroredScreen))]
#[unsafe(method_family = none)]
pub fn mirroredScreen(&self) -> Option<Retained<UIScreen>>;
#[deprecated = "Use the sceneCaptureState in UITraitCollection instead."]
#[unsafe(method(isCaptured))]
#[unsafe(method_family = none)]
pub fn isCaptured(&self) -> bool;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(brightness))]
#[unsafe(method_family = none)]
pub fn brightness(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setBrightness:))]
#[unsafe(method_family = none)]
pub fn setBrightness(&self, brightness: CGFloat);
#[unsafe(method(wantsSoftwareDimming))]
#[unsafe(method_family = none)]
pub fn wantsSoftwareDimming(&self) -> bool;
#[unsafe(method(setWantsSoftwareDimming:))]
#[unsafe(method_family = none)]
pub fn setWantsSoftwareDimming(&self, wants_software_dimming: bool);
#[cfg(feature = "UIView")]
#[unsafe(method(coordinateSpace))]
#[unsafe(method_family = none)]
pub fn coordinateSpace(&self) -> Retained<ProtocolObject<dyn UICoordinateSpace>>;
#[cfg(feature = "UIView")]
#[unsafe(method(fixedCoordinateSpace))]
#[unsafe(method_family = none)]
pub fn fixedCoordinateSpace(&self) -> Retained<ProtocolObject<dyn UICoordinateSpace>>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(nativeBounds))]
#[unsafe(method_family = none)]
pub fn nativeBounds(&self) -> CGRect;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(nativeScale))]
#[unsafe(method_family = none)]
pub fn nativeScale(&self) -> CGFloat;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
#[unsafe(method(displayLinkWithTarget:selector:))]
#[unsafe(method_family = none)]
pub unsafe fn displayLinkWithTarget_selector(
&self,
target: &AnyObject,
sel: Sel,
) -> Option<Retained<CADisplayLink>>;
#[unsafe(method(maximumFramesPerSecond))]
#[unsafe(method_family = none)]
pub fn maximumFramesPerSecond(&self) -> NSInteger;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(calibratedLatency))]
#[unsafe(method_family = none)]
pub fn calibratedLatency(&self) -> CFTimeInterval;
#[unsafe(method(referenceDisplayModeStatus))]
#[unsafe(method_family = none)]
pub fn referenceDisplayModeStatus(&self) -> UIScreenReferenceDisplayModeStatus;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(currentEDRHeadroom))]
#[unsafe(method_family = none)]
pub fn currentEDRHeadroom(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(potentialEDRHeadroom))]
#[unsafe(method_family = none)]
pub fn potentialEDRHeadroom(&self) -> CGFloat;
#[cfg(feature = "UIFocus")]
#[deprecated = "Use -[UIWindowScene focusSystem].focusedItem instead"]
#[unsafe(method(focusedItem))]
#[unsafe(method_family = none)]
pub fn focusedItem(&self) -> Option<Retained<ProtocolObject<dyn UIFocusItem>>>;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[deprecated = "Use -[UIWindowScene focusSystem].focusedItem instead"]
#[unsafe(method(focusedView))]
#[unsafe(method_family = none)]
pub fn focusedView(&self) -> Option<Retained<UIView>>;
#[deprecated = "Use -[UIWindowScene focusSystem] != nil instead"]
#[unsafe(method(supportsFocus))]
#[unsafe(method_family = none)]
pub fn supportsFocus(&self) -> bool;
#[cfg(feature = "objc2-core-foundation")]
#[deprecated]
#[unsafe(method(applicationFrame))]
#[unsafe(method_family = none)]
pub fn applicationFrame(&self) -> CGRect;
);
}
impl UIScreen {
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>;
);
}
impl UIScreen {
extern_methods!(
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[unsafe(method(snapshotViewAfterScreenUpdates:))]
#[unsafe(method_family = none)]
pub fn snapshotViewAfterScreenUpdates(&self, after_updates: bool) -> Retained<UIView>;
);
}