objc2_ui_kit/generated/
UIWindowScene.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-cloud-kit")]
7use objc2_cloud_kit::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowscene?language=objc)
14    #[unsafe(super(UIScene, UIResponder, NSObject))]
15    #[thread_kind = MainThreadOnly]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[cfg(all(feature = "UIResponder", feature = "UIScene"))]
18    pub struct UIWindowScene;
19);
20
21#[cfg(all(feature = "UIResponder", feature = "UIScene"))]
22extern_conformance!(
23    unsafe impl NSObjectProtocol for UIWindowScene {}
24);
25
26#[cfg(all(feature = "UIResponder", feature = "UIScene"))]
27extern_conformance!(
28    unsafe impl UIResponderStandardEditActions for UIWindowScene {}
29);
30
31#[cfg(all(feature = "UIResponder", feature = "UIScene"))]
32impl UIWindowScene {
33    extern_methods!(
34        #[cfg(feature = "UIScreen")]
35        #[unsafe(method(screen))]
36        #[unsafe(method_family = none)]
37        pub fn screen(&self) -> Retained<UIScreen>;
38
39        #[cfg(feature = "UIOrientation")]
40        #[deprecated = "Use effectiveGeometry.interfaceOrientation instead."]
41        #[unsafe(method(interfaceOrientation))]
42        #[unsafe(method_family = none)]
43        pub fn interfaceOrientation(&self) -> UIInterfaceOrientation;
44
45        #[cfg(feature = "UIView")]
46        #[deprecated = "Use effectiveGeometry.coordinateSpace instead."]
47        #[unsafe(method(coordinateSpace))]
48        #[unsafe(method_family = none)]
49        pub fn coordinateSpace(&self) -> Retained<ProtocolObject<dyn UICoordinateSpace>>;
50
51        #[cfg(feature = "UITraitCollection")]
52        #[unsafe(method(traitCollection))]
53        #[unsafe(method_family = none)]
54        pub fn traitCollection(&self) -> Retained<UITraitCollection>;
55
56        #[cfg(all(feature = "UIWindowSceneGeometryPreferences", feature = "block2"))]
57        #[unsafe(method(requestGeometryUpdateWithPreferences:errorHandler:))]
58        #[unsafe(method_family = none)]
59        pub fn requestGeometryUpdateWithPreferences_errorHandler(
60            &self,
61            geometry_preferences: &UIWindowSceneGeometryPreferences,
62            error_handler: Option<&block2::DynBlock<dyn Fn(NonNull<NSError>)>>,
63        );
64
65        #[cfg(feature = "UIWindowSceneGeometry")]
66        #[unsafe(method(effectiveGeometry))]
67        #[unsafe(method_family = none)]
68        pub fn effectiveGeometry(&self) -> Retained<UIWindowSceneGeometry>;
69
70        #[cfg(feature = "UISceneSizeRestrictions")]
71        /// Preferences the system should evaluate when resizing the scene. If non `nil`, returns a mutable instance that the client may customize.
72        /// - Note: This property will be `nil` on platforms that don't support scene resizing.
73        #[unsafe(method(sizeRestrictions))]
74        #[unsafe(method_family = none)]
75        pub fn sizeRestrictions(&self) -> Option<Retained<UISceneSizeRestrictions>>;
76
77        #[cfg(all(feature = "UIView", feature = "UIWindow"))]
78        #[unsafe(method(windows))]
79        #[unsafe(method_family = none)]
80        pub fn windows(&self) -> Retained<NSArray<UIWindow>>;
81
82        #[cfg(all(feature = "UIView", feature = "UIWindow"))]
83        #[unsafe(method(keyWindow))]
84        #[unsafe(method_family = none)]
85        pub fn keyWindow(&self) -> Option<Retained<UIWindow>>;
86
87        #[cfg(feature = "UIActivityItemsConfigurationReading")]
88        /// An optional object used as a source of scene-level activity items configuration
89        ///
90        /// If this property returns
91        /// `nil,`the
92        /// `activityItemsConfiguration`property of the most-presented view controller
93        /// of the scene's key window will be used for scene-level sharing and activities.
94        #[unsafe(method(activityItemsConfigurationSource))]
95        #[unsafe(method_family = none)]
96        pub fn activityItemsConfigurationSource(
97            &self,
98        ) -> Option<Retained<ProtocolObject<dyn UIActivityItemsConfigurationProviding>>>;
99
100        #[cfg(feature = "UIActivityItemsConfigurationReading")]
101        /// Setter for [`activityItemsConfigurationSource`][Self::activityItemsConfigurationSource].
102        ///
103        /// This is a [weak property][objc2::topics::weak_property].
104        #[unsafe(method(setActivityItemsConfigurationSource:))]
105        #[unsafe(method_family = none)]
106        pub fn setActivityItemsConfigurationSource(
107            &self,
108            activity_items_configuration_source: Option<
109                &ProtocolObject<dyn UIActivityItemsConfigurationProviding>,
110            >,
111        );
112
113        #[cfg(feature = "UISceneWindowingBehaviors")]
114        /// Additional window behaviors which may be platform specific. This property will be nil on unsupported platforms, otherwise will provide a mutable object for window behavior customization.
115        #[unsafe(method(windowingBehaviors))]
116        #[unsafe(method_family = none)]
117        pub fn windowingBehaviors(&self) -> Option<Retained<UISceneWindowingBehaviors>>;
118
119        #[unsafe(method(isFullScreen))]
120        #[unsafe(method_family = none)]
121        pub fn isFullScreen(&self) -> bool;
122    );
123}
124
125/// Methods declared on superclass `UIScene`.
126#[cfg(all(feature = "UIResponder", feature = "UIScene"))]
127impl UIWindowScene {
128    extern_methods!(
129        #[unsafe(method(new))]
130        #[unsafe(method_family = new)]
131        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
132
133        #[unsafe(method(init))]
134        #[unsafe(method_family = init)]
135        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
136
137        #[cfg(all(feature = "UISceneOptions", feature = "UISceneSession"))]
138        #[unsafe(method(initWithSession:connectionOptions:))]
139        #[unsafe(method_family = init)]
140        pub fn initWithSession_connectionOptions(
141            this: Allocated<Self>,
142            session: &UISceneSession,
143            connection_options: &UISceneConnectionOptions,
144        ) -> Retained<Self>;
145    );
146}
147
148#[cfg(all(feature = "UIResponder", feature = "UIScene"))]
149impl UIWindowScene {
150    extern_methods!(
151        #[cfg(feature = "UITraitCollection")]
152        #[unsafe(method(traitOverrides))]
153        #[unsafe(method_family = none)]
154        pub fn traitOverrides(&self) -> Retained<ProtocolObject<dyn UITraitOverrides>>;
155    );
156}
157
158#[cfg(all(
159    feature = "UIResponder",
160    feature = "UIScene",
161    feature = "UITraitCollection"
162))]
163extern_conformance!(
164    unsafe impl UITraitChangeObservable for UIWindowScene {}
165);
166
167#[cfg(all(
168    feature = "UIResponder",
169    feature = "UIScene",
170    feature = "UITraitCollection"
171))]
172extern_conformance!(
173    unsafe impl UITraitEnvironment for UIWindowScene {}
174);
175
176extern_protocol!(
177    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowscenedelegate?language=objc)
178    #[cfg(feature = "UIScene")]
179    pub unsafe trait UIWindowSceneDelegate: UISceneDelegate + MainThreadOnly {
180        #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
181        #[optional]
182        #[unsafe(method(window))]
183        #[unsafe(method_family = none)]
184        fn window(&self) -> Option<Retained<UIWindow>>;
185
186        #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
187        /// Setter for [`window`][Self::window].
188        #[optional]
189        #[unsafe(method(setWindow:))]
190        #[unsafe(method_family = none)]
191        fn setWindow(&self, window: Option<&UIWindow>);
192
193        #[cfg(all(
194            feature = "UIOrientation",
195            feature = "UIResponder",
196            feature = "UITraitCollection",
197            feature = "UIView"
198        ))]
199        /// Called when the coordinate space, interface orientation, or trait collection of a `UIWindowScene` changes.
200        ///
201        /// Always called when a UIWindowScene moves between screens.
202        #[deprecated = "Use windowScene(_: didUpdateEffectiveGeometry:) to be notified of the scene's geometry changes, or use traits whose values are inherited from the scene via the traitCollection of views and view controllers instead."]
203        #[optional]
204        #[unsafe(method(windowScene:didUpdateCoordinateSpace:interfaceOrientation:traitCollection:))]
205        #[unsafe(method_family = none)]
206        fn windowScene_didUpdateCoordinateSpace_interfaceOrientation_traitCollection(
207            &self,
208            window_scene: &UIWindowScene,
209            previous_coordinate_space: &ProtocolObject<dyn UICoordinateSpace>,
210            previous_interface_orientation: UIInterfaceOrientation,
211            previous_trait_collection: &UITraitCollection,
212        );
213
214        #[cfg(all(feature = "UIResponder", feature = "UIWindowSceneGeometry"))]
215        /// Called when the window scene's effective geometry has changed.
216        ///
217        /// Always called when a `UIWindowScene` moves between screens.
218        #[optional]
219        #[unsafe(method(windowScene:didUpdateEffectiveGeometry:))]
220        #[unsafe(method_family = none)]
221        fn windowScene_didUpdateEffectiveGeometry(
222            &self,
223            window_scene: &UIWindowScene,
224            previous_effective_geometry: &UIWindowSceneGeometry,
225        );
226
227        #[cfg(all(
228            feature = "UIApplicationShortcutItem",
229            feature = "UIResponder",
230            feature = "block2"
231        ))]
232        #[optional]
233        #[unsafe(method(windowScene:performActionForShortcutItem:completionHandler:))]
234        #[unsafe(method_family = none)]
235        fn windowScene_performActionForShortcutItem_completionHandler(
236            &self,
237            window_scene: &UIWindowScene,
238            shortcut_item: &UIApplicationShortcutItem,
239            completion_handler: &block2::DynBlock<dyn Fn(Bool)>,
240        );
241
242        #[cfg(all(feature = "UIResponder", feature = "objc2-cloud-kit"))]
243        #[optional]
244        #[unsafe(method(windowScene:userDidAcceptCloudKitShareWithMetadata:))]
245        #[unsafe(method_family = none)]
246        fn windowScene_userDidAcceptCloudKitShareWithMetadata(
247            &self,
248            window_scene: &UIWindowScene,
249            cloud_kit_share_metadata: &CKShareMetadata,
250        );
251
252        #[cfg(all(feature = "UIResponder", feature = "UISceneWindowingControlStyle"))]
253        /// Called by the system to determine the windowing control style for the provided scene.
254        /// `automaticStyle` will be used if this method is not implemented.
255        #[optional]
256        #[unsafe(method(preferredWindowingControlStyleForScene:))]
257        #[unsafe(method_family = none)]
258        fn preferredWindowingControlStyleForScene(
259            &self,
260            window_scene: &UIWindowScene,
261        ) -> Retained<UISceneWindowingControlStyle>;
262    }
263);
264
265extern "C" {
266    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowscenesessionroleapplication?language=objc)
267    #[cfg(feature = "UISceneDefinitions")]
268    pub static UIWindowSceneSessionRoleApplication: &'static UISceneSessionRole;
269}
270
271extern "C" {
272    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowscenesessionroleexternaldisplaynoninteractive?language=objc)
273    #[cfg(feature = "UISceneDefinitions")]
274    pub static UIWindowSceneSessionRoleExternalDisplayNonInteractive: &'static UISceneSessionRole;
275}
276
277extern "C" {
278    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowscenesessionroleexternaldisplay?language=objc)
279    #[cfg(feature = "UISceneDefinitions")]
280    #[deprecated]
281    pub static UIWindowSceneSessionRoleExternalDisplay: &'static UISceneSessionRole;
282}
283
284extern "C" {
285    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowscenesessionrolevolumetricapplication?language=objc)
286    #[cfg(feature = "UISceneDefinitions")]
287    pub static UIWindowSceneSessionRoleVolumetricApplication: &'static UISceneSessionRole;
288}
289
290extern "C" {
291    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowscenesessionroleassistiveaccessapplication?language=objc)
292    #[cfg(feature = "UISceneDefinitions")]
293    pub static UIWindowSceneSessionRoleAssistiveAccessApplication: &'static UISceneSessionRole;
294}
295
296/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowscenedismissalanimation?language=objc)
297// NS_ENUM
298#[repr(transparent)]
299#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
300pub struct UIWindowSceneDismissalAnimation(pub NSInteger);
301impl UIWindowSceneDismissalAnimation {
302    #[doc(alias = "UIWindowSceneDismissalAnimationStandard")]
303    pub const Standard: Self = Self(1);
304    #[doc(alias = "UIWindowSceneDismissalAnimationCommit")]
305    pub const Commit: Self = Self(2);
306    #[doc(alias = "UIWindowSceneDismissalAnimationDecline")]
307    pub const Decline: Self = Self(3);
308}
309
310unsafe impl Encode for UIWindowSceneDismissalAnimation {
311    const ENCODING: Encoding = NSInteger::ENCODING;
312}
313
314unsafe impl RefEncode for UIWindowSceneDismissalAnimation {
315    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
316}
317
318extern_class!(
319    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowscenedestructionrequestoptions?language=objc)
320    #[unsafe(super(UISceneDestructionRequestOptions, NSObject))]
321    #[thread_kind = MainThreadOnly]
322    #[derive(Debug, PartialEq, Eq, Hash)]
323    #[cfg(feature = "UISceneOptions")]
324    pub struct UIWindowSceneDestructionRequestOptions;
325);
326
327#[cfg(feature = "UISceneOptions")]
328extern_conformance!(
329    unsafe impl NSObjectProtocol for UIWindowSceneDestructionRequestOptions {}
330);
331
332#[cfg(feature = "UISceneOptions")]
333impl UIWindowSceneDestructionRequestOptions {
334    extern_methods!(
335        #[unsafe(method(windowDismissalAnimation))]
336        #[unsafe(method_family = none)]
337        pub fn windowDismissalAnimation(&self) -> UIWindowSceneDismissalAnimation;
338
339        /// Setter for [`windowDismissalAnimation`][Self::windowDismissalAnimation].
340        #[unsafe(method(setWindowDismissalAnimation:))]
341        #[unsafe(method_family = none)]
342        pub fn setWindowDismissalAnimation(
343            &self,
344            window_dismissal_animation: UIWindowSceneDismissalAnimation,
345        );
346    );
347}
348
349/// Methods declared on superclass `NSObject`.
350#[cfg(feature = "UISceneOptions")]
351impl UIWindowSceneDestructionRequestOptions {
352    extern_methods!(
353        #[unsafe(method(init))]
354        #[unsafe(method_family = init)]
355        pub fn init(this: Allocated<Self>) -> Retained<Self>;
356
357        #[unsafe(method(new))]
358        #[unsafe(method_family = new)]
359        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
360    );
361}