objc2_app_kit/generated/
NSCollectionViewFlowLayout.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
12#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSCollectionViewScrollDirection(pub NSInteger);
17impl NSCollectionViewScrollDirection {
18 #[doc(alias = "NSCollectionViewScrollDirectionVertical")]
19 pub const Vertical: Self = Self(0);
20 #[doc(alias = "NSCollectionViewScrollDirectionHorizontal")]
21 pub const Horizontal: Self = Self(1);
22}
23
24unsafe impl Encode for NSCollectionViewScrollDirection {
25 const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for NSCollectionViewScrollDirection {
29 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32extern "C" {
33 #[cfg(feature = "NSCollectionView")]
35 pub static NSCollectionElementKindSectionHeader:
36 &'static NSCollectionViewSupplementaryElementKind;
37}
38
39extern "C" {
40 #[cfg(feature = "NSCollectionView")]
42 pub static NSCollectionElementKindSectionFooter:
43 &'static NSCollectionViewSupplementaryElementKind;
44}
45
46extern_class!(
47 #[unsafe(super(NSCollectionViewLayoutInvalidationContext, NSObject))]
49 #[derive(Debug, PartialEq, Eq, Hash)]
50 #[cfg(feature = "NSCollectionViewLayout")]
51 pub struct NSCollectionViewFlowLayoutInvalidationContext;
52);
53
54#[cfg(feature = "NSCollectionViewLayout")]
55extern_conformance!(
56 unsafe impl NSObjectProtocol for NSCollectionViewFlowLayoutInvalidationContext {}
57);
58
59#[cfg(feature = "NSCollectionViewLayout")]
60impl NSCollectionViewFlowLayoutInvalidationContext {
61 extern_methods!(
62 #[unsafe(method(invalidateFlowLayoutDelegateMetrics))]
63 #[unsafe(method_family = none)]
64 pub unsafe fn invalidateFlowLayoutDelegateMetrics(&self) -> bool;
65
66 #[unsafe(method(setInvalidateFlowLayoutDelegateMetrics:))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn setInvalidateFlowLayoutDelegateMetrics(
70 &self,
71 invalidate_flow_layout_delegate_metrics: bool,
72 );
73
74 #[unsafe(method(invalidateFlowLayoutAttributes))]
75 #[unsafe(method_family = none)]
76 pub unsafe fn invalidateFlowLayoutAttributes(&self) -> bool;
77
78 #[unsafe(method(setInvalidateFlowLayoutAttributes:))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn setInvalidateFlowLayoutAttributes(
82 &self,
83 invalidate_flow_layout_attributes: bool,
84 );
85 );
86}
87
88#[cfg(feature = "NSCollectionViewLayout")]
90impl NSCollectionViewFlowLayoutInvalidationContext {
91 extern_methods!(
92 #[unsafe(method(init))]
93 #[unsafe(method_family = init)]
94 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
95
96 #[unsafe(method(new))]
97 #[unsafe(method_family = new)]
98 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
99 );
100}
101
102extern_protocol!(
103 #[cfg(feature = "NSCollectionView")]
105 pub unsafe trait NSCollectionViewDelegateFlowLayout:
106 NSCollectionViewDelegate + MainThreadOnly
107 {
108 #[cfg(all(
109 feature = "NSCollectionViewLayout",
110 feature = "NSResponder",
111 feature = "NSView"
112 ))]
113 #[optional]
114 #[unsafe(method(collectionView:layout:sizeForItemAtIndexPath:))]
115 #[unsafe(method_family = none)]
116 unsafe fn collectionView_layout_sizeForItemAtIndexPath(
117 &self,
118 collection_view: &NSCollectionView,
119 collection_view_layout: &NSCollectionViewLayout,
120 index_path: &NSIndexPath,
121 ) -> NSSize;
122
123 #[cfg(all(
124 feature = "NSCollectionViewLayout",
125 feature = "NSResponder",
126 feature = "NSView"
127 ))]
128 #[optional]
129 #[unsafe(method(collectionView:layout:insetForSectionAtIndex:))]
130 #[unsafe(method_family = none)]
131 unsafe fn collectionView_layout_insetForSectionAtIndex(
132 &self,
133 collection_view: &NSCollectionView,
134 collection_view_layout: &NSCollectionViewLayout,
135 section: NSInteger,
136 ) -> NSEdgeInsets;
137
138 #[cfg(all(
139 feature = "NSCollectionViewLayout",
140 feature = "NSResponder",
141 feature = "NSView",
142 feature = "objc2-core-foundation"
143 ))]
144 #[optional]
145 #[unsafe(method(collectionView:layout:minimumLineSpacingForSectionAtIndex:))]
146 #[unsafe(method_family = none)]
147 unsafe fn collectionView_layout_minimumLineSpacingForSectionAtIndex(
148 &self,
149 collection_view: &NSCollectionView,
150 collection_view_layout: &NSCollectionViewLayout,
151 section: NSInteger,
152 ) -> CGFloat;
153
154 #[cfg(all(
155 feature = "NSCollectionViewLayout",
156 feature = "NSResponder",
157 feature = "NSView",
158 feature = "objc2-core-foundation"
159 ))]
160 #[optional]
161 #[unsafe(method(collectionView:layout:minimumInteritemSpacingForSectionAtIndex:))]
162 #[unsafe(method_family = none)]
163 unsafe fn collectionView_layout_minimumInteritemSpacingForSectionAtIndex(
164 &self,
165 collection_view: &NSCollectionView,
166 collection_view_layout: &NSCollectionViewLayout,
167 section: NSInteger,
168 ) -> CGFloat;
169
170 #[cfg(all(
171 feature = "NSCollectionViewLayout",
172 feature = "NSResponder",
173 feature = "NSView"
174 ))]
175 #[optional]
176 #[unsafe(method(collectionView:layout:referenceSizeForHeaderInSection:))]
177 #[unsafe(method_family = none)]
178 unsafe fn collectionView_layout_referenceSizeForHeaderInSection(
179 &self,
180 collection_view: &NSCollectionView,
181 collection_view_layout: &NSCollectionViewLayout,
182 section: NSInteger,
183 ) -> NSSize;
184
185 #[cfg(all(
186 feature = "NSCollectionViewLayout",
187 feature = "NSResponder",
188 feature = "NSView"
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: &NSCollectionView,
196 collection_view_layout: &NSCollectionViewLayout,
197 section: NSInteger,
198 ) -> NSSize;
199 }
200);
201
202extern_class!(
203 #[unsafe(super(NSCollectionViewLayout, NSObject))]
205 #[derive(Debug, PartialEq, Eq, Hash)]
206 #[cfg(feature = "NSCollectionViewLayout")]
207 pub struct NSCollectionViewFlowLayout;
208);
209
210#[cfg(feature = "NSCollectionViewLayout")]
211extern_conformance!(
212 unsafe impl NSCoding for NSCollectionViewFlowLayout {}
213);
214
215#[cfg(feature = "NSCollectionViewLayout")]
216extern_conformance!(
217 unsafe impl NSObjectProtocol for NSCollectionViewFlowLayout {}
218);
219
220#[cfg(feature = "NSCollectionViewLayout")]
221impl NSCollectionViewFlowLayout {
222 extern_methods!(
223 #[cfg(feature = "objc2-core-foundation")]
224 #[unsafe(method(minimumLineSpacing))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn minimumLineSpacing(&self) -> CGFloat;
227
228 #[cfg(feature = "objc2-core-foundation")]
229 #[unsafe(method(setMinimumLineSpacing:))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn setMinimumLineSpacing(&self, minimum_line_spacing: CGFloat);
233
234 #[cfg(feature = "objc2-core-foundation")]
235 #[unsafe(method(minimumInteritemSpacing))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn minimumInteritemSpacing(&self) -> CGFloat;
238
239 #[cfg(feature = "objc2-core-foundation")]
240 #[unsafe(method(setMinimumInteritemSpacing:))]
242 #[unsafe(method_family = none)]
243 pub unsafe fn setMinimumInteritemSpacing(&self, minimum_interitem_spacing: CGFloat);
244
245 #[unsafe(method(itemSize))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn itemSize(&self) -> NSSize;
248
249 #[unsafe(method(setItemSize:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn setItemSize(&self, item_size: NSSize);
253
254 #[unsafe(method(estimatedItemSize))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn estimatedItemSize(&self) -> NSSize;
257
258 #[unsafe(method(setEstimatedItemSize:))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn setEstimatedItemSize(&self, estimated_item_size: NSSize);
262
263 #[unsafe(method(scrollDirection))]
264 #[unsafe(method_family = none)]
265 pub unsafe fn scrollDirection(&self) -> NSCollectionViewScrollDirection;
266
267 #[unsafe(method(setScrollDirection:))]
269 #[unsafe(method_family = none)]
270 pub unsafe fn setScrollDirection(&self, scroll_direction: NSCollectionViewScrollDirection);
271
272 #[unsafe(method(headerReferenceSize))]
273 #[unsafe(method_family = none)]
274 pub unsafe fn headerReferenceSize(&self) -> NSSize;
275
276 #[unsafe(method(setHeaderReferenceSize:))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn setHeaderReferenceSize(&self, header_reference_size: NSSize);
280
281 #[unsafe(method(footerReferenceSize))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn footerReferenceSize(&self) -> NSSize;
284
285 #[unsafe(method(setFooterReferenceSize:))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn setFooterReferenceSize(&self, footer_reference_size: NSSize);
289
290 #[unsafe(method(sectionInset))]
291 #[unsafe(method_family = none)]
292 pub unsafe fn sectionInset(&self) -> NSEdgeInsets;
293
294 #[unsafe(method(setSectionInset:))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn setSectionInset(&self, section_inset: NSEdgeInsets);
298
299 #[unsafe(method(sectionHeadersPinToVisibleBounds))]
300 #[unsafe(method_family = none)]
301 pub unsafe fn sectionHeadersPinToVisibleBounds(&self) -> bool;
302
303 #[unsafe(method(setSectionHeadersPinToVisibleBounds:))]
305 #[unsafe(method_family = none)]
306 pub unsafe fn setSectionHeadersPinToVisibleBounds(
307 &self,
308 section_headers_pin_to_visible_bounds: bool,
309 );
310
311 #[unsafe(method(sectionFootersPinToVisibleBounds))]
312 #[unsafe(method_family = none)]
313 pub unsafe fn sectionFootersPinToVisibleBounds(&self) -> bool;
314
315 #[unsafe(method(setSectionFootersPinToVisibleBounds:))]
317 #[unsafe(method_family = none)]
318 pub unsafe fn setSectionFootersPinToVisibleBounds(
319 &self,
320 section_footers_pin_to_visible_bounds: bool,
321 );
322
323 #[unsafe(method(sectionAtIndexIsCollapsed:))]
324 #[unsafe(method_family = none)]
325 pub unsafe fn sectionAtIndexIsCollapsed(&self, section_index: NSUInteger) -> bool;
326
327 #[unsafe(method(collapseSectionAtIndex:))]
328 #[unsafe(method_family = none)]
329 pub unsafe fn collapseSectionAtIndex(&self, section_index: NSUInteger);
330
331 #[unsafe(method(expandSectionAtIndex:))]
332 #[unsafe(method_family = none)]
333 pub unsafe fn expandSectionAtIndex(&self, section_index: NSUInteger);
334 );
335}
336
337#[cfg(feature = "NSCollectionViewLayout")]
339impl NSCollectionViewFlowLayout {
340 extern_methods!(
341 #[unsafe(method(init))]
342 #[unsafe(method_family = init)]
343 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
344
345 #[unsafe(method(new))]
346 #[unsafe(method_family = new)]
347 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
348 );
349}