objc2_app_kit/generated/
NSObjectController.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::*;
6#[cfg(feature = "objc2-core-data")]
7#[cfg(target_vendor = "apple")]
8use objc2_core_data::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13extern_class!(
14    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsobjectcontroller?language=objc)
15    #[unsafe(super(NSController, NSObject))]
16    #[thread_kind = MainThreadOnly]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    #[cfg(feature = "NSController")]
19    pub struct NSObjectController;
20);
21
22#[cfg(feature = "NSController")]
23unsafe impl NSCoding for NSObjectController {}
24
25#[cfg(all(feature = "NSController", feature = "NSKeyValueBinding"))]
26unsafe impl NSEditor for NSObjectController {}
27
28#[cfg(all(feature = "NSController", feature = "NSKeyValueBinding"))]
29unsafe impl NSEditorRegistration for NSObjectController {}
30
31#[cfg(feature = "NSController")]
32unsafe impl NSObjectProtocol for NSObjectController {}
33
34#[cfg(feature = "NSController")]
35impl NSObjectController {
36    extern_methods!(
37        #[unsafe(method(initWithContent:))]
38        #[unsafe(method_family = init)]
39        pub unsafe fn initWithContent(
40            this: Allocated<Self>,
41            content: Option<&AnyObject>,
42        ) -> Retained<Self>;
43
44        #[unsafe(method(initWithCoder:))]
45        #[unsafe(method_family = init)]
46        pub unsafe fn initWithCoder(
47            this: Allocated<Self>,
48            coder: &NSCoder,
49        ) -> Option<Retained<Self>>;
50
51        #[unsafe(method(content))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn content(&self) -> Option<Retained<AnyObject>>;
54
55        /// Setter for [`content`][Self::content].
56        #[unsafe(method(setContent:))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn setContent(&self, content: Option<&AnyObject>);
59
60        #[unsafe(method(selection))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn selection(&self) -> Retained<AnyObject>;
63
64        #[unsafe(method(selectedObjects))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn selectedObjects(&self) -> Retained<NSArray>;
67
68        #[unsafe(method(automaticallyPreparesContent))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn automaticallyPreparesContent(&self) -> bool;
71
72        /// Setter for [`automaticallyPreparesContent`][Self::automaticallyPreparesContent].
73        #[unsafe(method(setAutomaticallyPreparesContent:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn setAutomaticallyPreparesContent(&self, automatically_prepares_content: bool);
76
77        #[unsafe(method(prepareContent))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn prepareContent(&self);
80
81        #[unsafe(method(objectClass))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn objectClass(&self) -> Option<&'static AnyClass>;
84
85        /// Setter for [`objectClass`][Self::objectClass].
86        #[unsafe(method(setObjectClass:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn setObjectClass(&self, object_class: Option<&AnyClass>);
89
90        #[unsafe(method(newObject))]
91        #[unsafe(method_family = new)]
92        pub unsafe fn newObject(&self) -> Retained<AnyObject>;
93
94        #[unsafe(method(addObject:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn addObject(&self, object: &AnyObject);
97
98        #[unsafe(method(removeObject:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn removeObject(&self, object: &AnyObject);
101
102        #[unsafe(method(isEditable))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn isEditable(&self) -> bool;
105
106        /// Setter for [`isEditable`][Self::isEditable].
107        #[unsafe(method(setEditable:))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn setEditable(&self, editable: bool);
110
111        #[unsafe(method(add:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn add(&self, sender: Option<&AnyObject>);
114
115        #[unsafe(method(canAdd))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn canAdd(&self) -> bool;
118
119        #[unsafe(method(remove:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn remove(&self, sender: Option<&AnyObject>);
122
123        #[unsafe(method(canRemove))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn canRemove(&self) -> bool;
126
127        #[cfg(feature = "NSUserInterfaceValidation")]
128        #[unsafe(method(validateUserInterfaceItem:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn validateUserInterfaceItem(
131            &self,
132            item: &ProtocolObject<dyn NSValidatedUserInterfaceItem>,
133        ) -> bool;
134    );
135}
136
137/// Methods declared on superclass `NSController`.
138#[cfg(feature = "NSController")]
139impl NSObjectController {
140    extern_methods!(
141        #[unsafe(method(init))]
142        #[unsafe(method_family = init)]
143        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
144    );
145}
146
147/// Methods declared on superclass `NSObject`.
148#[cfg(feature = "NSController")]
149impl NSObjectController {
150    extern_methods!(
151        #[unsafe(method(new))]
152        #[unsafe(method_family = new)]
153        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
154    );
155}
156
157/// NSManagedController.
158#[cfg(feature = "NSController")]
159impl NSObjectController {
160    extern_methods!(
161        #[cfg(feature = "objc2-core-data")]
162        #[cfg(target_vendor = "apple")]
163        #[unsafe(method(managedObjectContext))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn managedObjectContext(&self) -> Option<Retained<NSManagedObjectContext>>;
166
167        #[cfg(feature = "objc2-core-data")]
168        #[cfg(target_vendor = "apple")]
169        /// Setter for [`managedObjectContext`][Self::managedObjectContext].
170        #[unsafe(method(setManagedObjectContext:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn setManagedObjectContext(
173            &self,
174            managed_object_context: Option<&NSManagedObjectContext>,
175        );
176
177        #[unsafe(method(entityName))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn entityName(&self) -> Option<Retained<NSString>>;
180
181        /// Setter for [`entityName`][Self::entityName].
182        #[unsafe(method(setEntityName:))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn setEntityName(&self, entity_name: Option<&NSString>);
185
186        #[unsafe(method(fetchPredicate))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn fetchPredicate(&self) -> Option<Retained<NSPredicate>>;
189
190        /// Setter for [`fetchPredicate`][Self::fetchPredicate].
191        #[unsafe(method(setFetchPredicate:))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn setFetchPredicate(&self, fetch_predicate: Option<&NSPredicate>);
194
195        #[cfg(feature = "objc2-core-data")]
196        #[cfg(target_vendor = "apple")]
197        #[unsafe(method(fetchWithRequest:merge:error:_))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn fetchWithRequest_merge_error(
200            &self,
201            fetch_request: Option<&NSFetchRequest>,
202            merge: bool,
203        ) -> Result<(), Retained<NSError>>;
204
205        #[unsafe(method(fetch:))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn fetch(&self, sender: Option<&AnyObject>);
208
209        #[unsafe(method(usesLazyFetching))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn usesLazyFetching(&self) -> bool;
212
213        /// Setter for [`usesLazyFetching`][Self::usesLazyFetching].
214        #[unsafe(method(setUsesLazyFetching:))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn setUsesLazyFetching(&self, uses_lazy_fetching: bool);
217
218        #[cfg(feature = "objc2-core-data")]
219        #[cfg(target_vendor = "apple")]
220        #[unsafe(method(defaultFetchRequest))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn defaultFetchRequest(&self) -> Retained<NSFetchRequest>;
223    );
224}