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