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!(
#[cfg(feature = "NSController")]
unsafe impl NSObjectController {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
}
);
extern_methods!(
#[cfg(feature = "NSController")]
unsafe impl NSObjectController {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Id<Self>;
}
);
extern_methods!(
#[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>;
}
);