objc2_app_kit/generated/
NSScreen.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7use objc2_foundation::*;
8#[cfg(feature = "objc2-quartz-core")]
9#[cfg(target_vendor = "apple")]
10use objc2_quartz_core::*;
11
12use crate::*;
13
14extern_class!(
15 #[unsafe(super(NSObject))]
17 #[thread_kind = MainThreadOnly]
18 #[derive(Debug, PartialEq, Eq, Hash)]
19 pub struct NSScreen;
20);
21
22unsafe impl NSObjectProtocol for NSScreen {}
23
24impl NSScreen {
25 extern_methods!(
26 #[unsafe(method(screens))]
27 #[unsafe(method_family = none)]
28 pub fn screens(mtm: MainThreadMarker) -> Retained<NSArray<NSScreen>>;
29
30 #[unsafe(method(mainScreen))]
31 #[unsafe(method_family = none)]
32 pub fn mainScreen(mtm: MainThreadMarker) -> Option<Retained<NSScreen>>;
33
34 #[unsafe(method(deepestScreen))]
35 #[unsafe(method_family = none)]
36 pub unsafe fn deepestScreen(mtm: MainThreadMarker) -> Option<Retained<NSScreen>>;
37
38 #[unsafe(method(screensHaveSeparateSpaces))]
39 #[unsafe(method_family = none)]
40 pub unsafe fn screensHaveSeparateSpaces(mtm: MainThreadMarker) -> bool;
41
42 #[cfg(feature = "NSGraphics")]
43 #[unsafe(method(depth))]
44 #[unsafe(method_family = none)]
45 pub unsafe fn depth(&self) -> NSWindowDepth;
46
47 #[unsafe(method(frame))]
48 #[unsafe(method_family = none)]
49 pub fn frame(&self) -> NSRect;
50
51 #[unsafe(method(visibleFrame))]
52 #[unsafe(method_family = none)]
53 pub fn visibleFrame(&self) -> NSRect;
54
55 #[cfg(feature = "NSGraphics")]
56 #[unsafe(method(deviceDescription))]
57 #[unsafe(method_family = none)]
58 pub fn deviceDescription(
59 &self,
60 ) -> Retained<NSDictionary<NSDeviceDescriptionKey, AnyObject>>;
61
62 #[cfg(feature = "NSColorSpace")]
63 #[unsafe(method(colorSpace))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn colorSpace(&self) -> Option<Retained<NSColorSpace>>;
66
67 #[cfg(feature = "NSGraphics")]
68 #[unsafe(method(supportedWindowDepths))]
69 #[unsafe(method_family = none)]
70 pub unsafe fn supportedWindowDepths(&self) -> NonNull<NSWindowDepth>;
71
72 #[cfg(feature = "NSGraphics")]
73 #[unsafe(method(canRepresentDisplayGamut:))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn canRepresentDisplayGamut(&self, display_gamut: NSDisplayGamut) -> bool;
76
77 #[unsafe(method(convertRectToBacking:))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn convertRectToBacking(&self, rect: NSRect) -> NSRect;
80
81 #[unsafe(method(convertRectFromBacking:))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn convertRectFromBacking(&self, rect: NSRect) -> NSRect;
84
85 #[unsafe(method(backingAlignedRect:options:))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn backingAlignedRect_options(
88 &self,
89 rect: NSRect,
90 options: NSAlignmentOptions,
91 ) -> NSRect;
92
93 #[cfg(feature = "objc2-core-foundation")]
94 #[unsafe(method(backingScaleFactor))]
95 #[unsafe(method_family = none)]
96 pub fn backingScaleFactor(&self) -> CGFloat;
97
98 #[unsafe(method(localizedName))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn localizedName(&self) -> Retained<NSString>;
101
102 #[unsafe(method(safeAreaInsets))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn safeAreaInsets(&self) -> NSEdgeInsets;
105
106 #[unsafe(method(auxiliaryTopLeftArea))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn auxiliaryTopLeftArea(&self) -> NSRect;
109
110 #[unsafe(method(auxiliaryTopRightArea))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn auxiliaryTopRightArea(&self) -> NSRect;
113 );
114}
115
116impl NSScreen {
118 extern_methods!(
119 #[unsafe(method(init))]
120 #[unsafe(method_family = init)]
121 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
122
123 #[unsafe(method(new))]
124 #[unsafe(method_family = new)]
125 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
126 );
127}
128
129extern "C" {
130 pub static NSScreenColorSpaceDidChangeNotification: &'static NSNotificationName;
132}
133
134impl NSScreen {
135 extern_methods!(
136 #[cfg(feature = "objc2-core-foundation")]
137 #[unsafe(method(maximumExtendedDynamicRangeColorComponentValue))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn maximumExtendedDynamicRangeColorComponentValue(&self) -> CGFloat;
140
141 #[cfg(feature = "objc2-core-foundation")]
142 #[unsafe(method(maximumPotentialExtendedDynamicRangeColorComponentValue))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn maximumPotentialExtendedDynamicRangeColorComponentValue(&self) -> CGFloat;
145
146 #[cfg(feature = "objc2-core-foundation")]
147 #[unsafe(method(maximumReferenceExtendedDynamicRangeColorComponentValue))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn maximumReferenceExtendedDynamicRangeColorComponentValue(&self) -> CGFloat;
150 );
151}
152
153impl NSScreen {
154 extern_methods!(
155 #[unsafe(method(maximumFramesPerSecond))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn maximumFramesPerSecond(&self) -> NSInteger;
159
160 #[unsafe(method(minimumRefreshInterval))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn minimumRefreshInterval(&self) -> NSTimeInterval;
167
168 #[unsafe(method(maximumRefreshInterval))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn maximumRefreshInterval(&self) -> NSTimeInterval;
174
175 #[unsafe(method(displayUpdateGranularity))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn displayUpdateGranularity(&self) -> NSTimeInterval;
181
182 #[unsafe(method(lastDisplayUpdateTimestamp))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn lastDisplayUpdateTimestamp(&self) -> NSTimeInterval;
186 );
187}
188
189impl NSScreen {
191 extern_methods!(
192 #[cfg(feature = "objc2-quartz-core")]
193 #[cfg(target_vendor = "apple")]
194 #[unsafe(method(displayLinkWithTarget:selector:))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn displayLinkWithTarget_selector(
197 &self,
198 target: &AnyObject,
199 selector: Sel,
200 ) -> Retained<CADisplayLink>;
201 );
202}
203
204impl NSScreen {
206 extern_methods!(
207 #[cfg(feature = "objc2-core-foundation")]
208 #[deprecated = "Use -convertRectToBacking: or -backingScaleFactor instead"]
209 #[unsafe(method(userSpaceScaleFactor))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn userSpaceScaleFactor(&self) -> CGFloat;
212 );
213}