objc2_ui_kit/generated/
UIWindowSceneActivationAction.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// Return a
11/// `UIWindowSceneActivationConfiguration`
12///
13/// Parameter `action`: The
14/// `UIWindowSceneActivationAction`requesting a configuration.
15///
16/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowsceneactivationactionconfigurationprovider?language=objc)
17#[cfg(all(
18    feature = "UIAction",
19    feature = "UIMenuElement",
20    feature = "UIWindowSceneActivationConfiguration",
21    feature = "block2"
22))]
23pub type UIWindowSceneActivationActionConfigurationProvider = *mut block2::DynBlock<
24    dyn Fn(NonNull<UIWindowSceneActivationAction>) -> *mut UIWindowSceneActivationConfiguration,
25>;
26
27extern_class!(
28    /// An action that facilitates activating a
29    /// `UIWindowScene`when performed.
30    ///
31    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowsceneactivationaction?language=objc)
32    #[unsafe(super(UIAction, UIMenuElement, NSObject))]
33    #[derive(Debug, PartialEq, Eq, Hash)]
34    #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
35    pub struct UIWindowSceneActivationAction;
36);
37
38#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
39extern_conformance!(
40    unsafe impl NSCoding for UIWindowSceneActivationAction {}
41);
42
43#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
44extern_conformance!(
45    unsafe impl NSCopying for UIWindowSceneActivationAction {}
46);
47
48#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
49unsafe impl CopyingHelper for UIWindowSceneActivationAction {
50    type Result = Self;
51}
52
53#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
54extern_conformance!(
55    unsafe impl NSObjectProtocol for UIWindowSceneActivationAction {}
56);
57
58#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
59extern_conformance!(
60    unsafe impl NSSecureCoding for UIWindowSceneActivationAction {}
61);
62
63#[cfg(all(
64    feature = "UIAction",
65    feature = "UIMenuElement",
66    feature = "UIMenuLeaf"
67))]
68extern_conformance!(
69    unsafe impl UIMenuLeaf for UIWindowSceneActivationAction {}
70);
71
72#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
73impl UIWindowSceneActivationAction {
74    extern_methods!(
75        /// The actions title. Set to nil to use the default title.
76        #[unsafe(method(title))]
77        #[unsafe(method_family = none)]
78        pub fn title(&self) -> Retained<NSString>;
79
80        /// Setter for [`title`][Self::title].
81        ///
82        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
83        #[unsafe(method(setTitle:))]
84        #[unsafe(method_family = none)]
85        pub fn setTitle(&self, title: Option<&NSString>);
86
87        #[cfg(all(feature = "UIWindowSceneActivationConfiguration", feature = "block2"))]
88        /// Returns a new
89        /// `UIWindowSceneActivationAction`
90        ///
91        /// Parameter `identifier`: The action's identifier. Pass nil to use an auto-generated identifier.
92        ///
93        /// Parameter `alternateAction`: If running on a platform that doesn't support multiple windows, the alternate action is used. Otherwise, the alternates handler is called if the scene activation request fails.
94        ///
95        /// Parameter `configurationProvider`: Called when the action has been triggered. It should return a
96        /// `UIWindowSceneActivationConfiguration`whose user activity will be used to request scene activation.
97        ///
98        /// # Safety
99        ///
100        /// `configuration_provider` must be a valid pointer.
101        #[unsafe(method(actionWithIdentifier:alternateAction:configurationProvider:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn actionWithIdentifier_alternateAction_configurationProvider(
104            identifier: Option<&UIActionIdentifier>,
105            alternate_action: Option<&UIAction>,
106            configuration_provider: UIWindowSceneActivationActionConfigurationProvider,
107            mtm: MainThreadMarker,
108        ) -> Retained<Self>;
109
110        #[cfg(feature = "block2")]
111        /// # Safety
112        ///
113        /// `handler` must be a valid pointer.
114        #[unsafe(method(actionWithHandler:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn actionWithHandler(
117            handler: UIActionHandler,
118            mtm: MainThreadMarker,
119        ) -> Retained<Self>;
120
121        #[cfg(all(feature = "UIImage", feature = "block2"))]
122        /// # Safety
123        ///
124        /// `handler` must be a valid pointer.
125        #[unsafe(method(actionWithTitle:image:identifier:handler:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn actionWithTitle_image_identifier_handler(
128            title: &NSString,
129            image: Option<&UIImage>,
130            identifier: Option<&UIActionIdentifier>,
131            handler: UIActionHandler,
132            mtm: MainThreadMarker,
133        ) -> Retained<Self>;
134    );
135}
136
137/// Methods declared on superclass `UIAction`.
138#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
139impl UIWindowSceneActivationAction {
140    extern_methods!(
141        #[unsafe(method(init))]
142        #[unsafe(method_family = init)]
143        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
144
145        #[unsafe(method(new))]
146        #[unsafe(method_family = new)]
147        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
148    );
149}
150
151/// Methods declared on superclass `UIMenuElement`.
152#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
153impl UIWindowSceneActivationAction {
154    extern_methods!(
155        /// # Safety
156        ///
157        /// `coder` possibly has further requirements.
158        #[unsafe(method(initWithCoder:))]
159        #[unsafe(method_family = init)]
160        pub unsafe fn initWithCoder(
161            this: Allocated<Self>,
162            coder: &NSCoder,
163        ) -> Option<Retained<Self>>;
164    );
165}