objc2-app-kit 0.2.2

Bindings to the AppKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-data")]
#[cfg(target_vendor = "apple")]
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>,
        ) -> Retained<Self>;

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

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

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

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

        #[method_id(@__retain_semantics Other selectedObjects)]
        pub unsafe fn selectedObjects(&self) -> Retained<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) -> Retained<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>) -> Retained<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) -> Retained<Self>;
    }
);

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

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

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

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

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

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

        #[cfg(feature = "objc2-core-data")]
        #[cfg(target_vendor = "apple")]
        #[method(fetchWithRequest:merge:error:_)]
        pub unsafe fn fetchWithRequest_merge_error(
            &self,
            fetch_request: Option<&NSFetchRequest>,
            merge: bool,
        ) -> Result<(), Retained<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")]
        #[cfg(target_vendor = "apple")]
        #[method_id(@__retain_semantics Other defaultFetchRequest)]
        pub unsafe fn defaultFetchRequest(&self) -> Retained<NSFetchRequest>;
    }
);