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