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::*;
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UICollectionViewFlowLayoutAutomaticSize: CGSize;
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UICollectionViewFlowLayoutSectionInsetReference(pub NSInteger);
impl UICollectionViewFlowLayoutSectionInsetReference {
#[doc(alias = "UICollectionViewFlowLayoutSectionInsetFromContentInset")]
pub const FromContentInset: Self = Self(0);
#[doc(alias = "UICollectionViewFlowLayoutSectionInsetFromSafeArea")]
pub const FromSafeArea: Self = Self(1);
#[doc(alias = "UICollectionViewFlowLayoutSectionInsetFromLayoutMargins")]
pub const FromLayoutMargins: Self = Self(2);
}
unsafe impl Encode for UICollectionViewFlowLayoutSectionInsetReference {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UICollectionViewFlowLayoutSectionInsetReference {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(UICollectionViewLayoutInvalidationContext, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UICollectionViewLayout")]
pub struct UICollectionViewFlowLayoutInvalidationContext;
);
#[cfg(feature = "UICollectionViewLayout")]
extern_conformance!(
unsafe impl NSObjectProtocol for UICollectionViewFlowLayoutInvalidationContext {}
);
#[cfg(feature = "UICollectionViewLayout")]
impl UICollectionViewFlowLayoutInvalidationContext {
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 = "UICollectionViewLayout")]
impl UICollectionViewFlowLayoutInvalidationContext {
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(all(feature = "UICollectionView", feature = "UIScrollView"))]
pub unsafe trait UICollectionViewDelegateFlowLayout:
UICollectionViewDelegate + MainThreadOnly
{
#[cfg(all(
feature = "UICollectionViewLayout",
feature = "UIResponder",
feature = "UIView",
feature = "objc2-core-foundation"
))]
#[optional]
#[unsafe(method(collectionView:layout:sizeForItemAtIndexPath:))]
#[unsafe(method_family = none)]
fn collectionView_layout_sizeForItemAtIndexPath(
&self,
collection_view: &UICollectionView,
collection_view_layout: &UICollectionViewLayout,
index_path: &NSIndexPath,
) -> CGSize;
#[cfg(all(
feature = "UICollectionViewLayout",
feature = "UIGeometry",
feature = "UIResponder",
feature = "UIView",
feature = "objc2-core-foundation"
))]
#[optional]
#[unsafe(method(collectionView:layout:insetForSectionAtIndex:))]
#[unsafe(method_family = none)]
fn collectionView_layout_insetForSectionAtIndex(
&self,
collection_view: &UICollectionView,
collection_view_layout: &UICollectionViewLayout,
section: NSInteger,
) -> UIEdgeInsets;
#[cfg(all(
feature = "UICollectionViewLayout",
feature = "UIResponder",
feature = "UIView",
feature = "objc2-core-foundation"
))]
#[optional]
#[unsafe(method(collectionView:layout:minimumLineSpacingForSectionAtIndex:))]
#[unsafe(method_family = none)]
fn collectionView_layout_minimumLineSpacingForSectionAtIndex(
&self,
collection_view: &UICollectionView,
collection_view_layout: &UICollectionViewLayout,
section: NSInteger,
) -> CGFloat;
#[cfg(all(
feature = "UICollectionViewLayout",
feature = "UIResponder",
feature = "UIView",
feature = "objc2-core-foundation"
))]
#[optional]
#[unsafe(method(collectionView:layout:minimumInteritemSpacingForSectionAtIndex:))]
#[unsafe(method_family = none)]
fn collectionView_layout_minimumInteritemSpacingForSectionAtIndex(
&self,
collection_view: &UICollectionView,
collection_view_layout: &UICollectionViewLayout,
section: NSInteger,
) -> CGFloat;
#[cfg(all(
feature = "UICollectionViewLayout",
feature = "UIResponder",
feature = "UIView",
feature = "objc2-core-foundation"
))]
#[optional]
#[unsafe(method(collectionView:layout:referenceSizeForHeaderInSection:))]
#[unsafe(method_family = none)]
fn collectionView_layout_referenceSizeForHeaderInSection(
&self,
collection_view: &UICollectionView,
collection_view_layout: &UICollectionViewLayout,
section: NSInteger,
) -> CGSize;
#[cfg(all(
feature = "UICollectionViewLayout",
feature = "UIResponder",
feature = "UIView",
feature = "objc2-core-foundation"
))]
#[optional]
#[unsafe(method(collectionView:layout:referenceSizeForFooterInSection:))]
#[unsafe(method_family = none)]
fn collectionView_layout_referenceSizeForFooterInSection(
&self,
collection_view: &UICollectionView,
collection_view_layout: &UICollectionViewLayout,
section: NSInteger,
) -> CGSize;
}
);
extern_class!(
#[unsafe(super(UICollectionViewLayout, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UICollectionViewLayout")]
pub struct UICollectionViewFlowLayout;
);
#[cfg(feature = "UICollectionViewLayout")]
extern_conformance!(
unsafe impl NSCoding for UICollectionViewFlowLayout {}
);
#[cfg(feature = "UICollectionViewLayout")]
extern_conformance!(
unsafe impl NSObjectProtocol for UICollectionViewFlowLayout {}
);
#[cfg(feature = "UICollectionViewLayout")]
impl UICollectionViewFlowLayout {
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);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(itemSize))]
#[unsafe(method_family = none)]
pub fn itemSize(&self) -> CGSize;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setItemSize:))]
#[unsafe(method_family = none)]
pub fn setItemSize(&self, item_size: CGSize);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(estimatedItemSize))]
#[unsafe(method_family = none)]
pub fn estimatedItemSize(&self) -> CGSize;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setEstimatedItemSize:))]
#[unsafe(method_family = none)]
pub fn setEstimatedItemSize(&self, estimated_item_size: CGSize);
#[unsafe(method(scrollDirection))]
#[unsafe(method_family = none)]
pub fn scrollDirection(&self) -> UICollectionViewScrollDirection;
#[unsafe(method(setScrollDirection:))]
#[unsafe(method_family = none)]
pub fn setScrollDirection(&self, scroll_direction: UICollectionViewScrollDirection);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(headerReferenceSize))]
#[unsafe(method_family = none)]
pub fn headerReferenceSize(&self) -> CGSize;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setHeaderReferenceSize:))]
#[unsafe(method_family = none)]
pub fn setHeaderReferenceSize(&self, header_reference_size: CGSize);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(footerReferenceSize))]
#[unsafe(method_family = none)]
pub fn footerReferenceSize(&self) -> CGSize;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setFooterReferenceSize:))]
#[unsafe(method_family = none)]
pub fn setFooterReferenceSize(&self, footer_reference_size: CGSize);
#[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
#[unsafe(method(sectionInset))]
#[unsafe(method_family = none)]
pub fn sectionInset(&self) -> UIEdgeInsets;
#[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
#[unsafe(method(setSectionInset:))]
#[unsafe(method_family = none)]
pub fn setSectionInset(&self, section_inset: UIEdgeInsets);
#[unsafe(method(sectionInsetReference))]
#[unsafe(method_family = none)]
pub fn sectionInsetReference(&self) -> UICollectionViewFlowLayoutSectionInsetReference;
#[unsafe(method(setSectionInsetReference:))]
#[unsafe(method_family = none)]
pub fn setSectionInsetReference(
&self,
section_inset_reference: UICollectionViewFlowLayoutSectionInsetReference,
);
#[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,
);
);
}
#[cfg(feature = "UICollectionViewLayout")]
impl UICollectionViewFlowLayout {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
);
}
#[cfg(feature = "UICollectionViewLayout")]
impl UICollectionViewFlowLayout {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}