mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
* Headers/AppKit/NSOutlineView.h:
* Source/NSOutlineView.m: Add support for outlineView:dataCellForTableColumn:item: delegate method * Headers/AppKit/NSTableView.h: * Source/NSTableView.m: Add support for tableView:dataCellForTableColumn:row: delegate method git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34717 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1127241753
commit
bd5ff5ba95
5 changed files with 71 additions and 9 deletions
|
@ -1,3 +1,12 @@
|
|||
2012-02-03 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Headers/AppKit/NSOutlineView.h:
|
||||
* Source/NSOutlineView.m: Add support for
|
||||
outlineView:dataCellForTableColumn:item: delegate method
|
||||
* Headers/AppKit/NSTableView.h:
|
||||
* Source/NSTableView.m: Add support for
|
||||
tableView:dataCellForTableColumn:row: delegate method
|
||||
|
||||
2012-02-03 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Version 0.22.0
|
||||
|
|
|
@ -268,6 +268,13 @@ shouldSelectTableColumn: (NSTableColumn *)tableColumn;
|
|||
willDisplayCell: (id)cell
|
||||
forTableColumn: (NSTableColumn *)tableColumn
|
||||
item: (id)item;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
||||
- (NSCell *) outlineView: (NSOutlineView *)outlineView
|
||||
dataCellForTableColumn: (NSTableColumn *)aTableColumn
|
||||
item: (id)item;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Called when the given cell in the outline column is about to be displayed. This method is
|
||||
* useful for making last second modifications to what will be shown.
|
||||
|
|
|
@ -410,6 +410,11 @@ shouldSelectTableColumn: (NSTableColumn *)aTableColumn;
|
|||
willDisplayCell: (id)aCell
|
||||
forTableColumn: (NSTableColumn *)aTableColumn
|
||||
row: (int)rowIndex;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
||||
- (NSCell *) tableView: (NSTableView *)aTableView
|
||||
dataCellForTableColumn: (NSTableColumn *)aTableColumn
|
||||
row: (int)rowIndex;
|
||||
#endif
|
||||
- (void) tableViewColumnDidMove: (NSNotification *)aNotification;
|
||||
- (void) tableViewColumnDidResize: (NSNotification *)aNotification;
|
||||
- (void) tableViewSelectionDidChange: (NSNotification *)aNotification;
|
||||
|
|
|
@ -125,6 +125,8 @@ 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)
|
||||
|
@ -963,7 +965,7 @@ static NSImage *unexpandable = nil;
|
|||
id item = [self itemAtRow: rowIndex];
|
||||
|
||||
tb = [_tableColumns objectAtIndex: i];
|
||||
cell = [tb dataCellForRow: rowIndex];
|
||||
cell = [self _dataCellForTableColumn: tb row: rowIndex];
|
||||
if (i == _editedColumn && rowIndex == _editedRow)
|
||||
[cell _setInEditing: YES];
|
||||
[self _willDisplayCell: cell
|
||||
|
@ -1577,7 +1579,7 @@ Also returns the child index relative to this parent. */
|
|||
// Prepare the cell
|
||||
tb = [_tableColumns objectAtIndex: columnIndex];
|
||||
// NB: need to be released when no longer used
|
||||
_editedCell = [[tb dataCellForRow: rowIndex] copy];
|
||||
_editedCell = [[self _dataCellForTableColumn: tb row: rowIndex] copy];
|
||||
|
||||
[_editedCell setEditable: _dataSource_editable];
|
||||
[_editedCell setObjectValue: [self _objectValueForTableColumn: tb
|
||||
|
@ -2237,6 +2239,25 @@ Also returns the child index relative to this parent. */
|
|||
}
|
||||
}
|
||||
|
||||
- (NSCell *) _dataCellForTableColumn: (NSTableColumn *)tb
|
||||
row: (int) rowIndex
|
||||
{
|
||||
NSCell *cell = nil;
|
||||
if ([_delegate respondsToSelector:
|
||||
@selector(outlineView:dataCellForTableColumn:item:)])
|
||||
{
|
||||
id item = [self itemAtRow: rowIndex];
|
||||
cell = [_delegate outlineView: self
|
||||
dataCellForTableColumn: tb
|
||||
item: item];
|
||||
}
|
||||
if (cell == nil)
|
||||
{
|
||||
cell = [tb dataCellForRow: rowIndex];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSOutlineView (Private)
|
||||
|
|
|
@ -1979,6 +1979,8 @@ static void computeNewSelection
|
|||
- (void) _editNextCellAfterRow:(int)row inColumn:(int)column;
|
||||
- (void) _autosaveTableColumns;
|
||||
- (void) _autoloadTableColumns;
|
||||
- (NSCell *) _dataCellForTableColumn: (NSTableColumn *)tb
|
||||
row: (int) rowIndex;
|
||||
@end
|
||||
|
||||
|
||||
|
@ -3315,7 +3317,7 @@ byExtendingSelection: (BOOL)flag
|
|||
// Prepare the cell
|
||||
tb = [_tableColumns objectAtIndex: columnIndex];
|
||||
// NB: need to be released when no longer used
|
||||
_editedCell = [[tb dataCellForRow: rowIndex] copy];
|
||||
_editedCell = [[self _dataCellForTableColumn: tb row: rowIndex] copy];
|
||||
|
||||
[_editedCell setEditable: _dataSource_editable];
|
||||
[_editedCell setObjectValue: [self _objectValueForTableColumn: tb
|
||||
|
@ -3423,7 +3425,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
|||
/* 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 = [[tb dataCellForRow: rowIndex] copy];
|
||||
cell = [[self _dataCellForTableColumn: tb row: rowIndex] copy];
|
||||
originalValue = RETAIN([self _objectValueForTableColumn: tb
|
||||
row: rowIndex]);
|
||||
[cell setObjectValue: originalValue];
|
||||
|
@ -3782,7 +3784,7 @@ if (currentRow >= 0 && currentRow < _numberOfRows) \
|
|||
NSCell *cell;
|
||||
|
||||
tb = [_tableColumns objectAtIndex: _clickedColumn];
|
||||
cell = [tb dataCellForRow: _clickedRow];
|
||||
cell = [self _dataCellForTableColumn: tb row: _clickedRow];
|
||||
|
||||
[self _trackCellAtColumn: _clickedColumn
|
||||
row: _clickedRow
|
||||
|
@ -4746,7 +4748,7 @@ This method is deprecated, use -columnIndexesInRect:. */
|
|||
width = [[tb headerCell] cellSize].width;
|
||||
for (row = 0; row < _numberOfRows; row++)
|
||||
{
|
||||
cell = [tb dataCellForRow: row];
|
||||
cell = [self _dataCellForTableColumn: tb row: row];
|
||||
[cell setObjectValue: [_dataSource tableView: self
|
||||
objectValueForTableColumn: tb
|
||||
row: row]];
|
||||
|
@ -5691,7 +5693,7 @@ This method is deprecated, use -columnIndexesInRect:. */
|
|||
for (i = 0; i < _numberOfColumns; i++)
|
||||
{
|
||||
tb = [_tableColumns objectAtIndex: i];
|
||||
if ([tb dataCellForRow: -1] == aCell)
|
||||
if ([self _dataCellForTableColumn: tb row: -1] == aCell)
|
||||
{
|
||||
[self setNeedsDisplayInRect: [self rectOfColumn: i]];
|
||||
}
|
||||
|
@ -5716,7 +5718,7 @@ This method is deprecated, use -columnIndexesInRect:. */
|
|||
|
||||
for (j = firstVisibleRow; j < lastVisibleRow; j++)
|
||||
{
|
||||
if ([tb dataCellForRow: j] == aCell)
|
||||
if ([self _dataCellForTableColumn: tb row: j] == aCell)
|
||||
{
|
||||
rowRect = [self rectOfRow: j];
|
||||
[self setNeedsDisplayInRect:
|
||||
|
@ -6013,6 +6015,24 @@ 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)
|
||||
|
@ -6531,7 +6551,7 @@ For a more detailed explanation, -setSortDescriptors:. */
|
|||
|
||||
{
|
||||
NSTableColumn *tableColumn = [_tableColumns objectAtIndex: columnIndex];
|
||||
NSCell *cell = [tableColumn dataCellForRow: rowIndex];
|
||||
NSCell *cell = [self _dataCellForTableColumn: tableColumn row: rowIndex];
|
||||
|
||||
BOOL cellIsEditable = [cell isEditable];
|
||||
BOOL columnIsEditable = [tableColumn isEditable];
|
||||
|
|
Loading…
Reference in a new issue