mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Merge pull request #242 from gnustep/NSCollectionViewLayout_branch
This branch is to support methods needed by NSCollectionView layout methods. Added NSIndexMethods needed.
This commit is contained in:
commit
61d14215fa
2 changed files with 37 additions and 0 deletions
|
@ -72,6 +72,23 @@ GS_EXPORT_CLASS
|
|||
*/
|
||||
+ (id) indexPathWithIndexes: (NSUInteger*)indexes length: (NSUInteger)length;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11,GS_API_LATEST)
|
||||
/**
|
||||
* Return a path containing an item number and section.
|
||||
*/
|
||||
+ (NSIndexPath *) indexPathForItem: (NSInteger)item inSection: (NSInteger)section;
|
||||
|
||||
/**
|
||||
* Return an index number identifying an item in a collection view
|
||||
*/
|
||||
- (NSInteger) item;
|
||||
|
||||
/**
|
||||
* Return an index number identifying a section in a collection view
|
||||
*/
|
||||
- (NSInteger) section;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Compares other with the receiver.<br />
|
||||
* Returns NSOrderedSame if the two are identical.<br />
|
||||
|
|
|
@ -64,6 +64,16 @@ static NSIndexPath *dummy = nil;
|
|||
return AUTORELEASE(o);
|
||||
}
|
||||
|
||||
+ (NSIndexPath *) indexPathForItem: (NSInteger)item inSection: (NSInteger)section;
|
||||
{
|
||||
NSUInteger idxs[2];
|
||||
|
||||
idxs[0] = (NSUInteger)section;
|
||||
idxs[1] = (NSUInteger)item;
|
||||
|
||||
return [self indexPathWithIndexes: idxs length: 2];
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (empty == nil)
|
||||
|
@ -198,6 +208,16 @@ static NSIndexPath *dummy = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (NSInteger) item
|
||||
{
|
||||
return (NSInteger)[self indexAtPosition: 1];
|
||||
}
|
||||
|
||||
- (NSInteger) section
|
||||
{
|
||||
return (NSInteger)[self indexAtPosition: 0];
|
||||
}
|
||||
|
||||
- (void) getIndexes: (NSUInteger*)aBuffer
|
||||
{
|
||||
memcpy(aBuffer, _indexes, _length * sizeof(NSUInteger));
|
||||
|
|
Loading…
Reference in a new issue