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        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        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        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        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        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        fn presentationControllerShouldDismiss(
74            &self,
75            presentation_controller: &UIPresentationController,
76        ) -> bool;
77
78        #[optional]
79        #[unsafe(method(presentationControllerWillDismiss:))]
80        #[unsafe(method_family = none)]
81        fn presentationControllerWillDismiss(
82            &self,
83            presentation_controller: &UIPresentationController,
84        );
85
86        #[optional]
87        #[unsafe(method(presentationControllerDidDismiss:))]
88        #[unsafe(method_family = none)]
89        fn presentationControllerDidDismiss(
90            &self,
91            presentation_controller: &UIPresentationController,
92        );
93
94        #[optional]
95        #[unsafe(method(presentationControllerDidAttemptToDismiss:))]
96        #[unsafe(method_family = none)]
97        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 fn presentingViewController(&self) -> Retained<UIViewController>;
142
143        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
144        #[unsafe(method(presentedViewController))]
145        #[unsafe(method_family = none)]
146        pub fn presentedViewController(&self) -> Retained<UIViewController>;
147
148        #[cfg(feature = "UIViewController")]
149        #[unsafe(method(presentationStyle))]
150        #[unsafe(method_family = none)]
151        pub fn presentationStyle(&self) -> UIModalPresentationStyle;
152
153        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
154        #[unsafe(method(containerView))]
155        #[unsafe(method_family = none)]
156        pub fn containerView(&self) -> Option<Retained<UIView>>;
157
158        #[unsafe(method(delegate))]
159        #[unsafe(method_family = none)]
160        pub fn delegate(
161            &self,
162        ) -> Option<Retained<ProtocolObject<dyn UIAdaptivePresentationControllerDelegate>>>;
163
164        /// Setter for [`delegate`][Self::delegate].
165        ///
166        /// This is a [weak property][objc2::topics::weak_property].
167        #[unsafe(method(setDelegate:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn setDelegate(
170            &self,
171            delegate: Option<&ProtocolObject<dyn UIAdaptivePresentationControllerDelegate>>,
172        );
173
174        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
175        #[unsafe(method(initWithPresentedViewController:presentingViewController:))]
176        #[unsafe(method_family = init)]
177        pub fn initWithPresentedViewController_presentingViewController(
178            this: Allocated<Self>,
179            presented_view_controller: &UIViewController,
180            presenting_view_controller: Option<&UIViewController>,
181        ) -> Retained<Self>;
182
183        #[unsafe(method(init))]
184        #[unsafe(method_family = init)]
185        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
186
187        #[cfg(feature = "UIViewController")]
188        #[unsafe(method(adaptivePresentationStyle))]
189        #[unsafe(method_family = none)]
190        pub fn adaptivePresentationStyle(&self) -> UIModalPresentationStyle;
191
192        #[cfg(all(feature = "UITraitCollection", feature = "UIViewController"))]
193        #[unsafe(method(adaptivePresentationStyleForTraitCollection:))]
194        #[unsafe(method_family = none)]
195        pub fn adaptivePresentationStyleForTraitCollection(
196            &self,
197            trait_collection: &UITraitCollection,
198        ) -> UIModalPresentationStyle;
199
200        #[unsafe(method(containerViewWillLayoutSubviews))]
201        #[unsafe(method_family = none)]
202        pub fn containerViewWillLayoutSubviews(&self);
203
204        #[unsafe(method(containerViewDidLayoutSubviews))]
205        #[unsafe(method_family = none)]
206        pub fn containerViewDidLayoutSubviews(&self);
207
208        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
209        #[unsafe(method(presentedView))]
210        #[unsafe(method_family = none)]
211        pub fn presentedView(&self) -> Option<Retained<UIView>>;
212
213        #[cfg(feature = "objc2-core-foundation")]
214        #[unsafe(method(frameOfPresentedViewInContainerView))]
215        #[unsafe(method_family = none)]
216        pub fn frameOfPresentedViewInContainerView(&self) -> CGRect;
217
218        #[unsafe(method(shouldPresentInFullscreen))]
219        #[unsafe(method_family = none)]
220        pub fn shouldPresentInFullscreen(&self) -> bool;
221
222        #[unsafe(method(shouldRemovePresentersView))]
223        #[unsafe(method_family = none)]
224        pub fn shouldRemovePresentersView(&self) -> bool;
225
226        #[unsafe(method(presentationTransitionWillBegin))]
227        #[unsafe(method_family = none)]
228        pub fn presentationTransitionWillBegin(&self);
229
230        #[unsafe(method(presentationTransitionDidEnd:))]
231        #[unsafe(method_family = none)]
232        pub fn presentationTransitionDidEnd(&self, completed: bool);
233
234        #[unsafe(method(dismissalTransitionWillBegin))]
235        #[unsafe(method_family = none)]
236        pub fn dismissalTransitionWillBegin(&self);
237
238        #[unsafe(method(dismissalTransitionDidEnd:))]
239        #[unsafe(method_family = none)]
240        pub fn dismissalTransitionDidEnd(&self, completed: bool);
241
242        #[cfg(feature = "UITraitCollection")]
243        #[deprecated = "Use the traitOverrides property instead"]
244        #[unsafe(method(overrideTraitCollection))]
245        #[unsafe(method_family = none)]
246        pub fn overrideTraitCollection(&self) -> Option<Retained<UITraitCollection>>;
247
248        #[cfg(feature = "UITraitCollection")]
249        /// Setter for [`overrideTraitCollection`][Self::overrideTraitCollection].
250        ///
251        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
252        #[deprecated = "Use the traitOverrides property instead"]
253        #[unsafe(method(setOverrideTraitCollection:))]
254        #[unsafe(method_family = none)]
255        pub fn setOverrideTraitCollection(
256            &self,
257            override_trait_collection: Option<&UITraitCollection>,
258        );
259    );
260}
261
262/// Methods declared on superclass `NSObject`.
263impl UIPresentationController {
264    extern_methods!(
265        #[unsafe(method(new))]
266        #[unsafe(method_family = new)]
267        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
268    );
269}
270
271impl UIPresentationController {
272    extern_methods!(
273        #[cfg(feature = "UITraitCollection")]
274        #[unsafe(method(traitOverrides))]
275        #[unsafe(method_family = none)]
276        pub fn traitOverrides(&self) -> Retained<ProtocolObject<dyn UITraitOverrides>>;
277    );
278}
279
280#[cfg(feature = "UITraitCollection")]
281extern_conformance!(
282    unsafe impl UITraitChangeObservable for UIPresentationController {}
283);