mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Add new methods for NSIndexPath. Add row, section, item and new init methods
This commit is contained in:
parent
ae72ee4593
commit
95a24fb651
2 changed files with 28 additions and 1 deletions
|
@ -88,7 +88,19 @@ GS_EXPORT_CLASS
|
|||
*/
|
||||
- (NSInteger) section;
|
||||
#endif
|
||||
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_13,GS_API_LATEST)
|
||||
/**
|
||||
* Return a path containing row number and section.
|
||||
*/
|
||||
+ (NSIndexPath *) indexPathForRow: (NSInteger)item inSection: (NSInteger)section;
|
||||
|
||||
/**
|
||||
* Return an index number identifying a row in a table view
|
||||
*/
|
||||
- (NSInteger) item;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Compares other with the receiver.<br />
|
||||
* Returns NSOrderedSame if the two are identical.<br />
|
||||
|
|
|
@ -74,6 +74,16 @@ static NSIndexPath *dummy = nil;
|
|||
return [self indexPathWithIndexes: idxs length: 2];
|
||||
}
|
||||
|
||||
+ (NSIndexPath *) indexPathForRow: (NSInteger)row inSection: (NSInteger)section;
|
||||
{
|
||||
NSUInteger idxs[2];
|
||||
|
||||
idxs[0] = (NSUInteger)section;
|
||||
idxs[1] = (NSUInteger)row;
|
||||
|
||||
return [self indexPathWithIndexes: idxs length: 2];
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (empty == nil)
|
||||
|
@ -208,6 +218,11 @@ static NSIndexPath *dummy = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (NSInteger) row
|
||||
{
|
||||
return (NSInteger)[self indexAtPosition: 1];
|
||||
}
|
||||
|
||||
- (NSInteger) item
|
||||
{
|
||||
return (NSInteger)[self indexAtPosition: 1];
|
||||
|
|
Loading…
Reference in a new issue