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

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewlayoutregionadaptivityaxis?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSViewLayoutRegionAdaptivityAxis(pub NSInteger);
impl NSViewLayoutRegionAdaptivityAxis {
    #[doc(alias = "NSViewLayoutRegionAdaptivityAxisNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "NSViewLayoutRegionAdaptivityAxisHorizontal")]
    pub const Horizontal: Self = Self(1);
    #[doc(alias = "NSViewLayoutRegionAdaptivityAxisVertical")]
    pub const Vertical: Self = Self(2);
}

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

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewlayoutregion?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSViewLayoutRegion;
);

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

impl NSViewLayoutRegion {
    extern_methods!(
        #[unsafe(method(safeAreaLayoutRegionWithCornerAdaptation:))]
        #[unsafe(method_family = none)]
        pub fn safeAreaLayoutRegionWithCornerAdaptation(
            adaptivity_axis: NSViewLayoutRegionAdaptivityAxis,
        ) -> Retained<NSViewLayoutRegion>;

        #[unsafe(method(marginsLayoutRegionWithCornerAdaptation:))]
        #[unsafe(method_family = none)]
        pub fn marginsLayoutRegionWithCornerAdaptation(
            adaptivity_axis: NSViewLayoutRegionAdaptivityAxis,
        ) -> Retained<NSViewLayoutRegion>;

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

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// LayoutRegions.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSView {
    extern_methods!(
        #[cfg(feature = "NSLayoutGuide")]
        #[unsafe(method(layoutGuideForLayoutRegion:))]
        #[unsafe(method_family = none)]
        pub fn layoutGuideForLayoutRegion(
            &self,
            layout_region: &NSViewLayoutRegion,
        ) -> Retained<NSLayoutGuide>;

        #[unsafe(method(edgeInsetsForLayoutRegion:))]
        #[unsafe(method_family = none)]
        pub fn edgeInsetsForLayoutRegion(&self, layout_region: &NSViewLayoutRegion)
            -> NSEdgeInsets;

        #[unsafe(method(rectForLayoutRegion:))]
        #[unsafe(method_family = none)]
        pub fn rectForLayoutRegion(&self, layout_region: &NSViewLayoutRegion) -> NSRect;
    );
}
