#[cfg(feature = "block2")]
use block2::*;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCollectionViewDropOperation(pub NSInteger);
impl NSCollectionViewDropOperation {
pub const NSCollectionViewDropOn: Self = Self(0);
pub const NSCollectionViewDropBefore: Self = Self(1);
}
unsafe impl Encode for NSCollectionViewDropOperation {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSCollectionViewDropOperation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCollectionViewItemHighlightState(pub NSInteger);
impl NSCollectionViewItemHighlightState {
pub const NSCollectionViewItemHighlightNone: Self = Self(0);
pub const NSCollectionViewItemHighlightForSelection: Self = Self(1);
pub const NSCollectionViewItemHighlightForDeselection: Self = Self(2);
pub const NSCollectionViewItemHighlightAsDropTarget: Self = Self(3);
}
unsafe impl Encode for NSCollectionViewItemHighlightState {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSCollectionViewItemHighlightState {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCollectionViewScrollPosition(pub NSUInteger);
impl NSCollectionViewScrollPosition {
#[doc(alias = "NSCollectionViewScrollPositionNone")]
pub const None: Self = Self(0);
#[doc(alias = "NSCollectionViewScrollPositionTop")]
pub const Top: Self = Self(1 << 0);
#[doc(alias = "NSCollectionViewScrollPositionCenteredVertically")]
pub const CenteredVertically: Self = Self(1 << 1);
#[doc(alias = "NSCollectionViewScrollPositionBottom")]
pub const Bottom: Self = Self(1 << 2);
#[doc(alias = "NSCollectionViewScrollPositionNearestHorizontalEdge")]
pub const NearestHorizontalEdge: Self = Self(1 << 9);
#[doc(alias = "NSCollectionViewScrollPositionLeft")]
pub const Left: Self = Self(1 << 3);
#[doc(alias = "NSCollectionViewScrollPositionCenteredHorizontally")]
pub const CenteredHorizontally: Self = Self(1 << 4);
#[doc(alias = "NSCollectionViewScrollPositionRight")]
pub const Right: Self = Self(1 << 5);
#[doc(alias = "NSCollectionViewScrollPositionLeadingEdge")]
pub const LeadingEdge: Self = Self(1 << 6);
#[doc(alias = "NSCollectionViewScrollPositionTrailingEdge")]
pub const TrailingEdge: Self = Self(1 << 7);
#[doc(alias = "NSCollectionViewScrollPositionNearestVerticalEdge")]
pub const NearestVerticalEdge: Self = Self(1 << 8);
}
unsafe impl Encode for NSCollectionViewScrollPosition {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSCollectionViewScrollPosition {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub type NSCollectionViewSupplementaryElementKind = NSString;
extern_protocol!(
#[cfg(feature = "NSUserInterfaceItemIdentification")]
pub unsafe trait NSCollectionViewElement:
NSObjectProtocol + NSUserInterfaceItemIdentification + IsMainThreadOnly
{
#[optional]
#[method(prepareForReuse)]
unsafe fn prepareForReuse(&self);
#[cfg(feature = "NSCollectionViewLayout")]
#[optional]
#[method(applyLayoutAttributes:)]
unsafe fn applyLayoutAttributes(
&self,
layout_attributes: &NSCollectionViewLayoutAttributes,
);
#[cfg(feature = "NSCollectionViewLayout")]
#[optional]
#[method(willTransitionFromLayout:toLayout:)]
unsafe fn willTransitionFromLayout_toLayout(
&self,
old_layout: &NSCollectionViewLayout,
new_layout: &NSCollectionViewLayout,
);
#[cfg(feature = "NSCollectionViewLayout")]
#[optional]
#[method(didTransitionFromLayout:toLayout:)]
unsafe fn didTransitionFromLayout_toLayout(
&self,
old_layout: &NSCollectionViewLayout,
new_layout: &NSCollectionViewLayout,
);
#[cfg(feature = "NSCollectionViewLayout")]
#[optional]
#[method_id(@__retain_semantics Other preferredLayoutAttributesFittingAttributes:)]
unsafe fn preferredLayoutAttributesFittingAttributes(
&self,
layout_attributes: &NSCollectionViewLayoutAttributes,
) -> Id<NSCollectionViewLayoutAttributes>;
}
#[cfg(feature = "NSUserInterfaceItemIdentification")]
unsafe impl ProtocolType for dyn NSCollectionViewElement {}
);
extern_protocol!(
#[cfg(feature = "NSUserInterfaceItemIdentification")]
pub unsafe trait NSCollectionViewSectionHeaderView:
NSCollectionViewElement + IsMainThreadOnly
{
#[cfg(all(
feature = "NSButton",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method_id(@__retain_semantics Other sectionCollapseButton)]
unsafe fn sectionCollapseButton(&self) -> Option<Id<NSButton>>;
#[cfg(all(
feature = "NSButton",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(setSectionCollapseButton:)]
unsafe fn setSectionCollapseButton(&self, section_collapse_button: Option<&NSButton>);
}
#[cfg(feature = "NSUserInterfaceItemIdentification")]
unsafe impl ProtocolType for dyn NSCollectionViewSectionHeaderView {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
pub struct NSCollectionViewItem;
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
unsafe impl ClassType for NSCollectionViewItem {
#[inherits(NSResponder, NSObject)]
type Super = NSViewController;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
unsafe impl NSCoding for NSCollectionViewItem {}
#[cfg(all(
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSViewController"
))]
unsafe impl NSCollectionViewElement for NSCollectionViewItem {}
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
unsafe impl NSCopying for NSCollectionViewItem {}
#[cfg(all(
feature = "NSKeyValueBinding",
feature = "NSResponder",
feature = "NSViewController"
))]
unsafe impl NSEditor for NSCollectionViewItem {}
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
unsafe impl NSObjectProtocol for NSCollectionViewItem {}
#[cfg(all(
feature = "NSResponder",
feature = "NSStoryboardSegue",
feature = "NSViewController"
))]
unsafe impl NSSeguePerforming for NSCollectionViewItem {}
#[cfg(all(
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSViewController"
))]
unsafe impl NSUserInterfaceItemIdentification for NSCollectionViewItem {}
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
unsafe impl NSCollectionViewItem {
#[cfg(feature = "NSView")]
#[method_id(@__retain_semantics Other collectionView)]
pub unsafe fn collectionView(&self) -> Option<Id<NSCollectionView>>;
#[method(isSelected)]
pub unsafe fn isSelected(&self) -> bool;
#[method(setSelected:)]
pub unsafe fn setSelected(&self, selected: bool);
#[method(highlightState)]
pub unsafe fn highlightState(&self) -> NSCollectionViewItemHighlightState;
#[method(setHighlightState:)]
pub unsafe fn setHighlightState(&self, highlight_state: NSCollectionViewItemHighlightState);
#[cfg(all(feature = "NSControl", feature = "NSImageView", feature = "NSView"))]
#[method_id(@__retain_semantics Other imageView)]
pub unsafe fn imageView(&self) -> Option<Id<NSImageView>>;
#[cfg(all(feature = "NSControl", feature = "NSImageView", feature = "NSView"))]
#[method(setImageView:)]
pub unsafe fn setImageView(&self, image_view: Option<&NSImageView>);
#[cfg(all(feature = "NSControl", feature = "NSTextField", feature = "NSView"))]
#[method_id(@__retain_semantics Other textField)]
pub unsafe fn textField(&self) -> Option<Id<NSTextField>>;
#[cfg(all(feature = "NSControl", feature = "NSTextField", feature = "NSView"))]
#[method(setTextField:)]
pub unsafe fn setTextField(&self, text_field: Option<&NSTextField>);
#[cfg(feature = "NSDraggingItem")]
#[method_id(@__retain_semantics Other draggingImageComponents)]
pub unsafe fn draggingImageComponents(&self) -> Id<NSArray<NSDraggingImageComponent>>;
}
);
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
unsafe impl NSCollectionViewItem {
#[cfg(feature = "NSNib")]
#[method_id(@__retain_semantics Init initWithNibName:bundle:)]
pub unsafe fn initWithNibName_bundle(
this: Allocated<Self>,
nib_name_or_nil: Option<&NSNibName>,
nib_bundle_or_nil: Option<&NSBundle>,
) -> Id<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Option<Id<Self>>;
}
);
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
unsafe impl NSCollectionViewItem {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
}
);
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
unsafe impl NSCollectionViewItem {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Id<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
pub struct NSCollectionView;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl ClassType for NSCollectionView {
#[inherits(NSResponder, NSObject)]
type Super = NSView;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibility for NSCollectionView {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSCollectionView {}
#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSAnimatablePropertyContainer for NSCollectionView {}
#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSAppearanceCustomization for NSCollectionView {}
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCoding for NSCollectionView {}
#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSDraggingDestination for NSCollectionView {}
#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSDraggingSource for NSCollectionView {}
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSObjectProtocol for NSCollectionView {}
#[cfg(all(
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSCollectionView {}
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCollectionView {
#[method_id(@__retain_semantics Other dataSource)]
pub unsafe fn dataSource(
&self,
) -> Option<Id<ProtocolObject<dyn NSCollectionViewDataSource>>>;
#[method(setDataSource:)]
pub unsafe fn setDataSource(
&self,
data_source: Option<&ProtocolObject<dyn NSCollectionViewDataSource>>,
);
#[method_id(@__retain_semantics Other prefetchDataSource)]
pub unsafe fn prefetchDataSource(
&self,
) -> Option<Id<ProtocolObject<dyn NSCollectionViewPrefetching>>>;
#[method(setPrefetchDataSource:)]
pub unsafe fn setPrefetchDataSource(
&self,
prefetch_data_source: Option<&ProtocolObject<dyn NSCollectionViewPrefetching>>,
);
#[method_id(@__retain_semantics Other content)]
pub unsafe fn content(&self) -> Id<NSArray<AnyObject>>;
#[method(setContent:)]
pub unsafe fn setContent(&self, content: &NSArray<AnyObject>);
#[method(reloadData)]
pub unsafe fn reloadData(&self);
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Id<ProtocolObject<dyn NSCollectionViewDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSCollectionViewDelegate>>,
);
#[method_id(@__retain_semantics Other backgroundView)]
pub unsafe fn backgroundView(&self) -> Option<Id<NSView>>;
#[method(setBackgroundView:)]
pub unsafe fn setBackgroundView(&self, background_view: Option<&NSView>);
#[method(backgroundViewScrollsWithContent)]
pub unsafe fn backgroundViewScrollsWithContent(&self) -> bool;
#[method(setBackgroundViewScrollsWithContent:)]
pub unsafe fn setBackgroundViewScrollsWithContent(
&self,
background_view_scrolls_with_content: bool,
);
#[cfg(feature = "NSCollectionViewLayout")]
#[method_id(@__retain_semantics Other collectionViewLayout)]
pub unsafe fn collectionViewLayout(&self) -> Option<Id<NSCollectionViewLayout>>;
#[cfg(feature = "NSCollectionViewLayout")]
#[method(setCollectionViewLayout:)]
pub unsafe fn setCollectionViewLayout(
&self,
collection_view_layout: Option<&NSCollectionViewLayout>,
);
#[cfg(feature = "NSCollectionViewLayout")]
#[method_id(@__retain_semantics Other layoutAttributesForItemAtIndexPath:)]
pub unsafe fn layoutAttributesForItemAtIndexPath(
&self,
index_path: &NSIndexPath,
) -> Option<Id<NSCollectionViewLayoutAttributes>>;
#[cfg(feature = "NSCollectionViewLayout")]
#[method_id(@__retain_semantics Other layoutAttributesForSupplementaryElementOfKind:atIndexPath:)]
pub unsafe fn layoutAttributesForSupplementaryElementOfKind_atIndexPath(
&self,
kind: &NSCollectionViewSupplementaryElementKind,
index_path: &NSIndexPath,
) -> Option<Id<NSCollectionViewLayoutAttributes>>;
#[method(frameForItemAtIndex:)]
pub unsafe fn frameForItemAtIndex(&self, index: NSUInteger) -> NSRect;
#[method(frameForItemAtIndex:withNumberOfItems:)]
pub unsafe fn frameForItemAtIndex_withNumberOfItems(
&self,
index: NSUInteger,
number_of_items: NSUInteger,
) -> NSRect;
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other backgroundColors)]
pub unsafe fn backgroundColors(&self) -> Id<NSArray<NSColor>>;
#[cfg(feature = "NSColor")]
#[method(setBackgroundColors:)]
pub unsafe fn setBackgroundColors(&self, background_colors: Option<&NSArray<NSColor>>);
#[method(numberOfSections)]
pub unsafe fn numberOfSections(&self) -> NSInteger;
#[method(numberOfItemsInSection:)]
pub unsafe fn numberOfItemsInSection(&self, section: NSInteger) -> NSInteger;
#[method(isFirstResponder)]
pub unsafe fn isFirstResponder(&self) -> bool;
#[method(isSelectable)]
pub unsafe fn isSelectable(&self) -> bool;
#[method(setSelectable:)]
pub unsafe fn setSelectable(&self, selectable: bool);
#[method(allowsEmptySelection)]
pub unsafe fn allowsEmptySelection(&self) -> bool;
#[method(setAllowsEmptySelection:)]
pub unsafe fn setAllowsEmptySelection(&self, allows_empty_selection: bool);
#[method(allowsMultipleSelection)]
pub unsafe fn allowsMultipleSelection(&self) -> bool;
#[method(setAllowsMultipleSelection:)]
pub unsafe fn setAllowsMultipleSelection(&self, allows_multiple_selection: bool);
#[method_id(@__retain_semantics Other selectionIndexes)]
pub unsafe fn selectionIndexes(&self) -> Id<NSIndexSet>;
#[method(setSelectionIndexes:)]
pub unsafe fn setSelectionIndexes(&self, selection_indexes: &NSIndexSet);
#[method_id(@__retain_semantics Other selectionIndexPaths)]
pub unsafe fn selectionIndexPaths(&self) -> Id<NSSet<NSIndexPath>>;
#[method(setSelectionIndexPaths:)]
pub unsafe fn setSelectionIndexPaths(&self, selection_index_paths: &NSSet<NSIndexPath>);
#[method(selectItemsAtIndexPaths:scrollPosition:)]
pub unsafe fn selectItemsAtIndexPaths_scrollPosition(
&self,
index_paths: &NSSet<NSIndexPath>,
scroll_position: NSCollectionViewScrollPosition,
);
#[method(deselectItemsAtIndexPaths:)]
pub unsafe fn deselectItemsAtIndexPaths(&self, index_paths: &NSSet<NSIndexPath>);
#[method(selectAll:)]
pub unsafe fn selectAll(&self, sender: Option<&AnyObject>);
#[method(deselectAll:)]
pub unsafe fn deselectAll(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSUserInterfaceItemIdentification")]
#[method(registerClass:forItemWithIdentifier:)]
pub unsafe fn registerClass_forItemWithIdentifier(
&self,
item_class: Option<&AnyClass>,
identifier: &NSUserInterfaceItemIdentifier,
);
#[cfg(all(feature = "NSNib", feature = "NSUserInterfaceItemIdentification"))]
#[method(registerNib:forItemWithIdentifier:)]
pub unsafe fn registerNib_forItemWithIdentifier(
&self,
nib: Option<&NSNib>,
identifier: &NSUserInterfaceItemIdentifier,
);
#[cfg(feature = "NSUserInterfaceItemIdentification")]
#[method(registerClass:forSupplementaryViewOfKind:withIdentifier:)]
pub unsafe fn registerClass_forSupplementaryViewOfKind_withIdentifier(
&self,
view_class: Option<&AnyClass>,
kind: &NSCollectionViewSupplementaryElementKind,
identifier: &NSUserInterfaceItemIdentifier,
);
#[cfg(all(feature = "NSNib", feature = "NSUserInterfaceItemIdentification"))]
#[method(registerNib:forSupplementaryViewOfKind:withIdentifier:)]
pub unsafe fn registerNib_forSupplementaryViewOfKind_withIdentifier(
&self,
nib: Option<&NSNib>,
kind: &NSCollectionViewSupplementaryElementKind,
identifier: &NSUserInterfaceItemIdentifier,
);
#[cfg(all(
feature = "NSUserInterfaceItemIdentification",
feature = "NSViewController"
))]
#[method_id(@__retain_semantics Other makeItemWithIdentifier:forIndexPath:)]
pub unsafe fn makeItemWithIdentifier_forIndexPath(
&self,
identifier: &NSUserInterfaceItemIdentifier,
index_path: &NSIndexPath,
) -> Id<NSCollectionViewItem>;
#[cfg(feature = "NSUserInterfaceItemIdentification")]
#[method_id(@__retain_semantics Other makeSupplementaryViewOfKind:withIdentifier:forIndexPath:)]
pub unsafe fn makeSupplementaryViewOfKind_withIdentifier_forIndexPath(
&self,
element_kind: &NSCollectionViewSupplementaryElementKind,
identifier: &NSUserInterfaceItemIdentifier,
index_path: &NSIndexPath,
) -> Id<NSView>;
#[cfg(feature = "NSViewController")]
#[method_id(@__retain_semantics Other itemAtIndex:)]
pub unsafe fn itemAtIndex(&self, index: NSUInteger) -> Option<Id<NSCollectionViewItem>>;
#[cfg(feature = "NSViewController")]
#[method_id(@__retain_semantics Other itemAtIndexPath:)]
pub unsafe fn itemAtIndexPath(
&self,
index_path: &NSIndexPath,
) -> Option<Id<NSCollectionViewItem>>;
#[cfg(feature = "NSViewController")]
#[method_id(@__retain_semantics Other visibleItems)]
pub unsafe fn visibleItems(&self) -> Id<NSArray<NSCollectionViewItem>>;
#[method_id(@__retain_semantics Other indexPathsForVisibleItems)]
pub unsafe fn indexPathsForVisibleItems(&self) -> Id<NSSet<NSIndexPath>>;
#[cfg(feature = "NSViewController")]
#[method_id(@__retain_semantics Other indexPathForItem:)]
pub unsafe fn indexPathForItem(
&self,
item: &NSCollectionViewItem,
) -> Option<Id<NSIndexPath>>;
#[method_id(@__retain_semantics Other indexPathForItemAtPoint:)]
pub unsafe fn indexPathForItemAtPoint(&self, point: NSPoint) -> Option<Id<NSIndexPath>>;
#[cfg(feature = "NSUserInterfaceItemIdentification")]
#[method_id(@__retain_semantics Other supplementaryViewForElementKind:atIndexPath:)]
pub unsafe fn supplementaryViewForElementKind_atIndexPath(
&self,
element_kind: &NSCollectionViewSupplementaryElementKind,
index_path: &NSIndexPath,
) -> Option<Id<NSView>>;
#[cfg(feature = "NSUserInterfaceItemIdentification")]
#[method_id(@__retain_semantics Other visibleSupplementaryViewsOfKind:)]
pub unsafe fn visibleSupplementaryViewsOfKind(
&self,
element_kind: &NSCollectionViewSupplementaryElementKind,
) -> Id<NSArray<NSView>>;
#[method_id(@__retain_semantics Other indexPathsForVisibleSupplementaryElementsOfKind:)]
pub unsafe fn indexPathsForVisibleSupplementaryElementsOfKind(
&self,
element_kind: &NSCollectionViewSupplementaryElementKind,
) -> Id<NSSet<NSIndexPath>>;
#[method(insertSections:)]
pub unsafe fn insertSections(&self, sections: &NSIndexSet);
#[method(deleteSections:)]
pub unsafe fn deleteSections(&self, sections: &NSIndexSet);
#[method(reloadSections:)]
pub unsafe fn reloadSections(&self, sections: &NSIndexSet);
#[method(moveSection:toSection:)]
pub unsafe fn moveSection_toSection(&self, section: NSInteger, new_section: NSInteger);
#[method(insertItemsAtIndexPaths:)]
pub unsafe fn insertItemsAtIndexPaths(&self, index_paths: &NSSet<NSIndexPath>);
#[method(deleteItemsAtIndexPaths:)]
pub unsafe fn deleteItemsAtIndexPaths(&self, index_paths: &NSSet<NSIndexPath>);
#[method(reloadItemsAtIndexPaths:)]
pub unsafe fn reloadItemsAtIndexPaths(&self, index_paths: &NSSet<NSIndexPath>);
#[method(moveItemAtIndexPath:toIndexPath:)]
pub unsafe fn moveItemAtIndexPath_toIndexPath(
&self,
index_path: &NSIndexPath,
new_index_path: &NSIndexPath,
);
#[cfg(feature = "block2")]
#[method(performBatchUpdates:completionHandler:)]
pub unsafe fn performBatchUpdates_completionHandler(
&self,
updates: Option<&Block<dyn Fn() + '_>>,
completion_handler: Option<&Block<dyn Fn(Bool)>>,
);
#[method(toggleSectionCollapse:)]
pub unsafe fn toggleSectionCollapse(&self, sender: &AnyObject);
#[method(scrollToItemsAtIndexPaths:scrollPosition:)]
pub unsafe fn scrollToItemsAtIndexPaths_scrollPosition(
&self,
index_paths: &NSSet<NSIndexPath>,
scroll_position: NSCollectionViewScrollPosition,
);
#[cfg(feature = "NSDragging")]
#[method(setDraggingSourceOperationMask:forLocal:)]
pub unsafe fn setDraggingSourceOperationMask_forLocal(
&self,
drag_operation_mask: NSDragOperation,
local_destination: bool,
);
#[cfg(all(feature = "NSEvent", feature = "NSImage"))]
#[method_id(@__retain_semantics Other draggingImageForItemsAtIndexPaths:withEvent:offset:)]
pub unsafe fn draggingImageForItemsAtIndexPaths_withEvent_offset(
&self,
index_paths: &NSSet<NSIndexPath>,
event: &NSEvent,
drag_image_offset: NSPointPointer,
) -> Id<NSImage>;
#[cfg(all(feature = "NSEvent", feature = "NSImage"))]
#[method_id(@__retain_semantics Other draggingImageForItemsAtIndexes:withEvent:offset:)]
pub unsafe fn draggingImageForItemsAtIndexes_withEvent_offset(
&self,
indexes: &NSIndexSet,
event: &NSEvent,
drag_image_offset: NSPointPointer,
) -> Id<NSImage>;
}
);
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCollectionView {
#[method_id(@__retain_semantics Init initWithFrame:)]
pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Id<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Option<Id<Self>>;
}
);
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCollectionView {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
}
);
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCollectionView {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Id<Self>;
}
);
extern_protocol!(
pub unsafe trait NSCollectionViewDataSource:
NSObjectProtocol + IsMainThreadOnly
{
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(collectionView:numberOfItemsInSection:)]
unsafe fn collectionView_numberOfItemsInSection(
&self,
collection_view: &NSCollectionView,
section: NSInteger,
) -> NSInteger;
#[cfg(all(
feature = "NSResponder",
feature = "NSView",
feature = "NSViewController"
))]
#[method_id(@__retain_semantics Other collectionView:itemForRepresentedObjectAtIndexPath:)]
unsafe fn collectionView_itemForRepresentedObjectAtIndexPath(
&self,
collection_view: &NSCollectionView,
index_path: &NSIndexPath,
) -> Id<NSCollectionViewItem>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(numberOfSectionsInCollectionView:)]
unsafe fn numberOfSectionsInCollectionView(
&self,
collection_view: &NSCollectionView,
) -> NSInteger;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:viewForSupplementaryElementOfKind:atIndexPath:)]
unsafe fn collectionView_viewForSupplementaryElementOfKind_atIndexPath(
&self,
collection_view: &NSCollectionView,
kind: &NSCollectionViewSupplementaryElementKind,
index_path: &NSIndexPath,
) -> Id<NSView>;
}
unsafe impl ProtocolType for dyn NSCollectionViewDataSource {}
);
extern_protocol!(
pub unsafe trait NSCollectionViewPrefetching:
NSObjectProtocol + IsMainThreadOnly
{
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(collectionView:prefetchItemsAtIndexPaths:)]
unsafe fn collectionView_prefetchItemsAtIndexPaths(
&self,
collection_view: &NSCollectionView,
index_paths: &NSArray<NSIndexPath>,
);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(collectionView:cancelPrefetchingForItemsAtIndexPaths:)]
unsafe fn collectionView_cancelPrefetchingForItemsAtIndexPaths(
&self,
collection_view: &NSCollectionView,
index_paths: &NSArray<NSIndexPath>,
);
}
unsafe impl ProtocolType for dyn NSCollectionViewPrefetching {}
);
extern_protocol!(
pub unsafe trait NSCollectionViewDelegate: NSObjectProtocol {
#[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(collectionView:canDragItemsAtIndexPaths:withEvent:)]
unsafe fn collectionView_canDragItemsAtIndexPaths_withEvent(
&self,
collection_view: &NSCollectionView,
index_paths: &NSSet<NSIndexPath>,
event: &NSEvent,
) -> bool;
#[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(collectionView:canDragItemsAtIndexes:withEvent:)]
unsafe fn collectionView_canDragItemsAtIndexes_withEvent(
&self,
collection_view: &NSCollectionView,
indexes: &NSIndexSet,
event: &NSEvent,
) -> bool;
#[cfg(all(feature = "NSPasteboard", feature = "NSResponder", feature = "NSView"))]
#[deprecated = "Use -collectionView:pasteboardWriterForItemAtIndexPath: instead"]
#[optional]
#[method(collectionView:writeItemsAtIndexPaths:toPasteboard:)]
unsafe fn collectionView_writeItemsAtIndexPaths_toPasteboard(
&self,
collection_view: &NSCollectionView,
index_paths: &NSSet<NSIndexPath>,
pasteboard: &NSPasteboard,
) -> bool;
#[cfg(all(feature = "NSPasteboard", feature = "NSResponder", feature = "NSView"))]
#[deprecated = "Use -collectionView:pasteboardWriterForItemAtIndexPath: instead"]
#[optional]
#[method(collectionView:writeItemsAtIndexes:toPasteboard:)]
unsafe fn collectionView_writeItemsAtIndexes_toPasteboard(
&self,
collection_view: &NSCollectionView,
indexes: &NSIndexSet,
pasteboard: &NSPasteboard,
) -> bool;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[deprecated = "Use NSFilePromiseReceiver objects instead"]
#[optional]
#[method_id(@__retain_semantics Other collectionView:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAtIndexPaths:)]
unsafe fn collectionView_namesOfPromisedFilesDroppedAtDestination_forDraggedItemsAtIndexPaths(
&self,
collection_view: &NSCollectionView,
drop_url: &NSURL,
index_paths: &NSSet<NSIndexPath>,
) -> Id<NSArray<NSString>>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[deprecated = "Use NSFilePromiseReceiver objects instead"]
#[optional]
#[method_id(@__retain_semantics Other collectionView:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAtIndexes:)]
unsafe fn collectionView_namesOfPromisedFilesDroppedAtDestination_forDraggedItemsAtIndexes(
&self,
collection_view: &NSCollectionView,
drop_url: &NSURL,
indexes: &NSIndexSet,
) -> Id<NSArray<NSString>>;
#[cfg(all(
feature = "NSEvent",
feature = "NSImage",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:draggingImageForItemsAtIndexPaths:withEvent:offset:)]
unsafe fn collectionView_draggingImageForItemsAtIndexPaths_withEvent_offset(
&self,
collection_view: &NSCollectionView,
index_paths: &NSSet<NSIndexPath>,
event: &NSEvent,
drag_image_offset: NSPointPointer,
) -> Id<NSImage>;
#[cfg(all(
feature = "NSEvent",
feature = "NSImage",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:draggingImageForItemsAtIndexes:withEvent:offset:)]
unsafe fn collectionView_draggingImageForItemsAtIndexes_withEvent_offset(
&self,
collection_view: &NSCollectionView,
indexes: &NSIndexSet,
event: &NSEvent,
drag_image_offset: NSPointPointer,
) -> Id<NSImage>;
#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(collectionView:validateDrop:proposedIndexPath:dropOperation:)]
unsafe fn collectionView_validateDrop_proposedIndexPath_dropOperation(
&self,
collection_view: &NSCollectionView,
dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
proposed_drop_index_path: &mut Id<NSIndexPath>,
proposed_drop_operation: NonNull<NSCollectionViewDropOperation>,
) -> NSDragOperation;
#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(collectionView:validateDrop:proposedIndex:dropOperation:)]
unsafe fn collectionView_validateDrop_proposedIndex_dropOperation(
&self,
collection_view: &NSCollectionView,
dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
proposed_drop_index: NonNull<NSInteger>,
proposed_drop_operation: NonNull<NSCollectionViewDropOperation>,
) -> NSDragOperation;
#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(collectionView:acceptDrop:indexPath:dropOperation:)]
unsafe fn collectionView_acceptDrop_indexPath_dropOperation(
&self,
collection_view: &NSCollectionView,
dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
index_path: &NSIndexPath,
drop_operation: NSCollectionViewDropOperation,
) -> bool;
#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(collectionView:acceptDrop:index:dropOperation:)]
unsafe fn collectionView_acceptDrop_index_dropOperation(
&self,
collection_view: &NSCollectionView,
dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
index: NSInteger,
drop_operation: NSCollectionViewDropOperation,
) -> bool;
#[cfg(all(feature = "NSPasteboard", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:pasteboardWriterForItemAtIndexPath:)]
unsafe fn collectionView_pasteboardWriterForItemAtIndexPath(
&self,
collection_view: &NSCollectionView,
index_path: &NSIndexPath,
) -> Option<Id<ProtocolObject<dyn NSPasteboardWriting>>>;
#[cfg(all(feature = "NSPasteboard", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:pasteboardWriterForItemAtIndex:)]
unsafe fn collectionView_pasteboardWriterForItemAtIndex(
&self,
collection_view: &NSCollectionView,
index: NSUInteger,
) -> Option<Id<ProtocolObject<dyn NSPasteboardWriting>>>;
#[cfg(all(
feature = "NSDraggingSession",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(collectionView:draggingSession:willBeginAtPoint:forItemsAtIndexPaths:)]
unsafe fn collectionView_draggingSession_willBeginAtPoint_forItemsAtIndexPaths(
&self,
collection_view: &NSCollectionView,
session: &NSDraggingSession,
screen_point: NSPoint,
index_paths: &NSSet<NSIndexPath>,
);
#[cfg(all(
feature = "NSDraggingSession",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(collectionView:draggingSession:willBeginAtPoint:forItemsAtIndexes:)]
unsafe fn collectionView_draggingSession_willBeginAtPoint_forItemsAtIndexes(
&self,
collection_view: &NSCollectionView,
session: &NSDraggingSession,
screen_point: NSPoint,
indexes: &NSIndexSet,
);
#[cfg(all(
feature = "NSDragging",
feature = "NSDraggingSession",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(collectionView:draggingSession:endedAtPoint:dragOperation:)]
unsafe fn collectionView_draggingSession_endedAtPoint_dragOperation(
&self,
collection_view: &NSCollectionView,
session: &NSDraggingSession,
screen_point: NSPoint,
operation: NSDragOperation,
);
#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(collectionView:updateDraggingItemsForDrag:)]
unsafe fn collectionView_updateDraggingItemsForDrag(
&self,
collection_view: &NSCollectionView,
dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:shouldChangeItemsAtIndexPaths:toHighlightState:)]
unsafe fn collectionView_shouldChangeItemsAtIndexPaths_toHighlightState(
&self,
collection_view: &NSCollectionView,
index_paths: &NSSet<NSIndexPath>,
highlight_state: NSCollectionViewItemHighlightState,
) -> Id<NSSet<NSIndexPath>>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(collectionView:didChangeItemsAtIndexPaths:toHighlightState:)]
unsafe fn collectionView_didChangeItemsAtIndexPaths_toHighlightState(
&self,
collection_view: &NSCollectionView,
index_paths: &NSSet<NSIndexPath>,
highlight_state: NSCollectionViewItemHighlightState,
);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:shouldSelectItemsAtIndexPaths:)]
unsafe fn collectionView_shouldSelectItemsAtIndexPaths(
&self,
collection_view: &NSCollectionView,
index_paths: &NSSet<NSIndexPath>,
) -> Id<NSSet<NSIndexPath>>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:shouldDeselectItemsAtIndexPaths:)]
unsafe fn collectionView_shouldDeselectItemsAtIndexPaths(
&self,
collection_view: &NSCollectionView,
index_paths: &NSSet<NSIndexPath>,
) -> Id<NSSet<NSIndexPath>>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(collectionView:didSelectItemsAtIndexPaths:)]
unsafe fn collectionView_didSelectItemsAtIndexPaths(
&self,
collection_view: &NSCollectionView,
index_paths: &NSSet<NSIndexPath>,
);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(collectionView:didDeselectItemsAtIndexPaths:)]
unsafe fn collectionView_didDeselectItemsAtIndexPaths(
&self,
collection_view: &NSCollectionView,
index_paths: &NSSet<NSIndexPath>,
);
#[cfg(all(
feature = "NSResponder",
feature = "NSView",
feature = "NSViewController"
))]
#[optional]
#[method(collectionView:willDisplayItem:forRepresentedObjectAtIndexPath:)]
unsafe fn collectionView_willDisplayItem_forRepresentedObjectAtIndexPath(
&self,
collection_view: &NSCollectionView,
item: &NSCollectionViewItem,
index_path: &NSIndexPath,
);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:)]
unsafe fn collectionView_willDisplaySupplementaryView_forElementKind_atIndexPath(
&self,
collection_view: &NSCollectionView,
view: &NSView,
element_kind: &NSCollectionViewSupplementaryElementKind,
index_path: &NSIndexPath,
);
#[cfg(all(
feature = "NSResponder",
feature = "NSView",
feature = "NSViewController"
))]
#[optional]
#[method(collectionView:didEndDisplayingItem:forRepresentedObjectAtIndexPath:)]
unsafe fn collectionView_didEndDisplayingItem_forRepresentedObjectAtIndexPath(
&self,
collection_view: &NSCollectionView,
item: &NSCollectionViewItem,
index_path: &NSIndexPath,
);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:)]
unsafe fn collectionView_didEndDisplayingSupplementaryView_forElementOfKind_atIndexPath(
&self,
collection_view: &NSCollectionView,
view: &NSView,
element_kind: &NSCollectionViewSupplementaryElementKind,
index_path: &NSIndexPath,
);
#[cfg(all(
feature = "NSCollectionViewLayout",
feature = "NSCollectionViewTransitionLayout",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:transitionLayoutForOldLayout:newLayout:)]
unsafe fn collectionView_transitionLayoutForOldLayout_newLayout(
&self,
collection_view: &NSCollectionView,
from_layout: &NSCollectionViewLayout,
to_layout: &NSCollectionViewLayout,
) -> Id<NSCollectionViewTransitionLayout>;
}
unsafe impl ProtocolType for dyn NSCollectionViewDelegate {}
);
extern_category!(
#[doc(alias = "NSCollectionViewAdditions")]
pub unsafe trait NSIndexPathNSCollectionViewAdditions {
#[method_id(@__retain_semantics Other indexPathForItem:inSection:)]
unsafe fn indexPathForItem_inSection(
item: NSInteger,
section: NSInteger,
) -> Id<NSIndexPath>;
#[method(item)]
unsafe fn item(&self) -> NSInteger;
#[method(section)]
unsafe fn section(&self) -> NSInteger;
}
unsafe impl NSIndexPathNSCollectionViewAdditions for NSIndexPath {}
);
extern_category!(
#[doc(alias = "NSCollectionViewAdditions")]
pub unsafe trait NSSetNSCollectionViewAdditions {
#[method_id(@__retain_semantics Other setWithCollectionViewIndexPath:)]
unsafe fn setWithCollectionViewIndexPath(index_path: &NSIndexPath) -> Id<Self>;
#[method_id(@__retain_semantics Other setWithCollectionViewIndexPaths:)]
unsafe fn setWithCollectionViewIndexPaths(index_paths: &NSArray<NSIndexPath>) -> Id<Self>;
#[cfg(feature = "block2")]
#[method(enumerateIndexPathsWithOptions:usingBlock:)]
unsafe fn enumerateIndexPathsWithOptions_usingBlock(
&self,
opts: NSEnumerationOptions,
block: &Block<dyn Fn(NonNull<NSIndexPath>, NonNull<Bool>) + '_>,
);
}
unsafe impl NSSetNSCollectionViewAdditions for NSSet {}
);
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCollectionView {
#[cfg(feature = "NSViewController")]
#[deprecated = "Use -[NSCollectionViewDataSource collectionView:itemForRepresentedObjectAtIndexPath:] instead"]
#[method_id(@__retain_semantics New newItemForRepresentedObject:)]
pub unsafe fn newItemForRepresentedObject(
&self,
object: &AnyObject,
) -> Id<NSCollectionViewItem>;
#[cfg(feature = "NSViewController")]
#[deprecated = "Use -registerNib:forItemWithIdentifier: or -registerClass:forItemWithIdentifier: instead."]
#[method_id(@__retain_semantics Other itemPrototype)]
pub unsafe fn itemPrototype(&self) -> Option<Id<NSCollectionViewItem>>;
#[cfg(feature = "NSViewController")]
#[deprecated = "Use -registerNib:forItemWithIdentifier: or -registerClass:forItemWithIdentifier: instead."]
#[method(setItemPrototype:)]
pub unsafe fn setItemPrototype(&self, item_prototype: Option<&NSCollectionViewItem>);
#[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its maximumNumberOfRows instead"]
#[method(maxNumberOfRows)]
pub unsafe fn maxNumberOfRows(&self) -> NSUInteger;
#[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its maximumNumberOfRows instead"]
#[method(setMaxNumberOfRows:)]
pub unsafe fn setMaxNumberOfRows(&self, max_number_of_rows: NSUInteger);
#[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its maximumNumberOfColumns instead"]
#[method(maxNumberOfColumns)]
pub unsafe fn maxNumberOfColumns(&self) -> NSUInteger;
#[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its maximumNumberOfColumns instead"]
#[method(setMaxNumberOfColumns:)]
pub unsafe fn setMaxNumberOfColumns(&self, max_number_of_columns: NSUInteger);
#[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its minimumItemSize instead"]
#[method(minItemSize)]
pub unsafe fn minItemSize(&self) -> NSSize;
#[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its minimumItemSize instead"]
#[method(setMinItemSize:)]
pub unsafe fn setMinItemSize(&self, min_item_size: NSSize);
#[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its maximumItemSize instead"]
#[method(maxItemSize)]
pub unsafe fn maxItemSize(&self) -> NSSize;
#[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its maximumItemSize instead"]
#[method(setMaxItemSize:)]
pub unsafe fn setMaxItemSize(&self, max_item_size: NSSize);
}
);