//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstreecontroller?language=objc)
    #[unsafe(super(NSObjectController, NSController, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "NSController", feature = "NSObjectController"))]
    pub struct NSTreeController;
);

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

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

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

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

#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
impl NSTreeController {
    extern_methods!(
        #[unsafe(method(rearrangeObjects))]
        #[unsafe(method_family = none)]
        pub unsafe fn rearrangeObjects(&self);

        #[cfg(feature = "NSTreeNode")]
        #[unsafe(method(arrangedObjects))]
        #[unsafe(method_family = none)]
        pub unsafe fn arrangedObjects(&self) -> Retained<NSTreeNode>;

        #[unsafe(method(childrenKeyPath))]
        #[unsafe(method_family = none)]
        pub unsafe fn childrenKeyPath(&self) -> Option<Retained<NSString>>;

        /// Setter for [`childrenKeyPath`][Self::childrenKeyPath].
        #[unsafe(method(setChildrenKeyPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setChildrenKeyPath(&self, children_key_path: Option<&NSString>);

        #[unsafe(method(countKeyPath))]
        #[unsafe(method_family = none)]
        pub unsafe fn countKeyPath(&self) -> Option<Retained<NSString>>;

        /// Setter for [`countKeyPath`][Self::countKeyPath].
        #[unsafe(method(setCountKeyPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCountKeyPath(&self, count_key_path: Option<&NSString>);

        #[unsafe(method(leafKeyPath))]
        #[unsafe(method_family = none)]
        pub unsafe fn leafKeyPath(&self) -> Option<Retained<NSString>>;

        /// Setter for [`leafKeyPath`][Self::leafKeyPath].
        #[unsafe(method(setLeafKeyPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLeafKeyPath(&self, leaf_key_path: Option<&NSString>);

        #[unsafe(method(sortDescriptors))]
        #[unsafe(method_family = none)]
        pub unsafe fn sortDescriptors(&self) -> Retained<NSArray<NSSortDescriptor>>;

        /// Setter for [`sortDescriptors`][Self::sortDescriptors].
        #[unsafe(method(setSortDescriptors:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSortDescriptors(&self, sort_descriptors: &NSArray<NSSortDescriptor>);

        #[unsafe(method(content))]
        #[unsafe(method_family = none)]
        pub unsafe fn content(&self) -> Option<Retained<AnyObject>>;

        /// Setter for [`content`][Self::content].
        #[unsafe(method(setContent:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setContent(&self, content: Option<&AnyObject>);

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

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

        #[unsafe(method(addChild:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addChild(&self, sender: Option<&AnyObject>);

        #[unsafe(method(insert:))]
        #[unsafe(method_family = none)]
        pub unsafe fn insert(&self, sender: Option<&AnyObject>);

        #[unsafe(method(insertChild:))]
        #[unsafe(method_family = none)]
        pub unsafe fn insertChild(&self, sender: Option<&AnyObject>);

        #[unsafe(method(canInsert))]
        #[unsafe(method_family = none)]
        pub unsafe fn canInsert(&self) -> bool;

        #[unsafe(method(canInsertChild))]
        #[unsafe(method_family = none)]
        pub unsafe fn canInsertChild(&self) -> bool;

        #[unsafe(method(canAddChild))]
        #[unsafe(method_family = none)]
        pub unsafe fn canAddChild(&self) -> bool;

        #[unsafe(method(insertObject:atArrangedObjectIndexPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn insertObject_atArrangedObjectIndexPath(
            &self,
            object: Option<&AnyObject>,
            index_path: &NSIndexPath,
        );

        #[unsafe(method(insertObjects:atArrangedObjectIndexPaths:))]
        #[unsafe(method_family = none)]
        pub unsafe fn insertObjects_atArrangedObjectIndexPaths(
            &self,
            objects: &NSArray,
            index_paths: &NSArray<NSIndexPath>,
        );

        #[unsafe(method(removeObjectAtArrangedObjectIndexPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeObjectAtArrangedObjectIndexPath(&self, index_path: &NSIndexPath);

        #[unsafe(method(removeObjectsAtArrangedObjectIndexPaths:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeObjectsAtArrangedObjectIndexPaths(
            &self,
            index_paths: &NSArray<NSIndexPath>,
        );

        #[unsafe(method(avoidsEmptySelection))]
        #[unsafe(method_family = none)]
        pub unsafe fn avoidsEmptySelection(&self) -> bool;

        /// Setter for [`avoidsEmptySelection`][Self::avoidsEmptySelection].
        #[unsafe(method(setAvoidsEmptySelection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAvoidsEmptySelection(&self, avoids_empty_selection: bool);

        #[unsafe(method(preservesSelection))]
        #[unsafe(method_family = none)]
        pub unsafe fn preservesSelection(&self) -> bool;

        /// Setter for [`preservesSelection`][Self::preservesSelection].
        #[unsafe(method(setPreservesSelection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPreservesSelection(&self, preserves_selection: bool);

        #[unsafe(method(selectsInsertedObjects))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectsInsertedObjects(&self) -> bool;

        /// Setter for [`selectsInsertedObjects`][Self::selectsInsertedObjects].
        #[unsafe(method(setSelectsInsertedObjects:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSelectsInsertedObjects(&self, selects_inserted_objects: bool);

        #[unsafe(method(alwaysUsesMultipleValuesMarker))]
        #[unsafe(method_family = none)]
        pub unsafe fn alwaysUsesMultipleValuesMarker(&self) -> bool;

        /// Setter for [`alwaysUsesMultipleValuesMarker`][Self::alwaysUsesMultipleValuesMarker].
        #[unsafe(method(setAlwaysUsesMultipleValuesMarker:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAlwaysUsesMultipleValuesMarker(
            &self,
            always_uses_multiple_values_marker: bool,
        );

        #[unsafe(method(selectedObjects))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectedObjects(&self) -> Retained<NSArray>;

        #[unsafe(method(setSelectionIndexPaths:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSelectionIndexPaths(&self, index_paths: &NSArray<NSIndexPath>) -> bool;

        #[unsafe(method(selectionIndexPaths))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectionIndexPaths(&self) -> Retained<NSArray<NSIndexPath>>;

        #[unsafe(method(setSelectionIndexPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSelectionIndexPath(&self, index_path: Option<&NSIndexPath>) -> bool;

        #[unsafe(method(selectionIndexPath))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectionIndexPath(&self) -> Option<Retained<NSIndexPath>>;

        #[unsafe(method(addSelectionIndexPaths:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addSelectionIndexPaths(&self, index_paths: &NSArray<NSIndexPath>) -> bool;

        #[unsafe(method(removeSelectionIndexPaths:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeSelectionIndexPaths(&self, index_paths: &NSArray<NSIndexPath>) -> bool;

        #[cfg(feature = "NSTreeNode")]
        #[unsafe(method(selectedNodes))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectedNodes(&self) -> Retained<NSArray<NSTreeNode>>;

        #[cfg(feature = "NSTreeNode")]
        #[unsafe(method(moveNode:toIndexPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn moveNode_toIndexPath(&self, node: &NSTreeNode, index_path: &NSIndexPath);

        #[cfg(feature = "NSTreeNode")]
        #[unsafe(method(moveNodes:toIndexPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn moveNodes_toIndexPath(
            &self,
            nodes: &NSArray<NSTreeNode>,
            starting_index_path: &NSIndexPath,
        );

        #[cfg(feature = "NSTreeNode")]
        #[unsafe(method(childrenKeyPathForNode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn childrenKeyPathForNode(
            &self,
            node: &NSTreeNode,
        ) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSTreeNode")]
        #[unsafe(method(countKeyPathForNode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn countKeyPathForNode(&self, node: &NSTreeNode) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSTreeNode")]
        #[unsafe(method(leafKeyPathForNode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn leafKeyPathForNode(&self, node: &NSTreeNode) -> Option<Retained<NSString>>;
    );
}

/// Methods declared on superclass `NSObjectController`.
#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
impl NSTreeController {
    extern_methods!(
        #[unsafe(method(initWithContent:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContent(
            this: Allocated<Self>,
            content: Option<&AnyObject>,
        ) -> Retained<Self>;

        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSController`.
#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
impl NSTreeController {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
impl NSTreeController {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}
