objc2_app_kit/generated/
NSArrayController.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/nsarraycontroller?language=objc)
12    #[unsafe(super(NSObjectController, NSController, NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    #[cfg(all(feature = "NSController", feature = "NSObjectController"))]
16    pub struct NSArrayController;
17);
18
19#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
20extern_conformance!(
21    unsafe impl NSCoding for NSArrayController {}
22);
23
24#[cfg(all(
25    feature = "NSController",
26    feature = "NSKeyValueBinding",
27    feature = "NSObjectController"
28))]
29extern_conformance!(
30    unsafe impl NSEditor for NSArrayController {}
31);
32
33#[cfg(all(
34    feature = "NSController",
35    feature = "NSKeyValueBinding",
36    feature = "NSObjectController"
37))]
38extern_conformance!(
39    unsafe impl NSEditorRegistration for NSArrayController {}
40);
41
42#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
43extern_conformance!(
44    unsafe impl NSObjectProtocol for NSArrayController {}
45);
46
47#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
48impl NSArrayController {
49    extern_methods!(
50        #[unsafe(method(rearrangeObjects))]
51        #[unsafe(method_family = none)]
52        pub fn rearrangeObjects(&self);
53
54        #[unsafe(method(automaticallyRearrangesObjects))]
55        #[unsafe(method_family = none)]
56        pub fn automaticallyRearrangesObjects(&self) -> bool;
57
58        /// Setter for [`automaticallyRearrangesObjects`][Self::automaticallyRearrangesObjects].
59        #[unsafe(method(setAutomaticallyRearrangesObjects:))]
60        #[unsafe(method_family = none)]
61        pub fn setAutomaticallyRearrangesObjects(&self, automatically_rearranges_objects: bool);
62
63        #[unsafe(method(automaticRearrangementKeyPaths))]
64        #[unsafe(method_family = none)]
65        pub fn automaticRearrangementKeyPaths(&self) -> Option<Retained<NSArray<NSString>>>;
66
67        #[unsafe(method(didChangeArrangementCriteria))]
68        #[unsafe(method_family = none)]
69        pub fn didChangeArrangementCriteria(&self);
70
71        #[unsafe(method(sortDescriptors))]
72        #[unsafe(method_family = none)]
73        pub fn sortDescriptors(&self) -> Retained<NSArray<NSSortDescriptor>>;
74
75        /// Setter for [`sortDescriptors`][Self::sortDescriptors].
76        ///
77        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
78        #[unsafe(method(setSortDescriptors:))]
79        #[unsafe(method_family = none)]
80        pub fn setSortDescriptors(&self, sort_descriptors: &NSArray<NSSortDescriptor>);
81
82        #[unsafe(method(filterPredicate))]
83        #[unsafe(method_family = none)]
84        pub fn filterPredicate(&self) -> Option<Retained<NSPredicate>>;
85
86        /// Setter for [`filterPredicate`][Self::filterPredicate].
87        #[unsafe(method(setFilterPredicate:))]
88        #[unsafe(method_family = none)]
89        pub fn setFilterPredicate(&self, filter_predicate: Option<&NSPredicate>);
90
91        #[unsafe(method(clearsFilterPredicateOnInsertion))]
92        #[unsafe(method_family = none)]
93        pub fn clearsFilterPredicateOnInsertion(&self) -> bool;
94
95        /// Setter for [`clearsFilterPredicateOnInsertion`][Self::clearsFilterPredicateOnInsertion].
96        #[unsafe(method(setClearsFilterPredicateOnInsertion:))]
97        #[unsafe(method_family = none)]
98        pub fn setClearsFilterPredicateOnInsertion(
99            &self,
100            clears_filter_predicate_on_insertion: bool,
101        );
102
103        /// # Safety
104        ///
105        /// `objects` generic should be of the correct type.
106        #[unsafe(method(arrangeObjects:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn arrangeObjects(&self, objects: &NSArray) -> Retained<NSArray>;
109
110        #[unsafe(method(arrangedObjects))]
111        #[unsafe(method_family = none)]
112        pub fn arrangedObjects(&self) -> Retained<AnyObject>;
113
114        #[unsafe(method(avoidsEmptySelection))]
115        #[unsafe(method_family = none)]
116        pub fn avoidsEmptySelection(&self) -> bool;
117
118        /// Setter for [`avoidsEmptySelection`][Self::avoidsEmptySelection].
119        #[unsafe(method(setAvoidsEmptySelection:))]
120        #[unsafe(method_family = none)]
121        pub fn setAvoidsEmptySelection(&self, avoids_empty_selection: bool);
122
123        #[unsafe(method(preservesSelection))]
124        #[unsafe(method_family = none)]
125        pub fn preservesSelection(&self) -> bool;
126
127        /// Setter for [`preservesSelection`][Self::preservesSelection].
128        #[unsafe(method(setPreservesSelection:))]
129        #[unsafe(method_family = none)]
130        pub fn setPreservesSelection(&self, preserves_selection: bool);
131
132        #[unsafe(method(selectsInsertedObjects))]
133        #[unsafe(method_family = none)]
134        pub fn selectsInsertedObjects(&self) -> bool;
135
136        /// Setter for [`selectsInsertedObjects`][Self::selectsInsertedObjects].
137        #[unsafe(method(setSelectsInsertedObjects:))]
138        #[unsafe(method_family = none)]
139        pub fn setSelectsInsertedObjects(&self, selects_inserted_objects: bool);
140
141        #[unsafe(method(alwaysUsesMultipleValuesMarker))]
142        #[unsafe(method_family = none)]
143        pub fn alwaysUsesMultipleValuesMarker(&self) -> bool;
144
145        /// Setter for [`alwaysUsesMultipleValuesMarker`][Self::alwaysUsesMultipleValuesMarker].
146        #[unsafe(method(setAlwaysUsesMultipleValuesMarker:))]
147        #[unsafe(method_family = none)]
148        pub fn setAlwaysUsesMultipleValuesMarker(&self, always_uses_multiple_values_marker: bool);
149
150        #[unsafe(method(setSelectionIndexes:))]
151        #[unsafe(method_family = none)]
152        pub fn setSelectionIndexes(&self, indexes: &NSIndexSet) -> bool;
153
154        #[unsafe(method(selectionIndexes))]
155        #[unsafe(method_family = none)]
156        pub fn selectionIndexes(&self) -> Retained<NSIndexSet>;
157
158        #[unsafe(method(setSelectionIndex:))]
159        #[unsafe(method_family = none)]
160        pub fn setSelectionIndex(&self, index: NSUInteger) -> bool;
161
162        #[unsafe(method(selectionIndex))]
163        #[unsafe(method_family = none)]
164        pub fn selectionIndex(&self) -> NSUInteger;
165
166        #[unsafe(method(addSelectionIndexes:))]
167        #[unsafe(method_family = none)]
168        pub fn addSelectionIndexes(&self, indexes: &NSIndexSet) -> bool;
169
170        #[unsafe(method(removeSelectionIndexes:))]
171        #[unsafe(method_family = none)]
172        pub fn removeSelectionIndexes(&self, indexes: &NSIndexSet) -> bool;
173
174        /// # Safety
175        ///
176        /// `objects` generic should be of the correct type.
177        #[unsafe(method(setSelectedObjects:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setSelectedObjects(&self, objects: &NSArray) -> bool;
180
181        #[unsafe(method(selectedObjects))]
182        #[unsafe(method_family = none)]
183        pub fn selectedObjects(&self) -> Retained<NSArray>;
184
185        /// # Safety
186        ///
187        /// `objects` generic should be of the correct type.
188        #[unsafe(method(addSelectedObjects:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn addSelectedObjects(&self, objects: &NSArray) -> bool;
191
192        /// # Safety
193        ///
194        /// `objects` generic should be of the correct type.
195        #[unsafe(method(removeSelectedObjects:))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn removeSelectedObjects(&self, objects: &NSArray) -> bool;
198
199        /// # Safety
200        ///
201        /// `sender` should be of the correct type.
202        #[unsafe(method(add:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn add(&self, sender: Option<&AnyObject>);
205
206        /// # Safety
207        ///
208        /// `sender` should be of the correct type.
209        #[unsafe(method(remove:))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn remove(&self, sender: Option<&AnyObject>);
212
213        /// # Safety
214        ///
215        /// `sender` should be of the correct type.
216        #[unsafe(method(insert:))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn insert(&self, sender: Option<&AnyObject>);
219
220        #[unsafe(method(canInsert))]
221        #[unsafe(method_family = none)]
222        pub fn canInsert(&self) -> bool;
223
224        /// # Safety
225        ///
226        /// `sender` should be of the correct type.
227        #[unsafe(method(selectNext:))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn selectNext(&self, sender: Option<&AnyObject>);
230
231        /// # Safety
232        ///
233        /// `sender` should be of the correct type.
234        #[unsafe(method(selectPrevious:))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn selectPrevious(&self, sender: Option<&AnyObject>);
237
238        #[unsafe(method(canSelectNext))]
239        #[unsafe(method_family = none)]
240        pub fn canSelectNext(&self) -> bool;
241
242        #[unsafe(method(canSelectPrevious))]
243        #[unsafe(method_family = none)]
244        pub fn canSelectPrevious(&self) -> bool;
245
246        /// # Safety
247        ///
248        /// `object` should be of the correct type.
249        #[unsafe(method(addObject:))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn addObject(&self, object: &AnyObject);
252
253        /// # Safety
254        ///
255        /// `objects` generic should be of the correct type.
256        #[unsafe(method(addObjects:))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn addObjects(&self, objects: &NSArray);
259
260        /// # Safety
261        ///
262        /// `object` should be of the correct type.
263        #[unsafe(method(insertObject:atArrangedObjectIndex:))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn insertObject_atArrangedObjectIndex(
266            &self,
267            object: &AnyObject,
268            index: NSUInteger,
269        );
270
271        /// # Safety
272        ///
273        /// `objects` generic should be of the correct type.
274        #[unsafe(method(insertObjects:atArrangedObjectIndexes:))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn insertObjects_atArrangedObjectIndexes(
277            &self,
278            objects: &NSArray,
279            indexes: &NSIndexSet,
280        );
281
282        #[unsafe(method(removeObjectAtArrangedObjectIndex:))]
283        #[unsafe(method_family = none)]
284        pub fn removeObjectAtArrangedObjectIndex(&self, index: NSUInteger);
285
286        #[unsafe(method(removeObjectsAtArrangedObjectIndexes:))]
287        #[unsafe(method_family = none)]
288        pub fn removeObjectsAtArrangedObjectIndexes(&self, indexes: &NSIndexSet);
289
290        /// # Safety
291        ///
292        /// `object` should be of the correct type.
293        #[unsafe(method(removeObject:))]
294        #[unsafe(method_family = none)]
295        pub unsafe fn removeObject(&self, object: &AnyObject);
296
297        /// # Safety
298        ///
299        /// `objects` generic should be of the correct type.
300        #[unsafe(method(removeObjects:))]
301        #[unsafe(method_family = none)]
302        pub unsafe fn removeObjects(&self, objects: &NSArray);
303    );
304}
305
306/// Methods declared on superclass `NSObjectController`.
307#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
308impl NSArrayController {
309    extern_methods!(
310        /// # Safety
311        ///
312        /// `content` should be of the correct type.
313        #[unsafe(method(initWithContent:))]
314        #[unsafe(method_family = init)]
315        pub unsafe fn initWithContent(
316            this: Allocated<Self>,
317            content: Option<&AnyObject>,
318        ) -> Retained<Self>;
319
320        /// # Safety
321        ///
322        /// `coder` possibly has further requirements.
323        #[unsafe(method(initWithCoder:))]
324        #[unsafe(method_family = init)]
325        pub unsafe fn initWithCoder(
326            this: Allocated<Self>,
327            coder: &NSCoder,
328        ) -> Option<Retained<Self>>;
329    );
330}
331
332/// Methods declared on superclass `NSController`.
333#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
334impl NSArrayController {
335    extern_methods!(
336        #[unsafe(method(init))]
337        #[unsafe(method_family = init)]
338        pub fn init(this: Allocated<Self>) -> Retained<Self>;
339    );
340}
341
342/// Methods declared on superclass `NSObject`.
343#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
344impl NSArrayController {
345    extern_methods!(
346        #[unsafe(method(new))]
347        #[unsafe(method_family = new)]
348        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
349    );
350}