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