1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSCollectionViewDropOperation(pub NSInteger);
15impl NSCollectionViewDropOperation {
16 #[doc(alias = "NSCollectionViewDropOn")]
17 pub const On: Self = Self(0);
18 #[doc(alias = "NSCollectionViewDropBefore")]
19 pub const Before: Self = Self(1);
20}
21
22unsafe impl Encode for NSCollectionViewDropOperation {
23 const ENCODING: Encoding = NSInteger::ENCODING;
24}
25
26unsafe impl RefEncode for NSCollectionViewDropOperation {
27 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
28}
29
30#[repr(transparent)]
33#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
34pub struct NSCollectionViewItemHighlightState(pub NSInteger);
35impl NSCollectionViewItemHighlightState {
36 #[doc(alias = "NSCollectionViewItemHighlightNone")]
37 pub const None: Self = Self(0);
38 #[doc(alias = "NSCollectionViewItemHighlightForSelection")]
39 pub const ForSelection: Self = Self(1);
40 #[doc(alias = "NSCollectionViewItemHighlightForDeselection")]
41 pub const ForDeselection: Self = Self(2);
42 #[doc(alias = "NSCollectionViewItemHighlightAsDropTarget")]
43 pub const AsDropTarget: Self = Self(3);
44}
45
46unsafe impl Encode for NSCollectionViewItemHighlightState {
47 const ENCODING: Encoding = NSInteger::ENCODING;
48}
49
50unsafe impl RefEncode for NSCollectionViewItemHighlightState {
51 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
52}
53
54#[repr(transparent)]
57#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
58pub struct NSCollectionViewScrollPosition(pub NSUInteger);
59bitflags::bitflags! {
60 impl NSCollectionViewScrollPosition: NSUInteger {
61 #[doc(alias = "NSCollectionViewScrollPositionNone")]
62 const None = 0;
63 #[doc(alias = "NSCollectionViewScrollPositionTop")]
64 const Top = 1<<0;
65 #[doc(alias = "NSCollectionViewScrollPositionCenteredVertically")]
66 const CenteredVertically = 1<<1;
67 #[doc(alias = "NSCollectionViewScrollPositionBottom")]
68 const Bottom = 1<<2;
69 #[doc(alias = "NSCollectionViewScrollPositionNearestHorizontalEdge")]
70 const NearestHorizontalEdge = 1<<9;
71 #[doc(alias = "NSCollectionViewScrollPositionLeft")]
72 const Left = 1<<3;
73 #[doc(alias = "NSCollectionViewScrollPositionCenteredHorizontally")]
74 const CenteredHorizontally = 1<<4;
75 #[doc(alias = "NSCollectionViewScrollPositionRight")]
76 const Right = 1<<5;
77 #[doc(alias = "NSCollectionViewScrollPositionLeadingEdge")]
78 const LeadingEdge = 1<<6;
79 #[doc(alias = "NSCollectionViewScrollPositionTrailingEdge")]
80 const TrailingEdge = 1<<7;
81 #[doc(alias = "NSCollectionViewScrollPositionNearestVerticalEdge")]
82 const NearestVerticalEdge = 1<<8;
83 }
84}
85
86unsafe impl Encode for NSCollectionViewScrollPosition {
87 const ENCODING: Encoding = NSUInteger::ENCODING;
88}
89
90unsafe impl RefEncode for NSCollectionViewScrollPosition {
91 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
92}
93
94pub type NSCollectionViewSupplementaryElementKind = NSString;
96
97extern_protocol!(
98 #[cfg(feature = "NSUserInterfaceItemIdentification")]
100 pub unsafe trait NSCollectionViewElement:
101 NSObjectProtocol + NSUserInterfaceItemIdentification + MainThreadOnly
102 {
103 #[optional]
104 #[unsafe(method(prepareForReuse))]
105 #[unsafe(method_family = none)]
106 fn prepareForReuse(&self);
107
108 #[cfg(feature = "NSCollectionViewLayout")]
109 #[optional]
110 #[unsafe(method(applyLayoutAttributes:))]
111 #[unsafe(method_family = none)]
112 fn applyLayoutAttributes(&self, layout_attributes: &NSCollectionViewLayoutAttributes);
113
114 #[cfg(feature = "NSCollectionViewLayout")]
115 #[optional]
116 #[unsafe(method(willTransitionFromLayout:toLayout:))]
117 #[unsafe(method_family = none)]
118 fn willTransitionFromLayout_toLayout(
119 &self,
120 old_layout: &NSCollectionViewLayout,
121 new_layout: &NSCollectionViewLayout,
122 );
123
124 #[cfg(feature = "NSCollectionViewLayout")]
125 #[optional]
126 #[unsafe(method(didTransitionFromLayout:toLayout:))]
127 #[unsafe(method_family = none)]
128 fn didTransitionFromLayout_toLayout(
129 &self,
130 old_layout: &NSCollectionViewLayout,
131 new_layout: &NSCollectionViewLayout,
132 );
133
134 #[cfg(feature = "NSCollectionViewLayout")]
135 #[optional]
136 #[unsafe(method(preferredLayoutAttributesFittingAttributes:))]
137 #[unsafe(method_family = none)]
138 fn preferredLayoutAttributesFittingAttributes(
139 &self,
140 layout_attributes: &NSCollectionViewLayoutAttributes,
141 ) -> Retained<NSCollectionViewLayoutAttributes>;
142 }
143);
144
145extern_protocol!(
146 #[cfg(feature = "NSUserInterfaceItemIdentification")]
148 pub unsafe trait NSCollectionViewSectionHeaderView:
149 NSCollectionViewElement + MainThreadOnly
150 {
151 #[cfg(all(
152 feature = "NSButton",
153 feature = "NSControl",
154 feature = "NSResponder",
155 feature = "NSView"
156 ))]
157 #[optional]
158 #[unsafe(method(sectionCollapseButton))]
159 #[unsafe(method_family = none)]
160 fn sectionCollapseButton(&self) -> Option<Retained<NSButton>>;
161
162 #[cfg(all(
163 feature = "NSButton",
164 feature = "NSControl",
165 feature = "NSResponder",
166 feature = "NSView"
167 ))]
168 #[optional]
172 #[unsafe(method(setSectionCollapseButton:))]
173 #[unsafe(method_family = none)]
174 fn setSectionCollapseButton(&self, section_collapse_button: Option<&NSButton>);
175 }
176);
177
178extern_class!(
179 #[unsafe(super(NSViewController, NSResponder, NSObject))]
181 #[derive(Debug, PartialEq, Eq, Hash)]
182 #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
183 pub struct NSCollectionViewItem;
184);
185
186#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
187extern_conformance!(
188 unsafe impl NSCoding for NSCollectionViewItem {}
189);
190
191#[cfg(all(
192 feature = "NSResponder",
193 feature = "NSUserInterfaceItemIdentification",
194 feature = "NSViewController"
195))]
196extern_conformance!(
197 unsafe impl NSCollectionViewElement for NSCollectionViewItem {}
198);
199
200#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
201extern_conformance!(
202 unsafe impl NSCopying for NSCollectionViewItem {}
203);
204
205#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
206unsafe impl CopyingHelper for NSCollectionViewItem {
207 type Result = Self;
208}
209
210#[cfg(all(
211 feature = "NSKeyValueBinding",
212 feature = "NSResponder",
213 feature = "NSViewController"
214))]
215extern_conformance!(
216 unsafe impl NSEditor for NSCollectionViewItem {}
217);
218
219#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
220extern_conformance!(
221 unsafe impl NSObjectProtocol for NSCollectionViewItem {}
222);
223
224#[cfg(all(
225 feature = "NSResponder",
226 feature = "NSStoryboardSegue",
227 feature = "NSViewController"
228))]
229extern_conformance!(
230 unsafe impl NSSeguePerforming for NSCollectionViewItem {}
231);
232
233#[cfg(all(
234 feature = "NSResponder",
235 feature = "NSUserInterfaceItemIdentification",
236 feature = "NSViewController"
237))]
238extern_conformance!(
239 unsafe impl NSUserInterfaceItemIdentification for NSCollectionViewItem {}
240);
241
242#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
243impl NSCollectionViewItem {
244 extern_methods!(
245 #[cfg(feature = "NSView")]
246 #[unsafe(method(collectionView))]
247 #[unsafe(method_family = none)]
248 pub fn collectionView(&self) -> Option<Retained<NSCollectionView>>;
249
250 #[unsafe(method(isSelected))]
251 #[unsafe(method_family = none)]
252 pub fn isSelected(&self) -> bool;
253
254 #[unsafe(method(setSelected:))]
256 #[unsafe(method_family = none)]
257 pub fn setSelected(&self, selected: bool);
258
259 #[unsafe(method(highlightState))]
260 #[unsafe(method_family = none)]
261 pub fn highlightState(&self) -> NSCollectionViewItemHighlightState;
262
263 #[unsafe(method(setHighlightState:))]
265 #[unsafe(method_family = none)]
266 pub fn setHighlightState(&self, highlight_state: NSCollectionViewItemHighlightState);
267
268 #[cfg(all(feature = "NSControl", feature = "NSImageView", feature = "NSView"))]
269 #[unsafe(method(imageView))]
270 #[unsafe(method_family = none)]
271 pub fn imageView(&self) -> Option<Retained<NSImageView>>;
272
273 #[cfg(all(feature = "NSControl", feature = "NSImageView", feature = "NSView"))]
274 #[unsafe(method(setImageView:))]
278 #[unsafe(method_family = none)]
279 pub fn setImageView(&self, image_view: Option<&NSImageView>);
280
281 #[cfg(all(feature = "NSControl", feature = "NSTextField", feature = "NSView"))]
282 #[unsafe(method(textField))]
283 #[unsafe(method_family = none)]
284 pub fn textField(&self) -> Option<Retained<NSTextField>>;
285
286 #[cfg(all(feature = "NSControl", feature = "NSTextField", feature = "NSView"))]
287 #[unsafe(method(setTextField:))]
291 #[unsafe(method_family = none)]
292 pub fn setTextField(&self, text_field: Option<&NSTextField>);
293
294 #[cfg(feature = "NSDraggingItem")]
295 #[unsafe(method(draggingImageComponents))]
296 #[unsafe(method_family = none)]
297 pub fn draggingImageComponents(&self) -> Retained<NSArray<NSDraggingImageComponent>>;
298 );
299}
300
301#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
303impl NSCollectionViewItem {
304 extern_methods!(
305 #[cfg(feature = "NSNib")]
306 #[unsafe(method(initWithNibName:bundle:))]
307 #[unsafe(method_family = init)]
308 pub fn initWithNibName_bundle(
309 this: Allocated<Self>,
310 nib_name_or_nil: Option<&NSNibName>,
311 nib_bundle_or_nil: Option<&NSBundle>,
312 ) -> Retained<Self>;
313
314 #[unsafe(method(initWithCoder:))]
318 #[unsafe(method_family = init)]
319 pub unsafe fn initWithCoder(
320 this: Allocated<Self>,
321 coder: &NSCoder,
322 ) -> Option<Retained<Self>>;
323 );
324}
325
326#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
328impl NSCollectionViewItem {
329 extern_methods!(
330 #[unsafe(method(init))]
331 #[unsafe(method_family = init)]
332 pub fn init(this: Allocated<Self>) -> Retained<Self>;
333 );
334}
335
336#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
338impl NSCollectionViewItem {
339 extern_methods!(
340 #[unsafe(method(new))]
341 #[unsafe(method_family = new)]
342 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
343 );
344}
345
346extern_class!(
347 #[unsafe(super(NSView, NSResponder, NSObject))]
349 #[derive(Debug, PartialEq, Eq, Hash)]
350 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
351 pub struct NSCollectionView;
352);
353
354#[cfg(all(
355 feature = "NSAccessibilityProtocols",
356 feature = "NSResponder",
357 feature = "NSView"
358))]
359extern_conformance!(
360 unsafe impl NSAccessibility for NSCollectionView {}
361);
362
363#[cfg(all(
364 feature = "NSAccessibilityProtocols",
365 feature = "NSResponder",
366 feature = "NSView"
367))]
368extern_conformance!(
369 unsafe impl NSAccessibilityElementProtocol for NSCollectionView {}
370);
371
372#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
373extern_conformance!(
374 unsafe impl NSAnimatablePropertyContainer for NSCollectionView {}
375);
376
377#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
378extern_conformance!(
379 unsafe impl NSAppearanceCustomization for NSCollectionView {}
380);
381
382#[cfg(all(feature = "NSResponder", feature = "NSView"))]
383extern_conformance!(
384 unsafe impl NSCoding for NSCollectionView {}
385);
386
387#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
388extern_conformance!(
389 unsafe impl NSDraggingDestination for NSCollectionView {}
390);
391
392#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
393extern_conformance!(
394 unsafe impl NSDraggingSource for NSCollectionView {}
395);
396
397#[cfg(all(feature = "NSResponder", feature = "NSView"))]
398extern_conformance!(
399 unsafe impl NSObjectProtocol for NSCollectionView {}
400);
401
402#[cfg(all(
403 feature = "NSResponder",
404 feature = "NSUserInterfaceItemIdentification",
405 feature = "NSView"
406))]
407extern_conformance!(
408 unsafe impl NSUserInterfaceItemIdentification for NSCollectionView {}
409);
410
411#[cfg(all(feature = "NSResponder", feature = "NSView"))]
412impl NSCollectionView {
413 extern_methods!(
414 #[unsafe(method(dataSource))]
415 #[unsafe(method_family = none)]
416 pub fn dataSource(
417 &self,
418 ) -> Option<Retained<ProtocolObject<dyn NSCollectionViewDataSource>>>;
419
420 #[unsafe(method(setDataSource:))]
424 #[unsafe(method_family = none)]
425 pub fn setDataSource(
426 &self,
427 data_source: Option<&ProtocolObject<dyn NSCollectionViewDataSource>>,
428 );
429
430 #[unsafe(method(prefetchDataSource))]
431 #[unsafe(method_family = none)]
432 pub fn prefetchDataSource(
433 &self,
434 ) -> Option<Retained<ProtocolObject<dyn NSCollectionViewPrefetching>>>;
435
436 #[unsafe(method(setPrefetchDataSource:))]
440 #[unsafe(method_family = none)]
441 pub fn setPrefetchDataSource(
442 &self,
443 prefetch_data_source: Option<&ProtocolObject<dyn NSCollectionViewPrefetching>>,
444 );
445
446 #[unsafe(method(content))]
447 #[unsafe(method_family = none)]
448 pub fn content(&self) -> Retained<NSArray<AnyObject>>;
449
450 #[unsafe(method(setContent:))]
458 #[unsafe(method_family = none)]
459 pub unsafe fn setContent(&self, content: &NSArray<AnyObject>);
460
461 #[unsafe(method(reloadData))]
462 #[unsafe(method_family = none)]
463 pub fn reloadData(&self);
464
465 #[unsafe(method(delegate))]
466 #[unsafe(method_family = none)]
467 pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSCollectionViewDelegate>>>;
468
469 #[unsafe(method(setDelegate:))]
473 #[unsafe(method_family = none)]
474 pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSCollectionViewDelegate>>);
475
476 #[unsafe(method(backgroundView))]
477 #[unsafe(method_family = none)]
478 pub fn backgroundView(&self) -> Option<Retained<NSView>>;
479
480 #[unsafe(method(setBackgroundView:))]
482 #[unsafe(method_family = none)]
483 pub fn setBackgroundView(&self, background_view: Option<&NSView>);
484
485 #[unsafe(method(backgroundViewScrollsWithContent))]
486 #[unsafe(method_family = none)]
487 pub fn backgroundViewScrollsWithContent(&self) -> bool;
488
489 #[unsafe(method(setBackgroundViewScrollsWithContent:))]
491 #[unsafe(method_family = none)]
492 pub fn setBackgroundViewScrollsWithContent(
493 &self,
494 background_view_scrolls_with_content: bool,
495 );
496
497 #[cfg(feature = "NSCollectionViewLayout")]
498 #[unsafe(method(collectionViewLayout))]
499 #[unsafe(method_family = none)]
500 pub fn collectionViewLayout(&self) -> Option<Retained<NSCollectionViewLayout>>;
501
502 #[cfg(feature = "NSCollectionViewLayout")]
503 #[unsafe(method(setCollectionViewLayout:))]
505 #[unsafe(method_family = none)]
506 pub fn setCollectionViewLayout(
507 &self,
508 collection_view_layout: Option<&NSCollectionViewLayout>,
509 );
510
511 #[cfg(feature = "NSCollectionViewLayout")]
512 #[unsafe(method(layoutAttributesForItemAtIndexPath:))]
513 #[unsafe(method_family = none)]
514 pub fn layoutAttributesForItemAtIndexPath(
515 &self,
516 index_path: &NSIndexPath,
517 ) -> Option<Retained<NSCollectionViewLayoutAttributes>>;
518
519 #[cfg(feature = "NSCollectionViewLayout")]
520 #[unsafe(method(layoutAttributesForSupplementaryElementOfKind:atIndexPath:))]
521 #[unsafe(method_family = none)]
522 pub fn layoutAttributesForSupplementaryElementOfKind_atIndexPath(
523 &self,
524 kind: &NSCollectionViewSupplementaryElementKind,
525 index_path: &NSIndexPath,
526 ) -> Option<Retained<NSCollectionViewLayoutAttributes>>;
527
528 #[unsafe(method(frameForItemAtIndex:))]
529 #[unsafe(method_family = none)]
530 pub fn frameForItemAtIndex(&self, index: NSUInteger) -> NSRect;
531
532 #[unsafe(method(frameForItemAtIndex:withNumberOfItems:))]
533 #[unsafe(method_family = none)]
534 pub fn frameForItemAtIndex_withNumberOfItems(
535 &self,
536 index: NSUInteger,
537 number_of_items: NSUInteger,
538 ) -> NSRect;
539
540 #[cfg(feature = "NSColor")]
541 #[unsafe(method(backgroundColors))]
542 #[unsafe(method_family = none)]
543 pub fn backgroundColors(&self) -> Retained<NSArray<NSColor>>;
544
545 #[cfg(feature = "NSColor")]
546 #[unsafe(method(setBackgroundColors:))]
550 #[unsafe(method_family = none)]
551 pub fn setBackgroundColors(&self, background_colors: Option<&NSArray<NSColor>>);
552
553 #[unsafe(method(numberOfSections))]
554 #[unsafe(method_family = none)]
555 pub fn numberOfSections(&self) -> NSInteger;
556
557 #[unsafe(method(numberOfItemsInSection:))]
558 #[unsafe(method_family = none)]
559 pub fn numberOfItemsInSection(&self, section: NSInteger) -> NSInteger;
560
561 #[unsafe(method(isFirstResponder))]
562 #[unsafe(method_family = none)]
563 pub fn isFirstResponder(&self) -> bool;
564
565 #[unsafe(method(isSelectable))]
566 #[unsafe(method_family = none)]
567 pub fn isSelectable(&self) -> bool;
568
569 #[unsafe(method(setSelectable:))]
571 #[unsafe(method_family = none)]
572 pub fn setSelectable(&self, selectable: bool);
573
574 #[unsafe(method(allowsEmptySelection))]
575 #[unsafe(method_family = none)]
576 pub fn allowsEmptySelection(&self) -> bool;
577
578 #[unsafe(method(setAllowsEmptySelection:))]
580 #[unsafe(method_family = none)]
581 pub fn setAllowsEmptySelection(&self, allows_empty_selection: bool);
582
583 #[unsafe(method(allowsMultipleSelection))]
584 #[unsafe(method_family = none)]
585 pub fn allowsMultipleSelection(&self) -> bool;
586
587 #[unsafe(method(setAllowsMultipleSelection:))]
589 #[unsafe(method_family = none)]
590 pub fn setAllowsMultipleSelection(&self, allows_multiple_selection: bool);
591
592 #[unsafe(method(selectionIndexes))]
593 #[unsafe(method_family = none)]
594 pub fn selectionIndexes(&self) -> Retained<NSIndexSet>;
595
596 #[unsafe(method(setSelectionIndexes:))]
600 #[unsafe(method_family = none)]
601 pub fn setSelectionIndexes(&self, selection_indexes: &NSIndexSet);
602
603 #[unsafe(method(selectionIndexPaths))]
604 #[unsafe(method_family = none)]
605 pub fn selectionIndexPaths(&self) -> Retained<NSSet<NSIndexPath>>;
606
607 #[unsafe(method(setSelectionIndexPaths:))]
611 #[unsafe(method_family = none)]
612 pub fn setSelectionIndexPaths(&self, selection_index_paths: &NSSet<NSIndexPath>);
613
614 #[unsafe(method(selectItemsAtIndexPaths:scrollPosition:))]
615 #[unsafe(method_family = none)]
616 pub fn selectItemsAtIndexPaths_scrollPosition(
617 &self,
618 index_paths: &NSSet<NSIndexPath>,
619 scroll_position: NSCollectionViewScrollPosition,
620 );
621
622 #[unsafe(method(deselectItemsAtIndexPaths:))]
623 #[unsafe(method_family = none)]
624 pub fn deselectItemsAtIndexPaths(&self, index_paths: &NSSet<NSIndexPath>);
625
626 #[unsafe(method(selectAll:))]
630 #[unsafe(method_family = none)]
631 pub unsafe fn selectAll(&self, sender: Option<&AnyObject>);
632
633 #[unsafe(method(deselectAll:))]
637 #[unsafe(method_family = none)]
638 pub unsafe fn deselectAll(&self, sender: Option<&AnyObject>);
639
640 #[cfg(feature = "NSUserInterfaceItemIdentification")]
641 #[unsafe(method(registerClass:forItemWithIdentifier:))]
645 #[unsafe(method_family = none)]
646 pub unsafe fn registerClass_forItemWithIdentifier(
647 &self,
648 item_class: Option<&AnyClass>,
649 identifier: &NSUserInterfaceItemIdentifier,
650 );
651
652 #[cfg(all(feature = "NSNib", feature = "NSUserInterfaceItemIdentification"))]
653 #[unsafe(method(registerNib:forItemWithIdentifier:))]
654 #[unsafe(method_family = none)]
655 pub fn registerNib_forItemWithIdentifier(
656 &self,
657 nib: Option<&NSNib>,
658 identifier: &NSUserInterfaceItemIdentifier,
659 );
660
661 #[cfg(feature = "NSUserInterfaceItemIdentification")]
662 #[unsafe(method(registerClass:forSupplementaryViewOfKind:withIdentifier:))]
666 #[unsafe(method_family = none)]
667 pub unsafe fn registerClass_forSupplementaryViewOfKind_withIdentifier(
668 &self,
669 view_class: Option<&AnyClass>,
670 kind: &NSCollectionViewSupplementaryElementKind,
671 identifier: &NSUserInterfaceItemIdentifier,
672 );
673
674 #[cfg(all(feature = "NSNib", feature = "NSUserInterfaceItemIdentification"))]
675 #[unsafe(method(registerNib:forSupplementaryViewOfKind:withIdentifier:))]
676 #[unsafe(method_family = none)]
677 pub fn registerNib_forSupplementaryViewOfKind_withIdentifier(
678 &self,
679 nib: Option<&NSNib>,
680 kind: &NSCollectionViewSupplementaryElementKind,
681 identifier: &NSUserInterfaceItemIdentifier,
682 );
683
684 #[cfg(all(
685 feature = "NSUserInterfaceItemIdentification",
686 feature = "NSViewController"
687 ))]
688 #[unsafe(method(makeItemWithIdentifier:forIndexPath:))]
689 #[unsafe(method_family = none)]
690 pub fn makeItemWithIdentifier_forIndexPath(
691 &self,
692 identifier: &NSUserInterfaceItemIdentifier,
693 index_path: &NSIndexPath,
694 ) -> Retained<NSCollectionViewItem>;
695
696 #[cfg(feature = "NSUserInterfaceItemIdentification")]
697 #[unsafe(method(makeSupplementaryViewOfKind:withIdentifier:forIndexPath:))]
698 #[unsafe(method_family = none)]
699 pub fn makeSupplementaryViewOfKind_withIdentifier_forIndexPath(
700 &self,
701 element_kind: &NSCollectionViewSupplementaryElementKind,
702 identifier: &NSUserInterfaceItemIdentifier,
703 index_path: &NSIndexPath,
704 ) -> Retained<NSView>;
705
706 #[cfg(feature = "NSViewController")]
707 #[unsafe(method(itemAtIndex:))]
708 #[unsafe(method_family = none)]
709 pub fn itemAtIndex(&self, index: NSUInteger) -> Option<Retained<NSCollectionViewItem>>;
710
711 #[cfg(feature = "NSViewController")]
712 #[unsafe(method(itemAtIndexPath:))]
713 #[unsafe(method_family = none)]
714 pub fn itemAtIndexPath(
715 &self,
716 index_path: &NSIndexPath,
717 ) -> Option<Retained<NSCollectionViewItem>>;
718
719 #[cfg(feature = "NSViewController")]
720 #[unsafe(method(visibleItems))]
721 #[unsafe(method_family = none)]
722 pub fn visibleItems(&self) -> Retained<NSArray<NSCollectionViewItem>>;
723
724 #[unsafe(method(indexPathsForVisibleItems))]
725 #[unsafe(method_family = none)]
726 pub fn indexPathsForVisibleItems(&self) -> Retained<NSSet<NSIndexPath>>;
727
728 #[cfg(feature = "NSViewController")]
729 #[unsafe(method(indexPathForItem:))]
730 #[unsafe(method_family = none)]
731 pub fn indexPathForItem(
732 &self,
733 item: &NSCollectionViewItem,
734 ) -> Option<Retained<NSIndexPath>>;
735
736 #[unsafe(method(indexPathForItemAtPoint:))]
737 #[unsafe(method_family = none)]
738 pub fn indexPathForItemAtPoint(&self, point: NSPoint) -> Option<Retained<NSIndexPath>>;
739
740 #[cfg(feature = "NSUserInterfaceItemIdentification")]
741 #[unsafe(method(supplementaryViewForElementKind:atIndexPath:))]
742 #[unsafe(method_family = none)]
743 pub fn supplementaryViewForElementKind_atIndexPath(
744 &self,
745 element_kind: &NSCollectionViewSupplementaryElementKind,
746 index_path: &NSIndexPath,
747 ) -> Option<Retained<NSView>>;
748
749 #[cfg(feature = "NSUserInterfaceItemIdentification")]
750 #[unsafe(method(visibleSupplementaryViewsOfKind:))]
751 #[unsafe(method_family = none)]
752 pub fn visibleSupplementaryViewsOfKind(
753 &self,
754 element_kind: &NSCollectionViewSupplementaryElementKind,
755 ) -> Retained<NSArray<NSView>>;
756
757 #[unsafe(method(indexPathsForVisibleSupplementaryElementsOfKind:))]
758 #[unsafe(method_family = none)]
759 pub fn indexPathsForVisibleSupplementaryElementsOfKind(
760 &self,
761 element_kind: &NSCollectionViewSupplementaryElementKind,
762 ) -> Retained<NSSet<NSIndexPath>>;
763
764 #[unsafe(method(insertSections:))]
765 #[unsafe(method_family = none)]
766 pub fn insertSections(&self, sections: &NSIndexSet);
767
768 #[unsafe(method(deleteSections:))]
769 #[unsafe(method_family = none)]
770 pub fn deleteSections(&self, sections: &NSIndexSet);
771
772 #[unsafe(method(reloadSections:))]
773 #[unsafe(method_family = none)]
774 pub fn reloadSections(&self, sections: &NSIndexSet);
775
776 #[unsafe(method(moveSection:toSection:))]
777 #[unsafe(method_family = none)]
778 pub fn moveSection_toSection(&self, section: NSInteger, new_section: NSInteger);
779
780 #[unsafe(method(insertItemsAtIndexPaths:))]
781 #[unsafe(method_family = none)]
782 pub fn insertItemsAtIndexPaths(&self, index_paths: &NSSet<NSIndexPath>);
783
784 #[unsafe(method(deleteItemsAtIndexPaths:))]
785 #[unsafe(method_family = none)]
786 pub fn deleteItemsAtIndexPaths(&self, index_paths: &NSSet<NSIndexPath>);
787
788 #[unsafe(method(reloadItemsAtIndexPaths:))]
789 #[unsafe(method_family = none)]
790 pub fn reloadItemsAtIndexPaths(&self, index_paths: &NSSet<NSIndexPath>);
791
792 #[unsafe(method(moveItemAtIndexPath:toIndexPath:))]
793 #[unsafe(method_family = none)]
794 pub fn moveItemAtIndexPath_toIndexPath(
795 &self,
796 index_path: &NSIndexPath,
797 new_index_path: &NSIndexPath,
798 );
799
800 #[cfg(feature = "block2")]
801 #[unsafe(method(performBatchUpdates:completionHandler:))]
802 #[unsafe(method_family = none)]
803 pub fn performBatchUpdates_completionHandler(
804 &self,
805 updates: Option<&block2::DynBlock<dyn Fn() + '_>>,
806 completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
807 );
808
809 #[unsafe(method(toggleSectionCollapse:))]
813 #[unsafe(method_family = none)]
814 pub unsafe fn toggleSectionCollapse(&self, sender: &AnyObject);
815
816 #[unsafe(method(scrollToItemsAtIndexPaths:scrollPosition:))]
817 #[unsafe(method_family = none)]
818 pub fn scrollToItemsAtIndexPaths_scrollPosition(
819 &self,
820 index_paths: &NSSet<NSIndexPath>,
821 scroll_position: NSCollectionViewScrollPosition,
822 );
823
824 #[cfg(feature = "NSDragging")]
825 #[unsafe(method(setDraggingSourceOperationMask:forLocal:))]
826 #[unsafe(method_family = none)]
827 pub fn setDraggingSourceOperationMask_forLocal(
828 &self,
829 drag_operation_mask: NSDragOperation,
830 local_destination: bool,
831 );
832
833 #[cfg(all(feature = "NSEvent", feature = "NSImage"))]
834 #[unsafe(method(draggingImageForItemsAtIndexPaths:withEvent:offset:))]
838 #[unsafe(method_family = none)]
839 pub unsafe fn draggingImageForItemsAtIndexPaths_withEvent_offset(
840 &self,
841 index_paths: &NSSet<NSIndexPath>,
842 event: &NSEvent,
843 drag_image_offset: NSPointPointer,
844 ) -> Retained<NSImage>;
845
846 #[cfg(all(feature = "NSEvent", feature = "NSImage"))]
847 #[unsafe(method(draggingImageForItemsAtIndexes:withEvent:offset:))]
851 #[unsafe(method_family = none)]
852 pub unsafe fn draggingImageForItemsAtIndexes_withEvent_offset(
853 &self,
854 indexes: &NSIndexSet,
855 event: &NSEvent,
856 drag_image_offset: NSPointPointer,
857 ) -> Retained<NSImage>;
858 );
859}
860
861#[cfg(all(feature = "NSResponder", feature = "NSView"))]
863impl NSCollectionView {
864 extern_methods!(
865 #[unsafe(method(initWithFrame:))]
866 #[unsafe(method_family = init)]
867 pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
868
869 #[unsafe(method(initWithCoder:))]
873 #[unsafe(method_family = init)]
874 pub unsafe fn initWithCoder(
875 this: Allocated<Self>,
876 coder: &NSCoder,
877 ) -> Option<Retained<Self>>;
878 );
879}
880
881#[cfg(all(feature = "NSResponder", feature = "NSView"))]
883impl NSCollectionView {
884 extern_methods!(
885 #[unsafe(method(init))]
886 #[unsafe(method_family = init)]
887 pub fn init(this: Allocated<Self>) -> Retained<Self>;
888 );
889}
890
891#[cfg(all(feature = "NSResponder", feature = "NSView"))]
893impl NSCollectionView {
894 extern_methods!(
895 #[unsafe(method(new))]
896 #[unsafe(method_family = new)]
897 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
898 );
899}
900
901extern_protocol!(
902 pub unsafe trait NSCollectionViewDataSource: NSObjectProtocol + MainThreadOnly {
904 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
905 #[unsafe(method(collectionView:numberOfItemsInSection:))]
906 #[unsafe(method_family = none)]
907 fn collectionView_numberOfItemsInSection(
908 &self,
909 collection_view: &NSCollectionView,
910 section: NSInteger,
911 ) -> NSInteger;
912
913 #[cfg(all(
914 feature = "NSResponder",
915 feature = "NSView",
916 feature = "NSViewController"
917 ))]
918 #[unsafe(method(collectionView:itemForRepresentedObjectAtIndexPath:))]
919 #[unsafe(method_family = none)]
920 fn collectionView_itemForRepresentedObjectAtIndexPath(
921 &self,
922 collection_view: &NSCollectionView,
923 index_path: &NSIndexPath,
924 ) -> Retained<NSCollectionViewItem>;
925
926 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
927 #[optional]
928 #[unsafe(method(numberOfSectionsInCollectionView:))]
929 #[unsafe(method_family = none)]
930 fn numberOfSectionsInCollectionView(&self, collection_view: &NSCollectionView)
931 -> NSInteger;
932
933 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
934 #[optional]
935 #[unsafe(method(collectionView:viewForSupplementaryElementOfKind:atIndexPath:))]
936 #[unsafe(method_family = none)]
937 fn collectionView_viewForSupplementaryElementOfKind_atIndexPath(
938 &self,
939 collection_view: &NSCollectionView,
940 kind: &NSCollectionViewSupplementaryElementKind,
941 index_path: &NSIndexPath,
942 ) -> Retained<NSView>;
943 }
944);
945
946extern_protocol!(
947 pub unsafe trait NSCollectionViewPrefetching: NSObjectProtocol + MainThreadOnly {
949 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
950 #[unsafe(method(collectionView:prefetchItemsAtIndexPaths:))]
951 #[unsafe(method_family = none)]
952 fn collectionView_prefetchItemsAtIndexPaths(
953 &self,
954 collection_view: &NSCollectionView,
955 index_paths: &NSArray<NSIndexPath>,
956 );
957
958 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
959 #[optional]
960 #[unsafe(method(collectionView:cancelPrefetchingForItemsAtIndexPaths:))]
961 #[unsafe(method_family = none)]
962 fn collectionView_cancelPrefetchingForItemsAtIndexPaths(
963 &self,
964 collection_view: &NSCollectionView,
965 index_paths: &NSArray<NSIndexPath>,
966 );
967 }
968);
969
970extern_protocol!(
971 pub unsafe trait NSCollectionViewDelegate: NSObjectProtocol {
973 #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
974 #[optional]
975 #[unsafe(method(collectionView:canDragItemsAtIndexPaths:withEvent:))]
976 #[unsafe(method_family = none)]
977 fn collectionView_canDragItemsAtIndexPaths_withEvent(
978 &self,
979 collection_view: &NSCollectionView,
980 index_paths: &NSSet<NSIndexPath>,
981 event: &NSEvent,
982 ) -> bool;
983
984 #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
985 #[optional]
986 #[unsafe(method(collectionView:canDragItemsAtIndexes:withEvent:))]
987 #[unsafe(method_family = none)]
988 fn collectionView_canDragItemsAtIndexes_withEvent(
989 &self,
990 collection_view: &NSCollectionView,
991 indexes: &NSIndexSet,
992 event: &NSEvent,
993 ) -> bool;
994
995 #[cfg(all(feature = "NSPasteboard", feature = "NSResponder", feature = "NSView"))]
996 #[deprecated = "Use -collectionView:pasteboardWriterForItemAtIndexPath: instead"]
997 #[optional]
998 #[unsafe(method(collectionView:writeItemsAtIndexPaths:toPasteboard:))]
999 #[unsafe(method_family = none)]
1000 fn collectionView_writeItemsAtIndexPaths_toPasteboard(
1001 &self,
1002 collection_view: &NSCollectionView,
1003 index_paths: &NSSet<NSIndexPath>,
1004 pasteboard: &NSPasteboard,
1005 ) -> bool;
1006
1007 #[cfg(all(feature = "NSPasteboard", feature = "NSResponder", feature = "NSView"))]
1008 #[deprecated = "Use -collectionView:pasteboardWriterForItemAtIndexPath: instead"]
1009 #[optional]
1010 #[unsafe(method(collectionView:writeItemsAtIndexes:toPasteboard:))]
1011 #[unsafe(method_family = none)]
1012 fn collectionView_writeItemsAtIndexes_toPasteboard(
1013 &self,
1014 collection_view: &NSCollectionView,
1015 indexes: &NSIndexSet,
1016 pasteboard: &NSPasteboard,
1017 ) -> bool;
1018
1019 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1020 #[deprecated = "Use NSFilePromiseReceiver objects instead"]
1021 #[optional]
1022 #[unsafe(method(collectionView:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAtIndexPaths:))]
1023 #[unsafe(method_family = none)]
1024 fn collectionView_namesOfPromisedFilesDroppedAtDestination_forDraggedItemsAtIndexPaths(
1025 &self,
1026 collection_view: &NSCollectionView,
1027 drop_url: &NSURL,
1028 index_paths: &NSSet<NSIndexPath>,
1029 ) -> Retained<NSArray<NSString>>;
1030
1031 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1032 #[deprecated = "Use NSFilePromiseReceiver objects instead"]
1033 #[optional]
1034 #[unsafe(method(collectionView:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAtIndexes:))]
1035 #[unsafe(method_family = none)]
1036 fn collectionView_namesOfPromisedFilesDroppedAtDestination_forDraggedItemsAtIndexes(
1037 &self,
1038 collection_view: &NSCollectionView,
1039 drop_url: &NSURL,
1040 indexes: &NSIndexSet,
1041 ) -> Retained<NSArray<NSString>>;
1042
1043 #[cfg(all(
1044 feature = "NSEvent",
1045 feature = "NSImage",
1046 feature = "NSResponder",
1047 feature = "NSView"
1048 ))]
1049 #[optional]
1053 #[unsafe(method(collectionView:draggingImageForItemsAtIndexPaths:withEvent:offset:))]
1054 #[unsafe(method_family = none)]
1055 unsafe fn collectionView_draggingImageForItemsAtIndexPaths_withEvent_offset(
1056 &self,
1057 collection_view: &NSCollectionView,
1058 index_paths: &NSSet<NSIndexPath>,
1059 event: &NSEvent,
1060 drag_image_offset: NSPointPointer,
1061 ) -> Retained<NSImage>;
1062
1063 #[cfg(all(
1064 feature = "NSEvent",
1065 feature = "NSImage",
1066 feature = "NSResponder",
1067 feature = "NSView"
1068 ))]
1069 #[optional]
1073 #[unsafe(method(collectionView:draggingImageForItemsAtIndexes:withEvent:offset:))]
1074 #[unsafe(method_family = none)]
1075 unsafe fn collectionView_draggingImageForItemsAtIndexes_withEvent_offset(
1076 &self,
1077 collection_view: &NSCollectionView,
1078 indexes: &NSIndexSet,
1079 event: &NSEvent,
1080 drag_image_offset: NSPointPointer,
1081 ) -> Retained<NSImage>;
1082
1083 #[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
1084 #[optional]
1088 #[unsafe(method(collectionView:validateDrop:proposedIndexPath:dropOperation:))]
1089 #[unsafe(method_family = none)]
1090 unsafe fn collectionView_validateDrop_proposedIndexPath_dropOperation(
1091 &self,
1092 collection_view: &NSCollectionView,
1093 dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
1094 proposed_drop_index_path: &mut Retained<NSIndexPath>,
1095 proposed_drop_operation: NonNull<NSCollectionViewDropOperation>,
1096 ) -> NSDragOperation;
1097
1098 #[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
1099 #[optional]
1104 #[unsafe(method(collectionView:validateDrop:proposedIndex:dropOperation:))]
1105 #[unsafe(method_family = none)]
1106 unsafe fn collectionView_validateDrop_proposedIndex_dropOperation(
1107 &self,
1108 collection_view: &NSCollectionView,
1109 dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
1110 proposed_drop_index: NonNull<NSInteger>,
1111 proposed_drop_operation: NonNull<NSCollectionViewDropOperation>,
1112 ) -> NSDragOperation;
1113
1114 #[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
1115 #[optional]
1116 #[unsafe(method(collectionView:acceptDrop:indexPath:dropOperation:))]
1117 #[unsafe(method_family = none)]
1118 fn collectionView_acceptDrop_indexPath_dropOperation(
1119 &self,
1120 collection_view: &NSCollectionView,
1121 dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
1122 index_path: &NSIndexPath,
1123 drop_operation: NSCollectionViewDropOperation,
1124 ) -> bool;
1125
1126 #[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
1127 #[optional]
1128 #[unsafe(method(collectionView:acceptDrop:index:dropOperation:))]
1129 #[unsafe(method_family = none)]
1130 fn collectionView_acceptDrop_index_dropOperation(
1131 &self,
1132 collection_view: &NSCollectionView,
1133 dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
1134 index: NSInteger,
1135 drop_operation: NSCollectionViewDropOperation,
1136 ) -> bool;
1137
1138 #[cfg(all(feature = "NSPasteboard", feature = "NSResponder", feature = "NSView"))]
1139 #[optional]
1140 #[unsafe(method(collectionView:pasteboardWriterForItemAtIndexPath:))]
1141 #[unsafe(method_family = none)]
1142 fn collectionView_pasteboardWriterForItemAtIndexPath(
1143 &self,
1144 collection_view: &NSCollectionView,
1145 index_path: &NSIndexPath,
1146 ) -> Option<Retained<ProtocolObject<dyn NSPasteboardWriting>>>;
1147
1148 #[cfg(all(feature = "NSPasteboard", feature = "NSResponder", feature = "NSView"))]
1149 #[optional]
1150 #[unsafe(method(collectionView:pasteboardWriterForItemAtIndex:))]
1151 #[unsafe(method_family = none)]
1152 fn collectionView_pasteboardWriterForItemAtIndex(
1153 &self,
1154 collection_view: &NSCollectionView,
1155 index: NSUInteger,
1156 ) -> Option<Retained<ProtocolObject<dyn NSPasteboardWriting>>>;
1157
1158 #[cfg(all(
1159 feature = "NSDraggingSession",
1160 feature = "NSResponder",
1161 feature = "NSView"
1162 ))]
1163 #[optional]
1164 #[unsafe(method(collectionView:draggingSession:willBeginAtPoint:forItemsAtIndexPaths:))]
1165 #[unsafe(method_family = none)]
1166 fn collectionView_draggingSession_willBeginAtPoint_forItemsAtIndexPaths(
1167 &self,
1168 collection_view: &NSCollectionView,
1169 session: &NSDraggingSession,
1170 screen_point: NSPoint,
1171 index_paths: &NSSet<NSIndexPath>,
1172 );
1173
1174 #[cfg(all(
1175 feature = "NSDraggingSession",
1176 feature = "NSResponder",
1177 feature = "NSView"
1178 ))]
1179 #[optional]
1180 #[unsafe(method(collectionView:draggingSession:willBeginAtPoint:forItemsAtIndexes:))]
1181 #[unsafe(method_family = none)]
1182 fn collectionView_draggingSession_willBeginAtPoint_forItemsAtIndexes(
1183 &self,
1184 collection_view: &NSCollectionView,
1185 session: &NSDraggingSession,
1186 screen_point: NSPoint,
1187 indexes: &NSIndexSet,
1188 );
1189
1190 #[cfg(all(
1191 feature = "NSDragging",
1192 feature = "NSDraggingSession",
1193 feature = "NSResponder",
1194 feature = "NSView"
1195 ))]
1196 #[optional]
1197 #[unsafe(method(collectionView:draggingSession:endedAtPoint:dragOperation:))]
1198 #[unsafe(method_family = none)]
1199 fn collectionView_draggingSession_endedAtPoint_dragOperation(
1200 &self,
1201 collection_view: &NSCollectionView,
1202 session: &NSDraggingSession,
1203 screen_point: NSPoint,
1204 operation: NSDragOperation,
1205 );
1206
1207 #[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
1208 #[optional]
1209 #[unsafe(method(collectionView:updateDraggingItemsForDrag:))]
1210 #[unsafe(method_family = none)]
1211 fn collectionView_updateDraggingItemsForDrag(
1212 &self,
1213 collection_view: &NSCollectionView,
1214 dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
1215 );
1216
1217 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1218 #[optional]
1219 #[unsafe(method(collectionView:shouldChangeItemsAtIndexPaths:toHighlightState:))]
1220 #[unsafe(method_family = none)]
1221 fn collectionView_shouldChangeItemsAtIndexPaths_toHighlightState(
1222 &self,
1223 collection_view: &NSCollectionView,
1224 index_paths: &NSSet<NSIndexPath>,
1225 highlight_state: NSCollectionViewItemHighlightState,
1226 ) -> Retained<NSSet<NSIndexPath>>;
1227
1228 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1229 #[optional]
1230 #[unsafe(method(collectionView:didChangeItemsAtIndexPaths:toHighlightState:))]
1231 #[unsafe(method_family = none)]
1232 fn collectionView_didChangeItemsAtIndexPaths_toHighlightState(
1233 &self,
1234 collection_view: &NSCollectionView,
1235 index_paths: &NSSet<NSIndexPath>,
1236 highlight_state: NSCollectionViewItemHighlightState,
1237 );
1238
1239 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1240 #[optional]
1241 #[unsafe(method(collectionView:shouldSelectItemsAtIndexPaths:))]
1242 #[unsafe(method_family = none)]
1243 fn collectionView_shouldSelectItemsAtIndexPaths(
1244 &self,
1245 collection_view: &NSCollectionView,
1246 index_paths: &NSSet<NSIndexPath>,
1247 ) -> Retained<NSSet<NSIndexPath>>;
1248
1249 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1250 #[optional]
1251 #[unsafe(method(collectionView:shouldDeselectItemsAtIndexPaths:))]
1252 #[unsafe(method_family = none)]
1253 fn collectionView_shouldDeselectItemsAtIndexPaths(
1254 &self,
1255 collection_view: &NSCollectionView,
1256 index_paths: &NSSet<NSIndexPath>,
1257 ) -> Retained<NSSet<NSIndexPath>>;
1258
1259 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1260 #[optional]
1261 #[unsafe(method(collectionView:didSelectItemsAtIndexPaths:))]
1262 #[unsafe(method_family = none)]
1263 fn collectionView_didSelectItemsAtIndexPaths(
1264 &self,
1265 collection_view: &NSCollectionView,
1266 index_paths: &NSSet<NSIndexPath>,
1267 );
1268
1269 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1270 #[optional]
1271 #[unsafe(method(collectionView:didDeselectItemsAtIndexPaths:))]
1272 #[unsafe(method_family = none)]
1273 fn collectionView_didDeselectItemsAtIndexPaths(
1274 &self,
1275 collection_view: &NSCollectionView,
1276 index_paths: &NSSet<NSIndexPath>,
1277 );
1278
1279 #[cfg(all(
1280 feature = "NSResponder",
1281 feature = "NSView",
1282 feature = "NSViewController"
1283 ))]
1284 #[optional]
1285 #[unsafe(method(collectionView:willDisplayItem:forRepresentedObjectAtIndexPath:))]
1286 #[unsafe(method_family = none)]
1287 fn collectionView_willDisplayItem_forRepresentedObjectAtIndexPath(
1288 &self,
1289 collection_view: &NSCollectionView,
1290 item: &NSCollectionViewItem,
1291 index_path: &NSIndexPath,
1292 );
1293
1294 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1295 #[optional]
1296 #[unsafe(method(collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:))]
1297 #[unsafe(method_family = none)]
1298 fn collectionView_willDisplaySupplementaryView_forElementKind_atIndexPath(
1299 &self,
1300 collection_view: &NSCollectionView,
1301 view: &NSView,
1302 element_kind: &NSCollectionViewSupplementaryElementKind,
1303 index_path: &NSIndexPath,
1304 );
1305
1306 #[cfg(all(
1307 feature = "NSResponder",
1308 feature = "NSView",
1309 feature = "NSViewController"
1310 ))]
1311 #[optional]
1312 #[unsafe(method(collectionView:didEndDisplayingItem:forRepresentedObjectAtIndexPath:))]
1313 #[unsafe(method_family = none)]
1314 fn collectionView_didEndDisplayingItem_forRepresentedObjectAtIndexPath(
1315 &self,
1316 collection_view: &NSCollectionView,
1317 item: &NSCollectionViewItem,
1318 index_path: &NSIndexPath,
1319 );
1320
1321 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1322 #[optional]
1323 #[unsafe(method(collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:))]
1324 #[unsafe(method_family = none)]
1325 fn collectionView_didEndDisplayingSupplementaryView_forElementOfKind_atIndexPath(
1326 &self,
1327 collection_view: &NSCollectionView,
1328 view: &NSView,
1329 element_kind: &NSCollectionViewSupplementaryElementKind,
1330 index_path: &NSIndexPath,
1331 );
1332
1333 #[cfg(all(
1334 feature = "NSCollectionViewLayout",
1335 feature = "NSCollectionViewTransitionLayout",
1336 feature = "NSResponder",
1337 feature = "NSView"
1338 ))]
1339 #[optional]
1340 #[unsafe(method(collectionView:transitionLayoutForOldLayout:newLayout:))]
1341 #[unsafe(method_family = none)]
1342 fn collectionView_transitionLayoutForOldLayout_newLayout(
1343 &self,
1344 collection_view: &NSCollectionView,
1345 from_layout: &NSCollectionViewLayout,
1346 to_layout: &NSCollectionViewLayout,
1347 ) -> Retained<NSCollectionViewTransitionLayout>;
1348 }
1349);
1350
1351mod private_NSIndexPathNSCollectionViewAdditions {
1352 pub trait Sealed {}
1353}
1354
1355#[doc(alias = "NSCollectionViewAdditions")]
1357pub unsafe trait NSIndexPathNSCollectionViewAdditions:
1358 ClassType + Sized + private_NSIndexPathNSCollectionViewAdditions::Sealed
1359{
1360 extern_methods!(
1361 #[unsafe(method(indexPathForItem:inSection:))]
1362 #[unsafe(method_family = none)]
1363 fn indexPathForItem_inSection(item: NSInteger, section: NSInteger)
1364 -> Retained<NSIndexPath>;
1365
1366 #[unsafe(method(item))]
1367 #[unsafe(method_family = none)]
1368 fn item(&self) -> NSInteger;
1369
1370 #[unsafe(method(section))]
1371 #[unsafe(method_family = none)]
1372 fn section(&self) -> NSInteger;
1373 );
1374}
1375
1376impl private_NSIndexPathNSCollectionViewAdditions::Sealed for NSIndexPath {}
1377unsafe impl NSIndexPathNSCollectionViewAdditions for NSIndexPath {}
1378
1379mod private_NSSetNSCollectionViewAdditions {
1380 pub trait Sealed {}
1381}
1382
1383#[doc(alias = "NSCollectionViewAdditions")]
1385pub unsafe trait NSSetNSCollectionViewAdditions:
1386 ClassType + Sized + private_NSSetNSCollectionViewAdditions::Sealed
1387{
1388 extern_methods!(
1389 #[unsafe(method(setWithCollectionViewIndexPath:))]
1390 #[unsafe(method_family = none)]
1391 fn setWithCollectionViewIndexPath(index_path: &NSIndexPath) -> Retained<Self>;
1392
1393 #[unsafe(method(setWithCollectionViewIndexPaths:))]
1394 #[unsafe(method_family = none)]
1395 fn setWithCollectionViewIndexPaths(index_paths: &NSArray<NSIndexPath>) -> Retained<Self>;
1396
1397 #[cfg(feature = "block2")]
1398 #[unsafe(method(enumerateIndexPathsWithOptions:usingBlock:))]
1399 #[unsafe(method_family = none)]
1400 fn enumerateIndexPathsWithOptions_usingBlock(
1401 &self,
1402 opts: NSEnumerationOptions,
1403 block: &block2::DynBlock<dyn Fn(NonNull<NSIndexPath>, NonNull<Bool>) + '_>,
1404 );
1405 );
1406}
1407
1408impl private_NSSetNSCollectionViewAdditions::Sealed for NSSet {}
1409unsafe impl NSSetNSCollectionViewAdditions for NSSet {}
1410
1411#[cfg(all(feature = "NSResponder", feature = "NSView"))]
1413impl NSCollectionView {
1414 extern_methods!(
1415 #[cfg(feature = "NSViewController")]
1416 #[deprecated = "Use -[NSCollectionViewDataSource collectionView:itemForRepresentedObjectAtIndexPath:] instead"]
1420 #[unsafe(method(newItemForRepresentedObject:))]
1421 #[unsafe(method_family = new)]
1422 pub unsafe fn newItemForRepresentedObject(
1423 &self,
1424 object: &AnyObject,
1425 ) -> Retained<NSCollectionViewItem>;
1426
1427 #[cfg(feature = "NSViewController")]
1428 #[deprecated = "Use -registerNib:forItemWithIdentifier: or -registerClass:forItemWithIdentifier: instead."]
1429 #[unsafe(method(itemPrototype))]
1430 #[unsafe(method_family = none)]
1431 pub fn itemPrototype(&self) -> Option<Retained<NSCollectionViewItem>>;
1432
1433 #[cfg(feature = "NSViewController")]
1434 #[deprecated = "Use -registerNib:forItemWithIdentifier: or -registerClass:forItemWithIdentifier: instead."]
1436 #[unsafe(method(setItemPrototype:))]
1437 #[unsafe(method_family = none)]
1438 pub fn setItemPrototype(&self, item_prototype: Option<&NSCollectionViewItem>);
1439
1440 #[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its maximumNumberOfRows instead"]
1441 #[unsafe(method(maxNumberOfRows))]
1442 #[unsafe(method_family = none)]
1443 pub fn maxNumberOfRows(&self) -> NSUInteger;
1444
1445 #[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its maximumNumberOfRows instead"]
1447 #[unsafe(method(setMaxNumberOfRows:))]
1448 #[unsafe(method_family = none)]
1449 pub fn setMaxNumberOfRows(&self, max_number_of_rows: NSUInteger);
1450
1451 #[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its maximumNumberOfColumns instead"]
1452 #[unsafe(method(maxNumberOfColumns))]
1453 #[unsafe(method_family = none)]
1454 pub fn maxNumberOfColumns(&self) -> NSUInteger;
1455
1456 #[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its maximumNumberOfColumns instead"]
1458 #[unsafe(method(setMaxNumberOfColumns:))]
1459 #[unsafe(method_family = none)]
1460 pub fn setMaxNumberOfColumns(&self, max_number_of_columns: NSUInteger);
1461
1462 #[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its minimumItemSize instead"]
1463 #[unsafe(method(minItemSize))]
1464 #[unsafe(method_family = none)]
1465 pub fn minItemSize(&self) -> NSSize;
1466
1467 #[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its minimumItemSize instead"]
1469 #[unsafe(method(setMinItemSize:))]
1470 #[unsafe(method_family = none)]
1471 pub fn setMinItemSize(&self, min_item_size: NSSize);
1472
1473 #[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its maximumItemSize instead"]
1474 #[unsafe(method(maxItemSize))]
1475 #[unsafe(method_family = none)]
1476 pub fn maxItemSize(&self) -> NSSize;
1477
1478 #[deprecated = "Use NSCollectionViewGridLayout as the receiver's collectionViewLayout, setting its maximumItemSize instead"]
1480 #[unsafe(method(setMaxItemSize:))]
1481 #[unsafe(method_family = none)]
1482 pub fn setMaxItemSize(&self, max_item_size: NSSize);
1483 );
1484}