mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Add implementation of setters and getters in NSCollectionViewGridLayout
This commit is contained in:
parent
7d46f9f69a
commit
35e0e62144
3 changed files with 198 additions and 3 deletions
|
@ -26,6 +26,7 @@
|
|||
#define _NSCollectionViewGridLayout_h_GNUSTEP_GUI_INCLUDE
|
||||
|
||||
#import <AppKit/NSCollectionViewLayout.h>
|
||||
#import <Foundation/NSGeometry.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
|
||||
|
@ -34,7 +35,34 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
@interface NSCollectionViewGridLayout : NSCollectionViewLayout
|
||||
{
|
||||
NSUInteger _maximumNumberOfRows;
|
||||
NSUInteger _maximumNumberOfColumns;
|
||||
NSSize _minimumItemSize;
|
||||
NSSize _maximumItemSize;
|
||||
NSEdgeInsets _margins;
|
||||
CGFloat _minimumInteritemSpacing;
|
||||
}
|
||||
|
||||
- (void) setMaximumNumberOfRows: (NSUInteger)maxRows;
|
||||
- (NSUInteger) maximumNumberOfRows;
|
||||
|
||||
- (void) setMaximumNumberOfColumns: (NSUInteger)maxCols;
|
||||
- (NSUInteger) maximumNumberOfColumns;
|
||||
|
||||
- (void) setMinimumItemSize: (NSSize)minSize;
|
||||
- (NSSize) minimumItemSize;
|
||||
|
||||
- (void) setMaximumItemSize: (NSSize)maxSize;
|
||||
- (NSSize) maximumItemSize;;
|
||||
|
||||
- (void) setMargins: (NSEdgeInsets)insets;
|
||||
- (NSEdgeInsets) margins;
|
||||
|
||||
- (void) setMinimumInteritemSpacing: (CGFloat)spacing;
|
||||
- (CGFloat) minimumInteritemSpacing;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
@ -1394,7 +1394,7 @@ static NSString *placeholderItem = nil;
|
|||
if (_collectionViewLayout)
|
||||
{
|
||||
NSCollectionViewLayoutAttributes *attrs =
|
||||
[_collectionViewLayout layoutAttributesForItemAtIndexPath: path];
|
||||
[self layoutAttributesForItemAtIndexPath: path];
|
||||
NSRect frame = [attrs frame];
|
||||
BOOL hidden = [attrs isHidden];
|
||||
CGFloat alpha = [attrs alpha];
|
||||
|
@ -1604,13 +1604,18 @@ static NSString *placeholderItem = nil;
|
|||
|
||||
- (NSCollectionViewLayoutAttributes *) layoutAttributesForItemAtIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
NSCollectionViewLayoutAttributes *attrs =
|
||||
[_collectionViewLayout layoutAttributesForItemAtIndexPath: indexPath];
|
||||
return attrs;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *) layoutAttributesForSupplementaryElementOfKind: (NSCollectionViewSupplementaryElementKind)kind
|
||||
atIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
NSCollectionViewLayoutAttributes *attrs =
|
||||
[_collectionViewLayout layoutAttributesForSupplementaryViewOfKind: kind
|
||||
atIndexPath: indexPath];
|
||||
return attrs;
|
||||
}
|
||||
|
||||
/* Animating Multiple Changes */
|
||||
|
|
|
@ -26,5 +26,167 @@
|
|||
|
||||
@implementation NSCollectionViewGridLayout
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder: coder];
|
||||
if (self)
|
||||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
}
|
||||
|
||||
- (void) setMaximumNumberOfRows: (NSUInteger)maxRows
|
||||
{
|
||||
_maximumNumberOfRows = maxRows;
|
||||
}
|
||||
|
||||
- (NSUInteger) maximumNumberOfRows;
|
||||
{
|
||||
return _maximumNumberOfRows;
|
||||
}
|
||||
|
||||
- (void) setMaximumNumberOfColumns: (NSUInteger)maxCols
|
||||
{
|
||||
_maximumNumberOfColumns = maxCols;
|
||||
}
|
||||
|
||||
- (NSUInteger) maximumNumberOfColumns
|
||||
{
|
||||
return _maximumNumberOfColumns;
|
||||
}
|
||||
|
||||
- (void) setMinimumItemSize: (NSSize)minSize
|
||||
{
|
||||
_minimumItemSize = minSize;
|
||||
}
|
||||
|
||||
- (NSSize) minimumItemSize
|
||||
{
|
||||
return _minimumItemSize;
|
||||
}
|
||||
|
||||
- (void) setMaximumItemSize: (NSSize)maxSize
|
||||
{
|
||||
_maximumItemSize = maxSize;
|
||||
}
|
||||
|
||||
- (NSSize) maximumItemSize
|
||||
{
|
||||
return _maximumItemSize;
|
||||
}
|
||||
|
||||
|
||||
- (void) setMargins: (NSEdgeInsets)insets
|
||||
{
|
||||
_margins = insets;
|
||||
}
|
||||
|
||||
- (NSEdgeInsets) margins
|
||||
{
|
||||
return _margins;
|
||||
}
|
||||
|
||||
- (void) setMinimumInteritemSpacing: (CGFloat)spacing
|
||||
{
|
||||
_minimumInteritemSpacing = spacing;
|
||||
}
|
||||
|
||||
- (CGFloat) minimumInteritemSpacing
|
||||
{
|
||||
return _minimumInteritemSpacing;
|
||||
}
|
||||
|
||||
// Methods to override for specific layouts...
|
||||
- (void) prepareLayout
|
||||
{
|
||||
[super prepareLayout];
|
||||
}
|
||||
|
||||
- (NSArray *) layoutAttributesForElementsInRect: (NSRect)rect
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSCollectionViewLayoutAttributes *) layoutAttributesForItemAtIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
NSCollectionViewLayoutAttributes *attrs = [[NSCollectionViewLayoutAttributes alloc] init];
|
||||
AUTORELEASE(attrs);
|
||||
return attrs;
|
||||
}
|
||||
|
||||
- (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 subclassing hooks...
|
||||
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in a new issue