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
112extern_conformance!(
113    unsafe impl NSObjectProtocol for UIPresentationController {}
114);
115
116#[cfg(feature = "UIAppearance")]
117extern_conformance!(
118    unsafe impl UIAppearanceContainer for UIPresentationController {}
119);
120
121#[cfg(feature = "UIViewController")]
122extern_conformance!(
123    unsafe impl UIContentContainer for UIPresentationController {}
124);
125
126#[cfg(feature = "UIFocus")]
127extern_conformance!(
128    unsafe impl UIFocusEnvironment for UIPresentationController {}
129);
130
131#[cfg(feature = "UITraitCollection")]
132extern_conformance!(
133    unsafe impl UITraitEnvironment for UIPresentationController {}
134);
135
136impl UIPresentationController {
137    extern_methods!(
138        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
139        #[unsafe(method(presentingViewController))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn presentingViewController(&self) -> Retained<UIViewController>;
142
143        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
144        #[unsafe(method(presentedViewController))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn presentedViewController(&self) -> Retained<UIViewController>;
147
148        #[cfg(feature = "UIViewController")]
149        #[unsafe(method(presentationStyle))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn presentationStyle(&self) -> UIModalPresentationStyle;
152
153        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
154        #[unsafe(method(containerView))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn containerView(&self) -> Option<Retained<UIView>>;
157
158        #[unsafe(method(delegate))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn delegate(
161            &self,
162        ) -> Option<Retained<ProtocolObject<dyn UIAdaptivePresentationControllerDelegate>>>;
163
164        /// This is a [weak property][objc2::topics::weak_property].
165        /// Setter for [`delegate`][Self::delegate].
166        #[unsafe(method(setDelegate:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn setDelegate(
169            &self,
170            delegate: Option<&ProtocolObject<dyn UIAdaptivePresentationControllerDelegate>>,
171        );
172
173        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
174        #[unsafe(method(initWithPresentedViewController:presentingViewController:))]
175        #[unsafe(method_family = init)]
176        pub unsafe fn initWithPresentedViewController_presentingViewController(
177            this: Allocated<Self>,
178            presented_view_controller: &UIViewController,
179            presenting_view_controller: Option<&UIViewController>,
180        ) -> Retained<Self>;
181
182        #[unsafe(method(init))]
183        #[unsafe(method_family = init)]
184        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
185
186        #[cfg(feature = "UIViewController")]
187        #[unsafe(method(adaptivePresentationStyle))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn adaptivePresentationStyle(&self) -> UIModalPresentationStyle;
190
191        #[cfg(all(feature = "UITraitCollection", feature = "UIViewController"))]
192        #[unsafe(method(adaptivePresentationStyleForTraitCollection:))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn adaptivePresentationStyleForTraitCollection(
195            &self,
196            trait_collection: &UITraitCollection,
197        ) -> UIModalPresentationStyle;
198
199        #[unsafe(method(containerViewWillLayoutSubviews))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn containerViewWillLayoutSubviews(&self);
202
203        #[unsafe(method(containerViewDidLayoutSubviews))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn containerViewDidLayoutSubviews(&self);
206
207        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
208        #[unsafe(method(presentedView))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn presentedView(&self) -> Option<Retained<UIView>>;
211
212        #[cfg(feature = "objc2-core-foundation")]
213        #[unsafe(method(frameOfPresentedViewInContainerView))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn frameOfPresentedViewInContainerView(&self) -> CGRect;
216
217        #[unsafe(method(shouldPresentInFullscreen))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn shouldPresentInFullscreen(&self) -> bool;
220
221        #[unsafe(method(shouldRemovePresentersView))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn shouldRemovePresentersView(&self) -> bool;
224
225        #[unsafe(method(presentationTransitionWillBegin))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn presentationTransitionWillBegin(&self);
228
229        #[unsafe(method(presentationTransitionDidEnd:))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn presentationTransitionDidEnd(&self, completed: bool);
232
233        #[unsafe(method(dismissalTransitionWillBegin))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn dismissalTransitionWillBegin(&self);
236
237        #[unsafe(method(dismissalTransitionDidEnd:))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn dismissalTransitionDidEnd(&self, completed: bool);
240
241        #[cfg(feature = "UITraitCollection")]
242        #[deprecated = "Use the traitOverrides property instead"]
243        #[unsafe(method(overrideTraitCollection))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn overrideTraitCollection(&self) -> Option<Retained<UITraitCollection>>;
246
247        #[cfg(feature = "UITraitCollection")]
248        /// Setter for [`overrideTraitCollection`][Self::overrideTraitCollection].
249        #[deprecated = "Use the traitOverrides property instead"]
250        #[unsafe(method(setOverrideTraitCollection:))]
251        #[unsafe(method_family = none)]
252        pub unsafe fn setOverrideTraitCollection(
253            &self,
254            override_trait_collection: Option<&UITraitCollection>,
255        );
256    );
257}
258
259/// Methods declared on superclass `NSObject`.
260impl UIPresentationController {
261    extern_methods!(
262        #[unsafe(method(new))]
263        #[unsafe(method_family = new)]
264        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
265    );
266}
267
268impl UIPresentationController {
269    extern_methods!(
270        #[cfg(feature = "UITraitCollection")]
271        #[unsafe(method(traitOverrides))]
272        #[unsafe(method_family = none)]
273        pub unsafe fn traitOverrides(&self) -> Retained<ProtocolObject<dyn UITraitOverrides>>;
274    );
275}
276
277#[cfg(feature = "UITraitCollection")]
278extern_conformance!(
279    unsafe impl UITraitChangeObservable for UIPresentationController {}
280);