mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 17:52:42 +00:00
Replaced -_dataCellForTableColumn:row: by -preparedCellAtColumn:row: new public method from Mac OS X 10.5
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36136 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0e308561c1
commit
e4e5428122
4 changed files with 68 additions and 59 deletions
|
@ -1,3 +1,12 @@
|
|||
2013-02-14 Quentin Mathe <quentin.mathe@gmail.com>
|
||||
|
||||
* Headers/AppKit/NSTableView.h
|
||||
* Source/NSTableView.m
|
||||
* Source/NSOutline.m
|
||||
(-_dataCellForTableColumn:row:, -preparedCellAtColumn:row:):
|
||||
Replaced _dataCellForTableColumn:row: by -preparedCellAtColumn:row:
|
||||
new public method from Mac OS X 10.5.
|
||||
|
||||
2013-02-14 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/GSXibLoader.m (GSXibKeyedUnarchiver -_preProcessXib:):
|
||||
|
|
|
@ -229,6 +229,12 @@ typedef enum _NSTableViewColumnAutoresizingStyle
|
|||
- (NSTableViewGridLineStyle) gridStyleMask;
|
||||
#endif
|
||||
|
||||
/* Proving Cells */
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
||||
- (NSCell *) preparedCellAtColumn: (NSInteger)columnIndex row: (NSInteger)rowIndex;
|
||||
#endif
|
||||
|
||||
/* Editing Cells */
|
||||
/* ALL TODOS */
|
||||
- (void) editColumn: (NSInteger)columnIndex
|
||||
|
|
|
@ -126,8 +126,6 @@ static NSImage *unexpandable = nil;
|
|||
- (void) _closeItem: (id)item;
|
||||
- (void) _removeChildren: (id)startitem;
|
||||
- (void) _noteNumberOfRowsChangedBelowItem: (id)item by: (int)n;
|
||||
- (NSCell *) _dataCellForTableColumn: (NSTableColumn *)tb
|
||||
row: (int) rowIndex;
|
||||
@end
|
||||
|
||||
@interface NSOutlineView (Private)
|
||||
|
@ -915,9 +913,7 @@ static NSImage *unexpandable = nil;
|
|||
{
|
||||
int startingColumn;
|
||||
int endingColumn;
|
||||
NSTableColumn *tb;
|
||||
NSRect drawingRect;
|
||||
NSCell *cell;
|
||||
NSCell *imageCell = nil;
|
||||
NSRect imageRect;
|
||||
int i;
|
||||
|
@ -964,11 +960,13 @@ static NSImage *unexpandable = nil;
|
|||
for (i = startingColumn; i <= endingColumn; i++)
|
||||
{
|
||||
id item = [self itemAtRow: rowIndex];
|
||||
NSTableColumn *tb = [_tableColumns objectAtIndex: i];
|
||||
NSCell *cell = [self preparedCellAtColumn: i row: rowIndex];
|
||||
|
||||
tb = [_tableColumns objectAtIndex: i];
|
||||
cell = [self _dataCellForTableColumn: tb row: rowIndex];
|
||||
if (i == _editedColumn && rowIndex == _editedRow)
|
||||
[cell _setInEditing: YES];
|
||||
{
|
||||
[cell _setInEditing: YES];
|
||||
}
|
||||
[self _willDisplayCell: cell
|
||||
forTableColumn: tb
|
||||
row: rowIndex];
|
||||
|
@ -1584,11 +1582,11 @@ Also returns the child index relative to this parent. */
|
|||
_editedColumn = columnIndex;
|
||||
|
||||
// Prepare the cell
|
||||
tb = [_tableColumns objectAtIndex: columnIndex];
|
||||
// NB: need to be released when no longer used
|
||||
_editedCell = [[self _dataCellForTableColumn: tb row: rowIndex] copy];
|
||||
_editedCell = [[self preparedCellAtColumn: columnIndex row: rowIndex] copy];
|
||||
|
||||
[_editedCell setEditable: _dataSource_editable];
|
||||
tb = [_tableColumns objectAtIndex: columnIndex];
|
||||
[_editedCell setObjectValue: [self _objectValueForTableColumn: tb
|
||||
row: rowIndex]];
|
||||
|
||||
|
@ -2246,17 +2244,17 @@ Also returns the child index relative to this parent. */
|
|||
}
|
||||
}
|
||||
|
||||
- (NSCell *) _dataCellForTableColumn: (NSTableColumn *)tb
|
||||
row: (int) rowIndex
|
||||
- (NSCell *) preparedCellAtColumn: (NSInteger)columnIndex row: (NSInteger)rowIndex
|
||||
{
|
||||
NSCell *cell = nil;
|
||||
NSTableColumn *tb = [_tableColumns objectAtIndex: columnIndex];
|
||||
|
||||
if ([_delegate respondsToSelector:
|
||||
@selector(outlineView:dataCellForTableColumn:item:)])
|
||||
@selector(outlineView:dataCellForTableColumn:item:)])
|
||||
{
|
||||
id item = [self itemAtRow: rowIndex];
|
||||
cell = [_delegate outlineView: self
|
||||
dataCellForTableColumn: tb
|
||||
item: item];
|
||||
cell = [_delegate outlineView: self dataCellForTableColumn: tb
|
||||
item: item];
|
||||
}
|
||||
if (cell == nil)
|
||||
{
|
||||
|
|
|
@ -1982,8 +1982,6 @@ static void computeNewSelection
|
|||
- (void) _editNextCellAfterRow:(int)row inColumn:(int)column;
|
||||
- (void) _autosaveTableColumns;
|
||||
- (void) _autoloadTableColumns;
|
||||
- (NSCell *) _dataCellForTableColumn: (NSTableColumn *)tb
|
||||
row: (int) rowIndex;
|
||||
@end
|
||||
|
||||
|
||||
|
@ -3177,6 +3175,28 @@ byExtendingSelection: (BOOL)flag
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Providing Cells
|
||||
*/
|
||||
|
||||
- (NSCell *) preparedCellAtColumn: (NSInteger)columnIndex row: (NSInteger)rowIndex
|
||||
{
|
||||
NSCell *cell = nil;
|
||||
NSTableColumn *tb = [_tableColumns objectAtIndex: columnIndex];
|
||||
|
||||
if ([_delegate respondsToSelector:
|
||||
@selector(tableView:dataCellForTableColumn:row:)])
|
||||
{
|
||||
cell = [_delegate tableView: self dataCellForTableColumn: tb
|
||||
row: rowIndex];
|
||||
}
|
||||
if (cell == nil)
|
||||
{
|
||||
cell = [tb dataCellForRow: rowIndex];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
/*
|
||||
* Editing Cells
|
||||
*/
|
||||
|
@ -3337,11 +3357,11 @@ byExtendingSelection: (BOOL)flag
|
|||
_editedColumn = columnIndex;
|
||||
|
||||
// Prepare the cell
|
||||
tb = [_tableColumns objectAtIndex: columnIndex];
|
||||
// NB: need to be released when no longer used
|
||||
_editedCell = [[self _dataCellForTableColumn: tb row: rowIndex] copy];
|
||||
_editedCell = [[self preparedCellAtColumn: columnIndex row: rowIndex] copy];
|
||||
|
||||
[_editedCell setEditable: _dataSource_editable];
|
||||
tb = [_tableColumns objectAtIndex: columnIndex];
|
||||
[_editedCell setObjectValue: [self _objectValueForTableColumn: tb
|
||||
row: rowIndex]];
|
||||
|
||||
|
@ -3433,26 +3453,21 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
|||
row: (NSInteger) rowIndex
|
||||
withEvent: (NSEvent *) theEvent
|
||||
{
|
||||
NSTableColumn *tb;
|
||||
NSCell *cell;
|
||||
NSRect cellFrame;
|
||||
id originalValue;
|
||||
|
||||
if (rowIndex == -1 || columnIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tb = [_tableColumns objectAtIndex: columnIndex];
|
||||
/* we should copy the cell here, as we do on editing.
|
||||
otherwise validation on a cell being edited could
|
||||
cause the cell we are selecting to get it's objectValue */
|
||||
cell = [[self _dataCellForTableColumn: tb row: rowIndex] copy];
|
||||
originalValue = RETAIN([self _objectValueForTableColumn: tb
|
||||
row: rowIndex]);
|
||||
NSCell *cell = [[self preparedCellAtColumn: columnIndex row: rowIndex] copy];
|
||||
NSTableColumn *tb = [_tableColumns objectAtIndex: columnIndex];
|
||||
id originalValue = RETAIN([self _objectValueForTableColumn: tb
|
||||
row: rowIndex]);
|
||||
[cell setObjectValue: originalValue];
|
||||
cellFrame = [self frameOfCellAtColumn: columnIndex
|
||||
row: rowIndex];
|
||||
NSRect cellFrame = [self frameOfCellAtColumn: columnIndex
|
||||
row: rowIndex];
|
||||
[cell setHighlighted: YES];
|
||||
[self setNeedsDisplayInRect: cellFrame];
|
||||
/* give delegate a chance to i.e set target */
|
||||
|
@ -3802,11 +3817,8 @@ if (currentRow >= 0 && currentRow < _numberOfRows) \
|
|||
* Can never get here from a dragging source
|
||||
* so they need to track in mouse up.
|
||||
*/
|
||||
NSTableColumn *tb;
|
||||
NSCell *cell;
|
||||
|
||||
tb = [_tableColumns objectAtIndex: _clickedColumn];
|
||||
cell = [self _dataCellForTableColumn: tb row: _clickedRow];
|
||||
NSCell *cell = [self preparedCellAtColumn: _clickedColumn
|
||||
row: _clickedRow];
|
||||
|
||||
[self _trackCellAtColumn: _clickedColumn
|
||||
row: _clickedRow
|
||||
|
@ -4770,7 +4782,8 @@ This method is deprecated, use -columnIndexesInRect:. */
|
|||
width = [[tb headerCell] cellSize].width;
|
||||
for (row = 0; row < _numberOfRows; row++)
|
||||
{
|
||||
cell = [self _dataCellForTableColumn: tb row: row];
|
||||
cell = [self preparedCellAtColumn: [_tableColumns indexOfObject: tb]
|
||||
row: row];
|
||||
[cell setObjectValue: [_dataSource tableView: self
|
||||
objectValueForTableColumn: tb
|
||||
row: row]];
|
||||
|
@ -5706,14 +5719,15 @@ This method is deprecated, use -columnIndexesInRect:. */
|
|||
- (void) updateCell: (NSCell*)aCell
|
||||
{
|
||||
int i, j;
|
||||
NSTableColumn *tb;
|
||||
|
||||
if (aCell == nil)
|
||||
return;
|
||||
|
||||
return;
|
||||
|
||||
for (i = 0; i < _numberOfColumns; i++)
|
||||
{
|
||||
tb = [_tableColumns objectAtIndex: i];
|
||||
if ([self _dataCellForTableColumn: tb row: -1] == aCell)
|
||||
if ([self preparedCellAtColumn: i row: -1] == aCell)
|
||||
{
|
||||
[self setNeedsDisplayInRect: [self rectOfColumn: i]];
|
||||
}
|
||||
|
@ -5738,7 +5752,7 @@ This method is deprecated, use -columnIndexesInRect:. */
|
|||
|
||||
for (j = firstVisibleRow; j < lastVisibleRow; j++)
|
||||
{
|
||||
if ([self _dataCellForTableColumn: tb row: j] == aCell)
|
||||
if ([self preparedCellAtColumn: i row: j] == aCell)
|
||||
{
|
||||
rowRect = [self rectOfRow: j];
|
||||
[self setNeedsDisplayInRect:
|
||||
|
@ -6035,24 +6049,6 @@ This method is deprecated, use -columnIndexesInRect:. */
|
|||
}
|
||||
}
|
||||
|
||||
- (NSCell *) _dataCellForTableColumn: (NSTableColumn *)tb
|
||||
row: (int) rowIndex
|
||||
{
|
||||
NSCell *cell = nil;
|
||||
if ([_delegate respondsToSelector:
|
||||
@selector(tableView:dataCellForTableColumn:row:)])
|
||||
{
|
||||
cell = [_delegate tableView: self
|
||||
dataCellForTableColumn: tb
|
||||
row: rowIndex];
|
||||
}
|
||||
if (cell == nil)
|
||||
{
|
||||
cell = [tb dataCellForRow: rowIndex];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void) superviewFrameChanged: (NSNotification*)aNotification
|
||||
{
|
||||
if (_autoresizesAllColumnsToFit == YES)
|
||||
|
@ -6571,7 +6567,7 @@ For a more detailed explanation, -setSortDescriptors:. */
|
|||
|
||||
{
|
||||
NSTableColumn *tableColumn = [_tableColumns objectAtIndex: columnIndex];
|
||||
NSCell *cell = [self _dataCellForTableColumn: tableColumn row: rowIndex];
|
||||
NSCell *cell = [self preparedCellAtColumn: columnIndex row: rowIndex];
|
||||
|
||||
BOOL cellIsEditable = [cell isEditable];
|
||||
BOOL columnIsEditable = [tableColumn isEditable];
|
||||
|
|
Loading…
Reference in a new issue