mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 20:41:55 +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
9531572fb4
commit
9a8f8f4e07
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>
|
2013-02-14 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/GSXibLoader.m (GSXibKeyedUnarchiver -_preProcessXib:):
|
* Source/GSXibLoader.m (GSXibKeyedUnarchiver -_preProcessXib:):
|
||||||
|
|
|
@ -229,6 +229,12 @@ typedef enum _NSTableViewColumnAutoresizingStyle
|
||||||
- (NSTableViewGridLineStyle) gridStyleMask;
|
- (NSTableViewGridLineStyle) gridStyleMask;
|
||||||
#endif
|
#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 */
|
/* Editing Cells */
|
||||||
/* ALL TODOS */
|
/* ALL TODOS */
|
||||||
- (void) editColumn: (NSInteger)columnIndex
|
- (void) editColumn: (NSInteger)columnIndex
|
||||||
|
|
|
@ -126,8 +126,6 @@ static NSImage *unexpandable = nil;
|
||||||
- (void) _closeItem: (id)item;
|
- (void) _closeItem: (id)item;
|
||||||
- (void) _removeChildren: (id)startitem;
|
- (void) _removeChildren: (id)startitem;
|
||||||
- (void) _noteNumberOfRowsChangedBelowItem: (id)item by: (int)n;
|
- (void) _noteNumberOfRowsChangedBelowItem: (id)item by: (int)n;
|
||||||
- (NSCell *) _dataCellForTableColumn: (NSTableColumn *)tb
|
|
||||||
row: (int) rowIndex;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface NSOutlineView (Private)
|
@interface NSOutlineView (Private)
|
||||||
|
@ -915,9 +913,7 @@ static NSImage *unexpandable = nil;
|
||||||
{
|
{
|
||||||
int startingColumn;
|
int startingColumn;
|
||||||
int endingColumn;
|
int endingColumn;
|
||||||
NSTableColumn *tb;
|
|
||||||
NSRect drawingRect;
|
NSRect drawingRect;
|
||||||
NSCell *cell;
|
|
||||||
NSCell *imageCell = nil;
|
NSCell *imageCell = nil;
|
||||||
NSRect imageRect;
|
NSRect imageRect;
|
||||||
int i;
|
int i;
|
||||||
|
@ -964,11 +960,13 @@ static NSImage *unexpandable = nil;
|
||||||
for (i = startingColumn; i <= endingColumn; i++)
|
for (i = startingColumn; i <= endingColumn; i++)
|
||||||
{
|
{
|
||||||
id item = [self itemAtRow: rowIndex];
|
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)
|
if (i == _editedColumn && rowIndex == _editedRow)
|
||||||
[cell _setInEditing: YES];
|
{
|
||||||
|
[cell _setInEditing: YES];
|
||||||
|
}
|
||||||
[self _willDisplayCell: cell
|
[self _willDisplayCell: cell
|
||||||
forTableColumn: tb
|
forTableColumn: tb
|
||||||
row: rowIndex];
|
row: rowIndex];
|
||||||
|
@ -1584,11 +1582,11 @@ Also returns the child index relative to this parent. */
|
||||||
_editedColumn = columnIndex;
|
_editedColumn = columnIndex;
|
||||||
|
|
||||||
// Prepare the cell
|
// Prepare the cell
|
||||||
tb = [_tableColumns objectAtIndex: columnIndex];
|
|
||||||
// NB: need to be released when no longer used
|
// 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];
|
[_editedCell setEditable: _dataSource_editable];
|
||||||
|
tb = [_tableColumns objectAtIndex: columnIndex];
|
||||||
[_editedCell setObjectValue: [self _objectValueForTableColumn: tb
|
[_editedCell setObjectValue: [self _objectValueForTableColumn: tb
|
||||||
row: rowIndex]];
|
row: rowIndex]];
|
||||||
|
|
||||||
|
@ -2246,17 +2244,17 @@ Also returns the child index relative to this parent. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSCell *) _dataCellForTableColumn: (NSTableColumn *)tb
|
- (NSCell *) preparedCellAtColumn: (NSInteger)columnIndex row: (NSInteger)rowIndex
|
||||||
row: (int) rowIndex
|
|
||||||
{
|
{
|
||||||
NSCell *cell = nil;
|
NSCell *cell = nil;
|
||||||
|
NSTableColumn *tb = [_tableColumns objectAtIndex: columnIndex];
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:
|
if ([_delegate respondsToSelector:
|
||||||
@selector(outlineView:dataCellForTableColumn:item:)])
|
@selector(outlineView:dataCellForTableColumn:item:)])
|
||||||
{
|
{
|
||||||
id item = [self itemAtRow: rowIndex];
|
id item = [self itemAtRow: rowIndex];
|
||||||
cell = [_delegate outlineView: self
|
cell = [_delegate outlineView: self dataCellForTableColumn: tb
|
||||||
dataCellForTableColumn: tb
|
item: item];
|
||||||
item: item];
|
|
||||||
}
|
}
|
||||||
if (cell == nil)
|
if (cell == nil)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1982,8 +1982,6 @@ static void computeNewSelection
|
||||||
- (void) _editNextCellAfterRow:(int)row inColumn:(int)column;
|
- (void) _editNextCellAfterRow:(int)row inColumn:(int)column;
|
||||||
- (void) _autosaveTableColumns;
|
- (void) _autosaveTableColumns;
|
||||||
- (void) _autoloadTableColumns;
|
- (void) _autoloadTableColumns;
|
||||||
- (NSCell *) _dataCellForTableColumn: (NSTableColumn *)tb
|
|
||||||
row: (int) rowIndex;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@ -3177,6 +3175,28 @@ byExtendingSelection: (BOOL)flag
|
||||||
return 0;
|
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
|
* Editing Cells
|
||||||
*/
|
*/
|
||||||
|
@ -3337,11 +3357,11 @@ byExtendingSelection: (BOOL)flag
|
||||||
_editedColumn = columnIndex;
|
_editedColumn = columnIndex;
|
||||||
|
|
||||||
// Prepare the cell
|
// Prepare the cell
|
||||||
tb = [_tableColumns objectAtIndex: columnIndex];
|
|
||||||
// NB: need to be released when no longer used
|
// 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];
|
[_editedCell setEditable: _dataSource_editable];
|
||||||
|
tb = [_tableColumns objectAtIndex: columnIndex];
|
||||||
[_editedCell setObjectValue: [self _objectValueForTableColumn: tb
|
[_editedCell setObjectValue: [self _objectValueForTableColumn: tb
|
||||||
row: rowIndex]];
|
row: rowIndex]];
|
||||||
|
|
||||||
|
@ -3433,26 +3453,21 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
||||||
row: (NSInteger) rowIndex
|
row: (NSInteger) rowIndex
|
||||||
withEvent: (NSEvent *) theEvent
|
withEvent: (NSEvent *) theEvent
|
||||||
{
|
{
|
||||||
NSTableColumn *tb;
|
|
||||||
NSCell *cell;
|
|
||||||
NSRect cellFrame;
|
|
||||||
id originalValue;
|
|
||||||
|
|
||||||
if (rowIndex == -1 || columnIndex == -1)
|
if (rowIndex == -1 || columnIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tb = [_tableColumns objectAtIndex: columnIndex];
|
|
||||||
/* we should copy the cell here, as we do on editing.
|
/* we should copy the cell here, as we do on editing.
|
||||||
otherwise validation on a cell being edited could
|
otherwise validation on a cell being edited could
|
||||||
cause the cell we are selecting to get it's objectValue */
|
cause the cell we are selecting to get it's objectValue */
|
||||||
cell = [[self _dataCellForTableColumn: tb row: rowIndex] copy];
|
NSCell *cell = [[self preparedCellAtColumn: columnIndex row: rowIndex] copy];
|
||||||
originalValue = RETAIN([self _objectValueForTableColumn: tb
|
NSTableColumn *tb = [_tableColumns objectAtIndex: columnIndex];
|
||||||
row: rowIndex]);
|
id originalValue = RETAIN([self _objectValueForTableColumn: tb
|
||||||
|
row: rowIndex]);
|
||||||
[cell setObjectValue: originalValue];
|
[cell setObjectValue: originalValue];
|
||||||
cellFrame = [self frameOfCellAtColumn: columnIndex
|
NSRect cellFrame = [self frameOfCellAtColumn: columnIndex
|
||||||
row: rowIndex];
|
row: rowIndex];
|
||||||
[cell setHighlighted: YES];
|
[cell setHighlighted: YES];
|
||||||
[self setNeedsDisplayInRect: cellFrame];
|
[self setNeedsDisplayInRect: cellFrame];
|
||||||
/* give delegate a chance to i.e set target */
|
/* 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
|
* Can never get here from a dragging source
|
||||||
* so they need to track in mouse up.
|
* so they need to track in mouse up.
|
||||||
*/
|
*/
|
||||||
NSTableColumn *tb;
|
NSCell *cell = [self preparedCellAtColumn: _clickedColumn
|
||||||
NSCell *cell;
|
row: _clickedRow];
|
||||||
|
|
||||||
tb = [_tableColumns objectAtIndex: _clickedColumn];
|
|
||||||
cell = [self _dataCellForTableColumn: tb row: _clickedRow];
|
|
||||||
|
|
||||||
[self _trackCellAtColumn: _clickedColumn
|
[self _trackCellAtColumn: _clickedColumn
|
||||||
row: _clickedRow
|
row: _clickedRow
|
||||||
|
@ -4770,7 +4782,8 @@ This method is deprecated, use -columnIndexesInRect:. */
|
||||||
width = [[tb headerCell] cellSize].width;
|
width = [[tb headerCell] cellSize].width;
|
||||||
for (row = 0; row < _numberOfRows; row++)
|
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
|
[cell setObjectValue: [_dataSource tableView: self
|
||||||
objectValueForTableColumn: tb
|
objectValueForTableColumn: tb
|
||||||
row: row]];
|
row: row]];
|
||||||
|
@ -5706,14 +5719,15 @@ This method is deprecated, use -columnIndexesInRect:. */
|
||||||
- (void) updateCell: (NSCell*)aCell
|
- (void) updateCell: (NSCell*)aCell
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
NSTableColumn *tb;
|
|
||||||
if (aCell == nil)
|
if (aCell == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < _numberOfColumns; i++)
|
for (i = 0; i < _numberOfColumns; i++)
|
||||||
{
|
{
|
||||||
tb = [_tableColumns objectAtIndex: i];
|
if ([self preparedCellAtColumn: i row: -1] == aCell)
|
||||||
if ([self _dataCellForTableColumn: tb row: -1] == aCell)
|
|
||||||
{
|
{
|
||||||
[self setNeedsDisplayInRect: [self rectOfColumn: i]];
|
[self setNeedsDisplayInRect: [self rectOfColumn: i]];
|
||||||
}
|
}
|
||||||
|
@ -5738,7 +5752,7 @@ This method is deprecated, use -columnIndexesInRect:. */
|
||||||
|
|
||||||
for (j = firstVisibleRow; j < lastVisibleRow; j++)
|
for (j = firstVisibleRow; j < lastVisibleRow; j++)
|
||||||
{
|
{
|
||||||
if ([self _dataCellForTableColumn: tb row: j] == aCell)
|
if ([self preparedCellAtColumn: i row: j] == aCell)
|
||||||
{
|
{
|
||||||
rowRect = [self rectOfRow: j];
|
rowRect = [self rectOfRow: j];
|
||||||
[self setNeedsDisplayInRect:
|
[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
|
- (void) superviewFrameChanged: (NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
if (_autoresizesAllColumnsToFit == YES)
|
if (_autoresizesAllColumnsToFit == YES)
|
||||||
|
@ -6571,7 +6567,7 @@ For a more detailed explanation, -setSortDescriptors:. */
|
||||||
|
|
||||||
{
|
{
|
||||||
NSTableColumn *tableColumn = [_tableColumns objectAtIndex: columnIndex];
|
NSTableColumn *tableColumn = [_tableColumns objectAtIndex: columnIndex];
|
||||||
NSCell *cell = [self _dataCellForTableColumn: tableColumn row: rowIndex];
|
NSCell *cell = [self preparedCellAtColumn: columnIndex row: rowIndex];
|
||||||
|
|
||||||
BOOL cellIsEditable = [cell isEditable];
|
BOOL cellIsEditable = [cell isEditable];
|
||||||
BOOL columnIsEditable = [tableColumn isEditable];
|
BOOL columnIsEditable = [tableColumn isEditable];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue