Move code to handle enabled/editable bindings to a common method in the parent class

This commit is contained in:
Gregory John Casamento 2024-07-14 16:00:18 -04:00
parent ca4fe0e078
commit 766a358fb7
2 changed files with 20 additions and 32 deletions

View file

@ -145,6 +145,9 @@ static NSImage *unexpandable = nil;
- (id) _prototypeCellViewFromTableColumn: (NSTableColumn *)tb;
- (void) _drawCellViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect;
- (void) _applyBindingsToCell: (NSCell *)cell
forTableColumn: (NSTableColumn *)tb
row: (NSInteger)index;
@end
@implementation NSOutlineView
@ -1837,37 +1840,13 @@ Also returns the child index relative to this parent. */
return YES;
}
- (void) _willDisplayCell: (NSCell*)cell
- (void) _willDisplayCell: (NSCell *)cell
forTableColumn: (NSTableColumn *)tb
row: (NSInteger)index
{
GSKeyValueBinding *theBinding;
theBinding = [GSKeyValueBinding getBinding: NSEditableBinding
forObject: tb];
if (theBinding != nil)
{
id result = nil;
BOOL flag = NO;
result = [(NSArray *)[theBinding destinationValue]
objectAtIndex: index];
flag = [result boolValue];
[cell setEditable: flag];
}
theBinding = [GSKeyValueBinding getBinding: NSEnabledBinding
forObject: tb];
if (theBinding != nil)
{
id result = nil;
BOOL flag = NO;
result = [(NSArray *)[theBinding destinationValue]
objectAtIndex: index];
flag = [result boolValue];
[cell setEnabled: flag];
}
[self _applyBindingsToCell: cell
forTableColumn: tb
row: index];
if (_del_responds)
{

View file

@ -6857,9 +6857,9 @@ For a more detailed explanation, -setSortDescriptors:. */
}
}
- (void) _willDisplayCell: (NSCell*)cell
forTableColumn: (NSTableColumn *)tb
row: (NSInteger)index
- (void) _applyBindingsToCell: (NSCell *)cell
forTableColumn: (NSTableColumn *)tb
row: (NSInteger)index
{
GSKeyValueBinding *theBinding;
@ -6887,7 +6887,16 @@ For a more detailed explanation, -setSortDescriptors:. */
objectAtIndex: index];
flag = [result boolValue];
[cell setEnabled: flag];
}
}
}
- (void) _willDisplayCell: (NSCell*)cell
forTableColumn: (NSTableColumn *)tb
row: (NSInteger)index
{
[self _applyBindingsToCell: cell
forTableColumn: tb
row: index];
if (_del_responds)
{