mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Add methods and actions for layout classes as well as the abstract classes for NSCollectionViewLayout.
Declarations added to collectionview layout header. Clean compile for NSCollectionViewLayout abstract class Add header for NSCollectionViewFlowLayout.h Add skeleton implementation of NSCollectionViewFlowLayout Add implementation for simple setter/getter methods. Correct compilation error with non-clang compilers Fix compilation issues Add getter/setter for collectionViewLayout Skeleton of NSCollectionViewTransitionLayout implementation Add encoding/decoding for collectionViewLayout key Make NSCollectionViewGridLayout default if the NSCollectionViewLayoutKey is not set Add protocols for DataSource and Prefetching for NSCollectionView Add 10.11 methods to delegate declaration remove templating from NSCollectionViewDelegate that gcc can't handle. New delegate methods for NSCollectionViewDelegate to support NSSets of NSIndexPaths and multiple selection. Reset .travis.yml to the proper version and modify NSCollectionView.h to use forward declarations for both NSPasteboard and NSPasteboardWriting so that we don't explicitly import. Add declarations for missing methods from 10.11 version of NSCollectionView Add new methods for 10.11 for moving, deleting and collapsing sections. Add new methods from 10.11 Add the remaining missing methods as well as delcarations for blocks needed for batch handler and completion handler. Add skeleton implementations for all new methods Changes to add new methods to collection view for delegate Consolidate the registeredClass and registeredNib maps. Implementation of dataSource related methods Implment nib loading for NSCollectionViewItem subclasses Remove uneeded ivars, add categories for override and layout Minor formatting change Update categories and organization of code Add init method to NSCollectionViewFlowLayoutInvalidationContext Add collectionview layout subclasses Declarations added to collectionview layout header. Clean compile for NSCollectionViewLayout abstract class Add skeleton implementation of NSCollectionViewFlowLayout Add implementation for simple setter/getter methods. Correct compilation error with non-clang compilers Fix compilation issues Add getter/setter for collectionViewLayout Add encoding/decoding for collectionViewLayout key Make NSCollectionViewGridLayout default if the NSCollectionViewLayoutKey is not set Add protocols for DataSource and Prefetching for NSCollectionView New delegate methods for NSCollectionViewDelegate to support NSSets of NSIndexPaths and multiple selection. Reset .travis.yml to the proper version and modify NSCollectionView.h to use forward declarations for both NSPasteboard and NSPasteboardWriting so that we don't explicitly import. Add declarations for missing methods from 10.11 version of NSCollectionView Add new methods for 10.11 for moving, deleting and collapsing sections. Add new methods from 10.11 Changes to add new methods to collection view for delegate Consolidate the registeredClass and registeredNib maps. Add init method to NSCollectionViewFlowLayoutInvalidationContext Fix issues with rebase
This commit is contained in:
parent
aee03ee7c4
commit
8572458a5d
8 changed files with 1771 additions and 56 deletions
|
@ -1,11 +1,14 @@
|
|||
/* -*-objc-*-
|
||||
NSCollectionView.h
|
||||
|
||||
Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013,2021 Free Software Foundation, Inc.
|
||||
|
||||
Author: Doug Simons (doug.simons@testplant.com)
|
||||
Frank LeGrand (frank.legrand@testplant.com)
|
||||
Date: February 2013
|
||||
Gregory Casamento (greg.casamento@gmail.com)
|
||||
(Adding new delegate methods and support for layouts)
|
||||
|
||||
Date: February 2013, December 2021
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
|
@ -36,6 +39,22 @@
|
|||
|
||||
@class NSCollectionViewItem;
|
||||
@class NSCollectionView;
|
||||
@class NSCollectionViewLayout;
|
||||
@class NSCollectionViewLayoutAttributes;
|
||||
@class NSCollectionViewTransitionLayout;
|
||||
@class NSPasteboard;
|
||||
@class NSNib;
|
||||
@class NSMapTable;
|
||||
@class NSMutableArray;
|
||||
@class NSMutableDictionary;
|
||||
@class NSMutableSet;
|
||||
|
||||
@class NSMapTable;
|
||||
@class NSMutableArray;
|
||||
@class NSMutableDictionary;
|
||||
@class NSMutableSet;
|
||||
|
||||
@protocol NSPasteboardWriting;
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -44,33 +63,241 @@ enum
|
|||
};
|
||||
typedef NSInteger NSCollectionViewDropOperation;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
enum {
|
||||
NSCollectionViewItemHighlightNone = 0,
|
||||
NSCollectionViewItemHighlightForSelection = 1,
|
||||
NSCollectionViewItemHighlightForDeselection = 2,
|
||||
NSCollectionViewItemHighlightAsDropTarget = 3,
|
||||
};
|
||||
typedef NSInteger NSCollectionViewItemHighlightState;
|
||||
|
||||
enum {
|
||||
NSCollectionViewScrollPositionNone = 0,
|
||||
|
||||
/*
|
||||
* Vertical positions are mutually exclusive to each other, but are bitwise or-able with
|
||||
* the horizontal scroll positions. Combining positions from the same grouping
|
||||
* (horizontal or vertical) will result in an NSInvalidArgumentException.
|
||||
*/
|
||||
NSCollectionViewScrollPositionTop = 1 << 0,
|
||||
NSCollectionViewScrollPositionCenteredVertically = 1 << 1,
|
||||
NSCollectionViewScrollPositionBottom = 1 << 2,
|
||||
NSCollectionViewScrollPositionNearestHorizontalEdge = 1 << 9, /* Nearer of Top,Bottom */
|
||||
|
||||
/*
|
||||
* Likewise, the horizontal positions are mutually exclusive to each other.
|
||||
*/
|
||||
NSCollectionViewScrollPositionLeft = 1 << 3,
|
||||
NSCollectionViewScrollPositionCenteredHorizontally = 1 << 4,
|
||||
NSCollectionViewScrollPositionRight = 1 << 5,
|
||||
NSCollectionViewScrollPositionLeadingEdge = 1 << 6, /* Left if LTR, Right if RTL */
|
||||
NSCollectionViewScrollPositionTrailingEdge = 1 << 7, /* Right if LTR, Left, if RTL */
|
||||
NSCollectionViewScrollPositionNearestVerticalEdge = 1 << 8, /* Nearer of Leading,Trailing */
|
||||
};
|
||||
typedef NSUInteger NSCollectionViewScrollPosition;
|
||||
|
||||
#endif
|
||||
|
||||
typedef NSString *NSCollectionViewSupplementaryElementKind;
|
||||
typedef NSString *NSUserInterfaceItemIdentifier;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
@protocol NSCollectionViewDataSource <NSObject>
|
||||
#if GS_PROTOCOLS_HAVE_OPTIONAL
|
||||
@required
|
||||
#endif
|
||||
- (NSInteger) collectionView: (NSCollectionView *)collectionView
|
||||
numberOfItemsInSection: (NSInteger)section;
|
||||
|
||||
- (NSCollectionViewItem *) collectionView: (NSCollectionView *)collectionView
|
||||
itemForRepresentedObjectAtIndexPath: (NSIndexPath *)indexPath;
|
||||
#if GS_PROTOCOLS_HAVE_OPTIONAL
|
||||
@optional
|
||||
#endif
|
||||
- (NSInteger) numberOfSectionsInCollectionView: (NSCollectionView *)collectionView;
|
||||
|
||||
- (NSView *) collectionView: (NSCollectionView *)collectionView
|
||||
viewForSupplementaryElementOfKind: (NSCollectionViewSupplementaryElementKind)kind
|
||||
atIndexPath:(NSIndexPath *)indexPath;
|
||||
@end
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
@protocol NSCollectionViewPrefetching <NSObject>
|
||||
#if GS_PROTOCOLS_HAVE_OPTIONAL
|
||||
@required
|
||||
#endif
|
||||
- (void)collectionView:(NSCollectionView *)collectionView prefetchItemsAtIndexPaths:(NSArray *)indexPaths;
|
||||
#if GS_PROTOCOLS_HAVE_OPTIONAL
|
||||
@optional
|
||||
#endif
|
||||
- (void)collectionView:(NSCollectionView *)collectionView cancelPrefetchingForItemsAtIndexPaths:(NSArray *)indexPaths;
|
||||
@end
|
||||
#endif
|
||||
|
||||
@protocol NSCollectionViewDelegate <NSObject>
|
||||
|
||||
- (NSImage *)collectionView:(NSCollectionView *)collectionView
|
||||
draggingImageForItemsAtIndexes:(NSIndexSet *)indexes
|
||||
withEvent:(NSEvent *)event
|
||||
offset:(NSPointPointer)dragImageOffset;
|
||||
- (BOOL)collectionView:(NSCollectionView *)collectionView
|
||||
writeItemsAtIndexes:(NSIndexSet *)indexes
|
||||
toPasteboard:(NSPasteboard *)pasteboard;
|
||||
- (BOOL)collectionView:(NSCollectionView *)collectionView
|
||||
canDragItemsAtIndexes:(NSIndexSet *)indexes
|
||||
withEvent:(NSEvent *)event;
|
||||
- (NSDragOperation)collectionView:(NSCollectionView *)collectionView
|
||||
validateDrop:(id < NSDraggingInfo >)draggingInfo
|
||||
proposedIndex:(NSInteger *)proposedDropIndex
|
||||
dropOperation:(NSCollectionViewDropOperation *)proposedDropOperation;
|
||||
- (BOOL)collectionView:(NSCollectionView *)collectionView
|
||||
acceptDrop:(id < NSDraggingInfo >)draggingInfo
|
||||
index:(NSInteger)index
|
||||
dropOperation:(NSCollectionViewDropOperation)dropOperation;
|
||||
- (NSArray *)collectionView:(NSCollectionView *)collectionView
|
||||
namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropURL
|
||||
forDraggedItemsAtIndexes:(NSIndexSet *)indexes;
|
||||
#if GS_PROTOCOLS_HAVE_OPTIONAL
|
||||
@optional
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
- (BOOL) collectionView: (NSCollectionView *)collectionView
|
||||
canDragItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
withEvent: (NSEvent *)event;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
- (BOOL) collectionView: (NSCollectionView *)collectionView
|
||||
canDragItemsAtIndexes: (NSIndexSet *)indexes
|
||||
withEvent: (NSEvent *)event;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
- (BOOL) collectionView: (NSCollectionView *)collectionView
|
||||
writeItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
toPasteboard: (NSPasteboard *)pasteboard;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
- (BOOL) collectionView: (NSCollectionView *)collectionView
|
||||
writeItemsAtIndexes: (NSIndexSet *)indexes
|
||||
toPasteboard: (NSPasteboard *)pasteboard;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
- (NSArray *) collectionView: (NSCollectionView *)collectionView
|
||||
namesOfPromisedFilesDroppedAtDestination: (NSURL *)dropURL
|
||||
forDraggedItemsAtIndexPaths: (NSSet *)indexPaths;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
- (NSArray *) collectionView: (NSCollectionView *)collectionView
|
||||
namesOfPromisedFilesDroppedAtDestination: (NSURL *)dropURL
|
||||
forDraggedItemsAtIndexes: (NSIndexSet *)indexes;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
- (NSImage *) collectionView: (NSCollectionView *)collectionView
|
||||
draggingImageForItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
withEvent: (NSEvent *)event
|
||||
offset: (NSPointPointer)dragImageOffset;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
- (NSImage *) collectionView: (NSCollectionView *)collectionView
|
||||
draggingImageForItemsAtIndexes: (NSIndexSet *)indexes
|
||||
withEvent: (NSEvent *)event
|
||||
offset: (NSPointPointer)dragImageOffset;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
- (NSDragOperation) collectionView: (NSCollectionView *)collectionView
|
||||
validateDrop: (id < NSDraggingInfo >)draggingInfo
|
||||
proposedIndexPath: (NSIndexPath **)proposedDropIndexPath
|
||||
dropOperation: (NSCollectionViewDropOperation *)proposedDropOperation;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
- (NSDragOperation) collectionView: (NSCollectionView *)collectionView
|
||||
validateDrop: (id < NSDraggingInfo >)draggingInfo
|
||||
proposedIndex: (NSInteger *)proposedDropIndex
|
||||
dropOperation: (NSCollectionViewDropOperation *)proposedDropOperation;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
- (BOOL) collectionView: (NSCollectionView *)collectionView
|
||||
acceptDrop: (id < NSDraggingInfo >)draggingInfo
|
||||
indexPath: (NSIndexPath *)indexPath
|
||||
dropOperation: (NSCollectionViewDropOperation)dropOperation;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
- (BOOL) collectionView: (NSCollectionView *)collectionView
|
||||
acceptDrop: (id < NSDraggingInfo >)draggingInfo
|
||||
index: (NSInteger)index
|
||||
dropOperation: (NSCollectionViewDropOperation)dropOperation;
|
||||
#endif
|
||||
|
||||
/* Multi-image drag and drop */
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
- (id <NSPasteboardWriting>) collectionView: (NSCollectionView *)collectionView
|
||||
pasteboardWriterForItemAtIndexPath: (NSIndexPath *)indexPath;
|
||||
#endif
|
||||
|
||||
- (id <NSPasteboardWriting>) collectionView: (NSCollectionView *)collectionView
|
||||
pasteboardWriterForItemAtIndex: (NSUInteger)index;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
- (void) collectionView: (NSCollectionView *)collectionView
|
||||
draggingSession: (NSDraggingSession *)session
|
||||
willBeginAtPoint: (NSPoint)screenPoint
|
||||
forItemsAtIndexPaths: (NSSet *)indexPaths;
|
||||
#endif
|
||||
|
||||
- (void) collectionView: (NSCollectionView *)collectionView
|
||||
draggingSession: (NSDraggingSession *)session
|
||||
willBeginAtPoint: (NSPoint)screenPoint
|
||||
forItemsAtIndexes: (NSIndexSet *)indexes;
|
||||
|
||||
- (void) collectionView: (NSCollectionView *)collectionView
|
||||
draggingSession: (NSDraggingSession *)session
|
||||
endedAtPoint: (NSPoint)screenPoint
|
||||
dragOperation: (NSDragOperation)operation;
|
||||
|
||||
- (void) collectionView: (NSCollectionView *)collectionView
|
||||
updateDraggingItemsForDrag: (id <NSDraggingInfo>)draggingInfo;
|
||||
|
||||
/* Selection and Highlighting */
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
- (NSSet *) collectionView: (NSCollectionView *)collectionView
|
||||
shouldChangeItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
toHighlightState: (NSCollectionViewItemHighlightState)highlightState;
|
||||
|
||||
- (void) collectionView: (NSCollectionView *)collectionView
|
||||
didChangeItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
toHighlightState: (NSCollectionViewItemHighlightState)highlightState;
|
||||
|
||||
- (NSSet *) collectionView: (NSCollectionView *)collectionView
|
||||
shouldSelectItemsAtIndexPaths: (NSSet *)indexPaths;
|
||||
|
||||
- (NSSet *) collectionView: (NSCollectionView *)collectionView shouldDeselectItemsAtIndexPaths: (NSSet *)indexPaths;
|
||||
|
||||
- (void) collectionView: (NSCollectionView *)collectionView didSelectItemsAtIndexPaths: (NSSet *)indexPaths;
|
||||
|
||||
- (void) collectionView: (NSCollectionView *)collectionView didDeselectItemsAtIndexPaths: (NSSet *)indexPaths;
|
||||
|
||||
/* Display Notification */
|
||||
|
||||
- (void) collectionView: (NSCollectionView *)collectionView
|
||||
willDisplayItem: (NSCollectionViewItem *)item
|
||||
forRepresentedObjectAtIndexPath: (NSIndexPath *)indexPath;
|
||||
|
||||
- (void) collectionView: (NSCollectionView *)collectionView
|
||||
willDisplaySupplementaryView: (NSView *)view
|
||||
forElementKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)indexPath;
|
||||
|
||||
- (void) collectionView: (NSCollectionView *)collectionView
|
||||
didEndDisplayingItem: (NSCollectionViewItem *)item
|
||||
forRepresentedObjectAtIndexPath: (NSIndexPath *)indexPath;
|
||||
|
||||
- (void) collectionView: (NSCollectionView *)collectionView
|
||||
didEndDisplayingSupplementaryView: (NSView *)view
|
||||
forElementOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)indexPath;
|
||||
|
||||
/* Layout Transition Support */
|
||||
|
||||
- (NSCollectionViewTransitionLayout *) collectionView: (NSCollectionView *)collectionView
|
||||
transitionLayoutForOldLayout: (NSCollectionViewLayout *)fromLayout
|
||||
newLayout: (NSCollectionViewLayout *)toLayout;
|
||||
#endif
|
||||
@end
|
||||
|
||||
|
||||
APPKIT_EXPORT_CLASS
|
||||
@interface NSCollectionView : NSView //<NSDraggingDestination, NSDraggingSource>
|
||||
{
|
||||
|
@ -80,11 +307,18 @@ APPKIT_EXPORT_CLASS
|
|||
|
||||
BOOL _allowsMultipleSelection;
|
||||
BOOL _isSelectable;
|
||||
BOOL _allowsEmptySelection;
|
||||
NSIndexSet *_selectionIndexes;
|
||||
|
||||
NSArray *_backgroundColors;
|
||||
IBOutlet id <NSCollectionViewDelegate> delegate;
|
||||
|
||||
|
||||
IBOutlet id <NSCollectionViewDelegate> _delegate;
|
||||
IBOutlet id <NSCollectionViewDataSource> _dataSource;
|
||||
IBOutlet NSView *_backgroundView;
|
||||
IBOutlet id <NSCollectionViewPrefetching> _prefetchDataSource;
|
||||
|
||||
BOOL _backgroundViewScrollsWithContent;
|
||||
|
||||
NSSize _itemSize;
|
||||
NSSize _maxItemSize;
|
||||
NSSize _minItemSize;
|
||||
|
@ -101,6 +335,22 @@ APPKIT_EXPORT_CLASS
|
|||
|
||||
NSUInteger _draggingOnRow;
|
||||
NSUInteger _draggingOnIndex;
|
||||
|
||||
NSCollectionViewLayout *_collectionViewLayout;
|
||||
|
||||
// Managing items
|
||||
NSArray *_visibleItems;
|
||||
NSSet *_indexPathsForVisibleItems;
|
||||
NSDictionary *_visibleSupplementaryViews;
|
||||
NSSet *_indexPathsForSupplementaryElementsOfKind;
|
||||
|
||||
// Registered class/nib for item identifier
|
||||
NSMapTable *_registeredNibs;
|
||||
NSMapTable *_registeredClasses;
|
||||
|
||||
// Registered class/nib for item kind & identifier
|
||||
NSMapTable *_registeredNibForItemWithIdentifier;
|
||||
NSMapTable *_registeredClassForItemWithIdentifier;
|
||||
}
|
||||
|
||||
- (BOOL) allowsMultipleSelection;
|
||||
|
@ -109,8 +359,8 @@ APPKIT_EXPORT_CLASS
|
|||
- (NSArray *) backgroundColors;
|
||||
- (void) setBackgroundColors: (NSArray *)colors;
|
||||
|
||||
- (NSArray *)content;
|
||||
- (void)setContent:(NSArray *)content;
|
||||
- (NSArray *) content;
|
||||
- (void) setContent: (NSArray *)content;
|
||||
|
||||
- (id < NSCollectionViewDelegate >) delegate;
|
||||
- (void) setDelegate: (id < NSCollectionViewDelegate >)aDelegate;
|
||||
|
@ -136,9 +386,14 @@ APPKIT_EXPORT_CLASS
|
|||
- (NSIndexSet *) selectionIndexes;
|
||||
- (void) setSelectionIndexes: (NSIndexSet *)indexes;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
- (NSCollectionViewLayout *) collectionViewLayout;
|
||||
- (void) setCollectionViewLayout: (NSCollectionViewLayout *)layout;
|
||||
#endif
|
||||
|
||||
- (NSRect) frameForItemAtIndex: (NSUInteger)index;
|
||||
- (NSCollectionViewItem *) itemAtIndex: (NSUInteger)index;
|
||||
- (NSCollectionViewItem *) newItemForRepresentedObject:(id)object;
|
||||
- (NSCollectionViewItem *) newItemForRepresentedObject: (id)object;
|
||||
|
||||
- (void) tile;
|
||||
|
||||
|
@ -149,6 +404,142 @@ APPKIT_EXPORT_CLASS
|
|||
withEvent: (NSEvent *)event
|
||||
offset: (NSPointPointer)dragImageOffset;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
/* Locating Items and Views */
|
||||
|
||||
- (NSArray *) visibleItems;
|
||||
|
||||
- (NSSet *) indexPathsForVisibleItems;
|
||||
|
||||
- (NSArray *) visibleSupplementaryViewsOfKind: (NSCollectionViewSupplementaryElementKind)elementKind;
|
||||
|
||||
- (NSSet *) indexPathsForVisibleSupplementaryElementsOfKind: (NSCollectionViewSupplementaryElementKind)elementKind;
|
||||
|
||||
- (NSIndexPath *) indexPathForItem: (NSCollectionViewItem *)item;
|
||||
|
||||
- (NSIndexPath *) indexPathForItemAtPoint: (NSPoint)point;
|
||||
|
||||
- (NSCollectionViewItem *) itemAtIndexPath: (NSIndexPath *)indexPath;
|
||||
|
||||
- (NSView *)supplementaryViewForElementKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)indexPath;
|
||||
|
||||
- (void) scrollToItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
scrollPosition: (NSCollectionViewScrollPosition)scrollPosition;
|
||||
|
||||
/* Creating Collection view Items */
|
||||
|
||||
- (NSCollectionViewItem *) makeItemWithIdentifier: (NSUserInterfaceItemIdentifier)identifier
|
||||
forIndexPath: (NSIndexPath *)indexPath;
|
||||
|
||||
- (void) registerClass: (Class)itemClass
|
||||
forItemWithIdentifier: (NSUserInterfaceItemIdentifier)identifier;
|
||||
|
||||
- (void) registerNib: (NSNib *)nib
|
||||
forItemWithIdentifier: (NSUserInterfaceItemIdentifier)identifier;
|
||||
|
||||
- (NSView *) makeSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
withIdentifier: (NSUserInterfaceItemIdentifier)identifier
|
||||
forIndexPath: (NSIndexPath *)indexPath;
|
||||
|
||||
- (void)registerClass: (Class)viewClass
|
||||
forSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)kind
|
||||
withIdentifier:(NSUserInterfaceItemIdentifier)identifier;
|
||||
|
||||
- (void) registerNib: (NSNib *)nib
|
||||
forSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)kind
|
||||
withIdentifier: (NSUserInterfaceItemIdentifier)identifier;
|
||||
|
||||
/* Providing the collection view's data */
|
||||
|
||||
- (id<NSCollectionViewDataSource>) dataSource;
|
||||
|
||||
- (void) setDataSource: (id<NSCollectionViewDataSource>)dataSource;
|
||||
|
||||
/* Configuring the Collection view */
|
||||
|
||||
- (NSView *) backgroundView;
|
||||
|
||||
- (void) setBackgroundView: (NSView *)backgroundView;
|
||||
|
||||
- (BOOL) backgroundViewScrollsWithContent;
|
||||
|
||||
- (void) setBackgroundViewScrollsWithContent: (BOOL)f;
|
||||
|
||||
/* Reloading Content */
|
||||
|
||||
- (void) reloadData;
|
||||
|
||||
- (void) reloadSections: (NSIndexSet *)sections;
|
||||
|
||||
- (void) reloadItemsAtIndexPaths: (NSSet *)indexPaths;
|
||||
|
||||
/* Prefetching Collection View Cells and Data */
|
||||
|
||||
- (id<NSCollectionViewPrefetching>) prefetchDataSource;
|
||||
|
||||
- (void) setPrefetchDataSource: (id<NSCollectionViewPrefetching>)prefetchDataSource;
|
||||
|
||||
/* Getting the State of the Collection View */
|
||||
|
||||
- (NSInteger) numberOfSections;
|
||||
|
||||
- (NSInteger) numberOfItemsInSection: (NSInteger)section;
|
||||
|
||||
/* Inserting, Moving and Deleting Items */
|
||||
|
||||
- (void) insertItemsAtIndexPaths: (NSSet *)indexPaths;
|
||||
|
||||
- (void) moveItemAtIndexPath: (NSIndexPath *)indexPath
|
||||
toIndexPath: (NSIndexPath *)newIndexPath;
|
||||
|
||||
- (void) deleteItemsAtIndexPaths: (NSSet *)indexPaths;
|
||||
|
||||
/* Inserting, Moving, Deleting and Collapsing Sections */
|
||||
|
||||
- (void) insertSections: (NSIndexSet *)sections;
|
||||
|
||||
- (void) moveSection: (NSInteger)section
|
||||
toSection: (NSInteger)newSection;
|
||||
|
||||
- (void) deleteSections: (NSIndexSet *)sections;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_12, GS_API_LATEST)
|
||||
- (IBAction) toggleSectionCollapse: (id)sender;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
- (BOOL) allowsEmptySelection;
|
||||
|
||||
- (void) setAllowsEmptySelection: (BOOL)flag;
|
||||
|
||||
- (NSSet *) selectionIndexPaths; // copy
|
||||
|
||||
- (IBAction) selectAll: (id)sender;
|
||||
|
||||
- (IBAction) deselectAll: (id)sender;
|
||||
|
||||
- (void) selectItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
scrollPosition: (NSCollectionViewScrollPosition)scrollPosition;
|
||||
|
||||
- (void) deselectItemsAtIndexPaths: (NSSet *)indexPaths;
|
||||
|
||||
/* Getting Layout Information */
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *) layoutAttributesForItemAtIndexPath: (NSIndexPath *)indexPath;
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *) layoutAttributesForSupplementaryElementOfKind: (NSCollectionViewSupplementaryElementKind)kind
|
||||
atIndexPath: (NSIndexPath *)indexPath;
|
||||
/* Animating Multiple Changes */
|
||||
|
||||
DEFINE_BLOCK_TYPE_NO_ARGS(GSCollectionViewPerformBatchUpdatesBlock, void);
|
||||
DEFINE_BLOCK_TYPE(GSCollectionViewCompletionHandlerBlock, void, BOOL);
|
||||
|
||||
- (void) performBatchUpdates: (GSCollectionViewPerformBatchUpdatesBlock) updates
|
||||
completionHandler: (GSCollectionViewCompletionHandlerBlock) completionHandler;
|
||||
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -25,15 +25,115 @@
|
|||
#ifndef _NSCollectionViewFlowLayout_h_GNUSTEP_GUI_INCLUDE
|
||||
#define _NSCollectionViewFlowLayout_h_GNUSTEP_GUI_INCLUDE
|
||||
|
||||
#import <AppKit/NSCollectionView.h>
|
||||
#import <AppKit/NSCollectionViewLayout.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
NSCollectionViewScrollDirectionVertical,
|
||||
NSCollectionViewScrollDirectionHorizontal
|
||||
};
|
||||
typedef NSInteger NSCollectionViewScrollDirection;
|
||||
|
||||
NSCollectionViewSupplementaryElementKind const NSCollectionElementKindSectionHeader;
|
||||
NSCollectionViewSupplementaryElementKind const NSCollectionElementKindSectionFooter;
|
||||
|
||||
@interface NSCollectionViewFlowLayoutInvalidationContext : NSCollectionViewLayoutInvalidationContext
|
||||
{
|
||||
BOOL _invalidateFlowLayoutDelegateMetrics;
|
||||
BOOL _invalidateFlowLayoutAttributes;
|
||||
}
|
||||
|
||||
- (void) setInvalidateFlowLayoutDelegateMetrics: (BOOL)flag;
|
||||
- (BOOL) invalidateFlowLayoutDelegateMetrics;
|
||||
|
||||
- (void) setInvalidateFlowLayoutAttributes: (BOOL)flag;
|
||||
- (BOOL) invalidateFlowLayoutAttributes;
|
||||
@end
|
||||
|
||||
@protocol NSCollectionViewDelegateFlowLayout <NSCollectionViewDelegate>
|
||||
|
||||
- (NSSize) collectionView: (NSCollectionView *)collectionView
|
||||
layout: (NSCollectionViewLayout*)collectionViewLayout
|
||||
sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
|
||||
|
||||
- (NSEdgeInsets)collectionView: (NSCollectionView *)collectionView
|
||||
layout: (NSCollectionViewLayout*)collectionViewLayout
|
||||
insetForSectionAtIndex: (NSInteger)section;
|
||||
|
||||
- (CGFloat) collectionView: (NSCollectionView *)collectionView
|
||||
layout: (NSCollectionViewLayout*)collectionViewLayout
|
||||
minimumLineSpacingForSectionAtIndex: (NSInteger)section;
|
||||
|
||||
- (CGFloat) collectionView: (NSCollectionView *)collectionView
|
||||
layout: (NSCollectionViewLayout*)collectionViewLayout
|
||||
minimumInteritemSpacingForSectionAtIndex: (NSInteger)section;
|
||||
|
||||
- (NSSize) collectionView: (NSCollectionView *)collectionView
|
||||
layout: (NSCollectionViewLayout*)collectionViewLayout
|
||||
referenceSizeForHeaderInSection: (NSInteger)section;
|
||||
|
||||
- (NSSize) collectionView: (NSCollectionView *)collectionView
|
||||
layout: (NSCollectionViewLayout*)collectionViewLayout
|
||||
referenceSizeForFooterInSection:(NSInteger)section;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSCollectionViewFlowLayout : NSCollectionViewLayout
|
||||
{
|
||||
CGFloat _minimumLineSpacing;
|
||||
CGFloat _minimumInteritemSpacing;
|
||||
NSSize _itemSize;
|
||||
NSSize _estimatedItemSize;
|
||||
NSCollectionViewScrollDirection _scrollDirection;
|
||||
NSSize _headerReferenceSize;
|
||||
NSSize _footerReferenceSize;
|
||||
NSEdgeInsets _sectionInset;
|
||||
BOOL _sectionHeadersPinToVisibleBounds;
|
||||
BOOL _sectionFootersPinToVisibleBounds;
|
||||
}
|
||||
|
||||
- (CGFloat) minimumLineSpacing;
|
||||
- (void) setMinimumLineSpacing: (CGFloat)spacing;
|
||||
|
||||
- (CGFloat) minimumInteritemSpacing;
|
||||
- (void) setMinimumInteritemSpacing: (CGFloat)spacing;
|
||||
|
||||
- (NSSize) itemSize;
|
||||
- (void) setItemSize: (NSSize)itemSize;
|
||||
|
||||
- (NSSize) estimatedItemSize;
|
||||
- (void) setEstimatedItemSize: (NSSize)size;
|
||||
|
||||
- (NSCollectionViewScrollDirection) scrollDirection;
|
||||
- (void) setScrollDirection: (NSCollectionViewScrollDirection)direction;
|
||||
|
||||
- (NSSize) headerReferenceSize;
|
||||
- (void) setHeaderReferenceSize: (NSSize)size;
|
||||
|
||||
- (NSSize) footerReferenceSize;
|
||||
- (void) setFooterReferenceSize: (NSSize)size;
|
||||
|
||||
- (NSEdgeInsets) sectionInset;
|
||||
- (void) setSectionInset: (NSEdgeInsets)inset;
|
||||
|
||||
- (BOOL) sectionHeadersPinToVisibleBounds;
|
||||
- (void) setSectionHeadersPinToVisibleBounds: (BOOL)f;
|
||||
|
||||
- (BOOL) sectionFootersPinToVisibleBounds;
|
||||
- (void) setSectionFootersPinToVisibleBounds: (BOOL)f;
|
||||
|
||||
- (BOOL) sectionAtIndexIsCollapsed: (NSUInteger)sectionIndex;
|
||||
|
||||
- (void) collapseSectionAtIndex: (NSUInteger)sectionIndex;
|
||||
|
||||
- (void) expandSectionAtIndex: (NSUInteger)sectionIndex;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
#define _NSCollectionViewLayout_h_GNUSTEP_GUI_INCLUDE
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSGeometry.h>
|
||||
|
||||
#import <AppKit/NSCollectionView.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
|
||||
|
@ -33,7 +36,212 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
@interface NSCollectionViewLayout : NSObject
|
||||
enum
|
||||
{
|
||||
NSCollectionElementCategoryItem,
|
||||
NSCollectionElementCategorySupplementaryView,
|
||||
NSCollectionElementCategoryDecorationView,
|
||||
NSCollectionElementCategoryInterItemGap
|
||||
};
|
||||
typedef NSInteger NSCollectionElementCategory;
|
||||
|
||||
|
||||
typedef NSString *NSCollectionViewDecorationElementKind;
|
||||
NSCollectionViewSupplementaryElementKind NSCollectionElementKindInterItemGapIndicator;
|
||||
|
||||
@class NSCollectionViewLayoutAttributes;
|
||||
@class NSCollectionView;
|
||||
@class NSDictionary;
|
||||
@class NSIndexPath;
|
||||
@class NSNib;
|
||||
@class NSSet;
|
||||
|
||||
@interface NSCollectionViewLayoutAttributes : NSObject <NSCopying>
|
||||
{
|
||||
NSRect _frame;
|
||||
NSSize _size;
|
||||
CGFloat _alpha;
|
||||
NSInteger _zIndex;
|
||||
BOOL _hidden;
|
||||
NSIndexPath *_indexPath;
|
||||
NSCollectionElementCategory _representedElementCategory;
|
||||
NSString *_representedElementKind;
|
||||
}
|
||||
|
||||
// Initializers
|
||||
+ (instancetype) layoutAttributesForItemWithIndexPath: (NSIndexPath *)indexPath;
|
||||
+ (instancetype) layoutAttributesForInterItemGapBeforeIndexPath: (NSIndexPath *)indexPath;
|
||||
+ (instancetype) layoutAttributesForSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
withIndexPath: (NSIndexPath *)indexPath;
|
||||
+ (instancetype)layoutAttributesForDecorationViewOfKind:(NSCollectionViewDecorationElementKind)decorationViewKind
|
||||
withIndexPath: (NSIndexPath*)indexPath;
|
||||
|
||||
// Properties
|
||||
- (NSRect) frame;
|
||||
- (void) setFrame: (NSRect)frame;
|
||||
|
||||
- (NSSize) size;
|
||||
- (void) setSize: (NSSize)size;
|
||||
|
||||
- (CGFloat) alpha;
|
||||
- (void) setAlpha: (CGFloat)alpha;
|
||||
|
||||
- (BOOL) isHidden;
|
||||
- (void) setHidden: (BOOL)hidden;
|
||||
|
||||
- (NSIndexPath *) indexPath;
|
||||
- (void) setIndexPath: (NSIndexPath *)indexPath;
|
||||
|
||||
- (NSCollectionElementCategory) representedElementCategory;
|
||||
- (NSString *) representedElementKind;
|
||||
@end
|
||||
|
||||
enum
|
||||
{
|
||||
NSCollectionUpdateActionInsert,
|
||||
NSCollectionUpdateActionDelete,
|
||||
NSCollectionUpdateActionReload,
|
||||
NSCollectionUpdateActionMove,
|
||||
NSCollectionUpdateActionNone
|
||||
};
|
||||
typedef NSInteger NSCollectionUpdateAction;
|
||||
|
||||
@interface NSCollectionViewUpdateItem : NSObject
|
||||
{
|
||||
NSIndexPath *_indexPathBeforeUpdate;
|
||||
NSIndexPath *_indexPathAfterUpdate;
|
||||
NSCollectionUpdateAction _updateAction;
|
||||
}
|
||||
|
||||
- (NSIndexPath *) indexPathBeforeUpdate;
|
||||
- (NSIndexPath *) indexPathAfterUpdate;
|
||||
- (NSCollectionUpdateAction) updateAction;
|
||||
@end
|
||||
|
||||
|
||||
@interface NSCollectionViewLayoutInvalidationContext : NSObject
|
||||
{
|
||||
NSPoint _contentOffsetAdjustment;
|
||||
NSSize _contentSizeAdjustment;
|
||||
NSSet *_invalidatedItemIndexPaths;
|
||||
NSDictionary *_invalidatedSupplementaryIndexPaths;
|
||||
NSDictionary *_invalidatedDecorationIndexPaths;
|
||||
}
|
||||
|
||||
// Initializers
|
||||
- (void)invalidateItemsAtIndexPaths: (NSSet *)indexPaths;
|
||||
- (void)invalidateSupplementaryElementsOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
atIndexPaths: (NSSet *)indexPaths;
|
||||
- (void)invalidateDecorationElementsOfKind: (NSCollectionViewDecorationElementKind)elementKind
|
||||
atIndexPaths: (NSSet *)indexPaths;
|
||||
|
||||
// Properties
|
||||
- (BOOL) invalidateEverything;
|
||||
- (BOOL) invalidateDataSourceCounts;
|
||||
|
||||
- (NSSet *) invalidatedItemIndexPaths;
|
||||
|
||||
- (NSPoint) contentOffsetAdjustment;
|
||||
- (void) setContentOffsetAdjustment: (NSPoint)point;
|
||||
|
||||
- (NSSize) contentSizeAdjustment;
|
||||
- (void) setContentSizeAdjustment: (NSSize)size;
|
||||
|
||||
- (NSDictionary *) invalidatedSupplementaryIndexPaths;
|
||||
- (NSDictionary *) invalidatedDecorationIndexPaths;
|
||||
@end
|
||||
|
||||
@interface NSCollectionViewLayout : NSObject <NSCoding>
|
||||
{
|
||||
NSCollectionView *_collectionView; // weak
|
||||
BOOL _valid;
|
||||
|
||||
Class _layoutAttributesClass;
|
||||
Class _invalidationContextClass;
|
||||
NSSize _collectionViewContentSize;
|
||||
}
|
||||
|
||||
// Initializers
|
||||
- (void)invalidateLayout;
|
||||
- (void)invalidateLayoutWithContext:(NSCollectionViewLayoutInvalidationContext *)context;
|
||||
|
||||
- (void)registerClass: (Class)viewClass
|
||||
forDecorationViewOfKind: (NSCollectionViewDecorationElementKind)elementKind;
|
||||
- (void)registerNib: (NSNib *)nib
|
||||
forDecorationViewOfKind: (NSCollectionViewDecorationElementKind)elementKind;
|
||||
|
||||
// Properties
|
||||
- (NSCollectionView *) collectionView;
|
||||
- (void) setCollectionView: (NSCollectionView *)cv;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSCollectionViewLayout (NSSubclassingHooks)
|
||||
|
||||
// Methods to override for specific layouts...
|
||||
- (void) prepareLayout;
|
||||
- (NSArray *) layoutAttributesForElementsInRect: (NSRect)rect;
|
||||
- (NSCollectionViewLayoutAttributes *) layoutAttributesForItemAtIndexPath: (NSIndexPath *)indexPath;
|
||||
- (NSCollectionViewLayoutAttributes *)
|
||||
layoutAttributesForSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)indexPath;
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *)
|
||||
layoutAttributesForDecorationViewOfKind: (NSCollectionViewDecorationElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)indexPath;
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *) layoutAttributesForDropTargetAtPoint: (NSPoint)pointInCollectionView;
|
||||
- (NSCollectionViewLayoutAttributes *) layoutAttributesForInterItemGapBeforeIndexPath: (NSIndexPath *)indexPath;
|
||||
|
||||
- (BOOL) shouldInvalidateLayoutForBoundsChange: (NSRect)newBounds;
|
||||
- (NSCollectionViewLayoutInvalidationContext *) invalidationContextForBoundsChange: (NSRect)newBounds;
|
||||
|
||||
- (BOOL) shouldInvalidateLayoutForPreferredLayoutAttributes: (NSCollectionViewLayoutAttributes *)preferredAttributes
|
||||
withOriginalAttributes: (NSCollectionViewLayoutAttributes *)originalAttributes;
|
||||
|
||||
- (NSCollectionViewLayoutInvalidationContext *)
|
||||
invalidationContextForPreferredLayoutAttributes: (NSCollectionViewLayoutAttributes *)preferredAttributes
|
||||
withOriginalAttributes: (NSCollectionViewLayoutAttributes *)originalAttributes;
|
||||
|
||||
- (NSPoint) targetContentOffsetForProposedContentOffset: (NSPoint)proposedContentOffset
|
||||
withScrollingVelocity: (NSPoint)velocity;
|
||||
- (NSPoint) targetContentOffsetForProposedContentOffset: (NSPoint)proposedContentOffset;
|
||||
|
||||
- (NSSize) collectionViewContentSize;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSCollectionViewLayout (NSUpdateSupportHooks)
|
||||
|
||||
// Update support
|
||||
- (void) prepareForCollectionViewUpdates: (NSArray *)updateItems;
|
||||
- (void) finalizeCollectionViewUpdates;
|
||||
- (void) prepareForAnimatedBoundsChange: (NSRect)oldBounds;
|
||||
- (void) finalizeAnimatedBoundsChange;
|
||||
|
||||
- (void) prepareForTransitionToLayout: (NSCollectionViewLayout *)newLayout;
|
||||
- (void) prepareForTransitionFromLayout: (NSCollectionViewLayout *)oldLayout;
|
||||
- (void) finalizeLayoutTransition;
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *) initialLayoutAttributesForAppearingItemAtIndexPath: (NSIndexPath *)itemIndexPath;
|
||||
- (NSCollectionViewLayoutAttributes *) finalLayoutAttributesForDisappearingItemAtIndexPath: (NSIndexPath *)itemIndexPath;
|
||||
- (NSCollectionViewLayoutAttributes *)
|
||||
initialLayoutAttributesForAppearingSupplementaryElementOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)elementIndexPath;
|
||||
- (NSCollectionViewLayoutAttributes *)
|
||||
finalLayoutAttributesForDisappearingSupplementaryElementOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)elementIndexPath;
|
||||
- (NSCollectionViewLayoutAttributes *)
|
||||
initialLayoutAttributesForAppearingDecorationElementOfKind: (NSCollectionViewDecorationElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)decorationIndexPath;
|
||||
- (NSCollectionViewLayoutAttributes *)
|
||||
finalLayoutAttributesForDisappearingDecorationElementOfKind: (NSCollectionViewDecorationElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)decorationIndexPath;
|
||||
|
||||
- (NSSet *)indexPathsToDeleteForSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)elementKind;
|
||||
- (NSSet *)indexPathsToDeleteForDecorationViewOfKind: (NSCollectionViewDecorationElementKind)elementKind;
|
||||
- (NSSet *)indexPathsToInsertForSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)elementKind;
|
||||
- (NSSet *)indexPathsToInsertForDecorationViewOfKind: (NSCollectionViewDecorationElementKind)elementKind;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -27,13 +27,33 @@
|
|||
|
||||
#import <AppKit/NSCollectionViewLayout.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef NSString* NSCollectionViewTransitionLayoutAnimatedKey;
|
||||
|
||||
@interface NSCollectionViewTransitionLayout : NSCollectionViewLayout
|
||||
{
|
||||
CGFloat _transitionProgress;
|
||||
NSCollectionViewLayout *_currentLayout;
|
||||
NSCollectionViewLayout *_nextLayout;
|
||||
}
|
||||
|
||||
- (CGFloat) transitionProgress;
|
||||
- (void) setTransitionProgress: (CGFloat)transitionProgress;
|
||||
|
||||
- (NSCollectionViewLayout *) currentLayout;
|
||||
- (NSCollectionViewLayout *) nextLayout;
|
||||
|
||||
// Designated initializer
|
||||
- (instancetype) initWithCurrentLayout: (NSCollectionViewLayout *)currentLayout
|
||||
nextLayout: (NSCollectionViewLayout *)nextLayout;
|
||||
|
||||
- (void) updateValue: (CGFloat)value forAnimatedKey: (NSCollectionViewTransitionLayoutAnimatedKey)key;
|
||||
- (CGFloat) valueForAnimatedKey: (NSCollectionViewTransitionLayoutAnimatedKey)key;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
/** <title>NSCollectionView</title>
|
||||
|
||||
Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013, 2021 Free Software Foundation, Inc.
|
||||
|
||||
Author: Doug Simons (doug.simons@testplant.com)
|
||||
Frank LeGrand (frank.legrand@testplant.com)
|
||||
Date: February 2013
|
||||
Gregory Casamento (greg.casamento@gmail.com)
|
||||
(Incorporate NSCollectionViewLayout logic)
|
||||
|
||||
Date: February 2013, December 2021
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
|
@ -26,20 +29,28 @@
|
|||
*/
|
||||
|
||||
#import "Foundation/NSKeyedArchiver.h"
|
||||
|
||||
#import <Foundation/NSGeometry.h>
|
||||
#import <Foundation/NSIndexSet.h>
|
||||
#import <Foundation/NSSet.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSMapTable.h>
|
||||
#import <Foundation/NSKeyedArchiver.h>
|
||||
|
||||
#import "AppKit/NSApplication.h"
|
||||
#import "AppKit/NSClipView.h"
|
||||
#import "AppKit/NSCollectionView.h"
|
||||
#import "AppKit/NSCollectionViewItem.h"
|
||||
#import "AppKit/NSCollectionViewLayout.h"
|
||||
#import "AppKit/NSCollectionViewGridLayout.h"
|
||||
#import "AppKit/NSEvent.h"
|
||||
#import "AppKit/NSGraphics.h"
|
||||
#import "AppKit/NSImage.h"
|
||||
#import "AppKit/NSKeyValueBinding.h"
|
||||
#import "AppKit/NSNib.h"
|
||||
#import "AppKit/NSPasteboard.h"
|
||||
#import "AppKit/NSWindow.h"
|
||||
|
||||
#import "GSGuiPrivate.h"
|
||||
|
||||
#include <math.h>
|
||||
|
@ -52,6 +63,9 @@ static NSString* NSCollectionViewMaxNumberOfColumnsKey = @"NSMaxNumberOfGr
|
|||
static NSString* NSCollectionViewSelectableKey = @"NSSelectable";
|
||||
static NSString* NSCollectionViewAllowsMultipleSelectionKey = @"NSAllowsMultipleSelection";
|
||||
static NSString* NSCollectionViewBackgroundColorsKey = @"NSBackgroundColors";
|
||||
static NSString* NSCollectionViewLayoutKey = @"NSCollectionViewLayout";
|
||||
|
||||
static NSCollectionViewSupplementaryElementKind GSNoSupplementaryElement = @"GSNoSupplementaryElement"; // private
|
||||
|
||||
/*
|
||||
* Class variables
|
||||
|
@ -100,6 +114,7 @@ static NSString *placeholderItem = nil;
|
|||
{
|
||||
placeholderItem = @"Placeholder";
|
||||
[self exposeBinding: NSContentBinding];
|
||||
[self setVersion: 0];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,6 +137,18 @@ static NSString *placeholderItem = nil;
|
|||
_items = [[NSMutableArray alloc] init];
|
||||
_selectionIndexes = [[NSIndexSet alloc] init];
|
||||
_draggingOnIndex = NSNotFound;
|
||||
|
||||
// 10.11 variables
|
||||
|
||||
// Managing items.
|
||||
_visibleItems = [[NSMutableArray alloc] init];
|
||||
_indexPathsForVisibleItems = [[NSMutableSet alloc] init];
|
||||
_visibleSupplementaryViews = [[NSMutableDictionary alloc] init];
|
||||
_indexPathsForSupplementaryElementsOfKind = [[NSMutableSet alloc] init];
|
||||
|
||||
// Registered nib/class
|
||||
_registeredNibs = RETAIN([NSMapTable weakToStrongObjectsMapTable]);
|
||||
_registeredClasses = RETAIN([NSMapTable weakToStrongObjectsMapTable]);
|
||||
}
|
||||
|
||||
- (void) _resetItemSize
|
||||
|
@ -185,6 +212,17 @@ static NSString *placeholderItem = nil;
|
|||
DESTROY (_backgroundColors);
|
||||
DESTROY (_selectionIndexes);
|
||||
DESTROY (_items);
|
||||
|
||||
// Managing items.
|
||||
DESTROY(_visibleItems);
|
||||
DESTROY(_indexPathsForVisibleItems);
|
||||
DESTROY(_visibleSupplementaryViews);
|
||||
DESTROY(_indexPathsForSupplementaryElementsOfKind);
|
||||
|
||||
// Registered nib/class
|
||||
DESTROY(_registeredNibs);
|
||||
DESTROY(_registeredClasses);
|
||||
|
||||
//DESTROY (_mouseDownEvent);
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -251,12 +289,12 @@ static NSString *placeholderItem = nil;
|
|||
|
||||
- (id < NSCollectionViewDelegate >) delegate
|
||||
{
|
||||
return delegate;
|
||||
return _delegate;
|
||||
}
|
||||
|
||||
- (void) setDelegate: (id < NSCollectionViewDelegate >)aDelegate
|
||||
{
|
||||
delegate = aDelegate;
|
||||
_delegate = aDelegate;
|
||||
}
|
||||
|
||||
- (NSCollectionViewItem *) itemPrototype
|
||||
|
@ -394,6 +432,16 @@ static NSString *placeholderItem = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayout *) collectionViewLayout
|
||||
{
|
||||
return _collectionViewLayout;
|
||||
}
|
||||
|
||||
- (void) setCollectionViewLayout: (NSCollectionViewLayout *)layout
|
||||
{
|
||||
ASSIGN(_collectionViewLayout, layout);
|
||||
}
|
||||
|
||||
- (NSRect) frameForItemAtIndex: (NSUInteger)theIndex
|
||||
{
|
||||
NSRect itemFrame = NSMakeRect (0,0,0,0);
|
||||
|
@ -608,18 +656,47 @@ static NSString *placeholderItem = nil;
|
|||
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
_minItemSize = [aCoder decodeSizeForKey: NSCollectionViewMinItemSizeKey];
|
||||
_maxItemSize = [aCoder decodeSizeForKey: NSCollectionViewMaxItemSizeKey];
|
||||
if ([aCoder containsValueForKey: NSCollectionViewMinItemSizeKey])
|
||||
{
|
||||
_minItemSize = [aCoder decodeSizeForKey: NSCollectionViewMinItemSizeKey];
|
||||
}
|
||||
|
||||
_maxNumberOfRows = [aCoder decodeInt64ForKey: NSCollectionViewMaxNumberOfRowsKey];
|
||||
_maxNumberOfColumns = [aCoder decodeInt64ForKey: NSCollectionViewMaxNumberOfColumnsKey];
|
||||
if ([aCoder containsValueForKey: NSCollectionViewMaxItemSizeKey])
|
||||
{
|
||||
_maxItemSize = [aCoder decodeSizeForKey: NSCollectionViewMaxItemSizeKey];
|
||||
}
|
||||
|
||||
if ([aCoder containsValueForKey: NSCollectionViewMaxNumberOfRowsKey])
|
||||
{
|
||||
_maxNumberOfRows = [aCoder decodeInt64ForKey: NSCollectionViewMaxNumberOfRowsKey];
|
||||
}
|
||||
|
||||
if ([aCoder containsValueForKey: NSCollectionViewMaxNumberOfColumnsKey])
|
||||
{
|
||||
_maxNumberOfColumns = [aCoder decodeInt64ForKey: NSCollectionViewMaxNumberOfColumnsKey];
|
||||
}
|
||||
|
||||
//_verticalMargin = [aCoder decodeFloatForKey: NSCollectionViewVerticalMarginKey];
|
||||
|
||||
_isSelectable = [aCoder decodeBoolForKey: NSCollectionViewSelectableKey];
|
||||
_allowsMultipleSelection = [aCoder decodeBoolForKey: NSCollectionViewAllowsMultipleSelectionKey];
|
||||
if ([aCoder containsValueForKey: NSCollectionViewSelectableKey])
|
||||
{
|
||||
_isSelectable = [aCoder decodeBoolForKey: NSCollectionViewSelectableKey];
|
||||
}
|
||||
|
||||
[self setBackgroundColors: [aCoder decodeObjectForKey: NSCollectionViewBackgroundColorsKey]];
|
||||
if ([aCoder containsValueForKey: NSCollectionViewAllowsMultipleSelectionKey])
|
||||
{
|
||||
_allowsMultipleSelection = [aCoder decodeBoolForKey: NSCollectionViewAllowsMultipleSelectionKey];
|
||||
}
|
||||
|
||||
if ([aCoder containsValueForKey: NSCollectionViewBackgroundColorsKey])
|
||||
{
|
||||
[self setBackgroundColors: [aCoder decodeObjectForKey: NSCollectionViewBackgroundColorsKey]];
|
||||
}
|
||||
|
||||
if ([aCoder containsValueForKey: NSCollectionViewLayoutKey])
|
||||
{
|
||||
[self setCollectionViewLayout: [aCoder decodeObjectForKey: NSCollectionViewLayoutKey]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -629,6 +706,7 @@ static NSString *placeholderItem = nil;
|
|||
decode_NSUInteger(aCoder, &_maxNumberOfColumns);
|
||||
[aCoder decodeValueOfObjCType: @encode(BOOL) at: &_isSelectable];
|
||||
[self setBackgroundColors: [aCoder decodeObject]]; // decode color...
|
||||
[self setCollectionViewLayout: [aCoder decodeObject]];
|
||||
}
|
||||
}
|
||||
[self _initDefaults];
|
||||
|
@ -664,6 +742,9 @@ static NSString *placeholderItem = nil;
|
|||
//[aCoder encodeCGFloat: _verticalMargin forKey: NSCollectionViewVerticalMarginKey];
|
||||
[aCoder encodeObject: _backgroundColors
|
||||
forKey: NSCollectionViewBackgroundColorsKey];
|
||||
|
||||
[aCoder encodeObject: _collectionViewLayout
|
||||
forKey: NSCollectionViewLayoutKey];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -673,6 +754,7 @@ static NSString *placeholderItem = nil;
|
|||
encode_NSUInteger(aCoder, &_maxNumberOfColumns);
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_isSelectable];
|
||||
[aCoder encodeObject: [self backgroundColors]]; // encode color...
|
||||
[aCoder encodeObject: [self collectionViewLayout]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -959,12 +1041,12 @@ static NSString *placeholderItem = nil;
|
|||
if (![dragIndexes count])
|
||||
return NO;
|
||||
|
||||
if (![delegate respondsToSelector: @selector(collectionView:writeItemsAtIndexes:toPasteboard:)])
|
||||
if (![_delegate respondsToSelector: @selector(collectionView:writeItemsAtIndexes:toPasteboard:)])
|
||||
return NO;
|
||||
|
||||
if ([delegate respondsToSelector: @selector(collectionView:canDragItemsAtIndexes:withEvent:)])
|
||||
if ([_delegate respondsToSelector: @selector(collectionView:canDragItemsAtIndexes:withEvent:)])
|
||||
{
|
||||
if (![delegate collectionView: self
|
||||
if (![_delegate collectionView: self
|
||||
canDragItemsAtIndexes: dragIndexes
|
||||
withEvent: event])
|
||||
{
|
||||
|
@ -999,9 +1081,9 @@ static NSString *placeholderItem = nil;
|
|||
withEvent: (NSEvent *)event
|
||||
offset: (NSPointPointer)dragImageOffset
|
||||
{
|
||||
if ([delegate respondsToSelector: @selector(collectionView:draggingImageForItemsAtIndexes:withEvent:offset:)])
|
||||
if ([_delegate respondsToSelector: @selector(collectionView:draggingImageForItemsAtIndexes:withEvent:offset:)])
|
||||
{
|
||||
return [delegate collectionView: self
|
||||
return [_delegate collectionView: self
|
||||
draggingImageForItemsAtIndexes: indexes
|
||||
withEvent: event
|
||||
offset: dragImageOffset];
|
||||
|
@ -1015,13 +1097,13 @@ static NSString *placeholderItem = nil;
|
|||
- (BOOL) _writeItemsAtIndexes: (NSIndexSet *)indexes
|
||||
toPasteboard: (NSPasteboard *)pasteboard
|
||||
{
|
||||
if (![delegate respondsToSelector: @selector(collectionView:writeItemsAtIndexes:toPasteboard:)])
|
||||
if (![_delegate respondsToSelector: @selector(collectionView:writeItemsAtIndexes:toPasteboard:)])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
return [delegate collectionView: self
|
||||
return [_delegate collectionView: self
|
||||
writeItemsAtIndexes: indexes
|
||||
toPasteboard: pasteboard];
|
||||
}
|
||||
|
@ -1037,7 +1119,7 @@ static NSString *placeholderItem = nil;
|
|||
{
|
||||
NSDragOperation result = NSDragOperationNone;
|
||||
|
||||
if ([delegate respondsToSelector: @selector(collectionView:validateDrop:proposedIndex:dropOperation:)])
|
||||
if ([_delegate respondsToSelector: @selector(collectionView:validateDrop:proposedIndex:dropOperation:)])
|
||||
{
|
||||
NSPoint location = [self convertPoint: [sender draggingLocation] fromView: nil];
|
||||
NSInteger index = [self _indexAtPoint: location];
|
||||
|
@ -1050,7 +1132,7 @@ static NSString *placeholderItem = nil;
|
|||
|
||||
// TODO: We currently don't do anything with the proposedIndex & dropOperation that
|
||||
// may get altered by the delegate.
|
||||
result = [delegate collectionView: self
|
||||
result = [_delegate collectionView: self
|
||||
validateDrop: sender
|
||||
proposedIndex: proposedIndex
|
||||
dropOperation: dropOperation];
|
||||
|
@ -1098,10 +1180,10 @@ static NSString *placeholderItem = nil;
|
|||
index = (index > [_items count] - 1) ? [_items count] - 1 : index;
|
||||
|
||||
BOOL result = NO;
|
||||
if ([delegate respondsToSelector: @selector(collectionView:acceptDrop:index:dropOperation:)])
|
||||
if ([_delegate respondsToSelector: @selector(collectionView:acceptDrop:index:dropOperation:)])
|
||||
{
|
||||
// TODO: dropOperation should be retrieved from the validateDrop delegate method.
|
||||
result = [delegate collectionView: self
|
||||
result = [_delegate collectionView: self
|
||||
acceptDrop: sender
|
||||
index: index
|
||||
dropOperation: NSCollectionViewDropOn];
|
||||
|
@ -1114,4 +1196,329 @@ static NSString *placeholderItem = nil;
|
|||
return YES;
|
||||
}
|
||||
|
||||
/* New methods for later versions of macOS */
|
||||
|
||||
// 10.11 methods...
|
||||
|
||||
/* Locating Items and Views */
|
||||
|
||||
- (NSArray *) visibleItems
|
||||
{
|
||||
return _visibleItems;
|
||||
}
|
||||
|
||||
- (NSSet *) indexPathsForVisibleItems
|
||||
{
|
||||
return _indexPathsForVisibleItems;
|
||||
}
|
||||
|
||||
- (NSArray *) visibleSupplementaryViewsOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
{
|
||||
return [_visibleSupplementaryViews objectForKey: elementKind];
|
||||
}
|
||||
|
||||
- (NSSet *) indexPathsForVisibleSupplementaryElementsOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSIndexPath *) indexPathForItem: (NSCollectionViewItem *)item
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSIndexPath *) indexPathForItemAtPoint: (NSPoint)point
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSCollectionViewItem *) itemAtIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSView *)supplementaryViewForElementKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) scrollToItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
scrollPosition: (NSCollectionViewScrollPosition)scrollPosition
|
||||
{
|
||||
}
|
||||
|
||||
/* Creating Collection view Items */
|
||||
|
||||
- (NSCollectionViewItem *) makeItemWithIdentifier: (NSUserInterfaceItemIdentifier)identifier
|
||||
forIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) registerClass: (Class)itemClass
|
||||
forItemWithIdentifier: (NSUserInterfaceItemIdentifier)identifier
|
||||
{
|
||||
[self registerClass: itemClass
|
||||
forSupplementaryViewOfKind: GSNoSupplementaryElement
|
||||
withIdentifier: identifier];
|
||||
}
|
||||
|
||||
- (void) registerNib: (NSNib *)nib
|
||||
forItemWithIdentifier: (NSUserInterfaceItemIdentifier)identifier
|
||||
{
|
||||
[self registerNib: nib
|
||||
forSupplementaryViewOfKind: GSNoSupplementaryElement
|
||||
withIdentifier: identifier];
|
||||
}
|
||||
|
||||
- (NSView *) makeSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
withIdentifier: (NSUserInterfaceItemIdentifier)identifier
|
||||
forIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) registerClass: (Class)viewClass
|
||||
forSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)kind
|
||||
withIdentifier:(NSUserInterfaceItemIdentifier)identifier
|
||||
{
|
||||
NSMapTable *t = nil;
|
||||
|
||||
t = [_registeredClasses objectForKey: kind];
|
||||
if (t == nil)
|
||||
{
|
||||
t = [NSMapTable weakToWeakObjectsMapTable];
|
||||
[_registeredClasses setObject: t
|
||||
forKey: kind];
|
||||
}
|
||||
|
||||
[t setObject: viewClass forKey: identifier];
|
||||
}
|
||||
|
||||
- (void) registerNib: (NSNib *)nib
|
||||
forSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)kind
|
||||
withIdentifier: (NSUserInterfaceItemIdentifier)identifier
|
||||
{
|
||||
NSMapTable *t = nil;
|
||||
|
||||
t = [_registeredNibs objectForKey: kind];
|
||||
if (t == nil)
|
||||
{
|
||||
t = [NSMapTable weakToWeakObjectsMapTable];
|
||||
[_registeredNibs setObject: t
|
||||
forKey: kind];
|
||||
}
|
||||
|
||||
[t setObject: nib forKey: identifier];
|
||||
}
|
||||
|
||||
/* Providing the collection view's data */
|
||||
|
||||
- (id<NSCollectionViewDataSource>) dataSource
|
||||
{
|
||||
return _dataSource;
|
||||
}
|
||||
|
||||
- (void) setDataSource: (id<NSCollectionViewDataSource>)dataSource
|
||||
{
|
||||
_dataSource = dataSource;
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
/* Configuring the Collection view */
|
||||
|
||||
- (NSNib *) _nibForClass: (Class)cls
|
||||
{
|
||||
NSString *clsName = NSStringFromClass(cls);
|
||||
NSNib *nib = [[NSNib alloc] initWithNibNamed: clsName
|
||||
bundle: [NSBundle bundleForClass: cls]];
|
||||
return nib;
|
||||
}
|
||||
|
||||
- (NSView *) backgroundView
|
||||
{
|
||||
return _backgroundView;
|
||||
}
|
||||
|
||||
- (void) setBackgroundView: (NSView *)backgroundView
|
||||
{
|
||||
_backgroundView = backgroundView; // weak since view retains this
|
||||
}
|
||||
|
||||
- (BOOL) backgroundViewScrollsWithContent
|
||||
{
|
||||
return _backgroundViewScrollsWithContent;
|
||||
}
|
||||
|
||||
- (void) setBackgroundViewScrollsWithContent: (BOOL)f
|
||||
{
|
||||
_backgroundViewScrollsWithContent = f;
|
||||
}
|
||||
|
||||
/* Reloading Content */
|
||||
|
||||
- (void) reloadData
|
||||
{
|
||||
NSInteger ns = [self numberOfSections];
|
||||
NSInteger cs = 0;
|
||||
|
||||
for (cs = 0; cs < ns; cs++)
|
||||
{
|
||||
NSInteger ni = [self numberOfItemsInSection: cs];
|
||||
NSInteger ci = 0;
|
||||
|
||||
for (ci = 0; ci < ni; ci++)
|
||||
{
|
||||
NSIndexPath *p = nil;
|
||||
NSCollectionViewItem *item = [_dataSource collectionView: self itemForRepresentedObjectAtIndexPath: p];
|
||||
NSNib *nib = [self _nibForClass: [item class]];
|
||||
BOOL loaded = [nib instantiateWithOwner: item
|
||||
topLevelObjects: NULL];
|
||||
|
||||
if (loaded)
|
||||
{
|
||||
NSView *v = [item view];
|
||||
NSLog(@"%@",v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) reloadSections: (NSIndexSet *)sections
|
||||
{
|
||||
}
|
||||
|
||||
- (void) reloadItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
{
|
||||
}
|
||||
|
||||
/* Prefetching Collection View Cells and Data */
|
||||
|
||||
- (id<NSCollectionViewPrefetching>) prefetchDataSource
|
||||
{
|
||||
return _prefetchDataSource;
|
||||
}
|
||||
|
||||
- (void) setPrefetchDataSource: (id<NSCollectionViewPrefetching>)prefetchDataSource
|
||||
{
|
||||
_prefetchDataSource = prefetchDataSource;
|
||||
}
|
||||
|
||||
/* Getting the State of the Collection View */
|
||||
|
||||
- (NSInteger) numberOfSections
|
||||
{
|
||||
NSInteger n = 0;
|
||||
|
||||
if ([_dataSource respondsToSelector: @selector(numberOfsectionsInCollectionView:)])
|
||||
{
|
||||
n = [_dataSource numberOfSectionsInCollectionView: self];
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
- (NSInteger) numberOfItemsInSection: (NSInteger)section
|
||||
{
|
||||
NSInteger n = 0;
|
||||
|
||||
// Since this is a required method by the delegate we can assume it's presence
|
||||
// if it is not there, tests on macOS indicate that an unrecognized selector
|
||||
// exception is thrown.
|
||||
n = [_dataSource collectionView: self numberOfItemsInSection: section];
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/* Inserting, Moving and Deleting Items */
|
||||
|
||||
- (void) insertItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
{
|
||||
}
|
||||
|
||||
- (void) moveItemAtIndexPath: (NSIndexPath *)indexPath
|
||||
toIndexPath: (NSIndexPath *)newIndexPath
|
||||
{
|
||||
}
|
||||
|
||||
- (void) deleteItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
{
|
||||
}
|
||||
|
||||
/* Inserting, Moving, Deleting and Collapsing Sections */
|
||||
|
||||
- (void) insertSections: (NSIndexSet *)sections
|
||||
{
|
||||
}
|
||||
|
||||
- (void) moveSection: (NSInteger)section
|
||||
toSection: (NSInteger)newSection
|
||||
{
|
||||
}
|
||||
|
||||
- (void) deleteSections: (NSIndexSet *)sections
|
||||
{
|
||||
}
|
||||
|
||||
// 10.12 method...
|
||||
|
||||
- (IBAction) toggleSectionCollapse: (id)sender
|
||||
{
|
||||
}
|
||||
|
||||
// 10.11 methods...
|
||||
|
||||
- (BOOL) allowsEmptySelection
|
||||
{
|
||||
return _allowsEmptySelection;
|
||||
}
|
||||
|
||||
- (void) setAllowsEmptySelection: (BOOL)flag;
|
||||
{
|
||||
_allowsEmptySelection = flag;
|
||||
}
|
||||
|
||||
- (NSSet *) selectionIndexPaths // copy
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (IBAction) selectAll: (id)sender
|
||||
{
|
||||
}
|
||||
|
||||
- (IBAction) deselectAll: (id)sender
|
||||
{
|
||||
}
|
||||
|
||||
- (void) selectItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
scrollPosition: (NSCollectionViewScrollPosition)scrollPosition
|
||||
{
|
||||
}
|
||||
|
||||
- (void) deselectItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
{
|
||||
}
|
||||
|
||||
/* Getting Layout Information */
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *) layoutAttributesForItemAtIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *) layoutAttributesForSupplementaryElementOfKind: (NSCollectionViewSupplementaryElementKind)kind
|
||||
atIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
/* Animating Multiple Changes */
|
||||
|
||||
- (void) performBatchUpdates: (GSCollectionViewPerformBatchUpdatesBlock) updates
|
||||
completionHandler: (GSCollectionViewCompletionHandlerBlock) completionHandler
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -24,7 +24,155 @@
|
|||
|
||||
#import "AppKit/NSCollectionViewFlowLayout.h"
|
||||
|
||||
@implementation NSCollectionViewFlowLayout
|
||||
@implementation NSCollectionViewFlowLayoutInvalidationContext
|
||||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_invalidateFlowLayoutAttributes = YES;
|
||||
_invalidateFlowLayoutDelegateMetrics = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) setInvalidateFlowLayoutDelegateMetrics: (BOOL)flag
|
||||
{
|
||||
_invalidateFlowLayoutDelegateMetrics = flag;
|
||||
}
|
||||
|
||||
- (BOOL) invalidateFlowLayoutDelegateMetrics
|
||||
{
|
||||
return _invalidateFlowLayoutDelegateMetrics;
|
||||
}
|
||||
|
||||
- (void) setInvalidateFlowLayoutAttributes: (BOOL)flag
|
||||
{
|
||||
_invalidateFlowLayoutAttributes = flag;
|
||||
}
|
||||
|
||||
- (BOOL) invalidateFlowLayoutAttributes
|
||||
{
|
||||
return _invalidateFlowLayoutAttributes;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSCollectionViewFlowLayout
|
||||
|
||||
- (CGFloat) minimumLineSpacing
|
||||
{
|
||||
return _minimumLineSpacing;
|
||||
}
|
||||
|
||||
- (void) setMinimumLineSpacing: (CGFloat)spacing
|
||||
{
|
||||
_minimumLineSpacing = spacing;
|
||||
}
|
||||
|
||||
- (CGFloat) minimumInteritemSpacing
|
||||
{
|
||||
return _minimumInteritemSpacing;
|
||||
}
|
||||
|
||||
- (void) setMinimumInteritemSpacing: (CGFloat)spacing
|
||||
{
|
||||
_minimumInteritemSpacing = spacing;
|
||||
}
|
||||
|
||||
- (NSSize) itemSize
|
||||
{
|
||||
return _itemSize;
|
||||
}
|
||||
|
||||
- (void) setItemSize: (NSSize)itemSize
|
||||
{
|
||||
_itemSize = itemSize;
|
||||
}
|
||||
|
||||
- (NSSize) estimatedItemSize
|
||||
{
|
||||
return _estimatedItemSize;
|
||||
}
|
||||
|
||||
- (void) setEstimatedItemSize: (NSSize)size
|
||||
{
|
||||
_estimatedItemSize = size;
|
||||
}
|
||||
|
||||
- (NSCollectionViewScrollDirection) scrollDirection
|
||||
{
|
||||
return _scrollDirection;
|
||||
}
|
||||
|
||||
- (void) setScrollDirection: (NSCollectionViewScrollDirection)direction
|
||||
{
|
||||
_scrollDirection = direction;
|
||||
}
|
||||
|
||||
- (NSSize) headerReferenceSize
|
||||
{
|
||||
return _headerReferenceSize;
|
||||
}
|
||||
|
||||
- (void) setHeaderReferenceSize: (NSSize)size
|
||||
{
|
||||
_headerReferenceSize = size;
|
||||
}
|
||||
|
||||
- (NSSize) footerReferenceSize
|
||||
{
|
||||
return _footerReferenceSize;
|
||||
}
|
||||
|
||||
- (void) setFooterReferenceSize: (NSSize)size
|
||||
{
|
||||
_footerReferenceSize = size;
|
||||
}
|
||||
|
||||
- (NSEdgeInsets) sectionInset
|
||||
{
|
||||
return _sectionInset;
|
||||
}
|
||||
|
||||
- (void) setSectionInset: (NSEdgeInsets)inset
|
||||
{
|
||||
_sectionInset = inset;
|
||||
}
|
||||
|
||||
- (BOOL) sectionHeadersPinToVisibleBounds
|
||||
{
|
||||
return _sectionHeadersPinToVisibleBounds;
|
||||
}
|
||||
|
||||
- (void) setSectionHeadersPinToVisibleBounds: (BOOL)f
|
||||
{
|
||||
_sectionHeadersPinToVisibleBounds = f;
|
||||
}
|
||||
|
||||
- (BOOL) sectionFootersPinToVisibleBounds
|
||||
{
|
||||
return _sectionFootersPinToVisibleBounds;
|
||||
}
|
||||
|
||||
- (void) setSectionFootersPinToVisibleBounds: (BOOL)f
|
||||
{
|
||||
_sectionFootersPinToVisibleBounds = f;
|
||||
}
|
||||
|
||||
- (BOOL) sectionAtIndexIsCollapsed: (NSUInteger)sectionIndex
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) collapseSectionAtIndex: (NSUInteger)sectionIndex
|
||||
{
|
||||
}
|
||||
|
||||
- (void) expandSectionAtIndex: (NSUInteger)sectionIndex
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -24,7 +24,399 @@
|
|||
|
||||
#import "AppKit/NSCollectionViewLayout.h"
|
||||
|
||||
@implementation NSCollectionViewLayout
|
||||
@implementation NSCollectionViewLayoutAttributes
|
||||
|
||||
// Initializers
|
||||
+ (instancetype) layoutAttributesForItemWithIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (instancetype) layoutAttributesForInterItemGapBeforeIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (instancetype) layoutAttributesForSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
withIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (instancetype)layoutAttributesForDecorationViewOfKind: (NSCollectionViewDecorationElementKind)decorationViewKind
|
||||
withIndexPath: (NSIndexPath*)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Properties
|
||||
- (NSRect) frame
|
||||
{
|
||||
return _frame;
|
||||
}
|
||||
|
||||
- (void) setFrame: (NSRect)frame
|
||||
{
|
||||
_frame = frame;
|
||||
}
|
||||
|
||||
- (NSSize) size
|
||||
{
|
||||
return _size;
|
||||
}
|
||||
|
||||
- (void) setSize: (NSSize)size
|
||||
{
|
||||
_size = size;
|
||||
}
|
||||
|
||||
- (CGFloat) alpha
|
||||
{
|
||||
return _alpha;
|
||||
}
|
||||
|
||||
- (void) setAlpha: (CGFloat)alpha
|
||||
{
|
||||
_alpha = alpha;
|
||||
}
|
||||
|
||||
- (BOOL) isHidden
|
||||
{
|
||||
return _hidden;
|
||||
}
|
||||
|
||||
- (void) setHidden: (BOOL)hidden
|
||||
{
|
||||
_hidden = hidden;
|
||||
}
|
||||
|
||||
- (NSIndexPath *) indexPath
|
||||
{
|
||||
return _indexPath;
|
||||
}
|
||||
|
||||
- (void) setIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
_indexPath = indexPath;
|
||||
}
|
||||
|
||||
- (NSCollectionElementCategory) representedElementCategory
|
||||
{
|
||||
return _representedElementCategory;
|
||||
}
|
||||
|
||||
- (NSString *) representedElementKind
|
||||
{
|
||||
return _representedElementKind;
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone *)z
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSCollectionViewUpdateItem
|
||||
|
||||
- (NSIndexPath *) indexPathBeforeUpdate
|
||||
{
|
||||
return _indexPathBeforeUpdate;
|
||||
}
|
||||
|
||||
- (NSIndexPath *) indexPathAfterUpdate
|
||||
{
|
||||
return _indexPathAfterUpdate;
|
||||
}
|
||||
|
||||
- (NSCollectionUpdateAction) updateAction
|
||||
{
|
||||
return _updateAction;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSCollectionViewLayoutInvalidationContext
|
||||
|
||||
// Initializers
|
||||
- (void)invalidateItemsAtIndexPaths: (NSSet *)indexPaths
|
||||
{
|
||||
}
|
||||
|
||||
- (void)invalidateSupplementaryElementsOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
atIndexPaths: (NSSet *)indexPaths
|
||||
{
|
||||
}
|
||||
|
||||
- (void)invalidateDecorationElementsOfKind: (NSCollectionViewDecorationElementKind)elementKind
|
||||
atIndexPaths: (NSSet *)indexPaths
|
||||
{
|
||||
}
|
||||
|
||||
// Properties
|
||||
- (BOOL) invalidateEverything
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) invalidateDataSourceCounts
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSSet *) invalidatedItemIndexPaths
|
||||
{
|
||||
return _invalidatedItemIndexPaths;
|
||||
}
|
||||
|
||||
- (NSPoint) contentOffsetAdjustment
|
||||
{
|
||||
return _contentOffsetAdjustment;
|
||||
}
|
||||
|
||||
- (void) setContentOffsetAdjustment: (NSPoint)point
|
||||
{
|
||||
_contentOffsetAdjustment = point;
|
||||
}
|
||||
|
||||
- (NSSize) contentSizeAdjustment
|
||||
{
|
||||
return _contentSizeAdjustment;
|
||||
}
|
||||
|
||||
- (void) setContentSizeAdjustment: (NSSize)size
|
||||
{
|
||||
_contentSizeAdjustment = size;
|
||||
}
|
||||
|
||||
- (NSDictionary *) invalidatedSupplementaryIndexPaths
|
||||
{
|
||||
return _invalidatedSupplementaryIndexPaths;
|
||||
}
|
||||
|
||||
- (NSDictionary *) invalidatedDecorationIndexPaths
|
||||
{
|
||||
return _invalidatedDecorationIndexPaths;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSCollectionViewLayout
|
||||
|
||||
// Initializers
|
||||
- (void)invalidateLayout
|
||||
{
|
||||
_valid = NO;
|
||||
[_collectionView reloadData];
|
||||
}
|
||||
|
||||
- (void)invalidateLayoutWithContext:(NSCollectionViewLayoutInvalidationContext *)context
|
||||
{
|
||||
}
|
||||
|
||||
- (void)registerClass: (Class)viewClass
|
||||
forDecorationViewOfKind: (NSCollectionViewDecorationElementKind)elementKind
|
||||
{
|
||||
}
|
||||
|
||||
- (void)registerNib: (NSNib *)nib
|
||||
forDecorationViewOfKind: (NSCollectionViewDecorationElementKind)elementKind
|
||||
{
|
||||
}
|
||||
|
||||
// Properties
|
||||
- (NSCollectionView *) collectionView
|
||||
{
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
- (void) setCollectionView: (NSCollectionView *)cv
|
||||
{
|
||||
_collectionView = cv;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
}
|
||||
|
||||
- (instancetype) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSCollectionViewLayout (NSSubclassingHooks)
|
||||
|
||||
// Methods to override for specific layouts...
|
||||
- (void) prepareLayout
|
||||
{
|
||||
// abstract method implements nothing...
|
||||
}
|
||||
|
||||
- (NSArray *) layoutAttributesForElementsInRect: (NSRect)rect
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *) layoutAttributesForItemAtIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *)
|
||||
layoutAttributesForSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *)
|
||||
layoutAttributesForDecorationViewOfKind: (NSCollectionViewDecorationElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *)layoutAttributesForDropTargetAtPoint: (NSPoint)pointInCollectionView
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *)layoutAttributesForInterItemGapBeforeIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL)shouldInvalidateLayoutForBoundsChange: (NSRect)newBounds
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutInvalidationContext *)invalidationContextForBoundsChange: (NSRect)newBounds
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL)shouldInvalidateLayoutForPreferredLayoutAttributes: (NSCollectionViewLayoutAttributes *)preferredAttributes
|
||||
withOriginalAttributes: (NSCollectionViewLayoutAttributes *)originalAttributes
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutInvalidationContext *)
|
||||
invalidationContextForPreferredLayoutAttributes: (NSCollectionViewLayoutAttributes *)preferredAttributes
|
||||
withOriginalAttributes: (NSCollectionViewLayoutAttributes *)originalAttributes
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSPoint) targetContentOffsetForProposedContentOffset: (NSPoint)proposedContentOffset
|
||||
withScrollingVelocity: (NSPoint)velocity
|
||||
{
|
||||
return NSZeroPoint;
|
||||
}
|
||||
|
||||
- (NSPoint) targetContentOffsetForProposedContentOffset: (NSPoint)proposedContentOffset
|
||||
{
|
||||
return NSZeroPoint;
|
||||
}
|
||||
|
||||
- (NSSize) collectionViewContentSize
|
||||
{
|
||||
return [_collectionView frame].size;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSCollectionViewLayout (NSUpdateSupportHooks)
|
||||
|
||||
// Update support
|
||||
- (void) prepareForCollectionViewUpdates: (NSArray *)updateItems
|
||||
{
|
||||
}
|
||||
|
||||
- (void) finalizeCollectionViewUpdates
|
||||
{
|
||||
}
|
||||
|
||||
- (void) prepareForAnimatedBoundsChange: (NSRect)oldBounds
|
||||
{
|
||||
}
|
||||
|
||||
- (void) finalizeAnimatedBoundsChange
|
||||
{
|
||||
}
|
||||
|
||||
- (void) prepareForTransitionToLayout: (NSCollectionViewLayout *)newLayout
|
||||
{
|
||||
}
|
||||
|
||||
- (void) prepareForTransitionFromLayout: (NSCollectionViewLayout *)oldLayout
|
||||
{
|
||||
}
|
||||
|
||||
- (void) finalizeLayoutTransition
|
||||
{
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *) initialLayoutAttributesForAppearingItemAtIndexPath: (NSIndexPath *)itemIndexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *) finalLayoutAttributesForDisappearingItemAtIndexPath: (NSIndexPath *)itemIndexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *)
|
||||
initialLayoutAttributesForAppearingSupplementaryElementOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)elementIndexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *)
|
||||
finalLayoutAttributesForDisappearingSupplementaryElementOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)elementIndexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *)
|
||||
initialLayoutAttributesForAppearingDecorationElementOfKind: (NSCollectionViewDecorationElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)decorationIndexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *)
|
||||
finalLayoutAttributesForDisappearingDecorationElementOfKind: (NSCollectionViewDecorationElementKind)elementKind
|
||||
atIndexPath: (NSIndexPath *)decorationIndexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSSet *)indexPathsToDeleteForSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSSet *)indexPathsToDeleteForDecorationViewOfKind: (NSCollectionViewDecorationElementKind)elementKind
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSSet *)indexPathsToInsertForSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSSet *)indexPathsToInsertForDecorationViewOfKind: (NSCollectionViewDecorationElementKind)elementKind
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -26,5 +26,54 @@
|
|||
|
||||
@implementation NSCollectionViewTransitionLayout
|
||||
|
||||
- (CGFloat) transitionProgress
|
||||
{
|
||||
return _transitionProgress;
|
||||
}
|
||||
|
||||
- (void) setTransitionProgress: (CGFloat)transitionProgress
|
||||
{
|
||||
_transitionProgress = transitionProgress;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayout *) currentLayout
|
||||
{
|
||||
return _currentLayout;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayout *) nextLayout
|
||||
{
|
||||
return _nextLayout;
|
||||
}
|
||||
|
||||
// Designated initializer
|
||||
- (instancetype) initWithCurrentLayout: (NSCollectionViewLayout *)currentLayout
|
||||
nextLayout: (NSCollectionViewLayout *)nextLayout
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
ASSIGN(_currentLayout, currentLayout);
|
||||
ASSIGN(_nextLayout, nextLayout);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_currentLayout);
|
||||
RELEASE(_nextLayout);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) updateValue: (CGFloat)value forAnimatedKey: (NSCollectionViewTransitionLayoutAnimatedKey)key
|
||||
{
|
||||
}
|
||||
|
||||
- (CGFloat) valueForAnimatedKey: (NSCollectionViewTransitionLayoutAnimatedKey)key
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in a new issue