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