objc2_ui_kit/generated/
UISheetPresentationController.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::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerdetentidentifier?language=objc)
13// NS_TYPED_EXTENSIBLE_ENUM
14pub type UISheetPresentationControllerDetentIdentifier = NSString;
15
16extern "C" {
17    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerdetentidentifiermedium?language=objc)
18    pub static UISheetPresentationControllerDetentIdentifierMedium:
19        &'static UISheetPresentationControllerDetentIdentifier;
20}
21
22extern "C" {
23    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerdetentidentifierlarge?language=objc)
24    pub static UISheetPresentationControllerDetentIdentifierLarge:
25        &'static UISheetPresentationControllerDetentIdentifier;
26}
27
28extern "C" {
29    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerdetentinactive?language=objc)
30    #[cfg(feature = "objc2-core-foundation")]
31    pub static UISheetPresentationControllerDetentInactive: CGFloat;
32}
33
34extern_protocol!(
35    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerdetentresolutioncontext?language=objc)
36    pub unsafe trait UISheetPresentationControllerDetentResolutionContext:
37        NSObjectProtocol + MainThreadOnly
38    {
39        #[cfg(feature = "UITraitCollection")]
40        #[unsafe(method(containerTraitCollection))]
41        #[unsafe(method_family = none)]
42        unsafe fn containerTraitCollection(&self) -> Retained<UITraitCollection>;
43
44        #[cfg(feature = "objc2-core-foundation")]
45        #[unsafe(method(maximumDetentValue))]
46        #[unsafe(method_family = none)]
47        unsafe fn maximumDetentValue(&self) -> CGFloat;
48    }
49);
50
51extern_class!(
52    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerdetent?language=objc)
53    #[unsafe(super(NSObject))]
54    #[thread_kind = MainThreadOnly]
55    #[derive(Debug, PartialEq, Eq, Hash)]
56    pub struct UISheetPresentationControllerDetent;
57);
58
59extern_conformance!(
60    unsafe impl NSObjectProtocol for UISheetPresentationControllerDetent {}
61);
62
63impl UISheetPresentationControllerDetent {
64    extern_methods!(
65        #[unsafe(method(init))]
66        #[unsafe(method_family = init)]
67        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
68
69        #[unsafe(method(new))]
70        #[unsafe(method_family = new)]
71        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
72
73        #[unsafe(method(mediumDetent))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn mediumDetent(mtm: MainThreadMarker) -> Retained<Self>;
76
77        #[unsafe(method(largeDetent))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn largeDetent(mtm: MainThreadMarker) -> Retained<Self>;
80
81        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
82        #[unsafe(method(customDetentWithIdentifier:resolver:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn customDetentWithIdentifier_resolver(
85            identifier: Option<&UISheetPresentationControllerDetentIdentifier>,
86            resolver: &block2::DynBlock<
87                dyn Fn(
88                    NonNull<
89                        ProtocolObject<dyn UISheetPresentationControllerDetentResolutionContext>,
90                    >,
91                ) -> CGFloat,
92            >,
93            mtm: MainThreadMarker,
94        ) -> Retained<Self>;
95
96        #[unsafe(method(identifier))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn identifier(&self) -> Retained<UISheetPresentationControllerDetentIdentifier>;
99
100        #[cfg(feature = "objc2-core-foundation")]
101        #[unsafe(method(resolvedValueInContext:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn resolvedValueInContext(
104            &self,
105            context: &ProtocolObject<dyn UISheetPresentationControllerDetentResolutionContext>,
106        ) -> CGFloat;
107    );
108}
109
110extern "C" {
111    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerautomaticdimension?language=objc)
112    #[cfg(feature = "objc2-core-foundation")]
113    pub static UISheetPresentationControllerAutomaticDimension: CGFloat;
114}
115
116extern_protocol!(
117    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontrollerdelegate?language=objc)
118    #[cfg(feature = "UIPresentationController")]
119    pub unsafe trait UISheetPresentationControllerDelegate:
120        UIAdaptivePresentationControllerDelegate + MainThreadOnly
121    {
122        #[optional]
123        #[unsafe(method(sheetPresentationControllerDidChangeSelectedDetentIdentifier:))]
124        #[unsafe(method_family = none)]
125        unsafe fn sheetPresentationControllerDidChangeSelectedDetentIdentifier(
126            &self,
127            sheet_presentation_controller: &UISheetPresentationController,
128        );
129    }
130);
131
132extern_class!(
133    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisheetpresentationcontroller?language=objc)
134    #[unsafe(super(UIPresentationController, NSObject))]
135    #[thread_kind = MainThreadOnly]
136    #[derive(Debug, PartialEq, Eq, Hash)]
137    #[cfg(feature = "UIPresentationController")]
138    pub struct UISheetPresentationController;
139);
140
141#[cfg(feature = "UIPresentationController")]
142extern_conformance!(
143    unsafe impl NSObjectProtocol for UISheetPresentationController {}
144);
145
146#[cfg(all(feature = "UIAppearance", feature = "UIPresentationController"))]
147extern_conformance!(
148    unsafe impl UIAppearanceContainer for UISheetPresentationController {}
149);
150
151#[cfg(all(feature = "UIPresentationController", feature = "UIViewController"))]
152extern_conformance!(
153    unsafe impl UIContentContainer for UISheetPresentationController {}
154);
155
156#[cfg(all(feature = "UIFocus", feature = "UIPresentationController"))]
157extern_conformance!(
158    unsafe impl UIFocusEnvironment for UISheetPresentationController {}
159);
160
161#[cfg(all(feature = "UIPresentationController", feature = "UITraitCollection"))]
162extern_conformance!(
163    unsafe impl UITraitEnvironment for UISheetPresentationController {}
164);
165
166#[cfg(feature = "UIPresentationController")]
167impl UISheetPresentationController {
168    extern_methods!(
169        #[unsafe(method(delegate))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn delegate(
172            &self,
173        ) -> Option<Retained<ProtocolObject<dyn UISheetPresentationControllerDelegate>>>;
174
175        /// This is a [weak property][objc2::topics::weak_property].
176        /// Setter for [`delegate`][Self::delegate].
177        #[unsafe(method(setDelegate:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setDelegate(
180            &self,
181            delegate: Option<&ProtocolObject<dyn UISheetPresentationControllerDelegate>>,
182        );
183
184        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
185        #[unsafe(method(sourceView))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn sourceView(&self) -> Option<Retained<UIView>>;
188
189        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
190        /// Setter for [`sourceView`][Self::sourceView].
191        #[unsafe(method(setSourceView:))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn setSourceView(&self, source_view: Option<&UIView>);
194
195        #[unsafe(method(prefersPageSizing))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn prefersPageSizing(&self) -> bool;
198
199        /// Setter for [`prefersPageSizing`][Self::prefersPageSizing].
200        #[unsafe(method(setPrefersPageSizing:))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn setPrefersPageSizing(&self, prefers_page_sizing: bool);
203
204        #[unsafe(method(prefersEdgeAttachedInCompactHeight))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn prefersEdgeAttachedInCompactHeight(&self) -> bool;
207
208        /// Setter for [`prefersEdgeAttachedInCompactHeight`][Self::prefersEdgeAttachedInCompactHeight].
209        #[unsafe(method(setPrefersEdgeAttachedInCompactHeight:))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn setPrefersEdgeAttachedInCompactHeight(
212            &self,
213            prefers_edge_attached_in_compact_height: bool,
214        );
215
216        #[unsafe(method(widthFollowsPreferredContentSizeWhenEdgeAttached))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn widthFollowsPreferredContentSizeWhenEdgeAttached(&self) -> bool;
219
220        /// Setter for [`widthFollowsPreferredContentSizeWhenEdgeAttached`][Self::widthFollowsPreferredContentSizeWhenEdgeAttached].
221        #[unsafe(method(setWidthFollowsPreferredContentSizeWhenEdgeAttached:))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn setWidthFollowsPreferredContentSizeWhenEdgeAttached(
224            &self,
225            width_follows_preferred_content_size_when_edge_attached: bool,
226        );
227
228        #[unsafe(method(prefersGrabberVisible))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn prefersGrabberVisible(&self) -> bool;
231
232        /// Setter for [`prefersGrabberVisible`][Self::prefersGrabberVisible].
233        #[unsafe(method(setPrefersGrabberVisible:))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn setPrefersGrabberVisible(&self, prefers_grabber_visible: bool);
236
237        #[cfg(feature = "objc2-core-foundation")]
238        #[unsafe(method(preferredCornerRadius))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn preferredCornerRadius(&self) -> CGFloat;
241
242        #[cfg(feature = "objc2-core-foundation")]
243        /// Setter for [`preferredCornerRadius`][Self::preferredCornerRadius].
244        #[unsafe(method(setPreferredCornerRadius:))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn setPreferredCornerRadius(&self, preferred_corner_radius: CGFloat);
247
248        #[unsafe(method(detents))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn detents(&self) -> Retained<NSArray<UISheetPresentationControllerDetent>>;
251
252        /// Setter for [`detents`][Self::detents].
253        #[unsafe(method(setDetents:))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn setDetents(&self, detents: &NSArray<UISheetPresentationControllerDetent>);
256
257        #[unsafe(method(invalidateDetents))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn invalidateDetents(&self);
260
261        #[unsafe(method(selectedDetentIdentifier))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn selectedDetentIdentifier(
264            &self,
265        ) -> Option<Retained<UISheetPresentationControllerDetentIdentifier>>;
266
267        /// Setter for [`selectedDetentIdentifier`][Self::selectedDetentIdentifier].
268        #[unsafe(method(setSelectedDetentIdentifier:))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn setSelectedDetentIdentifier(
271            &self,
272            selected_detent_identifier: Option<&UISheetPresentationControllerDetentIdentifier>,
273        );
274
275        #[unsafe(method(largestUndimmedDetentIdentifier))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn largestUndimmedDetentIdentifier(
278            &self,
279        ) -> Option<Retained<UISheetPresentationControllerDetentIdentifier>>;
280
281        /// Setter for [`largestUndimmedDetentIdentifier`][Self::largestUndimmedDetentIdentifier].
282        #[unsafe(method(setLargestUndimmedDetentIdentifier:))]
283        #[unsafe(method_family = none)]
284        pub unsafe fn setLargestUndimmedDetentIdentifier(
285            &self,
286            largest_undimmed_detent_identifier: Option<
287                &UISheetPresentationControllerDetentIdentifier,
288            >,
289        );
290
291        #[unsafe(method(prefersScrollingExpandsWhenScrolledToEdge))]
292        #[unsafe(method_family = none)]
293        pub unsafe fn prefersScrollingExpandsWhenScrolledToEdge(&self) -> bool;
294
295        /// Setter for [`prefersScrollingExpandsWhenScrolledToEdge`][Self::prefersScrollingExpandsWhenScrolledToEdge].
296        #[unsafe(method(setPrefersScrollingExpandsWhenScrolledToEdge:))]
297        #[unsafe(method_family = none)]
298        pub unsafe fn setPrefersScrollingExpandsWhenScrolledToEdge(
299            &self,
300            prefers_scrolling_expands_when_scrolled_to_edge: bool,
301        );
302
303        #[cfg(feature = "block2")]
304        #[unsafe(method(animateChanges:))]
305        #[unsafe(method_family = none)]
306        pub unsafe fn animateChanges(&self, changes: &block2::DynBlock<dyn Fn() + '_>);
307    );
308}
309
310/// Methods declared on superclass `UIPresentationController`.
311#[cfg(feature = "UIPresentationController")]
312impl UISheetPresentationController {
313    extern_methods!(
314        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
315        #[unsafe(method(initWithPresentedViewController:presentingViewController:))]
316        #[unsafe(method_family = init)]
317        pub unsafe fn initWithPresentedViewController_presentingViewController(
318            this: Allocated<Self>,
319            presented_view_controller: &UIViewController,
320            presenting_view_controller: Option<&UIViewController>,
321        ) -> Retained<Self>;
322
323        #[unsafe(method(init))]
324        #[unsafe(method_family = init)]
325        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
326    );
327}
328
329/// Methods declared on superclass `NSObject`.
330#[cfg(feature = "UIPresentationController")]
331impl UISheetPresentationController {
332    extern_methods!(
333        #[unsafe(method(new))]
334        #[unsafe(method_family = new)]
335        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
336    );
337}