//! 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/nscollectionviewscrolldirection?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCollectionViewScrollDirection(pub NSInteger);
impl NSCollectionViewScrollDirection {
    #[doc(alias = "NSCollectionViewScrollDirectionVertical")]
    pub const Vertical: Self = Self(0);
    #[doc(alias = "NSCollectionViewScrollDirectionHorizontal")]
    pub const Horizontal: Self = Self(1);
}

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

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

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionelementkindsectionheader?language=objc)
    #[cfg(feature = "NSCollectionView")]
    pub static NSCollectionElementKindSectionHeader:
        &'static NSCollectionViewSupplementaryElementKind;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionelementkindsectionfooter?language=objc)
    #[cfg(feature = "NSCollectionView")]
    pub static NSCollectionElementKindSectionFooter:
        &'static NSCollectionViewSupplementaryElementKind;
}

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

#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSObjectProtocol for NSCollectionViewFlowLayoutInvalidationContext {}

#[cfg(feature = "NSCollectionViewLayout")]
impl NSCollectionViewFlowLayoutInvalidationContext {
    extern_methods!(
        #[unsafe(method(invalidateFlowLayoutDelegateMetrics))]
        #[unsafe(method_family = none)]
        pub unsafe fn invalidateFlowLayoutDelegateMetrics(&self) -> bool;

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

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

        /// Setter for [`invalidateFlowLayoutAttributes`][Self::invalidateFlowLayoutAttributes].
        #[unsafe(method(setInvalidateFlowLayoutAttributes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setInvalidateFlowLayoutAttributes(
            &self,
            invalidate_flow_layout_attributes: bool,
        );
    );
}

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

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionviewdelegateflowlayout?language=objc)
    #[cfg(feature = "NSCollectionView")]
    pub unsafe trait NSCollectionViewDelegateFlowLayout:
        NSCollectionViewDelegate + MainThreadOnly
    {
        #[cfg(all(
            feature = "NSCollectionViewLayout",
            feature = "NSResponder",
            feature = "NSView"
        ))]
        #[optional]
        #[unsafe(method(collectionView:layout:sizeForItemAtIndexPath:))]
        #[unsafe(method_family = none)]
        unsafe fn collectionView_layout_sizeForItemAtIndexPath(
            &self,
            collection_view: &NSCollectionView,
            collection_view_layout: &NSCollectionViewLayout,
            index_path: &NSIndexPath,
        ) -> NSSize;

        #[cfg(all(
            feature = "NSCollectionViewLayout",
            feature = "NSResponder",
            feature = "NSView"
        ))]
        #[optional]
        #[unsafe(method(collectionView:layout:insetForSectionAtIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn collectionView_layout_insetForSectionAtIndex(
            &self,
            collection_view: &NSCollectionView,
            collection_view_layout: &NSCollectionViewLayout,
            section: NSInteger,
        ) -> NSEdgeInsets;

        #[cfg(all(
            feature = "NSCollectionViewLayout",
            feature = "NSResponder",
            feature = "NSView",
            feature = "objc2-core-foundation"
        ))]
        #[optional]
        #[unsafe(method(collectionView:layout:minimumLineSpacingForSectionAtIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn collectionView_layout_minimumLineSpacingForSectionAtIndex(
            &self,
            collection_view: &NSCollectionView,
            collection_view_layout: &NSCollectionViewLayout,
            section: NSInteger,
        ) -> CGFloat;

        #[cfg(all(
            feature = "NSCollectionViewLayout",
            feature = "NSResponder",
            feature = "NSView",
            feature = "objc2-core-foundation"
        ))]
        #[optional]
        #[unsafe(method(collectionView:layout:minimumInteritemSpacingForSectionAtIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn collectionView_layout_minimumInteritemSpacingForSectionAtIndex(
            &self,
            collection_view: &NSCollectionView,
            collection_view_layout: &NSCollectionViewLayout,
            section: NSInteger,
        ) -> CGFloat;

        #[cfg(all(
            feature = "NSCollectionViewLayout",
            feature = "NSResponder",
            feature = "NSView"
        ))]
        #[optional]
        #[unsafe(method(collectionView:layout:referenceSizeForHeaderInSection:))]
        #[unsafe(method_family = none)]
        unsafe fn collectionView_layout_referenceSizeForHeaderInSection(
            &self,
            collection_view: &NSCollectionView,
            collection_view_layout: &NSCollectionViewLayout,
            section: NSInteger,
        ) -> NSSize;

        #[cfg(all(
            feature = "NSCollectionViewLayout",
            feature = "NSResponder",
            feature = "NSView"
        ))]
        #[optional]
        #[unsafe(method(collectionView:layout:referenceSizeForFooterInSection:))]
        #[unsafe(method_family = none)]
        unsafe fn collectionView_layout_referenceSizeForFooterInSection(
            &self,
            collection_view: &NSCollectionView,
            collection_view_layout: &NSCollectionViewLayout,
            section: NSInteger,
        ) -> NSSize;
    }
);

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

#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSCoding for NSCollectionViewFlowLayout {}

#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSObjectProtocol for NSCollectionViewFlowLayout {}

#[cfg(feature = "NSCollectionViewLayout")]
impl NSCollectionViewFlowLayout {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(minimumLineSpacing))]
        #[unsafe(method_family = none)]
        pub unsafe fn minimumLineSpacing(&self) -> CGFloat;

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

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

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

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

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

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

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

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

        /// Setter for [`scrollDirection`][Self::scrollDirection].
        #[unsafe(method(setScrollDirection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setScrollDirection(&self, scroll_direction: NSCollectionViewScrollDirection);

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

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

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

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

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

        /// Setter for [`sectionInset`][Self::sectionInset].
        #[unsafe(method(setSectionInset:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSectionInset(&self, section_inset: NSEdgeInsets);

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

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

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

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

        #[unsafe(method(sectionAtIndexIsCollapsed:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sectionAtIndexIsCollapsed(&self, section_index: NSUInteger) -> bool;

        #[unsafe(method(collapseSectionAtIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn collapseSectionAtIndex(&self, section_index: NSUInteger);

        #[unsafe(method(expandSectionAtIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn expandSectionAtIndex(&self, section_index: NSUInteger);
    );
}

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

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