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 #[deprecated = "Use UISceneDelegate or related notifications to be informed of connecting scenes from other screens"]
18 pub static UIScreenDidConnectNotification: &'static NSNotificationName;
19}
20
21extern "C" {
22 #[deprecated = "Use UISceneDelegate or related notifications to be informed of disconnecting scenes from other screens"]
24 pub static UIScreenDidDisconnectNotification: &'static NSNotificationName;
25}
26
27extern "C" {
28 pub static UIScreenModeDidChangeNotification: &'static NSNotificationName;
30}
31
32extern "C" {
33 pub static UIScreenBrightnessDidChangeNotification: &'static NSNotificationName;
35}
36
37extern "C" {
38 pub static UIScreenCapturedDidChangeNotification: &'static NSNotificationName;
40}
41
42extern "C" {
43 pub static UIScreenReferenceDisplayModeStatusDidChangeNotification: &'static NSNotificationName;
45}
46
47#[repr(transparent)]
50#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
51pub struct UIScreenOverscanCompensation(pub NSInteger);
52impl UIScreenOverscanCompensation {
53 #[doc(alias = "UIScreenOverscanCompensationScale")]
54 pub const Scale: Self = Self(0);
55 #[doc(alias = "UIScreenOverscanCompensationInsetBounds")]
56 pub const InsetBounds: Self = Self(1);
57 #[doc(alias = "UIScreenOverscanCompensationNone")]
58 pub const None: Self = Self(2);
59 #[doc(alias = "UIScreenOverscanCompensationInsetApplicationFrame")]
60 #[deprecated]
61 pub const InsetApplicationFrame: Self = Self(2);
62}
63
64unsafe impl Encode for UIScreenOverscanCompensation {
65 const ENCODING: Encoding = NSInteger::ENCODING;
66}
67
68unsafe impl RefEncode for UIScreenOverscanCompensation {
69 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
70}
71
72#[repr(transparent)]
75#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
76pub struct UIScreenReferenceDisplayModeStatus(pub NSInteger);
77impl UIScreenReferenceDisplayModeStatus {
78 #[doc(alias = "UIScreenReferenceDisplayModeStatusNotSupported")]
79 pub const NotSupported: Self = Self(0);
80 #[doc(alias = "UIScreenReferenceDisplayModeStatusNotEnabled")]
81 pub const NotEnabled: Self = Self(1);
82 #[doc(alias = "UIScreenReferenceDisplayModeStatusLimited")]
83 pub const Limited: Self = Self(2);
84 #[doc(alias = "UIScreenReferenceDisplayModeStatusEnabled")]
85 pub const Enabled: Self = Self(3);
86}
87
88unsafe impl Encode for UIScreenReferenceDisplayModeStatus {
89 const ENCODING: Encoding = NSInteger::ENCODING;
90}
91
92unsafe impl RefEncode for UIScreenReferenceDisplayModeStatus {
93 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
94}
95
96extern_class!(
97 #[unsafe(super(NSObject))]
99 #[thread_kind = MainThreadOnly]
100 #[derive(Debug, PartialEq, Eq, Hash)]
101 pub struct UIScreen;
102);
103
104extern_conformance!(
105 unsafe impl NSObjectProtocol for UIScreen {}
106);
107
108#[cfg(feature = "UITraitCollection")]
109extern_conformance!(
110 unsafe impl UITraitEnvironment for UIScreen {}
111);
112
113impl UIScreen {
114 extern_methods!(
115 #[deprecated = "Use UIApplication.shared.openSessions to find open sessions with scenes from other screens"]
116 #[unsafe(method(screens))]
117 #[unsafe(method_family = none)]
118 pub fn screens(mtm: MainThreadMarker) -> Retained<NSArray<UIScreen>>;
119
120 #[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."]
121 #[unsafe(method(mainScreen))]
122 #[unsafe(method_family = none)]
123 pub fn mainScreen(mtm: MainThreadMarker) -> Retained<UIScreen>;
124
125 #[cfg(feature = "objc2-core-foundation")]
126 #[unsafe(method(bounds))]
127 #[unsafe(method_family = none)]
128 pub fn bounds(&self) -> CGRect;
129
130 #[cfg(feature = "objc2-core-foundation")]
131 #[unsafe(method(scale))]
132 #[unsafe(method_family = none)]
133 pub fn scale(&self) -> CGFloat;
134
135 #[cfg(feature = "UIScreenMode")]
136 #[unsafe(method(availableModes))]
137 #[unsafe(method_family = none)]
138 pub fn availableModes(&self) -> Retained<NSArray<UIScreenMode>>;
139
140 #[cfg(feature = "UIScreenMode")]
141 #[unsafe(method(preferredMode))]
142 #[unsafe(method_family = none)]
143 pub fn preferredMode(&self) -> Option<Retained<UIScreenMode>>;
144
145 #[cfg(feature = "UIScreenMode")]
146 #[unsafe(method(currentMode))]
147 #[unsafe(method_family = none)]
148 pub fn currentMode(&self) -> Option<Retained<UIScreenMode>>;
149
150 #[cfg(feature = "UIScreenMode")]
151 #[unsafe(method(setCurrentMode:))]
153 #[unsafe(method_family = none)]
154 pub fn setCurrentMode(&self, current_mode: Option<&UIScreenMode>);
155
156 #[unsafe(method(overscanCompensation))]
157 #[unsafe(method_family = none)]
158 pub fn overscanCompensation(&self) -> UIScreenOverscanCompensation;
159
160 #[unsafe(method(setOverscanCompensation:))]
162 #[unsafe(method_family = none)]
163 pub fn setOverscanCompensation(&self, overscan_compensation: UIScreenOverscanCompensation);
164
165 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
166 #[unsafe(method(overscanCompensationInsets))]
167 #[unsafe(method_family = none)]
168 pub fn overscanCompensationInsets(&self) -> UIEdgeInsets;
169
170 #[unsafe(method(mirroredScreen))]
171 #[unsafe(method_family = none)]
172 pub fn mirroredScreen(&self) -> Option<Retained<UIScreen>>;
173
174 #[deprecated = "Use the sceneCaptureState in UITraitCollection instead."]
175 #[unsafe(method(isCaptured))]
176 #[unsafe(method_family = none)]
177 pub fn isCaptured(&self) -> bool;
178
179 #[cfg(feature = "objc2-core-foundation")]
180 #[unsafe(method(brightness))]
181 #[unsafe(method_family = none)]
182 pub fn brightness(&self) -> CGFloat;
183
184 #[cfg(feature = "objc2-core-foundation")]
185 #[unsafe(method(setBrightness:))]
187 #[unsafe(method_family = none)]
188 pub fn setBrightness(&self, brightness: CGFloat);
189
190 #[unsafe(method(wantsSoftwareDimming))]
191 #[unsafe(method_family = none)]
192 pub fn wantsSoftwareDimming(&self) -> bool;
193
194 #[unsafe(method(setWantsSoftwareDimming:))]
196 #[unsafe(method_family = none)]
197 pub fn setWantsSoftwareDimming(&self, wants_software_dimming: bool);
198
199 #[cfg(feature = "UIView")]
200 #[unsafe(method(coordinateSpace))]
201 #[unsafe(method_family = none)]
202 pub fn coordinateSpace(&self) -> Retained<ProtocolObject<dyn UICoordinateSpace>>;
203
204 #[cfg(feature = "UIView")]
205 #[unsafe(method(fixedCoordinateSpace))]
206 #[unsafe(method_family = none)]
207 pub fn fixedCoordinateSpace(&self) -> 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:))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn displayLinkWithTarget_selector(
228 &self,
229 target: &AnyObject,
230 sel: Sel,
231 ) -> Option<Retained<CADisplayLink>>;
232
233 #[unsafe(method(maximumFramesPerSecond))]
234 #[unsafe(method_family = none)]
235 pub fn maximumFramesPerSecond(&self) -> NSInteger;
236
237 #[cfg(feature = "objc2-core-foundation")]
238 #[unsafe(method(calibratedLatency))]
239 #[unsafe(method_family = none)]
240 pub fn calibratedLatency(&self) -> CFTimeInterval;
241
242 #[unsafe(method(referenceDisplayModeStatus))]
243 #[unsafe(method_family = none)]
244 pub fn referenceDisplayModeStatus(&self) -> UIScreenReferenceDisplayModeStatus;
245
246 #[cfg(feature = "objc2-core-foundation")]
247 #[unsafe(method(currentEDRHeadroom))]
248 #[unsafe(method_family = none)]
249 pub fn currentEDRHeadroom(&self) -> CGFloat;
250
251 #[cfg(feature = "objc2-core-foundation")]
252 #[unsafe(method(potentialEDRHeadroom))]
253 #[unsafe(method_family = none)]
254 pub fn potentialEDRHeadroom(&self) -> CGFloat;
255
256 #[cfg(feature = "UIFocus")]
257 #[deprecated = "Use -[UIWindowScene focusSystem].focusedItem instead"]
258 #[unsafe(method(focusedItem))]
259 #[unsafe(method_family = none)]
260 pub fn focusedItem(&self) -> Option<Retained<ProtocolObject<dyn UIFocusItem>>>;
261
262 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
263 #[deprecated = "Use -[UIWindowScene focusSystem].focusedItem instead"]
264 #[unsafe(method(focusedView))]
265 #[unsafe(method_family = none)]
266 pub fn focusedView(&self) -> Option<Retained<UIView>>;
267
268 #[deprecated = "Use -[UIWindowScene focusSystem] != nil instead"]
269 #[unsafe(method(supportsFocus))]
270 #[unsafe(method_family = none)]
271 pub fn supportsFocus(&self) -> bool;
272
273 #[cfg(feature = "objc2-core-foundation")]
274 #[deprecated]
275 #[unsafe(method(applicationFrame))]
276 #[unsafe(method_family = none)]
277 pub fn applicationFrame(&self) -> CGRect;
278 );
279}
280
281impl UIScreen {
283 extern_methods!(
284 #[unsafe(method(init))]
285 #[unsafe(method_family = init)]
286 pub fn init(this: Allocated<Self>) -> Retained<Self>;
287
288 #[unsafe(method(new))]
289 #[unsafe(method_family = new)]
290 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
291 );
292}
293
294impl UIScreen {
296 extern_methods!(
297 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
298 #[unsafe(method(snapshotViewAfterScreenUpdates:))]
299 #[unsafe(method_family = none)]
300 pub fn snapshotViewAfterScreenUpdates(&self, after_updates: bool) -> Retained<UIView>;
301 );
302}