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