mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
* Source/NSTableColumn.m (-initWithCoder:): Make columns
non-editable by default. * Source/NSTableView.m (-editColumn:...select:): Make editing here independ of the datasource. * Source/NSTableView.m: Split -_isCellEditableColumn:row: in two methods and ignore the cell isEditable state in -mouseDown:. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36307 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c2d01aeca2
commit
14584bb4e2
3 changed files with 37 additions and 21 deletions
|
@ -1,3 +1,12 @@
|
|||
2013-03-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSTableColumn.m (-initWithCoder:): Make columns
|
||||
non-editable by default.
|
||||
* Source/NSTableView.m (-editColumn:...select:): Make editing here
|
||||
independ of the datasource.
|
||||
* Source/NSTableView.m: Split -_isCellEditableColumn:row: in two
|
||||
methods and ignore the cell isEditable state in -mouseDown:.
|
||||
|
||||
2013-03-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSTextView.h: Make NSTextViewDelegate a formal protocol.
|
||||
|
|
|
@ -535,6 +535,10 @@ to YES. */
|
|||
{
|
||||
[self setEditable: [aDecoder decodeBoolForKey: @"NSIsEditable"]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setEditable: NO];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSWidth"])
|
||||
{
|
||||
[self setWidth: [aDecoder decodeFloatForKey: @"NSWidth"]];
|
||||
|
|
|
@ -141,8 +141,10 @@ typedef struct _tableViewFlags
|
|||
forTableColumn: (NSTableColumn *)tb
|
||||
row: (int)index;
|
||||
|
||||
- (BOOL) _isCellEditableColumn: (int) columnIndex
|
||||
row: (int) rowIndex;
|
||||
- (BOOL) _isEditableColumn: (int)columnIndex
|
||||
row: (int)rowIndex;
|
||||
- (BOOL) _isCellEditableColumn: (int)columnIndex
|
||||
row: (int)rowIndex;
|
||||
- (int) _numRows;
|
||||
@end
|
||||
|
||||
|
@ -3312,13 +3314,6 @@ byExtendingSelection: (BOOL)flag
|
|||
NSRect drawingRect;
|
||||
unsigned length = 0;
|
||||
|
||||
// We refuse to edit cells if the delegate can not accept results
|
||||
// of editing.
|
||||
if (_dataSource_editable == NO)
|
||||
{
|
||||
flag = YES;
|
||||
}
|
||||
|
||||
if (rowIndex != _selectedRow)
|
||||
{
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
|
@ -3360,7 +3355,6 @@ byExtendingSelection: (BOOL)flag
|
|||
// NB: need to be released when no longer used
|
||||
_editedCell = [[self preparedCellAtColumn: columnIndex row: rowIndex] copy];
|
||||
|
||||
[_editedCell setEditable: _dataSource_editable];
|
||||
tb = [_tableColumns objectAtIndex: columnIndex];
|
||||
[_editedCell setObjectValue: [self _objectValueForTableColumn: tb
|
||||
row: rowIndex]];
|
||||
|
@ -3591,7 +3585,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
|||
return;
|
||||
}
|
||||
|
||||
if (![self _isCellEditableColumn: _clickedColumn row: _clickedRow ])
|
||||
if (![self _isEditableColumn: _clickedColumn row: _clickedRow])
|
||||
{
|
||||
// Send double-action but don't edit
|
||||
[self _trackCellAtColumn: _clickedColumn
|
||||
|
@ -6576,19 +6570,28 @@ For a more detailed explanation, -setSortDescriptors:. */
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) _isCellEditableColumn: (int) columnIndex
|
||||
row: (int) rowIndex
|
||||
|
||||
- (BOOL) _isEditableColumn: (int) columnIndex
|
||||
row: (int) rowIndex
|
||||
{
|
||||
NSTableColumn *tableColumn = [_tableColumns objectAtIndex: columnIndex];
|
||||
NSCell *cell = [self preparedCellAtColumn: columnIndex row: rowIndex];
|
||||
|
||||
BOOL cellIsEditable = [cell isEditable];
|
||||
BOOL columnIsEditable = [tableColumn isEditable];
|
||||
BOOL delegateAllowsEditing = [self _shouldEditTableColumn: tableColumn
|
||||
row: rowIndex];
|
||||
|
||||
return cellIsEditable && columnIsEditable && delegateAllowsEditing;
|
||||
return [tableColumn isEditable] && [self _shouldEditTableColumn: tableColumn
|
||||
row: rowIndex];
|
||||
}
|
||||
|
||||
- (BOOL) _isCellEditableColumn: (int) columnIndex
|
||||
row: (int) rowIndex
|
||||
{
|
||||
if (![self _isEditableColumn: columnIndex row: rowIndex])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSCell *cell = [self preparedCellAtColumn: columnIndex row: rowIndex];
|
||||
|
||||
return [cell isEditable];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) _willDisplayCell: (NSCell*)cell
|
||||
|
|
Loading…
Reference in a new issue