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