From b1ffd8d556e13e95b000276dd007197ef1c29ecf Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Wed, 9 Jan 2013 20:24:27 -0800 Subject: [PATCH] Make default row height a theme attribute --- AppKit/CPTableView.j | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 49a08a7d3..e4a605ef3 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -260,8 +260,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; */ + (id)themeAttributes { - return [CPDictionary dictionaryWithObjects:[[CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null]] - forKeys:["alternating-row-colors", "grid-color", "highlighted-grid-color", "selection-color", "sourcelist-selection-color", "sort-image", "sort-image-reversed", "selection-radius"]]; + return [CPDictionary dictionaryWithObjects:[[CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], 25.0] + forKeys:["alternating-row-colors", "grid-color", "highlighted-grid-color", "selection-color", "sourcelist-selection-color", "sort-image", "sort-image-reversed", "selection-radius", "default-row-height"]]; } - (id)initWithFrame:(CGRect)aFrame @@ -291,7 +291,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; _numberOfHiddenColumns = 0; _intercellSpacing = _CGSizeMake(3.0, 2.0); - _rowHeight = 23.0; + _rowHeight = [self valueForThemeAttribute:@"default-row-height"]; [self setGridColor:[CPColor colorWithHexString:@"dce0e2"]]; [self setGridStyleMask:CPTableViewGridNone]; @@ -2864,7 +2864,8 @@ Your delegate can implement this method to avoid subclassing the tableview to ad { var dragView = [[_CPColumnDragView alloc] initWithLineColor:[self gridColor]], tableColumn = [[self tableColumns] objectAtIndex:theColumnIndex], - bounds = _CGRectMake(0.0, 0.0, [tableColumn width], _CGRectGetHeight([self exposedRect]) + 23.0), + defaultRowHeight = [self valueForThemeAttribute:@"default-row-height"], + bounds = _CGRectMake(0.0, 0.0, [tableColumn width], _CGRectGetHeight([self exposedRect]) + defaultRowHeight), columnRect = [self rectOfColumn:theColumnIndex], headerView = [tableColumn headerView], row = [_exposedRows firstIndex]; @@ -2878,7 +2879,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad dataViewFrame.origin.x = 0.0; // Offset by table header height - scroll position - dataViewFrame.origin.y = ( _CGRectGetMinY(dataViewFrame) - _CGRectGetMinY([self exposedRect]) ) + 23.0; + dataViewFrame.origin.y = ( _CGRectGetMinY(dataViewFrame) - _CGRectGetMinY([self exposedRect]) ) + defaultRowHeight; [dataView setFrame:dataViewFrame]; [self _setObjectValueForTableColumn:tableColumn row:row forView:dataView]; @@ -4875,7 +4876,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey", _tableColumns = [aCoder decodeObjectForKey:CPTableViewTableColumnsKey] || []; [_tableColumns makeObjectsPerformSelector:@selector(setTableView:) withObject:self]; - _rowHeight = [aCoder decodeFloatForKey:CPTableViewRowHeightKey] || 23.0; + _rowHeight = [aCoder decodeFloatForKey:CPTableViewRowHeightKey] || [self valueForThemeAttribute:@"default-row-height"]; _intercellSpacing = [aCoder decodeSizeForKey:CPTableViewIntercellSpacingKey]; if (_CGSizeEqualToSize(_intercellSpacing, _CGSizeMakeZero()))