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