From 4b8cc3e6d110a0e370805d32bf7d6e2800940f49 Mon Sep 17 00:00:00 2001 From: Randall Luecke Date: Wed, 11 Aug 2010 18:39:16 -0500 Subject: [PATCH] Table column drag view should draw lines the same color as the parent tableview. --- AppKit/CPTableView.j | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 779ceedf0..66f5bf125 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -2019,9 +2019,9 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; */ - (CPView)_dragViewForColumn:(int)theColumnIndex event:(CPEvent)theDragEvent offset:(CPPointPointer)theDragViewOffset { - var dragView = [[_CPColumnDragView alloc] initWithFrame:CPRectMakeZero()]; + var dragView = [[_CPColumnDragView alloc] initWithLineColor:[self gridColor]]; tableColumn = [[self tableColumns] objectAtIndex:theColumnIndex], - bounds = CPRectMake(0.0, 0.0, [tableColumn width], CPRectGetHeight([self _exposedRect]) + 23.0), + bounds = CPRectMake(0.0, 0.0, [tableColumn width], _CGRectGetHeight([self _exposedRect]) + 23.0), columnRect = [self rectOfColumn:theColumnIndex], headerView = [tableColumn headerView], row = [_exposedRows firstIndex]; @@ -2035,7 +2035,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; dataViewFrame.origin.x = 0.0; // Offset by table header height - scroll position - dataViewFrame.origin.y = ( CPRectGetMinY(dataViewFrame) - CPRectGetMinY([self _exposedRect]) ) + 23.0; + dataViewFrame.origin.y = ( _CGRectGetMinY(dataViewFrame) - _CGRectGetMinY([self _exposedRect]) ) + 23.0; [dataView setFrame:dataViewFrame]; [dataView setObjectValue:[self _objectValueForTableColumn:tableColumn row:row]]; @@ -2046,7 +2046,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; // Add the column header view var headerFrame = [headerView frame]; - headerFrame.origin = CPPointMakeZero(); + headerFrame.origin = _CGPointMakeZero(); var columnHeaderView = [[_CPTableColumnHeaderView alloc] initWithFrame:headerFrame]; [columnHeaderView setStringValue:[headerView stringValue]]; @@ -3721,11 +3721,25 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey", @end @implementation _CPColumnDragView : CPView +{ + CPColor _lineColor; +} + +- (id)initWithLineColor:(CPColor)aColor +{ + self = [super initWithFrame:_CGRectMakeZero()]; + + if (self) + _lineColor = aColor; + + return self; +} + - (void)drawRect:(CGRect)aRect { var context = [[CPGraphicsContext currentContext] graphicsPort]; - CGContextSetStrokeColor(context, [CPColor grayColor]); + CGContextSetStrokeColor(context, _lineColor); var points = [ _CGPointMake(0.5, 0),