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::*;
#[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" {
#[cfg(feature = "NSCollectionView")]
pub static NSCollectionElementKindSectionHeader:
&'static NSCollectionViewSupplementaryElementKind;
}
extern "C" {
#[cfg(feature = "NSCollectionView")]
pub static NSCollectionElementKindSectionFooter:
&'static NSCollectionViewSupplementaryElementKind;
}
extern_class!(
#[unsafe(super(NSCollectionViewLayoutInvalidationContext, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSCollectionViewLayout")]
pub struct NSCollectionViewFlowLayoutInvalidationContext;
);
#[cfg(feature = "NSCollectionViewLayout")]
extern_conformance!(
unsafe impl NSObjectProtocol for NSCollectionViewFlowLayoutInvalidationContext {}
);
#[cfg(feature = "NSCollectionViewLayout")]
impl NSCollectionViewFlowLayoutInvalidationContext {
extern_methods!(
#[unsafe(method(invalidateFlowLayoutDelegateMetrics))]
#[unsafe(method_family = none)]
pub fn invalidateFlowLayoutDelegateMetrics(&self) -> bool;
#[unsafe(method(setInvalidateFlowLayoutDelegateMetrics:))]
#[unsafe(method_family = none)]
pub fn setInvalidateFlowLayoutDelegateMetrics(
&self,
invalidate_flow_layout_delegate_metrics: bool,
);
#[unsafe(method(invalidateFlowLayoutAttributes))]
#[unsafe(method_family = none)]
pub fn invalidateFlowLayoutAttributes(&self) -> bool;
#[unsafe(method(setInvalidateFlowLayoutAttributes:))]
#[unsafe(method_family = none)]
pub fn setInvalidateFlowLayoutAttributes(&self, invalidate_flow_layout_attributes: bool);
);
}
#[cfg(feature = "NSCollectionViewLayout")]
impl NSCollectionViewFlowLayoutInvalidationContext {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_protocol!(
#[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)]
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)]
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)]
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)]
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)]
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)]
fn collectionView_layout_referenceSizeForFooterInSection(
&self,
collection_view: &NSCollectionView,
collection_view_layout: &NSCollectionViewLayout,
section: NSInteger,
) -> NSSize;
}
);
extern_class!(
#[unsafe(super(NSCollectionViewLayout, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSCollectionViewLayout")]
pub struct NSCollectionViewFlowLayout;
);
#[cfg(feature = "NSCollectionViewLayout")]
extern_conformance!(
unsafe impl NSCoding for NSCollectionViewFlowLayout {}
);
#[cfg(feature = "NSCollectionViewLayout")]
extern_conformance!(
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 fn minimumLineSpacing(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setMinimumLineSpacing:))]
#[unsafe(method_family = none)]
pub fn setMinimumLineSpacing(&self, minimum_line_spacing: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(minimumInteritemSpacing))]
#[unsafe(method_family = none)]
pub fn minimumInteritemSpacing(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setMinimumInteritemSpacing:))]
#[unsafe(method_family = none)]
pub fn setMinimumInteritemSpacing(&self, minimum_interitem_spacing: CGFloat);
#[unsafe(method(itemSize))]
#[unsafe(method_family = none)]
pub fn itemSize(&self) -> NSSize;
#[unsafe(method(setItemSize:))]
#[unsafe(method_family = none)]
pub fn setItemSize(&self, item_size: NSSize);
#[unsafe(method(estimatedItemSize))]
#[unsafe(method_family = none)]
pub fn estimatedItemSize(&self) -> NSSize;
#[unsafe(method(setEstimatedItemSize:))]
#[unsafe(method_family = none)]
pub fn setEstimatedItemSize(&self, estimated_item_size: NSSize);
#[unsafe(method(scrollDirection))]
#[unsafe(method_family = none)]
pub fn scrollDirection(&self) -> NSCollectionViewScrollDirection;
#[unsafe(method(setScrollDirection:))]
#[unsafe(method_family = none)]
pub fn setScrollDirection(&self, scroll_direction: NSCollectionViewScrollDirection);
#[unsafe(method(headerReferenceSize))]
#[unsafe(method_family = none)]
pub fn headerReferenceSize(&self) -> NSSize;
#[unsafe(method(setHeaderReferenceSize:))]
#[unsafe(method_family = none)]
pub fn setHeaderReferenceSize(&self, header_reference_size: NSSize);
#[unsafe(method(footerReferenceSize))]
#[unsafe(method_family = none)]
pub fn footerReferenceSize(&self) -> NSSize;
#[unsafe(method(setFooterReferenceSize:))]
#[unsafe(method_family = none)]
pub fn setFooterReferenceSize(&self, footer_reference_size: NSSize);
#[unsafe(method(sectionInset))]
#[unsafe(method_family = none)]
pub fn sectionInset(&self) -> NSEdgeInsets;
#[unsafe(method(setSectionInset:))]
#[unsafe(method_family = none)]
pub fn setSectionInset(&self, section_inset: NSEdgeInsets);
#[unsafe(method(sectionHeadersPinToVisibleBounds))]
#[unsafe(method_family = none)]
pub fn sectionHeadersPinToVisibleBounds(&self) -> bool;
#[unsafe(method(setSectionHeadersPinToVisibleBounds:))]
#[unsafe(method_family = none)]
pub fn setSectionHeadersPinToVisibleBounds(
&self,
section_headers_pin_to_visible_bounds: bool,
);
#[unsafe(method(sectionFootersPinToVisibleBounds))]
#[unsafe(method_family = none)]
pub fn sectionFootersPinToVisibleBounds(&self) -> bool;
#[unsafe(method(setSectionFootersPinToVisibleBounds:))]
#[unsafe(method_family = none)]
pub fn setSectionFootersPinToVisibleBounds(
&self,
section_footers_pin_to_visible_bounds: bool,
);
#[unsafe(method(sectionAtIndexIsCollapsed:))]
#[unsafe(method_family = none)]
pub fn sectionAtIndexIsCollapsed(&self, section_index: NSUInteger) -> bool;
#[unsafe(method(collapseSectionAtIndex:))]
#[unsafe(method_family = none)]
pub fn collapseSectionAtIndex(&self, section_index: NSUInteger);
#[unsafe(method(expandSectionAtIndex:))]
#[unsafe(method_family = none)]
pub fn expandSectionAtIndex(&self, section_index: NSUInteger);
);
}
#[cfg(feature = "NSCollectionViewLayout")]
impl NSCollectionViewFlowLayout {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}