use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
#[cfg(target_vendor = "apple")]
use objc2_core_graphics::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(target_vendor = "apple")]
use objc2_quartz_core::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSScreen;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSScreen {}
);
impl NSScreen {
extern_methods!(
#[unsafe(method(screens))]
#[unsafe(method_family = none)]
pub fn screens(mtm: MainThreadMarker) -> Retained<NSArray<NSScreen>>;
#[unsafe(method(mainScreen))]
#[unsafe(method_family = none)]
pub fn mainScreen(mtm: MainThreadMarker) -> Option<Retained<NSScreen>>;
#[unsafe(method(deepestScreen))]
#[unsafe(method_family = none)]
pub fn deepestScreen(mtm: MainThreadMarker) -> Option<Retained<NSScreen>>;
#[unsafe(method(screensHaveSeparateSpaces))]
#[unsafe(method_family = none)]
pub fn screensHaveSeparateSpaces(mtm: MainThreadMarker) -> bool;
#[cfg(feature = "NSGraphics")]
#[unsafe(method(depth))]
#[unsafe(method_family = none)]
pub fn depth(&self) -> NSWindowDepth;
#[unsafe(method(frame))]
#[unsafe(method_family = none)]
pub fn frame(&self) -> NSRect;
#[unsafe(method(visibleFrame))]
#[unsafe(method_family = none)]
pub fn visibleFrame(&self) -> NSRect;
#[cfg(feature = "NSGraphics")]
#[unsafe(method(deviceDescription))]
#[unsafe(method_family = none)]
pub fn deviceDescription(
&self,
) -> Retained<NSDictionary<NSDeviceDescriptionKey, AnyObject>>;
#[cfg(feature = "NSColorSpace")]
#[unsafe(method(colorSpace))]
#[unsafe(method_family = none)]
pub fn colorSpace(&self) -> Option<Retained<NSColorSpace>>;
#[cfg(feature = "NSGraphics")]
#[unsafe(method(supportedWindowDepths))]
#[unsafe(method_family = none)]
pub fn supportedWindowDepths(&self) -> NonNull<NSWindowDepth>;
#[cfg(feature = "NSGraphics")]
#[unsafe(method(canRepresentDisplayGamut:))]
#[unsafe(method_family = none)]
pub fn canRepresentDisplayGamut(&self, display_gamut: NSDisplayGamut) -> bool;
#[unsafe(method(convertRectToBacking:))]
#[unsafe(method_family = none)]
pub fn convertRectToBacking(&self, rect: NSRect) -> NSRect;
#[unsafe(method(convertRectFromBacking:))]
#[unsafe(method_family = none)]
pub fn convertRectFromBacking(&self, rect: NSRect) -> NSRect;
#[unsafe(method(backingAlignedRect:options:))]
#[unsafe(method_family = none)]
pub fn backingAlignedRect_options(
&self,
rect: NSRect,
options: NSAlignmentOptions,
) -> NSRect;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(backingScaleFactor))]
#[unsafe(method_family = none)]
pub fn backingScaleFactor(&self) -> CGFloat;
#[unsafe(method(localizedName))]
#[unsafe(method_family = none)]
pub fn localizedName(&self) -> Retained<NSString>;
#[unsafe(method(safeAreaInsets))]
#[unsafe(method_family = none)]
pub fn safeAreaInsets(&self) -> NSEdgeInsets;
#[unsafe(method(auxiliaryTopLeftArea))]
#[unsafe(method_family = none)]
pub fn auxiliaryTopLeftArea(&self) -> NSRect;
#[unsafe(method(auxiliaryTopRightArea))]
#[unsafe(method_family = none)]
pub fn auxiliaryTopRightArea(&self) -> NSRect;
#[cfg(feature = "objc2-core-graphics")]
#[cfg(target_vendor = "apple")]
#[unsafe(method(CGDirectDisplayID))]
#[unsafe(method_family = none)]
pub fn CGDirectDisplayID(&self) -> CGDirectDisplayID;
);
}
impl NSScreen {
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>;
);
}
extern "C" {
pub static NSScreenColorSpaceDidChangeNotification: &'static NSNotificationName;
}
impl NSScreen {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(maximumExtendedDynamicRangeColorComponentValue))]
#[unsafe(method_family = none)]
pub fn maximumExtendedDynamicRangeColorComponentValue(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(maximumPotentialExtendedDynamicRangeColorComponentValue))]
#[unsafe(method_family = none)]
pub fn maximumPotentialExtendedDynamicRangeColorComponentValue(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(maximumReferenceExtendedDynamicRangeColorComponentValue))]
#[unsafe(method_family = none)]
pub fn maximumReferenceExtendedDynamicRangeColorComponentValue(&self) -> CGFloat;
);
}
impl NSScreen {
extern_methods!(
#[unsafe(method(maximumFramesPerSecond))]
#[unsafe(method_family = none)]
pub fn maximumFramesPerSecond(&self) -> NSInteger;
#[unsafe(method(minimumRefreshInterval))]
#[unsafe(method_family = none)]
pub fn minimumRefreshInterval(&self) -> NSTimeInterval;
#[unsafe(method(maximumRefreshInterval))]
#[unsafe(method_family = none)]
pub fn maximumRefreshInterval(&self) -> NSTimeInterval;
#[unsafe(method(displayUpdateGranularity))]
#[unsafe(method_family = none)]
pub fn displayUpdateGranularity(&self) -> NSTimeInterval;
#[unsafe(method(lastDisplayUpdateTimestamp))]
#[unsafe(method_family = none)]
pub fn lastDisplayUpdateTimestamp(&self) -> NSTimeInterval;
);
}
impl NSScreen {
extern_methods!(
#[cfg(feature = "objc2-quartz-core")]
#[cfg(target_vendor = "apple")]
#[unsafe(method(displayLinkWithTarget:selector:))]
#[unsafe(method_family = none)]
pub unsafe fn displayLinkWithTarget_selector(
&self,
target: &AnyObject,
selector: Sel,
) -> Retained<CADisplayLink>;
);
}
impl NSScreen {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[deprecated = "Use -convertRectToBacking: or -backingScaleFactor instead"]
#[unsafe(method(userSpaceScaleFactor))]
#[unsafe(method_family = none)]
pub fn userSpaceScaleFactor(&self) -> CGFloat;
);
}