objc2_ui_kit/generated/
UIPresentationController.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-core-foundation")]
7use objc2_core_foundation::*;
8
9use crate::*;
10
11extern_protocol!(
12    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiadaptivepresentationcontrollerdelegate?language=objc)
13    pub unsafe trait UIAdaptivePresentationControllerDelegate:
14        NSObjectProtocol + MainThreadOnly
15    {
16        #[cfg(feature = "UIViewController")]
17        #[optional]
18        #[unsafe(method(adaptivePresentationStyleForPresentationController:))]
19        #[unsafe(method_family = none)]
20        unsafe fn adaptivePresentationStyleForPresentationController(
21            &self,
22            controller: &UIPresentationController,
23        ) -> UIModalPresentationStyle;
24
25        #[cfg(all(feature = "UITraitCollection", feature = "UIViewController"))]
26        #[optional]
27        #[unsafe(method(adaptivePresentationStyleForPresentationController:traitCollection:))]
28        #[unsafe(method_family = none)]
29        unsafe fn adaptivePresentationStyleForPresentationController_traitCollection(
30            &self,
31            controller: &UIPresentationController,
32            trait_collection: &UITraitCollection,
33        ) -> UIModalPresentationStyle;
34
35        #[optional]
36        #[unsafe(method(presentationController:prepareAdaptivePresentationController:))]
37        #[unsafe(method_family = none)]
38        unsafe fn presentationController_prepareAdaptivePresentationController(
39            &self,
40            presentation_controller: &UIPresentationController,
41            adaptive_presentation_controller: &UIPresentationController,
42        );
43
44        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
45        #[optional]
46        #[unsafe(method(presentationController:viewControllerForAdaptivePresentationStyle:))]
47        #[unsafe(method_family = none)]
48        unsafe fn presentationController_viewControllerForAdaptivePresentationStyle(
49            &self,
50            controller: &UIPresentationController,
51            style: UIModalPresentationStyle,
52        ) -> Option<Retained<UIViewController>>;
53
54        #[cfg(all(
55            feature = "UIViewController",
56            feature = "UIViewControllerTransitionCoordinator"
57        ))]
58        #[optional]
59        #[unsafe(method(presentationController:willPresentWithAdaptiveStyle:transitionCoordinator:))]
60        #[unsafe(method_family = none)]
61        unsafe fn presentationController_willPresentWithAdaptiveStyle_transitionCoordinator(
62            &self,
63            presentation_controller: &UIPresentationController,
64            style: UIModalPresentationStyle,
65            transition_coordinator: Option<
66                &ProtocolObject<dyn UIViewControllerTransitionCoordinator>,
67            >,
68        );
69
70        #[optional]
71        #[unsafe(method(presentationControllerShouldDismiss:))]
72        #[unsafe(method_family = none)]
73        unsafe fn presentationControllerShouldDismiss(
74            &self,
75            presentation_controller: &UIPresentationController,
76        ) -> bool;
77
78        #[optional]
79        #[unsafe(method(presentationControllerWillDismiss:))]
80        #[unsafe(method_family = none)]
81        unsafe fn presentationControllerWillDismiss(
82            &self,
83            presentation_controller: &UIPresentationController,
84        );
85
86        #[optional]
87        #[unsafe(method(presentationControllerDidDismiss:))]
88        #[unsafe(method_family = none)]
89        unsafe fn presentationControllerDidDismiss(
90            &self,
91            presentation_controller: &UIPresentationController,
92        );
93
94        #[optional]
95        #[unsafe(method(presentationControllerDidAttemptToDismiss:))]
96        #[unsafe(method_family = none)]
97        unsafe fn presentationControllerDidAttemptToDismiss(
98            &self,
99            presentation_controller: &UIPresentationController,
100        );
101    }
102);
103
104extern_class!(
105    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipresentationcontroller?language=objc)
106    #[unsafe(super(NSObject))]
107    #[thread_kind = MainThreadOnly]
108    #[derive(Debug, PartialEq, Eq, Hash)]
109    pub struct UIPresentationController;
110);
111
112unsafe impl NSObjectProtocol for UIPresentationController {}
113
114#[cfg(feature = "UIAppearance")]
115unsafe impl UIAppearanceContainer for UIPresentationController {}
116
117#[cfg(feature = "UIViewController")]
118unsafe impl UIContentContainer for UIPresentationController {}
119
120#[cfg(feature = "UIFocus")]
121unsafe impl UIFocusEnvironment for UIPresentationController {}
122
123#[cfg(feature = "UITraitCollection")]
124unsafe impl UITraitEnvironment for UIPresentationController {}
125
126impl UIPresentationController {
127    extern_methods!(
128        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
129        #[unsafe(method(presentingViewController))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn presentingViewController(&self) -> Retained<UIViewController>;
132
133        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
134        #[unsafe(method(presentedViewController))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn presentedViewController(&self) -> Retained<UIViewController>;
137
138        #[cfg(feature = "UIViewController")]
139        #[unsafe(method(presentationStyle))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn presentationStyle(&self) -> UIModalPresentationStyle;
142
143        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
144        #[unsafe(method(containerView))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn containerView(&self) -> Option<Retained<UIView>>;
147
148        #[unsafe(method(delegate))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn delegate(
151            &self,
152        ) -> Option<Retained<ProtocolObject<dyn UIAdaptivePresentationControllerDelegate>>>;
153
154        /// This is a [weak property][objc2::topics::weak_property].
155        /// Setter for [`delegate`][Self::delegate].
156        #[unsafe(method(setDelegate:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn setDelegate(
159            &self,
160            delegate: Option<&ProtocolObject<dyn UIAdaptivePresentationControllerDelegate>>,
161        );
162
163        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
164        #[unsafe(method(initWithPresentedViewController:presentingViewController:))]
165        #[unsafe(method_family = init)]
166        pub unsafe fn initWithPresentedViewController_presentingViewController(
167            this: Allocated<Self>,
168            presented_view_controller: &UIViewController,
169            presenting_view_controller: Option<&UIViewController>,
170        ) -> Retained<Self>;
171
172        #[unsafe(method(init))]
173        #[unsafe(method_family = init)]
174        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
175
176        #[cfg(feature = "UIViewController")]
177        #[unsafe(method(adaptivePresentationStyle))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn adaptivePresentationStyle(&self) -> UIModalPresentationStyle;
180
181        #[cfg(all(feature = "UITraitCollection", feature = "UIViewController"))]
182        #[unsafe(method(adaptivePresentationStyleForTraitCollection:))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn adaptivePresentationStyleForTraitCollection(
185            &self,
186            trait_collection: &UITraitCollection,
187        ) -> UIModalPresentationStyle;
188
189        #[unsafe(method(containerViewWillLayoutSubviews))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn containerViewWillLayoutSubviews(&self);
192
193        #[unsafe(method(containerViewDidLayoutSubviews))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn containerViewDidLayoutSubviews(&self);
196
197        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
198        #[unsafe(method(presentedView))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn presentedView(&self) -> Option<Retained<UIView>>;
201
202        #[cfg(feature = "objc2-core-foundation")]
203        #[unsafe(method(frameOfPresentedViewInContainerView))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn frameOfPresentedViewInContainerView(&self) -> CGRect;
206
207        #[unsafe(method(shouldPresentInFullscreen))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn shouldPresentInFullscreen(&self) -> bool;
210
211        #[unsafe(method(shouldRemovePresentersView))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn shouldRemovePresentersView(&self) -> bool;
214
215        #[unsafe(method(presentationTransitionWillBegin))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn presentationTransitionWillBegin(&self);
218
219        #[unsafe(method(presentationTransitionDidEnd:))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn presentationTransitionDidEnd(&self, completed: bool);
222
223        #[unsafe(method(dismissalTransitionWillBegin))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn dismissalTransitionWillBegin(&self);
226
227        #[unsafe(method(dismissalTransitionDidEnd:))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn dismissalTransitionDidEnd(&self, completed: bool);
230
231        #[cfg(feature = "UITraitCollection")]
232        #[deprecated = "Use the traitOverrides property instead"]
233        #[unsafe(method(overrideTraitCollection))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn overrideTraitCollection(&self) -> Option<Retained<UITraitCollection>>;
236
237        #[cfg(feature = "UITraitCollection")]
238        /// Setter for [`overrideTraitCollection`][Self::overrideTraitCollection].
239        #[deprecated = "Use the traitOverrides property instead"]
240        #[unsafe(method(setOverrideTraitCollection:))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn setOverrideTraitCollection(
243            &self,
244            override_trait_collection: Option<&UITraitCollection>,
245        );
246    );
247}
248
249/// Methods declared on superclass `NSObject`.
250impl UIPresentationController {
251    extern_methods!(
252        #[unsafe(method(new))]
253        #[unsafe(method_family = new)]
254        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
255    );
256}
257
258impl UIPresentationController {
259    extern_methods!(
260        #[cfg(feature = "UITraitCollection")]
261        #[unsafe(method(traitOverrides))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn traitOverrides(&self) -> Retained<ProtocolObject<dyn UITraitOverrides>>;
264    );
265}
266
267#[cfg(feature = "UITraitCollection")]
268unsafe impl UITraitChangeObservable for UIPresentationController {}