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