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

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSStackViewGravity(pub NSInteger);
impl NSStackViewGravity {
    #[doc(alias = "NSStackViewGravityTop")]
    pub const Top: Self = Self(1);
    #[doc(alias = "NSStackViewGravityLeading")]
    pub const Leading: Self = Self(1);
    #[doc(alias = "NSStackViewGravityCenter")]
    pub const Center: Self = Self(2);
    #[doc(alias = "NSStackViewGravityBottom")]
    pub const Bottom: Self = Self(3);
    #[doc(alias = "NSStackViewGravityTrailing")]
    pub const Trailing: Self = Self(3);
}

unsafe impl Encode for NSStackViewGravity {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSStackViewDistribution(pub NSInteger);
impl NSStackViewDistribution {
    #[doc(alias = "NSStackViewDistributionGravityAreas")]
    pub const GravityAreas: Self = Self(-1);
    #[doc(alias = "NSStackViewDistributionFill")]
    pub const Fill: Self = Self(0);
    #[doc(alias = "NSStackViewDistributionFillEqually")]
    pub const FillEqually: Self = Self(1);
    #[doc(alias = "NSStackViewDistributionFillProportionally")]
    pub const FillProportionally: Self = Self(2);
    #[doc(alias = "NSStackViewDistributionEqualSpacing")]
    pub const EqualSpacing: Self = Self(3);
    #[doc(alias = "NSStackViewDistributionEqualCentering")]
    pub const EqualCentering: Self = Self(4);
}

unsafe impl Encode for NSStackViewDistribution {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

// NS_TYPED_EXTENSIBLE_ENUM
pub type NSStackViewVisibilityPriority = c_float;

pub static NSStackViewVisibilityPriorityMustHold: NSStackViewVisibilityPriority = 1000 as _;

pub static NSStackViewVisibilityPriorityDetachOnlyIfNecessary: NSStackViewVisibilityPriority =
    900 as _;

pub static NSStackViewVisibilityPriorityNotVisible: NSStackViewVisibilityPriority = 0 as _;

pub static NSStackViewSpacingUseDefault: CGFloat = c_float::MAX as _;

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    pub struct NSStackView;

    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl ClassType for NSStackView {
        #[inherits(NSResponder, NSObject)]
        type Super = NSView;
        type Mutability = MainThreadOnly;
    }
);

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

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

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

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

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCoding for NSStackView {}

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

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSObjectProtocol for NSStackView {}

#[cfg(all(
    feature = "NSResponder",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSStackView {}

extern_methods!(
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSStackView {
        #[method_id(@__retain_semantics Other stackViewWithViews:)]
        pub unsafe fn stackViewWithViews(
            views: &NSArray<NSView>,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSStackViewDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn NSStackViewDelegate>>,
        );

        #[cfg(feature = "NSUserInterfaceLayout")]
        #[method(orientation)]
        pub unsafe fn orientation(&self) -> NSUserInterfaceLayoutOrientation;

        #[cfg(feature = "NSUserInterfaceLayout")]
        #[method(setOrientation:)]
        pub unsafe fn setOrientation(&self, orientation: NSUserInterfaceLayoutOrientation);

        #[cfg(feature = "NSLayoutConstraint")]
        #[method(alignment)]
        pub unsafe fn alignment(&self) -> NSLayoutAttribute;

        #[cfg(feature = "NSLayoutConstraint")]
        #[method(setAlignment:)]
        pub unsafe fn setAlignment(&self, alignment: NSLayoutAttribute);

        #[method(edgeInsets)]
        pub unsafe fn edgeInsets(&self) -> NSEdgeInsets;

        #[method(setEdgeInsets:)]
        pub unsafe fn setEdgeInsets(&self, edge_insets: NSEdgeInsets);

        #[method(distribution)]
        pub unsafe fn distribution(&self) -> NSStackViewDistribution;

        #[method(setDistribution:)]
        pub unsafe fn setDistribution(&self, distribution: NSStackViewDistribution);

        #[method(spacing)]
        pub unsafe fn spacing(&self) -> CGFloat;

        #[method(setSpacing:)]
        pub unsafe fn setSpacing(&self, spacing: CGFloat);

        #[method(setCustomSpacing:afterView:)]
        pub unsafe fn setCustomSpacing_afterView(&self, spacing: CGFloat, view: &NSView);

        #[method(customSpacingAfterView:)]
        pub unsafe fn customSpacingAfterView(&self, view: &NSView) -> CGFloat;

        #[method(detachesHiddenViews)]
        pub unsafe fn detachesHiddenViews(&self) -> bool;

        #[method(setDetachesHiddenViews:)]
        pub unsafe fn setDetachesHiddenViews(&self, detaches_hidden_views: bool);

        #[method_id(@__retain_semantics Other arrangedSubviews)]
        pub unsafe fn arrangedSubviews(&self) -> Retained<NSArray<NSView>>;

        #[method(addArrangedSubview:)]
        pub unsafe fn addArrangedSubview(&self, view: &NSView);

        #[method(insertArrangedSubview:atIndex:)]
        pub unsafe fn insertArrangedSubview_atIndex(&self, view: &NSView, index: NSInteger);

        #[method(removeArrangedSubview:)]
        pub unsafe fn removeArrangedSubview(&self, view: &NSView);

        #[method_id(@__retain_semantics Other detachedViews)]
        pub unsafe fn detachedViews(&self) -> Retained<NSArray<NSView>>;

        #[method(setVisibilityPriority:forView:)]
        pub unsafe fn setVisibilityPriority_forView(
            &self,
            priority: NSStackViewVisibilityPriority,
            view: &NSView,
        );

        #[method(visibilityPriorityForView:)]
        pub unsafe fn visibilityPriorityForView(
            &self,
            view: &NSView,
        ) -> NSStackViewVisibilityPriority;

        #[cfg(feature = "NSLayoutConstraint")]
        #[method(clippingResistancePriorityForOrientation:)]
        pub unsafe fn clippingResistancePriorityForOrientation(
            &self,
            orientation: NSLayoutConstraintOrientation,
        ) -> NSLayoutPriority;

        #[cfg(feature = "NSLayoutConstraint")]
        #[method(setClippingResistancePriority:forOrientation:)]
        pub unsafe fn setClippingResistancePriority_forOrientation(
            &self,
            clipping_resistance_priority: NSLayoutPriority,
            orientation: NSLayoutConstraintOrientation,
        );

        #[cfg(feature = "NSLayoutConstraint")]
        #[method(huggingPriorityForOrientation:)]
        pub unsafe fn huggingPriorityForOrientation(
            &self,
            orientation: NSLayoutConstraintOrientation,
        ) -> NSLayoutPriority;

        #[cfg(feature = "NSLayoutConstraint")]
        #[method(setHuggingPriority:forOrientation:)]
        pub unsafe fn setHuggingPriority_forOrientation(
            &self,
            hugging_priority: NSLayoutPriority,
            orientation: NSLayoutConstraintOrientation,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSView`
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSStackView {
        #[method_id(@__retain_semantics Init initWithFrame:)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;

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

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

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

extern_protocol!(
    pub unsafe trait NSStackViewDelegate: NSObjectProtocol + IsMainThreadOnly {
        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(stackView:willDetachViews:)]
        unsafe fn stackView_willDetachViews(
            &self,
            stack_view: &NSStackView,
            views: &NSArray<NSView>,
        );

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(stackView:didReattachViews:)]
        unsafe fn stackView_didReattachViews(
            &self,
            stack_view: &NSStackView,
            views: &NSArray<NSView>,
        );
    }

    unsafe impl ProtocolType for dyn NSStackViewDelegate {}
);

extern_methods!(
    /// NSStackViewGravityAreas
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSStackView {
        #[method(addView:inGravity:)]
        pub unsafe fn addView_inGravity(&self, view: &NSView, gravity: NSStackViewGravity);

        #[method(insertView:atIndex:inGravity:)]
        pub unsafe fn insertView_atIndex_inGravity(
            &self,
            view: &NSView,
            index: NSUInteger,
            gravity: NSStackViewGravity,
        );

        #[method(removeView:)]
        pub unsafe fn removeView(&self, view: &NSView);

        #[method_id(@__retain_semantics Other viewsInGravity:)]
        pub unsafe fn viewsInGravity(
            &self,
            gravity: NSStackViewGravity,
        ) -> Retained<NSArray<NSView>>;

        #[method(setViews:inGravity:)]
        pub unsafe fn setViews_inGravity(
            &self,
            views: &NSArray<NSView>,
            gravity: NSStackViewGravity,
        );

        #[method_id(@__retain_semantics Other views)]
        pub unsafe fn views(&self) -> Retained<NSArray<NSView>>;
    }
);

extern_methods!(
    /// NSStackViewDeprecated
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSStackView {
        #[deprecated = "Set -distribution to NSStackViewDistributionEqualSpacing instead."]
        #[method(hasEqualSpacing)]
        pub unsafe fn hasEqualSpacing(&self) -> bool;

        #[deprecated = "Set -distribution to NSStackViewDistributionEqualSpacing instead."]
        #[method(setHasEqualSpacing:)]
        pub unsafe fn setHasEqualSpacing(&self, has_equal_spacing: bool);
    }
);
