objc2_ui_kit/generated/
UISheetPresentationController.rs1use 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
12pub type UISheetPresentationControllerDetentIdentifier = NSString;
15
16extern "C" {
17 pub static UISheetPresentationControllerDetentIdentifierMedium:
19 &'static UISheetPresentationControllerDetentIdentifier;
20}
21
22extern "C" {
23 pub static UISheetPresentationControllerDetentIdentifierLarge:
25 &'static UISheetPresentationControllerDetentIdentifier;
26}
27
28extern "C" {
29 #[cfg(feature = "objc2-core-foundation")]
31 pub static UISheetPresentationControllerDetentInactive: CGFloat;
32}
33
34extern_protocol!(
35 pub unsafe trait UISheetPresentationControllerDetentResolutionContext:
37 NSObjectProtocol + MainThreadOnly
38 {
39 #[cfg(feature = "UITraitCollection")]
40 #[unsafe(method(containerTraitCollection))]
41 #[unsafe(method_family = none)]
42 fn containerTraitCollection(&self) -> Retained<UITraitCollection>;
43
44 #[cfg(feature = "objc2-core-foundation")]
45 #[unsafe(method(maximumDetentValue))]
46 #[unsafe(method_family = none)]
47 fn maximumDetentValue(&self) -> CGFloat;
48 }
49);
50
51extern_class!(
52 #[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 fn mediumDetent(mtm: MainThreadMarker) -> Retained<Self>;
76
77 #[unsafe(method(largeDetent))]
78 #[unsafe(method_family = none)]
79 pub 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 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 fn identifier(&self) -> Retained<UISheetPresentationControllerDetentIdentifier>;
99
100 #[cfg(feature = "objc2-core-foundation")]
101 #[unsafe(method(resolvedValueInContext:))]
102 #[unsafe(method_family = none)]
103 pub fn resolvedValueInContext(
104 &self,
105 context: &ProtocolObject<dyn UISheetPresentationControllerDetentResolutionContext>,
106 ) -> CGFloat;
107 );
108}
109
110extern "C" {
111 #[cfg(feature = "objc2-core-foundation")]
113 pub static UISheetPresentationControllerAutomaticDimension: CGFloat;
114}
115
116extern_protocol!(
117 #[cfg(feature = "UIPresentationController")]
119 pub unsafe trait UISheetPresentationControllerDelegate:
120 UIAdaptivePresentationControllerDelegate + MainThreadOnly
121 {
122 #[optional]
123 #[unsafe(method(sheetPresentationControllerDidChangeSelectedDetentIdentifier:))]
124 #[unsafe(method_family = none)]
125 fn sheetPresentationControllerDidChangeSelectedDetentIdentifier(
126 &self,
127 sheet_presentation_controller: &UISheetPresentationController,
128 );
129 }
130);
131
132extern_class!(
133 #[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 fn delegate(
172 &self,
173 ) -> Option<Retained<ProtocolObject<dyn UISheetPresentationControllerDelegate>>>;
174
175 #[unsafe(method(setDelegate:))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn setDelegate(
181 &self,
182 delegate: Option<&ProtocolObject<dyn UISheetPresentationControllerDelegate>>,
183 );
184
185 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
186 #[unsafe(method(sourceView))]
187 #[unsafe(method_family = none)]
188 pub fn sourceView(&self) -> Option<Retained<UIView>>;
189
190 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
191 #[unsafe(method(setSourceView:))]
193 #[unsafe(method_family = none)]
194 pub fn setSourceView(&self, source_view: Option<&UIView>);
195
196 #[unsafe(method(prefersPageSizing))]
197 #[unsafe(method_family = none)]
198 pub fn prefersPageSizing(&self) -> bool;
199
200 #[unsafe(method(setPrefersPageSizing:))]
202 #[unsafe(method_family = none)]
203 pub fn setPrefersPageSizing(&self, prefers_page_sizing: bool);
204
205 #[unsafe(method(prefersEdgeAttachedInCompactHeight))]
206 #[unsafe(method_family = none)]
207 pub fn prefersEdgeAttachedInCompactHeight(&self) -> bool;
208
209 #[unsafe(method(setPrefersEdgeAttachedInCompactHeight:))]
211 #[unsafe(method_family = none)]
212 pub fn setPrefersEdgeAttachedInCompactHeight(
213 &self,
214 prefers_edge_attached_in_compact_height: bool,
215 );
216
217 #[unsafe(method(widthFollowsPreferredContentSizeWhenEdgeAttached))]
218 #[unsafe(method_family = none)]
219 pub fn widthFollowsPreferredContentSizeWhenEdgeAttached(&self) -> bool;
220
221 #[unsafe(method(setWidthFollowsPreferredContentSizeWhenEdgeAttached:))]
223 #[unsafe(method_family = none)]
224 pub fn setWidthFollowsPreferredContentSizeWhenEdgeAttached(
225 &self,
226 width_follows_preferred_content_size_when_edge_attached: bool,
227 );
228
229 #[unsafe(method(prefersGrabberVisible))]
230 #[unsafe(method_family = none)]
231 pub fn prefersGrabberVisible(&self) -> bool;
232
233 #[unsafe(method(setPrefersGrabberVisible:))]
235 #[unsafe(method_family = none)]
236 pub fn setPrefersGrabberVisible(&self, prefers_grabber_visible: bool);
237
238 #[cfg(feature = "objc2-core-foundation")]
239 #[unsafe(method(preferredCornerRadius))]
240 #[unsafe(method_family = none)]
241 pub fn preferredCornerRadius(&self) -> CGFloat;
242
243 #[cfg(feature = "objc2-core-foundation")]
244 #[unsafe(method(setPreferredCornerRadius:))]
246 #[unsafe(method_family = none)]
247 pub fn setPreferredCornerRadius(&self, preferred_corner_radius: CGFloat);
248
249 #[unsafe(method(detents))]
250 #[unsafe(method_family = none)]
251 pub fn detents(&self) -> Retained<NSArray<UISheetPresentationControllerDetent>>;
252
253 #[unsafe(method(setDetents:))]
257 #[unsafe(method_family = none)]
258 pub fn setDetents(&self, detents: &NSArray<UISheetPresentationControllerDetent>);
259
260 #[unsafe(method(invalidateDetents))]
261 #[unsafe(method_family = none)]
262 pub fn invalidateDetents(&self);
263
264 #[unsafe(method(selectedDetentIdentifier))]
265 #[unsafe(method_family = none)]
266 pub fn selectedDetentIdentifier(
267 &self,
268 ) -> Option<Retained<UISheetPresentationControllerDetentIdentifier>>;
269
270 #[unsafe(method(setSelectedDetentIdentifier:))]
274 #[unsafe(method_family = none)]
275 pub fn setSelectedDetentIdentifier(
276 &self,
277 selected_detent_identifier: Option<&UISheetPresentationControllerDetentIdentifier>,
278 );
279
280 #[unsafe(method(largestUndimmedDetentIdentifier))]
281 #[unsafe(method_family = none)]
282 pub fn largestUndimmedDetentIdentifier(
283 &self,
284 ) -> Option<Retained<UISheetPresentationControllerDetentIdentifier>>;
285
286 #[unsafe(method(setLargestUndimmedDetentIdentifier:))]
290 #[unsafe(method_family = none)]
291 pub fn setLargestUndimmedDetentIdentifier(
292 &self,
293 largest_undimmed_detent_identifier: Option<
294 &UISheetPresentationControllerDetentIdentifier,
295 >,
296 );
297
298 #[unsafe(method(prefersScrollingExpandsWhenScrolledToEdge))]
299 #[unsafe(method_family = none)]
300 pub fn prefersScrollingExpandsWhenScrolledToEdge(&self) -> bool;
301
302 #[unsafe(method(setPrefersScrollingExpandsWhenScrolledToEdge:))]
304 #[unsafe(method_family = none)]
305 pub fn setPrefersScrollingExpandsWhenScrolledToEdge(
306 &self,
307 prefers_scrolling_expands_when_scrolled_to_edge: bool,
308 );
309
310 #[cfg(feature = "block2")]
311 #[unsafe(method(animateChanges:))]
312 #[unsafe(method_family = none)]
313 pub fn animateChanges(&self, changes: &block2::DynBlock<dyn Fn() + '_>);
314 );
315}
316
317#[cfg(feature = "UIPresentationController")]
319impl UISheetPresentationController {
320 extern_methods!(
321 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
322 #[unsafe(method(initWithPresentedViewController:presentingViewController:))]
323 #[unsafe(method_family = init)]
324 pub fn initWithPresentedViewController_presentingViewController(
325 this: Allocated<Self>,
326 presented_view_controller: &UIViewController,
327 presenting_view_controller: Option<&UIViewController>,
328 ) -> Retained<Self>;
329
330 #[unsafe(method(init))]
331 #[unsafe(method_family = init)]
332 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
333 );
334}
335
336#[cfg(feature = "UIPresentationController")]
338impl UISheetPresentationController {
339 extern_methods!(
340 #[unsafe(method(new))]
341 #[unsafe(method_family = new)]
342 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
343 );
344}