objc2_app_kit/generated/
NSDiffableDataSource.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdiffabledatasourcesnapshot?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct NSDiffableDataSourceSnapshot<
15        SectionIdentifierType: ?Sized = AnyObject,
16        ItemIdentifierType: ?Sized = AnyObject,
17    >;
18);
19
20extern_conformance!(
21    unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSCopying
22        for NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
23    {
24    }
25);
26
27unsafe impl<SectionIdentifierType: ?Sized + Message, ItemIdentifierType: ?Sized + Message>
28    CopyingHelper for NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
29{
30    type Result = Self;
31}
32
33extern_conformance!(
34    unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSObjectProtocol
35        for NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
36    {
37    }
38);
39
40impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
41    NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
42{
43    extern_methods!(
44        #[unsafe(method(numberOfItems))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn numberOfItems(&self) -> NSInteger;
47
48        #[unsafe(method(numberOfSections))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn numberOfSections(&self) -> NSInteger;
51
52        #[unsafe(method(sectionIdentifiers))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn sectionIdentifiers(&self) -> Retained<NSArray<SectionIdentifierType>>;
55
56        #[unsafe(method(itemIdentifiers))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn itemIdentifiers(&self) -> Retained<NSArray<ItemIdentifierType>>;
59
60        #[unsafe(method(numberOfItemsInSection:))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn numberOfItemsInSection(
63            &self,
64            section_identifier: &SectionIdentifierType,
65        ) -> NSInteger;
66
67        #[unsafe(method(itemIdentifiersInSectionWithIdentifier:))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn itemIdentifiersInSectionWithIdentifier(
70            &self,
71            section_identifier: &SectionIdentifierType,
72        ) -> Retained<NSArray<ItemIdentifierType>>;
73
74        #[unsafe(method(sectionIdentifierForSectionContainingItemIdentifier:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn sectionIdentifierForSectionContainingItemIdentifier(
77            &self,
78            item_identifier: &ItemIdentifierType,
79        ) -> Option<Retained<SectionIdentifierType>>;
80
81        #[unsafe(method(indexOfItemIdentifier:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn indexOfItemIdentifier(
84            &self,
85            item_identifier: &ItemIdentifierType,
86        ) -> NSInteger;
87
88        #[unsafe(method(indexOfSectionIdentifier:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn indexOfSectionIdentifier(
91            &self,
92            section_identifier: &SectionIdentifierType,
93        ) -> NSInteger;
94
95        #[unsafe(method(appendItemsWithIdentifiers:))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn appendItemsWithIdentifiers(&self, identifiers: &NSArray<ItemIdentifierType>);
98
99        #[unsafe(method(appendItemsWithIdentifiers:intoSectionWithIdentifier:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn appendItemsWithIdentifiers_intoSectionWithIdentifier(
102            &self,
103            identifiers: &NSArray<ItemIdentifierType>,
104            section_identifier: &SectionIdentifierType,
105        );
106
107        #[unsafe(method(insertItemsWithIdentifiers:beforeItemWithIdentifier:))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn insertItemsWithIdentifiers_beforeItemWithIdentifier(
110            &self,
111            identifiers: &NSArray<ItemIdentifierType>,
112            item_identifier: &ItemIdentifierType,
113        );
114
115        #[unsafe(method(insertItemsWithIdentifiers:afterItemWithIdentifier:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn insertItemsWithIdentifiers_afterItemWithIdentifier(
118            &self,
119            identifiers: &NSArray<ItemIdentifierType>,
120            item_identifier: &ItemIdentifierType,
121        );
122
123        #[unsafe(method(deleteItemsWithIdentifiers:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn deleteItemsWithIdentifiers(&self, identifiers: &NSArray<ItemIdentifierType>);
126
127        #[unsafe(method(deleteAllItems))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn deleteAllItems(&self);
130
131        #[unsafe(method(moveItemWithIdentifier:beforeItemWithIdentifier:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn moveItemWithIdentifier_beforeItemWithIdentifier(
134            &self,
135            from_identifier: &ItemIdentifierType,
136            to_identifier: &ItemIdentifierType,
137        );
138
139        #[unsafe(method(moveItemWithIdentifier:afterItemWithIdentifier:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn moveItemWithIdentifier_afterItemWithIdentifier(
142            &self,
143            from_identifier: &ItemIdentifierType,
144            to_identifier: &ItemIdentifierType,
145        );
146
147        #[unsafe(method(reloadItemsWithIdentifiers:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn reloadItemsWithIdentifiers(&self, identifiers: &NSArray<ItemIdentifierType>);
150
151        #[unsafe(method(appendSectionsWithIdentifiers:))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn appendSectionsWithIdentifiers(
154            &self,
155            section_identifiers: &NSArray<SectionIdentifierType>,
156        );
157
158        #[unsafe(method(insertSectionsWithIdentifiers:beforeSectionWithIdentifier:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn insertSectionsWithIdentifiers_beforeSectionWithIdentifier(
161            &self,
162            section_identifiers: &NSArray<SectionIdentifierType>,
163            to_section_identifier: &SectionIdentifierType,
164        );
165
166        #[unsafe(method(insertSectionsWithIdentifiers:afterSectionWithIdentifier:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn insertSectionsWithIdentifiers_afterSectionWithIdentifier(
169            &self,
170            section_identifiers: &NSArray<SectionIdentifierType>,
171            to_section_identifier: &SectionIdentifierType,
172        );
173
174        #[unsafe(method(deleteSectionsWithIdentifiers:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn deleteSectionsWithIdentifiers(
177            &self,
178            section_identifiers: &NSArray<SectionIdentifierType>,
179        );
180
181        #[unsafe(method(moveSectionWithIdentifier:beforeSectionWithIdentifier:))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn moveSectionWithIdentifier_beforeSectionWithIdentifier(
184            &self,
185            from_section_identifier: &SectionIdentifierType,
186            to_section_identifier: &SectionIdentifierType,
187        );
188
189        #[unsafe(method(moveSectionWithIdentifier:afterSectionWithIdentifier:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn moveSectionWithIdentifier_afterSectionWithIdentifier(
192            &self,
193            from_section_identifier: &SectionIdentifierType,
194            to_section_identifier: &SectionIdentifierType,
195        );
196
197        #[unsafe(method(reloadSectionsWithIdentifiers:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn reloadSectionsWithIdentifiers(
200            &self,
201            section_identifiers: &NSArray<SectionIdentifierType>,
202        );
203    );
204}
205
206/// Methods declared on superclass `NSObject`.
207impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
208    NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
209{
210    extern_methods!(
211        #[unsafe(method(init))]
212        #[unsafe(method_family = init)]
213        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
214
215        #[unsafe(method(new))]
216        #[unsafe(method_family = new)]
217        pub unsafe fn new() -> Retained<Self>;
218    );
219}
220
221/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionviewdiffabledatasourcesupplementaryviewprovider?language=objc)
222#[cfg(all(
223    feature = "NSCollectionView",
224    feature = "NSResponder",
225    feature = "NSView",
226    feature = "block2"
227))]
228pub type NSCollectionViewDiffableDataSourceSupplementaryViewProvider = *mut block2::DynBlock<
229    dyn Fn(NonNull<NSCollectionView>, NonNull<NSString>, NonNull<NSIndexPath>) -> *mut NSView,
230>;
231
232extern_class!(
233    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionviewdiffabledatasource?language=objc)
234    #[unsafe(super(NSObject))]
235    #[derive(Debug, PartialEq, Eq, Hash)]
236    pub struct NSCollectionViewDiffableDataSource<
237        SectionIdentifierType: ?Sized = AnyObject,
238        ItemIdentifierType: ?Sized = AnyObject,
239    >;
240);
241
242extern_conformance!(
243    unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSObjectProtocol
244        for NSCollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>
245    {
246    }
247);
248
249impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
250    NSCollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>
251{
252    extern_methods!(
253        #[unsafe(method(init))]
254        #[unsafe(method_family = init)]
255        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
256
257        #[unsafe(method(new))]
258        #[unsafe(method_family = new)]
259        pub unsafe fn new() -> Retained<Self>;
260
261        #[unsafe(method(snapshot))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn snapshot(
264            &self,
265        ) -> Retained<NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>>;
266
267        #[unsafe(method(applySnapshot:animatingDifferences:))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn applySnapshot_animatingDifferences(
270            &self,
271            snapshot: &NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
272            animating_differences: bool,
273        );
274
275        #[unsafe(method(itemIdentifierForIndexPath:))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn itemIdentifierForIndexPath(
278            &self,
279            index_path: &NSIndexPath,
280        ) -> Option<Retained<ItemIdentifierType>>;
281
282        #[unsafe(method(indexPathForItemIdentifier:))]
283        #[unsafe(method_family = none)]
284        pub unsafe fn indexPathForItemIdentifier(
285            &self,
286            identifier: &ItemIdentifierType,
287        ) -> Option<Retained<NSIndexPath>>;
288
289        #[cfg(all(
290            feature = "NSCollectionView",
291            feature = "NSResponder",
292            feature = "NSView",
293            feature = "block2"
294        ))]
295        #[unsafe(method(supplementaryViewProvider))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn supplementaryViewProvider(
298            &self,
299            mtm: MainThreadMarker,
300        ) -> NSCollectionViewDiffableDataSourceSupplementaryViewProvider;
301
302        #[cfg(all(
303            feature = "NSCollectionView",
304            feature = "NSResponder",
305            feature = "NSView",
306            feature = "block2"
307        ))]
308        /// Setter for [`supplementaryViewProvider`][Self::supplementaryViewProvider].
309        #[unsafe(method(setSupplementaryViewProvider:))]
310        #[unsafe(method_family = none)]
311        pub unsafe fn setSupplementaryViewProvider(
312            &self,
313            supplementary_view_provider: NSCollectionViewDiffableDataSourceSupplementaryViewProvider,
314        );
315    );
316}