Don't edit columns which are not editable

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@7459 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2000-09-10 15:01:15 +00:00
parent 16fd608dd2
commit 10ad22071d

View file

@ -1426,6 +1426,7 @@ byExtendingSelection: (BOOL)flag
NSPoint location = [theEvent locationInWindow]; NSPoint location = [theEvent locationInWindow];
NSTableColumn *tb; NSTableColumn *tb;
int clickCount; int clickCount;
BOOL shouldEdit;
// //
// Pathological case -- ignore mouse down // Pathological case -- ignore mouse down
@ -1765,20 +1766,32 @@ byExtendingSelection: (BOOL)flag
if ([self isRowSelected: _clickedRow] == NO) if ([self isRowSelected: _clickedRow] == NO)
return; return;
if ([_delegate respondsToSelector: tb = [_tableColumns objectAtIndex: _clickedColumn];
@selector(tableView:shouldEditTableColumn:row:)])
shouldEdit = YES;
if ([tb isEditable] == NO)
{
shouldEdit = NO;
}
else if ([_delegate respondsToSelector:
@selector(tableView:shouldEditTableColumn:row:)])
{ {
tb = [_tableColumns objectAtIndex: _clickedColumn];
if ([_delegate tableView: self shouldEditTableColumn: tb if ([_delegate tableView: self shouldEditTableColumn: tb
row: _clickedRow] == NO) row: _clickedRow] == NO)
{ {
// Send double-action but don't edit shouldEdit = NO;
[self sendAction: _doubleAction to: _target];
return;
} }
} }
if (shouldEdit == NO)
{
// Send double-action but don't edit
[self sendAction: _doubleAction to: _target];
return;
}
// Delegate said its OK to edit column. Go on, do it. // It is OK to edit column. Go on, do it.
[self editColumn: _clickedColumn row: _clickedRow [self editColumn: _clickedColumn row: _clickedRow
withEvent: theEvent select: NO]; withEvent: theEvent select: NO];
} }