//! 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstitleposition?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTitlePosition(pub NSUInteger);
impl NSTitlePosition {
    #[doc(alias = "NSNoTitle")]
    pub const NoTitle: Self = Self(0);
    #[doc(alias = "NSAboveTop")]
    pub const AboveTop: Self = Self(1);
    #[doc(alias = "NSAtTop")]
    pub const AtTop: Self = Self(2);
    #[doc(alias = "NSBelowTop")]
    pub const BelowTop: Self = Self(3);
    #[doc(alias = "NSAboveBottom")]
    pub const AboveBottom: Self = Self(4);
    #[doc(alias = "NSAtBottom")]
    pub const AtBottom: Self = Self(5);
    #[doc(alias = "NSBelowBottom")]
    pub const BelowBottom: Self = Self(6);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsboxtype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBoxType(pub NSUInteger);
impl NSBoxType {
    #[doc(alias = "NSBoxPrimary")]
    pub const Primary: Self = Self(0);
    #[doc(alias = "NSBoxSeparator")]
    pub const Separator: Self = Self(2);
    #[doc(alias = "NSBoxCustom")]
    pub const Custom: Self = Self(4);
}

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

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

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

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

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

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

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

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

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

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

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

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSBox {
    extern_methods!(
        #[unsafe(method(boxType))]
        #[unsafe(method_family = none)]
        pub fn boxType(&self) -> NSBoxType;

        /// Setter for [`boxType`][Self::boxType].
        #[unsafe(method(setBoxType:))]
        #[unsafe(method_family = none)]
        pub fn setBoxType(&self, box_type: NSBoxType);

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

        /// Setter for [`titlePosition`][Self::titlePosition].
        #[unsafe(method(setTitlePosition:))]
        #[unsafe(method_family = none)]
        pub fn setTitlePosition(&self, title_position: NSTitlePosition);

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

        /// Setter for [`title`][Self::title].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setTitle:))]
        #[unsafe(method_family = none)]
        pub fn setTitle(&self, title: &NSString);

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

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

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

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

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

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

        /// Setter for [`contentViewMargins`][Self::contentViewMargins].
        #[unsafe(method(setContentViewMargins:))]
        #[unsafe(method_family = none)]
        pub fn setContentViewMargins(&self, content_view_margins: NSSize);

        #[unsafe(method(sizeToFit))]
        #[unsafe(method_family = none)]
        pub fn sizeToFit(&self);

        #[unsafe(method(setFrameFromContentFrame:))]
        #[unsafe(method_family = none)]
        pub fn setFrameFromContentFrame(&self, content_frame: NSRect);

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

        /// Setter for [`contentView`][Self::contentView].
        #[unsafe(method(setContentView:))]
        #[unsafe(method_family = none)]
        pub fn setContentView(&self, content_view: Option<&NSView>);

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

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

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(borderWidth))]
        #[unsafe(method_family = none)]
        pub fn borderWidth(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`borderWidth`][Self::borderWidth].
        #[unsafe(method(setBorderWidth:))]
        #[unsafe(method_family = none)]
        pub fn setBorderWidth(&self, border_width: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(cornerRadius))]
        #[unsafe(method_family = none)]
        pub fn cornerRadius(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`cornerRadius`][Self::cornerRadius].
        #[unsafe(method(setCornerRadius:))]
        #[unsafe(method_family = none)]
        pub fn setCornerRadius(&self, corner_radius: CGFloat);

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

        #[cfg(feature = "NSColor")]
        /// Setter for [`borderColor`][Self::borderColor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setBorderColor:))]
        #[unsafe(method_family = none)]
        pub fn setBorderColor(&self, border_color: &NSColor);

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

        #[cfg(feature = "NSColor")]
        /// Setter for [`fillColor`][Self::fillColor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setFillColor:))]
        #[unsafe(method_family = none)]
        pub fn setFillColor(&self, fill_color: &NSColor);
    );
}

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

/// NSDeprecated.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSBox {
    extern_methods!(
        #[deprecated = "borderType is only applicable to NSBoxOldStyle, which is deprecated. To replace a borderType of NSNoBorder, use the `transparent` property."]
        #[unsafe(method(borderType))]
        #[unsafe(method_family = none)]
        pub fn borderType(&self) -> NSBorderType;

        /// Setter for [`borderType`][Self::borderType].
        #[deprecated = "borderType is only applicable to NSBoxOldStyle, which is deprecated. To replace a borderType of NSNoBorder, use the `transparent` property."]
        #[unsafe(method(setBorderType:))]
        #[unsafe(method_family = none)]
        pub fn setBorderType(&self, border_type: NSBorderType);

        /// # Safety
        ///
        /// `string_with_ampersand` might not allow `None`.
        #[deprecated]
        #[unsafe(method(setTitleWithMnemonic:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
    );
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsboxsecondary?language=objc)
#[deprecated]
pub static NSBoxSecondary: NSBoxType = NSBoxType(1);

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsboxoldstyle?language=objc)
#[deprecated = "NSBoxOldStyle is discouraged in modern application design. It should be replaced with either NSBoxPrimary or NSBoxCustom."]
pub static NSBoxOldStyle: NSBoxType = NSBoxType(3);
