mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-26 05:40:56 +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>
|
2004-06-20 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSTableView.m: (-mouseDown:) Set value after cell tracking.
|
* Source/NSTableView.m: (-mouseDown:) Set value after cell tracking.
|
||||||
|
|
|
@ -85,6 +85,9 @@ static NSImage *unexpandable = nil;
|
||||||
- (BOOL) _shouldSelectionChange;
|
- (BOOL) _shouldSelectionChange;
|
||||||
- (BOOL) _shouldEditTableColumn: (NSTableColumn *)tableColumn
|
- (BOOL) _shouldEditTableColumn: (NSTableColumn *)tableColumn
|
||||||
row: (int) rowIndex;
|
row: (int) rowIndex;
|
||||||
|
- (void) _willDisplayCell: (NSCell*)cell
|
||||||
|
forTableColumn: (NSTableColumn *)tb
|
||||||
|
row: (int)index;
|
||||||
- (id)_objectValueForTableColumn: (NSTableColumn *)tb
|
- (id)_objectValueForTableColumn: (NSTableColumn *)tb
|
||||||
row: (int)index;
|
row: (int)index;
|
||||||
- (void) _setObjectValue: (id)value
|
- (void) _setObjectValue: (id)value
|
||||||
|
@ -1010,15 +1013,9 @@ static NSImage *unexpandable = nil;
|
||||||
|
|
||||||
tb = [_tableColumns objectAtIndex: i];
|
tb = [_tableColumns objectAtIndex: i];
|
||||||
cell = [tb dataCellForRow: rowIndex];
|
cell = [tb dataCellForRow: rowIndex];
|
||||||
|
[self _willDisplayCell: cell
|
||||||
if ([_delegate respondsToSelector: @selector(outlineView:willDisplayCell:forTableColumn:item:)])
|
|
||||||
{
|
|
||||||
[_delegate outlineView: self
|
|
||||||
willDisplayCell: cell
|
|
||||||
forTableColumn: tb
|
forTableColumn: tb
|
||||||
item: item];
|
row: rowIndex];
|
||||||
}
|
|
||||||
|
|
||||||
[cell setObjectValue: [_dataSource outlineView: self
|
[cell setObjectValue: [_dataSource outlineView: self
|
||||||
objectValueForTableColumn: tb
|
objectValueForTableColumn: tb
|
||||||
byItem: item]];
|
byItem: item]];
|
||||||
|
@ -1205,10 +1202,11 @@ static NSImage *unexpandable = nil;
|
||||||
- (BOOL) _shouldEditTableColumn: (NSTableColumn *)tableColumn
|
- (BOOL) _shouldEditTableColumn: (NSTableColumn *)tableColumn
|
||||||
row: (int) rowIndex
|
row: (int) rowIndex
|
||||||
{
|
{
|
||||||
id item = [self itemAtRow: rowIndex];
|
|
||||||
if ([_delegate respondsToSelector:
|
if ([_delegate respondsToSelector:
|
||||||
@selector(outlineView:shouldEditTableColumn:item:)])
|
@selector(outlineView:shouldEditTableColumn:item:)])
|
||||||
{
|
{
|
||||||
|
id item = [self itemAtRow: rowIndex];
|
||||||
|
|
||||||
if ([_delegate outlineView: self shouldEditTableColumn: tableColumn
|
if ([_delegate outlineView: self shouldEditTableColumn: tableColumn
|
||||||
item: item] == NO)
|
item: item] == NO)
|
||||||
{
|
{
|
||||||
|
@ -1219,15 +1217,31 @@ static NSImage *unexpandable = nil;
|
||||||
return YES;
|
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
|
- (id) _objectValueForTableColumn: (NSTableColumn *)tb
|
||||||
row: (int) index
|
row: (int) index
|
||||||
{
|
{
|
||||||
id result = nil;
|
id result = nil;
|
||||||
id item = [self itemAtRow: index];
|
|
||||||
|
|
||||||
if([_dataSource respondsToSelector:
|
if([_dataSource respondsToSelector:
|
||||||
@selector(outlineView:objectValueForTableColumn:byItem:)])
|
@selector(outlineView:objectValueForTableColumn:byItem:)])
|
||||||
{
|
{
|
||||||
|
id item = [self itemAtRow: index];
|
||||||
|
|
||||||
result = [_dataSource outlineView: self
|
result = [_dataSource outlineView: self
|
||||||
objectValueForTableColumn: tb
|
objectValueForTableColumn: tb
|
||||||
byItem: item];
|
byItem: item];
|
||||||
|
@ -1240,10 +1254,11 @@ static NSImage *unexpandable = nil;
|
||||||
forTableColumn: (NSTableColumn *)tb
|
forTableColumn: (NSTableColumn *)tb
|
||||||
row: (int) index
|
row: (int) index
|
||||||
{
|
{
|
||||||
id item = [self itemAtRow: index];
|
|
||||||
if([_dataSource respondsToSelector:
|
if([_dataSource respondsToSelector:
|
||||||
@selector(outlineView:objectValueForTableColumn:byItem:)])
|
@selector(outlineView:setObjectValue:forTableColumn:byItem:)])
|
||||||
{
|
{
|
||||||
|
id item = [self itemAtRow: index];
|
||||||
|
|
||||||
[_dataSource outlineView: self
|
[_dataSource outlineView: self
|
||||||
setObjectValue: value
|
setObjectValue: value
|
||||||
forTableColumn: tb
|
forTableColumn: tb
|
||||||
|
@ -1713,13 +1728,9 @@ static NSImage *unexpandable = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
// But of course the delegate can mess it up if it wants
|
// But of course the delegate can mess it up if it wants
|
||||||
if (_del_responds)
|
[self _willDisplayCell: _editedCell
|
||||||
{
|
|
||||||
[_delegate outlineView: self
|
|
||||||
willDisplayCell: _editedCell
|
|
||||||
forTableColumn: tb
|
forTableColumn: tb
|
||||||
item: [self itemAtRow: rowIndex]];
|
row: rowIndex];
|
||||||
}
|
|
||||||
|
|
||||||
/* Please note the important point - calling stringValue normally
|
/* Please note the important point - calling stringValue normally
|
||||||
causes the _editedCell to call the validateEditing method of its
|
causes the _editedCell to call the validateEditing method of its
|
||||||
|
|
|
@ -92,6 +92,9 @@ static unsigned currentDragOperation;
|
||||||
- (BOOL) _shouldSelectionChange;
|
- (BOOL) _shouldSelectionChange;
|
||||||
- (BOOL) _shouldEditTableColumn: (NSTableColumn *)tableColumn
|
- (BOOL) _shouldEditTableColumn: (NSTableColumn *)tableColumn
|
||||||
row: (int) rowIndex;
|
row: (int) rowIndex;
|
||||||
|
- (void) _willDisplayCell: (NSCell*)cell
|
||||||
|
forTableColumn: (NSTableColumn *)tb
|
||||||
|
row: (int)index;
|
||||||
|
|
||||||
- (BOOL) _writeRows: (NSArray *) rows
|
- (BOOL) _writeRows: (NSArray *) rows
|
||||||
toPasteboard: (NSPasteboard *)pboard;
|
toPasteboard: (NSPasteboard *)pboard;
|
||||||
|
@ -3246,11 +3249,9 @@ byExtendingSelection: (BOOL)flag
|
||||||
}
|
}
|
||||||
|
|
||||||
// But of course the delegate can mess it up if it wants
|
// But of course the delegate can mess it up if it wants
|
||||||
if (_del_responds)
|
[self _willDisplayCell: _editedCell
|
||||||
{
|
forTableColumn: tb
|
||||||
[_delegate tableView: self willDisplayCell: _editedCell
|
row: rowIndex];
|
||||||
forTableColumn: tb row: rowIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Please note the important point - calling stringValue normally
|
/* Please note the important point - calling stringValue normally
|
||||||
causes the _editedCell to call the validateEditing method of its
|
causes the _editedCell to call the validateEditing method of its
|
||||||
|
@ -3469,13 +3470,9 @@ inline float computePeriod(NSPoint mouseLocationWin,
|
||||||
[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 */
|
||||||
if (_del_responds)
|
[self _willDisplayCell: cell
|
||||||
{
|
|
||||||
[_delegate tableView: self
|
|
||||||
willDisplayCell: cell
|
|
||||||
forTableColumn: tb
|
forTableColumn: tb
|
||||||
row: _clickedRow];
|
row: _clickedRow];
|
||||||
}
|
|
||||||
if ([cell trackMouse: lastEvent
|
if ([cell trackMouse: lastEvent
|
||||||
inRect: cellFrame
|
inRect: cellFrame
|
||||||
ofView: self
|
ofView: self
|
||||||
|
@ -4215,11 +4212,9 @@ inline float computePeriod(NSPoint mouseLocationWin,
|
||||||
[cell setObjectValue: [_dataSource tableView: self
|
[cell setObjectValue: [_dataSource tableView: self
|
||||||
objectValueForTableColumn: tb
|
objectValueForTableColumn: tb
|
||||||
row: row]];
|
row: row]];
|
||||||
if (_del_responds)
|
[self _willDisplayCell: cell
|
||||||
{
|
forTableColumn: tb
|
||||||
[_delegate tableView: self willDisplayCell: cell
|
row: row];
|
||||||
forTableColumn: tb row: row];
|
|
||||||
}
|
|
||||||
candidate_width = [cell cellSize].width;
|
candidate_width = [cell cellSize].width;
|
||||||
|
|
||||||
if (_drawsGrid)
|
if (_drawsGrid)
|
||||||
|
@ -4435,11 +4430,9 @@ inline float computePeriod(NSPoint mouseLocationWin,
|
||||||
{
|
{
|
||||||
tb = [_tableColumns objectAtIndex: i];
|
tb = [_tableColumns objectAtIndex: i];
|
||||||
cell = [tb dataCellForRow: rowIndex];
|
cell = [tb dataCellForRow: rowIndex];
|
||||||
if (_del_responds)
|
[self _willDisplayCell: cell
|
||||||
{
|
forTableColumn: tb
|
||||||
[_delegate tableView: self willDisplayCell: cell
|
row: rowIndex];
|
||||||
forTableColumn: tb row: rowIndex];
|
|
||||||
}
|
|
||||||
[cell setObjectValue: [_dataSource tableView: self
|
[cell setObjectValue: [_dataSource tableView: self
|
||||||
objectValueForTableColumn: tb
|
objectValueForTableColumn: tb
|
||||||
row: rowIndex]];
|
row: rowIndex]];
|
||||||
|
@ -5866,6 +5859,19 @@ inline float computePeriod(NSPoint mouseLocationWin,
|
||||||
return YES;
|
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
|
- (id) _objectValueForTableColumn: (NSTableColumn *)tb
|
||||||
row: (int) index
|
row: (int) index
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue