mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Address fred's comment about getting the cell more efficiently
This commit is contained in:
parent
2c488f07c8
commit
68dad85a1e
2 changed files with 14 additions and 8 deletions
|
@ -156,7 +156,7 @@ APPKIT_EXPORT const CGFloat NSGridViewSizeForContent;
|
|||
- (NSGridView *) gridView;
|
||||
- (void) setGridView: (NSGridView *)gv;
|
||||
- (NSInteger) numberOfCells;
|
||||
- (NSGridCell *) cellAtIndex:(NSInteger)index;
|
||||
- (NSGridCell *) cellAtIndex: (NSInteger)index;
|
||||
|
||||
- (NSGridCellPlacement) xPlacement;
|
||||
- (void) setXPlacement: (NSGridCellPlacement)x;
|
||||
|
@ -186,7 +186,7 @@ APPKIT_EXPORT const CGFloat NSGridViewSizeForContent;
|
|||
- (NSGridView *) gridView;
|
||||
- (void) setGridView: (NSGridView *)gv;
|
||||
- (NSInteger) numberOfCells;
|
||||
- (NSGridCell *)cellAtIndex:(NSInteger)index;
|
||||
- (NSGridCell *)cellAtIndex: (NSInteger)index;
|
||||
|
||||
- (NSGridCellPlacement) yPlacement;
|
||||
- (void) setYPlacement: (NSGridCellPlacement)y;
|
||||
|
|
|
@ -960,11 +960,14 @@
|
|||
return [arr count];
|
||||
}
|
||||
|
||||
- (NSGridCell *) cellAtIndex:(NSInteger)index
|
||||
- (NSGridCell *) cellAtIndex: (NSInteger)index
|
||||
{
|
||||
NSUInteger ci = [_gridView indexOfColumn: self];
|
||||
NSArray *arr = [_gridView _cellsForColumnAtIndex: ci];
|
||||
return [arr objectAtIndex: index];
|
||||
// First we get the columnIndex (ci) then we get the member of that column
|
||||
// referred to by index. The method called here gets the correct cell out of
|
||||
// the _cells array in the containing NSGridView.
|
||||
return [_gridView cellAtColumnIndex: ci
|
||||
rowIndex: index];
|
||||
}
|
||||
|
||||
- (NSGridCellPlacement) xPlacement
|
||||
|
@ -1134,11 +1137,14 @@
|
|||
return [arr count];
|
||||
}
|
||||
|
||||
- (NSGridCell *) cellAtIndex:(NSInteger)index
|
||||
- (NSGridCell *) cellAtIndex: (NSInteger)index
|
||||
{
|
||||
NSUInteger ri = [_gridView indexOfRow: self];
|
||||
NSArray *arr = [_gridView _cellsForRowAtIndex: ri];
|
||||
return [arr objectAtIndex: index];
|
||||
// First we get the rowIndex (ri) then we get the member of that row
|
||||
// referred to by index. The method called here gets the correct cell out of
|
||||
// the _cells array in the containing NSGridView.
|
||||
return [_gridView cellAtColumnIndex: index
|
||||
rowIndex: ri];
|
||||
}
|
||||
|
||||
- (NSGridCellPlacement) yPlacement
|
||||
|
|
Loading…
Reference in a new issue