mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 18:11:13 +00:00
Made mouse down changes of table view work with outline view.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19571 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
99fe5f4012
commit
fe94ecb9cd
3 changed files with 68 additions and 42 deletions
|
@ -1,3 +1,12 @@
|
|||
2004-06-21 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSTableView.m:
|
||||
* Source/NSOutlineView.m: (-_willDisplayCell:forTableColumn:row:)
|
||||
New method to abstract from differences in table and outline
|
||||
view. Used whenever the delegate gets informed by
|
||||
willDisplayCell:.
|
||||
(_setObjectValue:forTableColumn:row:) Check for correct method.
|
||||
|
||||
2004-06-20 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSTableView.m: (-mouseDown:) Set value after cell tracking.
|
||||
|
|
|
@ -85,6 +85,9 @@ static NSImage *unexpandable = nil;
|
|||
- (BOOL) _shouldSelectionChange;
|
||||
- (BOOL) _shouldEditTableColumn: (NSTableColumn *)tableColumn
|
||||
row: (int) rowIndex;
|
||||
- (void) _willDisplayCell: (NSCell*)cell
|
||||
forTableColumn: (NSTableColumn *)tb
|
||||
row: (int)index;
|
||||
- (id)_objectValueForTableColumn: (NSTableColumn *)tb
|
||||
row: (int)index;
|
||||
- (void) _setObjectValue: (id)value
|
||||
|
@ -1010,15 +1013,9 @@ static NSImage *unexpandable = nil;
|
|||
|
||||
tb = [_tableColumns objectAtIndex: i];
|
||||
cell = [tb dataCellForRow: rowIndex];
|
||||
|
||||
if ([_delegate respondsToSelector: @selector(outlineView:willDisplayCell:forTableColumn:item:)])
|
||||
{
|
||||
[_delegate outlineView: self
|
||||
willDisplayCell: cell
|
||||
forTableColumn: tb
|
||||
item: item];
|
||||
}
|
||||
|
||||
[self _willDisplayCell: cell
|
||||
forTableColumn: tb
|
||||
row: rowIndex];
|
||||
[cell setObjectValue: [_dataSource outlineView: self
|
||||
objectValueForTableColumn: tb
|
||||
byItem: item]];
|
||||
|
@ -1205,10 +1202,11 @@ static NSImage *unexpandable = nil;
|
|||
- (BOOL) _shouldEditTableColumn: (NSTableColumn *)tableColumn
|
||||
row: (int) rowIndex
|
||||
{
|
||||
id item = [self itemAtRow: rowIndex];
|
||||
if ([_delegate respondsToSelector:
|
||||
@selector(outlineView:shouldEditTableColumn:item:)])
|
||||
{
|
||||
id item = [self itemAtRow: rowIndex];
|
||||
|
||||
if ([_delegate outlineView: self shouldEditTableColumn: tableColumn
|
||||
item: item] == NO)
|
||||
{
|
||||
|
@ -1219,15 +1217,31 @@ static NSImage *unexpandable = nil;
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (void) _willDisplayCell: (NSCell*)cell
|
||||
forTableColumn: (NSTableColumn *)tb
|
||||
row: (int)index
|
||||
{
|
||||
if (_del_responds)
|
||||
{
|
||||
id item = [self itemAtRow: index];
|
||||
|
||||
[_delegate outlineView: self
|
||||
willDisplayCell: cell
|
||||
forTableColumn: tb
|
||||
item: item];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) _objectValueForTableColumn: (NSTableColumn *)tb
|
||||
row: (int) index
|
||||
{
|
||||
id result = nil;
|
||||
id item = [self itemAtRow: index];
|
||||
|
||||
if([_dataSource respondsToSelector:
|
||||
@selector(outlineView:objectValueForTableColumn:byItem:)])
|
||||
{
|
||||
id item = [self itemAtRow: index];
|
||||
|
||||
result = [_dataSource outlineView: self
|
||||
objectValueForTableColumn: tb
|
||||
byItem: item];
|
||||
|
@ -1240,10 +1254,11 @@ static NSImage *unexpandable = nil;
|
|||
forTableColumn: (NSTableColumn *)tb
|
||||
row: (int) index
|
||||
{
|
||||
id item = [self itemAtRow: index];
|
||||
if([_dataSource respondsToSelector:
|
||||
@selector(outlineView:objectValueForTableColumn:byItem:)])
|
||||
@selector(outlineView:setObjectValue:forTableColumn:byItem:)])
|
||||
{
|
||||
id item = [self itemAtRow: index];
|
||||
|
||||
[_dataSource outlineView: self
|
||||
setObjectValue: value
|
||||
forTableColumn: tb
|
||||
|
@ -1713,13 +1728,9 @@ static NSImage *unexpandable = nil;
|
|||
}
|
||||
|
||||
// But of course the delegate can mess it up if it wants
|
||||
if (_del_responds)
|
||||
{
|
||||
[_delegate outlineView: self
|
||||
willDisplayCell: _editedCell
|
||||
forTableColumn: tb
|
||||
item: [self itemAtRow: rowIndex]];
|
||||
}
|
||||
[self _willDisplayCell: _editedCell
|
||||
forTableColumn: tb
|
||||
row: rowIndex];
|
||||
|
||||
/* Please note the important point - calling stringValue normally
|
||||
causes the _editedCell to call the validateEditing method of its
|
||||
|
|
|
@ -92,6 +92,9 @@ static unsigned currentDragOperation;
|
|||
- (BOOL) _shouldSelectionChange;
|
||||
- (BOOL) _shouldEditTableColumn: (NSTableColumn *)tableColumn
|
||||
row: (int) rowIndex;
|
||||
- (void) _willDisplayCell: (NSCell*)cell
|
||||
forTableColumn: (NSTableColumn *)tb
|
||||
row: (int)index;
|
||||
|
||||
- (BOOL) _writeRows: (NSArray *) rows
|
||||
toPasteboard: (NSPasteboard *)pboard;
|
||||
|
@ -3246,11 +3249,9 @@ byExtendingSelection: (BOOL)flag
|
|||
}
|
||||
|
||||
// But of course the delegate can mess it up if it wants
|
||||
if (_del_responds)
|
||||
{
|
||||
[_delegate tableView: self willDisplayCell: _editedCell
|
||||
forTableColumn: tb row: rowIndex];
|
||||
}
|
||||
[self _willDisplayCell: _editedCell
|
||||
forTableColumn: tb
|
||||
row: rowIndex];
|
||||
|
||||
/* Please note the important point - calling stringValue normally
|
||||
causes the _editedCell to call the validateEditing method of its
|
||||
|
@ -3469,13 +3470,9 @@ inline float computePeriod(NSPoint mouseLocationWin,
|
|||
[cell setHighlighted: YES];
|
||||
[self setNeedsDisplayInRect: cellFrame];
|
||||
/* give delegate a chance to i.e set target */
|
||||
if (_del_responds)
|
||||
{
|
||||
[_delegate tableView: self
|
||||
willDisplayCell: cell
|
||||
forTableColumn: tb
|
||||
row: _clickedRow];
|
||||
}
|
||||
[self _willDisplayCell: cell
|
||||
forTableColumn: tb
|
||||
row: _clickedRow];
|
||||
if ([cell trackMouse: lastEvent
|
||||
inRect: cellFrame
|
||||
ofView: self
|
||||
|
@ -4215,11 +4212,9 @@ inline float computePeriod(NSPoint mouseLocationWin,
|
|||
[cell setObjectValue: [_dataSource tableView: self
|
||||
objectValueForTableColumn: tb
|
||||
row: row]];
|
||||
if (_del_responds)
|
||||
{
|
||||
[_delegate tableView: self willDisplayCell: cell
|
||||
forTableColumn: tb row: row];
|
||||
}
|
||||
[self _willDisplayCell: cell
|
||||
forTableColumn: tb
|
||||
row: row];
|
||||
candidate_width = [cell cellSize].width;
|
||||
|
||||
if (_drawsGrid)
|
||||
|
@ -4435,11 +4430,9 @@ inline float computePeriod(NSPoint mouseLocationWin,
|
|||
{
|
||||
tb = [_tableColumns objectAtIndex: i];
|
||||
cell = [tb dataCellForRow: rowIndex];
|
||||
if (_del_responds)
|
||||
{
|
||||
[_delegate tableView: self willDisplayCell: cell
|
||||
forTableColumn: tb row: rowIndex];
|
||||
}
|
||||
[self _willDisplayCell: cell
|
||||
forTableColumn: tb
|
||||
row: rowIndex];
|
||||
[cell setObjectValue: [_dataSource tableView: self
|
||||
objectValueForTableColumn: tb
|
||||
row: rowIndex]];
|
||||
|
@ -5866,6 +5859,19 @@ inline float computePeriod(NSPoint mouseLocationWin,
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (void) _willDisplayCell: (NSCell*)cell
|
||||
forTableColumn: (NSTableColumn *)tb
|
||||
row: (int)index
|
||||
{
|
||||
if (_del_responds)
|
||||
{
|
||||
[_delegate tableView: self
|
||||
willDisplayCell: cell
|
||||
forTableColumn: tb
|
||||
row: index];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) _objectValueForTableColumn: (NSTableColumn *)tb
|
||||
row: (int) index
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue