//! 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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumberwithdirectionaltabs?language=objc)
#[cfg(feature = "NSApplication")]
pub static NSAppKitVersionNumberWithDirectionalTabs: NSAppKitVersion = 631.0 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabviewtype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTabViewType(pub NSUInteger);
impl NSTabViewType {
    #[doc(alias = "NSTopTabsBezelBorder")]
    pub const TopTabsBezelBorder: Self = Self(0);
    #[doc(alias = "NSLeftTabsBezelBorder")]
    pub const LeftTabsBezelBorder: Self = Self(1);
    #[doc(alias = "NSBottomTabsBezelBorder")]
    pub const BottomTabsBezelBorder: Self = Self(2);
    #[doc(alias = "NSRightTabsBezelBorder")]
    pub const RightTabsBezelBorder: Self = Self(3);
    #[doc(alias = "NSNoTabsBezelBorder")]
    pub const NoTabsBezelBorder: Self = Self(4);
    #[doc(alias = "NSNoTabsLineBorder")]
    pub const NoTabsLineBorder: Self = Self(5);
    #[doc(alias = "NSNoTabsNoBorder")]
    pub const NoTabsNoBorder: Self = Self(6);
}

unsafe impl Encode for NSTabViewType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSTabViewType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabposition?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTabPosition(pub NSUInteger);
impl NSTabPosition {
    #[doc(alias = "NSTabPositionNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "NSTabPositionTop")]
    pub const Top: Self = Self(1);
    #[doc(alias = "NSTabPositionLeft")]
    pub const Left: Self = Self(2);
    #[doc(alias = "NSTabPositionBottom")]
    pub const Bottom: Self = Self(3);
    #[doc(alias = "NSTabPositionRight")]
    pub const Right: Self = Self(4);
}

unsafe impl Encode for NSTabPosition {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSTabPosition {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabviewbordertype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTabViewBorderType(pub NSUInteger);
impl NSTabViewBorderType {
    #[doc(alias = "NSTabViewBorderTypeNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "NSTabViewBorderTypeLine")]
    pub const Line: Self = Self(1);
    #[doc(alias = "NSTabViewBorderTypeBezel")]
    pub const Bezel: Self = Self(2);
}

unsafe impl Encode for NSTabViewBorderType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSTabViewBorderType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabview?language=objc)
    #[unsafe(super(NSView, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    pub struct NSTabView;
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibility for NSTabView {}
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for NSTabView {}
);

#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for NSTabView {}
);

#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSAppearanceCustomization for NSTabView {}
);

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSCoding for NSTabView {}
);

#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSDraggingDestination for NSTabView {}
);

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSTabView {}
);

#[cfg(all(
    feature = "NSResponder",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for NSTabView {}
);

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSTabView {
    extern_methods!(
        #[cfg(feature = "NSTabViewItem")]
        #[unsafe(method(selectTabViewItem:))]
        #[unsafe(method_family = none)]
        pub fn selectTabViewItem(&self, tab_view_item: Option<&NSTabViewItem>);

        #[unsafe(method(selectTabViewItemAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn selectTabViewItemAtIndex(&self, index: NSInteger);

        /// # Safety
        ///
        /// `identifier` should be of the correct type.
        #[unsafe(method(selectTabViewItemWithIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectTabViewItemWithIdentifier(&self, identifier: &AnyObject);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(takeSelectedTabViewItemFromSender:))]
        #[unsafe(method_family = none)]
        pub unsafe fn takeSelectedTabViewItemFromSender(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(selectFirstTabViewItem:))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectFirstTabViewItem(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(selectLastTabViewItem:))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectLastTabViewItem(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(selectNextTabViewItem:))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectNextTabViewItem(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(selectPreviousTabViewItem:))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectPreviousTabViewItem(&self, sender: Option<&AnyObject>);

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

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

        #[cfg(feature = "NSFont")]
        /// Setter for [`font`][Self::font].
        #[unsafe(method(setFont:))]
        #[unsafe(method_family = none)]
        pub fn setFont(&self, font: &NSFont);

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

        /// Setter for [`tabViewType`][Self::tabViewType].
        #[unsafe(method(setTabViewType:))]
        #[unsafe(method_family = none)]
        pub fn setTabViewType(&self, tab_view_type: NSTabViewType);

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

        /// Setter for [`tabPosition`][Self::tabPosition].
        #[unsafe(method(setTabPosition:))]
        #[unsafe(method_family = none)]
        pub fn setTabPosition(&self, tab_position: NSTabPosition);

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

        /// Setter for [`tabViewBorderType`][Self::tabViewBorderType].
        #[unsafe(method(setTabViewBorderType:))]
        #[unsafe(method_family = none)]
        pub fn setTabViewBorderType(&self, tab_view_border_type: NSTabViewBorderType);

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

        #[cfg(feature = "NSTabViewItem")]
        /// Setter for [`tabViewItems`][Self::tabViewItems].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setTabViewItems:))]
        #[unsafe(method_family = none)]
        pub fn setTabViewItems(&self, tab_view_items: &NSArray<NSTabViewItem>);

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

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

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

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

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

        #[cfg(feature = "NSCell")]
        #[unsafe(method(controlSize))]
        #[unsafe(method_family = none)]
        pub fn controlSize(&self) -> NSControlSize;

        #[cfg(feature = "NSCell")]
        /// Setter for [`controlSize`][Self::controlSize].
        #[unsafe(method(setControlSize:))]
        #[unsafe(method_family = none)]
        pub fn setControlSize(&self, control_size: NSControlSize);

        #[cfg(feature = "NSTabViewItem")]
        #[unsafe(method(addTabViewItem:))]
        #[unsafe(method_family = none)]
        pub fn addTabViewItem(&self, tab_view_item: &NSTabViewItem);

        #[cfg(feature = "NSTabViewItem")]
        #[unsafe(method(insertTabViewItem:atIndex:))]
        #[unsafe(method_family = none)]
        pub fn insertTabViewItem_atIndex(&self, tab_view_item: &NSTabViewItem, index: NSInteger);

        #[cfg(feature = "NSTabViewItem")]
        #[unsafe(method(removeTabViewItem:))]
        #[unsafe(method_family = none)]
        pub fn removeTabViewItem(&self, tab_view_item: &NSTabViewItem);

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSTabViewDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSTabViewDelegate>>);

        #[cfg(feature = "NSTabViewItem")]
        #[unsafe(method(tabViewItemAtPoint:))]
        #[unsafe(method_family = none)]
        pub fn tabViewItemAtPoint(&self, point: NSPoint) -> Option<Retained<NSTabViewItem>>;

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

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

        #[cfg(feature = "NSTabViewItem")]
        #[unsafe(method(indexOfTabViewItem:))]
        #[unsafe(method_family = none)]
        pub fn indexOfTabViewItem(&self, tab_view_item: &NSTabViewItem) -> NSInteger;

        #[cfg(feature = "NSTabViewItem")]
        #[unsafe(method(tabViewItemAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn tabViewItemAtIndex(&self, index: NSInteger) -> Retained<NSTabViewItem>;

        /// # Safety
        ///
        /// `identifier` should be of the correct type.
        #[unsafe(method(indexOfTabViewItemWithIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexOfTabViewItemWithIdentifier(&self, identifier: &AnyObject) -> NSInteger;

        #[cfg(feature = "NSCell")]
        #[deprecated = "The controlTint property is not respected on 10.14 and later."]
        #[unsafe(method(controlTint))]
        #[unsafe(method_family = none)]
        pub fn controlTint(&self) -> NSControlTint;

        #[cfg(feature = "NSCell")]
        /// Setter for [`controlTint`][Self::controlTint].
        #[deprecated = "The controlTint property is not respected on 10.14 and later."]
        #[unsafe(method(setControlTint:))]
        #[unsafe(method_family = none)]
        pub fn setControlTint(&self, control_tint: NSControlTint);
    );
}

/// Methods declared on superclass `NSView`.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSTabView {
    extern_methods!(
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

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

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabviewdelegate?language=objc)
    pub unsafe trait NSTabViewDelegate: NSObjectProtocol + MainThreadOnly {
        #[cfg(all(feature = "NSResponder", feature = "NSTabViewItem", feature = "NSView"))]
        #[optional]
        #[unsafe(method(tabView:shouldSelectTabViewItem:))]
        #[unsafe(method_family = none)]
        fn tabView_shouldSelectTabViewItem(
            &self,
            tab_view: &NSTabView,
            tab_view_item: Option<&NSTabViewItem>,
        ) -> bool;

        #[cfg(all(feature = "NSResponder", feature = "NSTabViewItem", feature = "NSView"))]
        #[optional]
        #[unsafe(method(tabView:willSelectTabViewItem:))]
        #[unsafe(method_family = none)]
        fn tabView_willSelectTabViewItem(
            &self,
            tab_view: &NSTabView,
            tab_view_item: Option<&NSTabViewItem>,
        );

        #[cfg(all(feature = "NSResponder", feature = "NSTabViewItem", feature = "NSView"))]
        #[optional]
        #[unsafe(method(tabView:didSelectTabViewItem:))]
        #[unsafe(method_family = none)]
        fn tabView_didSelectTabViewItem(
            &self,
            tab_view: &NSTabView,
            tab_view_item: Option<&NSTabViewItem>,
        );

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[unsafe(method(tabViewDidChangeNumberOfTabViewItems:))]
        #[unsafe(method_family = none)]
        fn tabViewDidChangeNumberOfTabViewItems(&self, tab_view: &NSTabView);
    }
);
