objc2_ui_kit/generated/
UICollectionViewFlowLayout.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
12extern "C" {
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewflowlayoutautomaticsize?language=objc)
14    #[cfg(feature = "objc2-core-foundation")]
15    pub static UICollectionViewFlowLayoutAutomaticSize: CGSize;
16}
17
18/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewflowlayoutsectioninsetreference?language=objc)
19// NS_ENUM
20#[repr(transparent)]
21#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
22pub struct UICollectionViewFlowLayoutSectionInsetReference(pub NSInteger);
23impl UICollectionViewFlowLayoutSectionInsetReference {
24    #[doc(alias = "UICollectionViewFlowLayoutSectionInsetFromContentInset")]
25    pub const FromContentInset: Self = Self(0);
26    #[doc(alias = "UICollectionViewFlowLayoutSectionInsetFromSafeArea")]
27    pub const FromSafeArea: Self = Self(1);
28    #[doc(alias = "UICollectionViewFlowLayoutSectionInsetFromLayoutMargins")]
29    pub const FromLayoutMargins: Self = Self(2);
30}
31
32unsafe impl Encode for UICollectionViewFlowLayoutSectionInsetReference {
33    const ENCODING: Encoding = NSInteger::ENCODING;
34}
35
36unsafe impl RefEncode for UICollectionViewFlowLayoutSectionInsetReference {
37    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_class!(
41    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewflowlayoutinvalidationcontext?language=objc)
42    #[unsafe(super(UICollectionViewLayoutInvalidationContext, NSObject))]
43    #[thread_kind = MainThreadOnly]
44    #[derive(Debug, PartialEq, Eq, Hash)]
45    #[cfg(feature = "UICollectionViewLayout")]
46    pub struct UICollectionViewFlowLayoutInvalidationContext;
47);
48
49#[cfg(feature = "UICollectionViewLayout")]
50extern_conformance!(
51    unsafe impl NSObjectProtocol for UICollectionViewFlowLayoutInvalidationContext {}
52);
53
54#[cfg(feature = "UICollectionViewLayout")]
55impl UICollectionViewFlowLayoutInvalidationContext {
56    extern_methods!(
57        #[unsafe(method(invalidateFlowLayoutDelegateMetrics))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn invalidateFlowLayoutDelegateMetrics(&self) -> bool;
60
61        /// Setter for [`invalidateFlowLayoutDelegateMetrics`][Self::invalidateFlowLayoutDelegateMetrics].
62        #[unsafe(method(setInvalidateFlowLayoutDelegateMetrics:))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn setInvalidateFlowLayoutDelegateMetrics(
65            &self,
66            invalidate_flow_layout_delegate_metrics: bool,
67        );
68
69        #[unsafe(method(invalidateFlowLayoutAttributes))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn invalidateFlowLayoutAttributes(&self) -> bool;
72
73        /// Setter for [`invalidateFlowLayoutAttributes`][Self::invalidateFlowLayoutAttributes].
74        #[unsafe(method(setInvalidateFlowLayoutAttributes:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn setInvalidateFlowLayoutAttributes(
77            &self,
78            invalidate_flow_layout_attributes: bool,
79        );
80    );
81}
82
83/// Methods declared on superclass `NSObject`.
84#[cfg(feature = "UICollectionViewLayout")]
85impl UICollectionViewFlowLayoutInvalidationContext {
86    extern_methods!(
87        #[unsafe(method(init))]
88        #[unsafe(method_family = init)]
89        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
90
91        #[unsafe(method(new))]
92        #[unsafe(method_family = new)]
93        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
94    );
95}
96
97extern_protocol!(
98    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewdelegateflowlayout?language=objc)
99    #[cfg(all(feature = "UICollectionView", feature = "UIScrollView"))]
100    pub unsafe trait UICollectionViewDelegateFlowLayout:
101        UICollectionViewDelegate + MainThreadOnly
102    {
103        #[cfg(all(
104            feature = "UICollectionViewLayout",
105            feature = "UIResponder",
106            feature = "UIView",
107            feature = "objc2-core-foundation"
108        ))]
109        #[optional]
110        #[unsafe(method(collectionView:layout:sizeForItemAtIndexPath:))]
111        #[unsafe(method_family = none)]
112        unsafe fn collectionView_layout_sizeForItemAtIndexPath(
113            &self,
114            collection_view: &UICollectionView,
115            collection_view_layout: &UICollectionViewLayout,
116            index_path: &NSIndexPath,
117        ) -> CGSize;
118
119        #[cfg(all(
120            feature = "UICollectionViewLayout",
121            feature = "UIGeometry",
122            feature = "UIResponder",
123            feature = "UIView",
124            feature = "objc2-core-foundation"
125        ))]
126        #[optional]
127        #[unsafe(method(collectionView:layout:insetForSectionAtIndex:))]
128        #[unsafe(method_family = none)]
129        unsafe fn collectionView_layout_insetForSectionAtIndex(
130            &self,
131            collection_view: &UICollectionView,
132            collection_view_layout: &UICollectionViewLayout,
133            section: NSInteger,
134        ) -> UIEdgeInsets;
135
136        #[cfg(all(
137            feature = "UICollectionViewLayout",
138            feature = "UIResponder",
139            feature = "UIView",
140            feature = "objc2-core-foundation"
141        ))]
142        #[optional]
143        #[unsafe(method(collectionView:layout:minimumLineSpacingForSectionAtIndex:))]
144        #[unsafe(method_family = none)]
145        unsafe fn collectionView_layout_minimumLineSpacingForSectionAtIndex(
146            &self,
147            collection_view: &UICollectionView,
148            collection_view_layout: &UICollectionViewLayout,
149            section: NSInteger,
150        ) -> CGFloat;
151
152        #[cfg(all(
153            feature = "UICollectionViewLayout",
154            feature = "UIResponder",
155            feature = "UIView",
156            feature = "objc2-core-foundation"
157        ))]
158        #[optional]
159        #[unsafe(method(collectionView:layout:minimumInteritemSpacingForSectionAtIndex:))]
160        #[unsafe(method_family = none)]
161        unsafe fn collectionView_layout_minimumInteritemSpacingForSectionAtIndex(
162            &self,
163            collection_view: &UICollectionView,
164            collection_view_layout: &UICollectionViewLayout,
165            section: NSInteger,
166        ) -> CGFloat;
167
168        #[cfg(all(
169            feature = "UICollectionViewLayout",
170            feature = "UIResponder",
171            feature = "UIView",
172            feature = "objc2-core-foundation"
173        ))]
174        #[optional]
175        #[unsafe(method(collectionView:layout:referenceSizeForHeaderInSection:))]
176        #[unsafe(method_family = none)]
177        unsafe fn collectionView_layout_referenceSizeForHeaderInSection(
178            &self,
179            collection_view: &UICollectionView,
180            collection_view_layout: &UICollectionViewLayout,
181            section: NSInteger,
182        ) -> CGSize;
183
184        #[cfg(all(
185            feature = "UICollectionViewLayout",
186            feature = "UIResponder",
187            feature = "UIView",
188            feature = "objc2-core-foundation"
189        ))]
190        #[optional]
191        #[unsafe(method(collectionView:layout:referenceSizeForFooterInSection:))]
192        #[unsafe(method_family = none)]
193        unsafe fn collectionView_layout_referenceSizeForFooterInSection(
194            &self,
195            collection_view: &UICollectionView,
196            collection_view_layout: &UICollectionViewLayout,
197            section: NSInteger,
198        ) -> CGSize;
199    }
200);
201
202extern_class!(
203    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewflowlayout?language=objc)
204    #[unsafe(super(UICollectionViewLayout, NSObject))]
205    #[thread_kind = MainThreadOnly]
206    #[derive(Debug, PartialEq, Eq, Hash)]
207    #[cfg(feature = "UICollectionViewLayout")]
208    pub struct UICollectionViewFlowLayout;
209);
210
211#[cfg(feature = "UICollectionViewLayout")]
212extern_conformance!(
213    unsafe impl NSCoding for UICollectionViewFlowLayout {}
214);
215
216#[cfg(feature = "UICollectionViewLayout")]
217extern_conformance!(
218    unsafe impl NSObjectProtocol for UICollectionViewFlowLayout {}
219);
220
221#[cfg(feature = "UICollectionViewLayout")]
222impl UICollectionViewFlowLayout {
223    extern_methods!(
224        #[cfg(feature = "objc2-core-foundation")]
225        #[unsafe(method(minimumLineSpacing))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn minimumLineSpacing(&self) -> CGFloat;
228
229        #[cfg(feature = "objc2-core-foundation")]
230        /// Setter for [`minimumLineSpacing`][Self::minimumLineSpacing].
231        #[unsafe(method(setMinimumLineSpacing:))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn setMinimumLineSpacing(&self, minimum_line_spacing: CGFloat);
234
235        #[cfg(feature = "objc2-core-foundation")]
236        #[unsafe(method(minimumInteritemSpacing))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn minimumInteritemSpacing(&self) -> CGFloat;
239
240        #[cfg(feature = "objc2-core-foundation")]
241        /// Setter for [`minimumInteritemSpacing`][Self::minimumInteritemSpacing].
242        #[unsafe(method(setMinimumInteritemSpacing:))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn setMinimumInteritemSpacing(&self, minimum_interitem_spacing: CGFloat);
245
246        #[cfg(feature = "objc2-core-foundation")]
247        #[unsafe(method(itemSize))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn itemSize(&self) -> CGSize;
250
251        #[cfg(feature = "objc2-core-foundation")]
252        /// Setter for [`itemSize`][Self::itemSize].
253        #[unsafe(method(setItemSize:))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn setItemSize(&self, item_size: CGSize);
256
257        #[cfg(feature = "objc2-core-foundation")]
258        #[unsafe(method(estimatedItemSize))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn estimatedItemSize(&self) -> CGSize;
261
262        #[cfg(feature = "objc2-core-foundation")]
263        /// Setter for [`estimatedItemSize`][Self::estimatedItemSize].
264        #[unsafe(method(setEstimatedItemSize:))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn setEstimatedItemSize(&self, estimated_item_size: CGSize);
267
268        #[unsafe(method(scrollDirection))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn scrollDirection(&self) -> UICollectionViewScrollDirection;
271
272        /// Setter for [`scrollDirection`][Self::scrollDirection].
273        #[unsafe(method(setScrollDirection:))]
274        #[unsafe(method_family = none)]
275        pub unsafe fn setScrollDirection(&self, scroll_direction: UICollectionViewScrollDirection);
276
277        #[cfg(feature = "objc2-core-foundation")]
278        #[unsafe(method(headerReferenceSize))]
279        #[unsafe(method_family = none)]
280        pub unsafe fn headerReferenceSize(&self) -> CGSize;
281
282        #[cfg(feature = "objc2-core-foundation")]
283        /// Setter for [`headerReferenceSize`][Self::headerReferenceSize].
284        #[unsafe(method(setHeaderReferenceSize:))]
285        #[unsafe(method_family = none)]
286        pub unsafe fn setHeaderReferenceSize(&self, header_reference_size: CGSize);
287
288        #[cfg(feature = "objc2-core-foundation")]
289        #[unsafe(method(footerReferenceSize))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn footerReferenceSize(&self) -> CGSize;
292
293        #[cfg(feature = "objc2-core-foundation")]
294        /// Setter for [`footerReferenceSize`][Self::footerReferenceSize].
295        #[unsafe(method(setFooterReferenceSize:))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn setFooterReferenceSize(&self, footer_reference_size: CGSize);
298
299        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
300        #[unsafe(method(sectionInset))]
301        #[unsafe(method_family = none)]
302        pub unsafe fn sectionInset(&self) -> UIEdgeInsets;
303
304        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
305        /// Setter for [`sectionInset`][Self::sectionInset].
306        #[unsafe(method(setSectionInset:))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn setSectionInset(&self, section_inset: UIEdgeInsets);
309
310        /// The reference boundary that the section insets will be defined as relative to. Defaults to `.fromContentInset`.
311        /// NOTE: Content inset will always be respected at a minimum. For example, if the sectionInsetReference equals `.fromSafeArea`, but the adjusted content inset is greater that the combination of the safe area and section insets, then section content will be aligned with the content inset instead.
312        #[unsafe(method(sectionInsetReference))]
313        #[unsafe(method_family = none)]
314        pub unsafe fn sectionInsetReference(
315            &self,
316        ) -> UICollectionViewFlowLayoutSectionInsetReference;
317
318        /// Setter for [`sectionInsetReference`][Self::sectionInsetReference].
319        #[unsafe(method(setSectionInsetReference:))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn setSectionInsetReference(
322            &self,
323            section_inset_reference: UICollectionViewFlowLayoutSectionInsetReference,
324        );
325
326        #[unsafe(method(sectionHeadersPinToVisibleBounds))]
327        #[unsafe(method_family = none)]
328        pub unsafe fn sectionHeadersPinToVisibleBounds(&self) -> bool;
329
330        /// Setter for [`sectionHeadersPinToVisibleBounds`][Self::sectionHeadersPinToVisibleBounds].
331        #[unsafe(method(setSectionHeadersPinToVisibleBounds:))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn setSectionHeadersPinToVisibleBounds(
334            &self,
335            section_headers_pin_to_visible_bounds: bool,
336        );
337
338        #[unsafe(method(sectionFootersPinToVisibleBounds))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn sectionFootersPinToVisibleBounds(&self) -> bool;
341
342        /// Setter for [`sectionFootersPinToVisibleBounds`][Self::sectionFootersPinToVisibleBounds].
343        #[unsafe(method(setSectionFootersPinToVisibleBounds:))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn setSectionFootersPinToVisibleBounds(
346            &self,
347            section_footers_pin_to_visible_bounds: bool,
348        );
349    );
350}
351
352/// Methods declared on superclass `UICollectionViewLayout`.
353#[cfg(feature = "UICollectionViewLayout")]
354impl UICollectionViewFlowLayout {
355    extern_methods!(
356        #[unsafe(method(init))]
357        #[unsafe(method_family = init)]
358        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
359
360        #[unsafe(method(initWithCoder:))]
361        #[unsafe(method_family = init)]
362        pub unsafe fn initWithCoder(
363            this: Allocated<Self>,
364            coder: &NSCoder,
365        ) -> Option<Retained<Self>>;
366    );
367}
368
369/// Methods declared on superclass `NSObject`.
370#[cfg(feature = "UICollectionViewLayout")]
371impl UICollectionViewFlowLayout {
372    extern_methods!(
373        #[unsafe(method(new))]
374        #[unsafe(method_family = new)]
375        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
376    );
377}