1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-data")]
use objc2_core_data::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSController")]
    pub struct NSObjectController;

    #[cfg(feature = "NSController")]
    unsafe impl ClassType for NSObjectController {
        #[inherits(NSObject)]
        type Super = NSController;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(feature = "NSController")]
unsafe impl NSCoding for NSObjectController {}

#[cfg(all(feature = "NSController", feature = "NSKeyValueBinding"))]
unsafe impl NSEditor for NSObjectController {}

#[cfg(all(feature = "NSController", feature = "NSKeyValueBinding"))]
unsafe impl NSEditorRegistration for NSObjectController {}

#[cfg(feature = "NSController")]
unsafe impl NSObjectProtocol for NSObjectController {}

extern_methods!(
    #[cfg(feature = "NSController")]
    unsafe impl NSObjectController {
        #[method_id(@__retain_semantics Init initWithContent:)]
        pub unsafe fn initWithContent(
            this: Allocated<Self>,
            content: Option<&AnyObject>,
        ) -> Id<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Option<Id<Self>>;

        #[method_id(@__retain_semantics Other content)]
        pub unsafe fn content(&self) -> Option<Id<AnyObject>>;

        #[method(setContent:)]
        pub unsafe fn setContent(&self, content: Option<&AnyObject>);

        #[method_id(@__retain_semantics Other selection)]
        pub unsafe fn selection(&self) -> Id<AnyObject>;

        #[method_id(@__retain_semantics Other selectedObjects)]
        pub unsafe fn selectedObjects(&self) -> Id<NSArray>;

        #[method(automaticallyPreparesContent)]
        pub unsafe fn automaticallyPreparesContent(&self) -> bool;

        #[method(setAutomaticallyPreparesContent:)]
        pub unsafe fn setAutomaticallyPreparesContent(&self, automatically_prepares_content: bool);

        #[method(prepareContent)]
        pub unsafe fn prepareContent(&self);

        #[method(objectClass)]
        pub unsafe fn objectClass(&self) -> Option<&'static AnyClass>;

        #[method(setObjectClass:)]
        pub unsafe fn setObjectClass(&self, object_class: Option<&AnyClass>);

        #[method_id(@__retain_semantics New newObject)]
        pub unsafe fn newObject(&self) -> Id<AnyObject>;

        #[method(addObject:)]
        pub unsafe fn addObject(&self, object: &AnyObject);

        #[method(removeObject:)]
        pub unsafe fn removeObject(&self, object: &AnyObject);

        #[method(isEditable)]
        pub unsafe fn isEditable(&self) -> bool;

        #[method(setEditable:)]
        pub unsafe fn setEditable(&self, editable: bool);

        #[method(add:)]
        pub unsafe fn add(&self, sender: Option<&AnyObject>);

        #[method(canAdd)]
        pub unsafe fn canAdd(&self) -> bool;

        #[method(remove:)]
        pub unsafe fn remove(&self, sender: Option<&AnyObject>);

        #[method(canRemove)]
        pub unsafe fn canRemove(&self) -> bool;

        #[cfg(feature = "NSUserInterfaceValidation")]
        #[method(validateUserInterfaceItem:)]
        pub unsafe fn validateUserInterfaceItem(
            &self,
            item: &ProtocolObject<dyn NSValidatedUserInterfaceItem>,
        ) -> bool;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSController`
    #[cfg(feature = "NSController")]
    unsafe impl NSObjectController {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "NSController")]
    unsafe impl NSObjectController {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Id<Self>;
    }
);

extern_methods!(
    /// NSManagedController
    #[cfg(feature = "NSController")]
    unsafe impl NSObjectController {
        #[cfg(feature = "objc2-core-data")]
        #[method_id(@__retain_semantics Other managedObjectContext)]
        pub unsafe fn managedObjectContext(&self) -> Option<Id<NSManagedObjectContext>>;

        #[cfg(feature = "objc2-core-data")]
        #[method(setManagedObjectContext:)]
        pub unsafe fn setManagedObjectContext(
            &self,
            managed_object_context: Option<&NSManagedObjectContext>,
        );

        #[method_id(@__retain_semantics Other entityName)]
        pub unsafe fn entityName(&self) -> Option<Id<NSString>>;

        #[method(setEntityName:)]
        pub unsafe fn setEntityName(&self, entity_name: Option<&NSString>);

        #[method_id(@__retain_semantics Other fetchPredicate)]
        pub unsafe fn fetchPredicate(&self) -> Option<Id<NSPredicate>>;

        #[method(setFetchPredicate:)]
        pub unsafe fn setFetchPredicate(&self, fetch_predicate: Option<&NSPredicate>);

        #[cfg(feature = "objc2-core-data")]
        #[method(fetchWithRequest:merge:error:_)]
        pub unsafe fn fetchWithRequest_merge_error(
            &self,
            fetch_request: Option<&NSFetchRequest>,
            merge: bool,
        ) -> Result<(), Id<NSError>>;

        #[method(fetch:)]
        pub unsafe fn fetch(&self, sender: Option<&AnyObject>);

        #[method(usesLazyFetching)]
        pub unsafe fn usesLazyFetching(&self) -> bool;

        #[method(setUsesLazyFetching:)]
        pub unsafe fn setUsesLazyFetching(&self, uses_lazy_fetching: bool);

        #[cfg(feature = "objc2-core-data")]
        #[method_id(@__retain_semantics Other defaultFetchRequest)]
        pub unsafe fn defaultFetchRequest(&self) -> Id<NSFetchRequest>;
    }
);