objc2-app-kit 0.3.2

Bindings to the AppKit framework
Documentation
//! 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/nstreenode?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSTreeNode;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for NSTreeNode {}
);

impl NSTreeNode {
    extern_methods!(
        /// # Safety
        ///
        /// `model_object` should be of the correct type.
        #[unsafe(method(treeNodeWithRepresentedObject:))]
        #[unsafe(method_family = none)]
        pub unsafe fn treeNodeWithRepresentedObject(
            model_object: Option<&AnyObject>,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `model_object` should be of the correct type.
        #[unsafe(method(initWithRepresentedObject:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithRepresentedObject(
            this: Allocated<Self>,
            model_object: Option<&AnyObject>,
        ) -> Retained<Self>;

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

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

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

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

        #[unsafe(method(mutableChildNodes))]
        #[unsafe(method_family = none)]
        pub fn mutableChildNodes(&self) -> Retained<NSMutableArray<NSTreeNode>>;

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

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

        #[unsafe(method(sortWithSortDescriptors:recursively:))]
        #[unsafe(method_family = none)]
        pub fn sortWithSortDescriptors_recursively(
            &self,
            sort_descriptors: &NSArray<NSSortDescriptor>,
            recursively: bool,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl NSTreeNode {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSTreeNode {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}