objc2_ui_kit/generated/
UIScreen.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15extern "C" {
16 pub static UIScreenDidConnectNotification: &'static NSNotificationName;
18}
19
20extern "C" {
21 pub static UIScreenDidDisconnectNotification: &'static NSNotificationName;
23}
24
25extern "C" {
26 pub static UIScreenModeDidChangeNotification: &'static NSNotificationName;
28}
29
30extern "C" {
31 pub static UIScreenBrightnessDidChangeNotification: &'static NSNotificationName;
33}
34
35extern "C" {
36 pub static UIScreenCapturedDidChangeNotification: &'static NSNotificationName;
38}
39
40extern "C" {
41 pub static UIScreenReferenceDisplayModeStatusDidChangeNotification: &'static NSNotificationName;
43}
44
45#[repr(transparent)]
48#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
49pub struct UIScreenOverscanCompensation(pub NSInteger);
50impl UIScreenOverscanCompensation {
51 #[doc(alias = "UIScreenOverscanCompensationScale")]
52 pub const Scale: Self = Self(0);
53 #[doc(alias = "UIScreenOverscanCompensationInsetBounds")]
54 pub const InsetBounds: Self = Self(1);
55 #[doc(alias = "UIScreenOverscanCompensationNone")]
56 pub const None: Self = Self(2);
57 #[doc(alias = "UIScreenOverscanCompensationInsetApplicationFrame")]
58 #[deprecated]
59 pub const InsetApplicationFrame: Self = Self(2);
60}
61
62unsafe impl Encode for UIScreenOverscanCompensation {
63 const ENCODING: Encoding = NSInteger::ENCODING;
64}
65
66unsafe impl RefEncode for UIScreenOverscanCompensation {
67 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
68}
69
70#[repr(transparent)]
73#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
74pub struct UIScreenReferenceDisplayModeStatus(pub NSInteger);
75impl UIScreenReferenceDisplayModeStatus {
76 #[doc(alias = "UIScreenReferenceDisplayModeStatusNotSupported")]
77 pub const NotSupported: Self = Self(0);
78 #[doc(alias = "UIScreenReferenceDisplayModeStatusNotEnabled")]
79 pub const NotEnabled: Self = Self(1);
80 #[doc(alias = "UIScreenReferenceDisplayModeStatusLimited")]
81 pub const Limited: Self = Self(2);
82 #[doc(alias = "UIScreenReferenceDisplayModeStatusEnabled")]
83 pub const Enabled: Self = Self(3);
84}
85
86unsafe impl Encode for UIScreenReferenceDisplayModeStatus {
87 const ENCODING: Encoding = NSInteger::ENCODING;
88}
89
90unsafe impl RefEncode for UIScreenReferenceDisplayModeStatus {
91 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
92}
93
94extern_class!(
95 #[unsafe(super(NSObject))]
97 #[thread_kind = MainThreadOnly]
98 #[derive(Debug, PartialEq, Eq, Hash)]
99 pub struct UIScreen;
100);
101
102extern_conformance!(
103 unsafe impl NSObjectProtocol for UIScreen {}
104);
105
106#[cfg(feature = "UITraitCollection")]
107extern_conformance!(
108 unsafe impl UITraitEnvironment for UIScreen {}
109);
110
111impl UIScreen {
112 extern_methods!(
113 #[deprecated = "Use UIApplication.shared.openSessions to find open sessions with scenes from other screens"]
114 #[unsafe(method(screens))]
115 #[unsafe(method_family = none)]
116 pub fn screens(mtm: MainThreadMarker) -> Retained<NSArray<UIScreen>>;
117
118 #[deprecated = "Use a UIScreen instance found through context instead: i.e, view.window.windowScene.screen"]
119 #[unsafe(method(mainScreen))]
120 #[unsafe(method_family = none)]
121 pub fn mainScreen(mtm: MainThreadMarker) -> Retained<UIScreen>;
122
123 #[cfg(feature = "objc2-core-foundation")]
124 #[unsafe(method(bounds))]
125 #[unsafe(method_family = none)]
126 pub fn bounds(&self) -> CGRect;
127
128 #[cfg(feature = "objc2-core-foundation")]
129 #[unsafe(method(scale))]
130 #[unsafe(method_family = none)]
131 pub fn scale(&self) -> CGFloat;
132
133 #[cfg(feature = "UIScreenMode")]
134 #[unsafe(method(availableModes))]
135 #[unsafe(method_family = none)]
136 pub fn availableModes(&self) -> Retained<NSArray<UIScreenMode>>;
137
138 #[cfg(feature = "UIScreenMode")]
139 #[unsafe(method(preferredMode))]
140 #[unsafe(method_family = none)]
141 pub fn preferredMode(&self) -> Option<Retained<UIScreenMode>>;
142
143 #[cfg(feature = "UIScreenMode")]
144 #[unsafe(method(currentMode))]
145 #[unsafe(method_family = none)]
146 pub fn currentMode(&self) -> Option<Retained<UIScreenMode>>;
147
148 #[cfg(feature = "UIScreenMode")]
149 #[unsafe(method(setCurrentMode:))]
151 #[unsafe(method_family = none)]
152 pub fn setCurrentMode(&self, current_mode: Option<&UIScreenMode>);
153
154 #[unsafe(method(overscanCompensation))]
155 #[unsafe(method_family = none)]
156 pub fn overscanCompensation(&self) -> UIScreenOverscanCompensation;
157
158 #[unsafe(method(setOverscanCompensation:))]
160 #[unsafe(method_family = none)]
161 pub fn setOverscanCompensation(&self, overscan_compensation: UIScreenOverscanCompensation);
162
163 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
164 #[unsafe(method(overscanCompensationInsets))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn overscanCompensationInsets(&self) -> UIEdgeInsets;
167
168 #[unsafe(method(mirroredScreen))]
169 #[unsafe(method_family = none)]
170 pub fn mirroredScreen(&self) -> Option<Retained<UIScreen>>;
171
172 #[deprecated = "Use the sceneCaptureState in UITraitCollection instead."]
173 #[unsafe(method(isCaptured))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn isCaptured(&self) -> bool;
176
177 #[cfg(feature = "objc2-core-foundation")]
178 #[unsafe(method(brightness))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn brightness(&self) -> CGFloat;
181
182 #[cfg(feature = "objc2-core-foundation")]
183 #[unsafe(method(setBrightness:))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn setBrightness(&self, brightness: CGFloat);
187
188 #[unsafe(method(wantsSoftwareDimming))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn wantsSoftwareDimming(&self) -> bool;
191
192 #[unsafe(method(setWantsSoftwareDimming:))]
194 #[unsafe(method_family = none)]
195 pub unsafe fn setWantsSoftwareDimming(&self, wants_software_dimming: bool);
196
197 #[cfg(feature = "UIView")]
198 #[unsafe(method(coordinateSpace))]
199 #[unsafe(method_family = none)]
200 pub fn coordinateSpace(&self) -> Retained<ProtocolObject<dyn UICoordinateSpace>>;
201
202 #[cfg(feature = "UIView")]
203 #[unsafe(method(fixedCoordinateSpace))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn fixedCoordinateSpace(
206 &self,
207 ) -> Retained<ProtocolObject<dyn UICoordinateSpace>>;
208
209 #[cfg(feature = "objc2-core-foundation")]
210 #[unsafe(method(nativeBounds))]
211 #[unsafe(method_family = none)]
212 pub fn nativeBounds(&self) -> CGRect;
213
214 #[cfg(feature = "objc2-core-foundation")]
215 #[unsafe(method(nativeScale))]
216 #[unsafe(method_family = none)]
217 pub fn nativeScale(&self) -> CGFloat;
218
219 #[cfg(feature = "objc2-quartz-core")]
220 #[cfg(not(target_os = "watchos"))]
221 #[unsafe(method(displayLinkWithTarget:selector:))]
222 #[unsafe(method_family = none)]
223 pub unsafe fn displayLinkWithTarget_selector(
224 &self,
225 target: &AnyObject,
226 sel: Sel,
227 ) -> Option<Retained<CADisplayLink>>;
228
229 #[unsafe(method(maximumFramesPerSecond))]
230 #[unsafe(method_family = none)]
231 pub fn maximumFramesPerSecond(&self) -> NSInteger;
232
233 #[cfg(feature = "objc2-core-foundation")]
234 #[unsafe(method(calibratedLatency))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn calibratedLatency(&self) -> CFTimeInterval;
237
238 #[unsafe(method(referenceDisplayModeStatus))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn referenceDisplayModeStatus(&self) -> UIScreenReferenceDisplayModeStatus;
241
242 #[cfg(feature = "objc2-core-foundation")]
243 #[unsafe(method(currentEDRHeadroom))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn currentEDRHeadroom(&self) -> CGFloat;
246
247 #[cfg(feature = "objc2-core-foundation")]
248 #[unsafe(method(potentialEDRHeadroom))]
249 #[unsafe(method_family = none)]
250 pub unsafe fn potentialEDRHeadroom(&self) -> CGFloat;
251
252 #[cfg(feature = "UIFocus")]
253 #[deprecated = "Use -[UIWindowScene focusSystem].focusedItem instead"]
254 #[unsafe(method(focusedItem))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn focusedItem(&self) -> Option<Retained<ProtocolObject<dyn UIFocusItem>>>;
257
258 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
259 #[deprecated = "Use -[UIWindowScene focusSystem].focusedItem instead"]
260 #[unsafe(method(focusedView))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn focusedView(&self) -> Option<Retained<UIView>>;
263
264 #[deprecated = "Use -[UIWindowScene focusSystem] != nil instead"]
265 #[unsafe(method(supportsFocus))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn supportsFocus(&self) -> bool;
268
269 #[cfg(feature = "objc2-core-foundation")]
270 #[deprecated]
271 #[unsafe(method(applicationFrame))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn applicationFrame(&self) -> CGRect;
274 );
275}
276
277impl UIScreen {
279 extern_methods!(
280 #[unsafe(method(init))]
281 #[unsafe(method_family = init)]
282 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
283
284 #[unsafe(method(new))]
285 #[unsafe(method_family = new)]
286 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
287 );
288}
289
290impl UIScreen {
292 extern_methods!(
293 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
294 #[unsafe(method(snapshotViewAfterScreenUpdates:))]
295 #[unsafe(method_family = none)]
296 pub unsafe fn snapshotViewAfterScreenUpdates(
297 &self,
298 after_updates: bool,
299 ) -> Retained<UIView>;
300 );
301}