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")]
55unsafe impl NSObjectProtocol for NSCollectionViewFlowLayoutInvalidationContext {}
56
57#[cfg(feature = "NSCollectionViewLayout")]
58impl NSCollectionViewFlowLayoutInvalidationContext {
59 extern_methods!(
60 #[unsafe(method(invalidateFlowLayoutDelegateMetrics))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn invalidateFlowLayoutDelegateMetrics(&self) -> bool;
63
64 #[unsafe(method(setInvalidateFlowLayoutDelegateMetrics:))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn setInvalidateFlowLayoutDelegateMetrics(
68 &self,
69 invalidate_flow_layout_delegate_metrics: bool,
70 );
71
72 #[unsafe(method(invalidateFlowLayoutAttributes))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn invalidateFlowLayoutAttributes(&self) -> bool;
75
76 #[unsafe(method(setInvalidateFlowLayoutAttributes:))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn setInvalidateFlowLayoutAttributes(
80 &self,
81 invalidate_flow_layout_attributes: bool,
82 );
83 );
84}
85
86#[cfg(feature = "NSCollectionViewLayout")]
88impl NSCollectionViewFlowLayoutInvalidationContext {
89 extern_methods!(
90 #[unsafe(method(init))]
91 #[unsafe(method_family = init)]
92 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
93
94 #[unsafe(method(new))]
95 #[unsafe(method_family = new)]
96 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
97 );
98}
99
100extern_protocol!(
101 #[cfg(feature = "NSCollectionView")]
103 pub unsafe trait NSCollectionViewDelegateFlowLayout:
104 NSCollectionViewDelegate + MainThreadOnly
105 {
106 #[cfg(all(
107 feature = "NSCollectionViewLayout",
108 feature = "NSResponder",
109 feature = "NSView"
110 ))]
111 #[optional]
112 #[unsafe(method(collectionView:layout:sizeForItemAtIndexPath:))]
113 #[unsafe(method_family = none)]
114 unsafe fn collectionView_layout_sizeForItemAtIndexPath(
115 &self,
116 collection_view: &NSCollectionView,
117 collection_view_layout: &NSCollectionViewLayout,
118 index_path: &NSIndexPath,
119 ) -> NSSize;
120
121 #[cfg(all(
122 feature = "NSCollectionViewLayout",
123 feature = "NSResponder",
124 feature = "NSView"
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: &NSCollectionView,
132 collection_view_layout: &NSCollectionViewLayout,
133 section: NSInteger,
134 ) -> NSEdgeInsets;
135
136 #[cfg(all(
137 feature = "NSCollectionViewLayout",
138 feature = "NSResponder",
139 feature = "NSView",
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: &NSCollectionView,
148 collection_view_layout: &NSCollectionViewLayout,
149 section: NSInteger,
150 ) -> CGFloat;
151
152 #[cfg(all(
153 feature = "NSCollectionViewLayout",
154 feature = "NSResponder",
155 feature = "NSView",
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: &NSCollectionView,
164 collection_view_layout: &NSCollectionViewLayout,
165 section: NSInteger,
166 ) -> CGFloat;
167
168 #[cfg(all(
169 feature = "NSCollectionViewLayout",
170 feature = "NSResponder",
171 feature = "NSView"
172 ))]
173 #[optional]
174 #[unsafe(method(collectionView:layout:referenceSizeForHeaderInSection:))]
175 #[unsafe(method_family = none)]
176 unsafe fn collectionView_layout_referenceSizeForHeaderInSection(
177 &self,
178 collection_view: &NSCollectionView,
179 collection_view_layout: &NSCollectionViewLayout,
180 section: NSInteger,
181 ) -> NSSize;
182
183 #[cfg(all(
184 feature = "NSCollectionViewLayout",
185 feature = "NSResponder",
186 feature = "NSView"
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: &NSCollectionView,
194 collection_view_layout: &NSCollectionViewLayout,
195 section: NSInteger,
196 ) -> NSSize;
197 }
198);
199
200extern_class!(
201 #[unsafe(super(NSCollectionViewLayout, NSObject))]
203 #[derive(Debug, PartialEq, Eq, Hash)]
204 #[cfg(feature = "NSCollectionViewLayout")]
205 pub struct NSCollectionViewFlowLayout;
206);
207
208#[cfg(feature = "NSCollectionViewLayout")]
209unsafe impl NSCoding for NSCollectionViewFlowLayout {}
210
211#[cfg(feature = "NSCollectionViewLayout")]
212unsafe impl NSObjectProtocol for NSCollectionViewFlowLayout {}
213
214#[cfg(feature = "NSCollectionViewLayout")]
215impl NSCollectionViewFlowLayout {
216 extern_methods!(
217 #[cfg(feature = "objc2-core-foundation")]
218 #[unsafe(method(minimumLineSpacing))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn minimumLineSpacing(&self) -> CGFloat;
221
222 #[cfg(feature = "objc2-core-foundation")]
223 #[unsafe(method(setMinimumLineSpacing:))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn setMinimumLineSpacing(&self, minimum_line_spacing: CGFloat);
227
228 #[cfg(feature = "objc2-core-foundation")]
229 #[unsafe(method(minimumInteritemSpacing))]
230 #[unsafe(method_family = none)]
231 pub unsafe fn minimumInteritemSpacing(&self) -> CGFloat;
232
233 #[cfg(feature = "objc2-core-foundation")]
234 #[unsafe(method(setMinimumInteritemSpacing:))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn setMinimumInteritemSpacing(&self, minimum_interitem_spacing: CGFloat);
238
239 #[unsafe(method(itemSize))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn itemSize(&self) -> NSSize;
242
243 #[unsafe(method(setItemSize:))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn setItemSize(&self, item_size: NSSize);
247
248 #[unsafe(method(estimatedItemSize))]
249 #[unsafe(method_family = none)]
250 pub unsafe fn estimatedItemSize(&self) -> NSSize;
251
252 #[unsafe(method(setEstimatedItemSize:))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn setEstimatedItemSize(&self, estimated_item_size: NSSize);
256
257 #[unsafe(method(scrollDirection))]
258 #[unsafe(method_family = none)]
259 pub unsafe fn scrollDirection(&self) -> NSCollectionViewScrollDirection;
260
261 #[unsafe(method(setScrollDirection:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn setScrollDirection(&self, scroll_direction: NSCollectionViewScrollDirection);
265
266 #[unsafe(method(headerReferenceSize))]
267 #[unsafe(method_family = none)]
268 pub unsafe fn headerReferenceSize(&self) -> NSSize;
269
270 #[unsafe(method(setHeaderReferenceSize:))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn setHeaderReferenceSize(&self, header_reference_size: NSSize);
274
275 #[unsafe(method(footerReferenceSize))]
276 #[unsafe(method_family = none)]
277 pub unsafe fn footerReferenceSize(&self) -> NSSize;
278
279 #[unsafe(method(setFooterReferenceSize:))]
281 #[unsafe(method_family = none)]
282 pub unsafe fn setFooterReferenceSize(&self, footer_reference_size: NSSize);
283
284 #[unsafe(method(sectionInset))]
285 #[unsafe(method_family = none)]
286 pub unsafe fn sectionInset(&self) -> NSEdgeInsets;
287
288 #[unsafe(method(setSectionInset:))]
290 #[unsafe(method_family = none)]
291 pub unsafe fn setSectionInset(&self, section_inset: NSEdgeInsets);
292
293 #[unsafe(method(sectionHeadersPinToVisibleBounds))]
294 #[unsafe(method_family = none)]
295 pub unsafe fn sectionHeadersPinToVisibleBounds(&self) -> bool;
296
297 #[unsafe(method(setSectionHeadersPinToVisibleBounds:))]
299 #[unsafe(method_family = none)]
300 pub unsafe fn setSectionHeadersPinToVisibleBounds(
301 &self,
302 section_headers_pin_to_visible_bounds: bool,
303 );
304
305 #[unsafe(method(sectionFootersPinToVisibleBounds))]
306 #[unsafe(method_family = none)]
307 pub unsafe fn sectionFootersPinToVisibleBounds(&self) -> bool;
308
309 #[unsafe(method(setSectionFootersPinToVisibleBounds:))]
311 #[unsafe(method_family = none)]
312 pub unsafe fn setSectionFootersPinToVisibleBounds(
313 &self,
314 section_footers_pin_to_visible_bounds: bool,
315 );
316
317 #[unsafe(method(sectionAtIndexIsCollapsed:))]
318 #[unsafe(method_family = none)]
319 pub unsafe fn sectionAtIndexIsCollapsed(&self, section_index: NSUInteger) -> bool;
320
321 #[unsafe(method(collapseSectionAtIndex:))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn collapseSectionAtIndex(&self, section_index: NSUInteger);
324
325 #[unsafe(method(expandSectionAtIndex:))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn expandSectionAtIndex(&self, section_index: NSUInteger);
328 );
329}
330
331#[cfg(feature = "NSCollectionViewLayout")]
333impl NSCollectionViewFlowLayout {
334 extern_methods!(
335 #[unsafe(method(init))]
336 #[unsafe(method_family = init)]
337 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
338
339 #[unsafe(method(new))]
340 #[unsafe(method_family = new)]
341 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
342 );
343}