mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 23:50:47 +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
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue