diff --git a/AppKit/CPButtonBar.j b/AppKit/CPButtonBar.j index e0d66f78f..a66fb7b86 100644 --- a/AppKit/CPButtonBar.j +++ b/AppKit/CPButtonBar.j @@ -8,6 +8,16 @@ { } +- (id)initWithFrame:(CGRect)aFrame +{ + self = [super initWithFrame:aFrame]; + + if (self) + [self setNeedsLayout]; + + return self; +} + + (CPString)themeClass { return @"button-bar"; diff --git a/AppKit/CPCollectionView.j b/AppKit/CPCollectionView.j index 4a9ddecba..7558eb64f 100644 --- a/AppKit/CPCollectionView.j +++ b/AppKit/CPCollectionView.j @@ -333,6 +333,8 @@ while (count--) { [[_items[count] view] removeFromSuperview]; + [_items[count] setSelected:NO]; + _cachedItems.push(_items[count]); } @@ -351,7 +353,11 @@ [self addSubview:[_items[index] view]]; } - + + index = CPNotFound; + while ((index = [_selectionIndexes indexGreaterThanIndex:index]) != CPNotFound) + [_items[index] setSelected:YES]; + [self tile]; } diff --git a/AppKit/CPProgressIndicator.j b/AppKit/CPProgressIndicator.j index 663da8450..a9502c418 100644 --- a/AppKit/CPProgressIndicator.j +++ b/AppKit/CPProgressIndicator.j @@ -104,17 +104,14 @@ var CPProgressIndicatorSpinningStyleColors = nil, for (; start <= end; ++start) { CPProgressIndicatorBezelBorderViewPool[start] = []; - CPProgressIndicatorBezelBorderViewPool[start][CPMiniControlSize] = []; CPProgressIndicatorBezelBorderViewPool[start][CPSmallControlSize] = []; CPProgressIndicatorBezelBorderViewPool[start][CPRegularControlSize] = []; } CPProgressIndicatorClassName = [self className]; - - CPProgressIndicatorStyleIdentifiers = []; - + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle] = @"Bar"; CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorSpinningStyle] = @"Spinny"; CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle] = @"HUDBar"; @@ -126,30 +123,20 @@ var CPProgressIndicatorSpinningStyleColors = nil, CPProgressIndicatorStyleSizes = []; // Bar Sttyle - var prefix = CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle]; + var prefixes = [ + CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle], + CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle], + CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle], + CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle] + ]; - CPProgressIndicatorStyleSizes[prefix + regularIdentifier] = [_CGSizeMake(3.0, 15.0), _CGSizeMake(1.0, 15.0), _CGSizeMake(3.0, 15.0)]; - CPProgressIndicatorStyleSizes[prefix + smallIdentifier] = [_CGSizeMake(3.0, 15.0), _CGSizeMake(1.0, 15.0), _CGSizeMake(3.0, 15.0)]; - CPProgressIndicatorStyleSizes[prefix + miniIdentifier] = [_CGSizeMake(3.0, 15.0), _CGSizeMake(1.0, 15.0), _CGSizeMake(3.0, 15.0)]; - - prefix = CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle]; - - CPProgressIndicatorStyleSizes[prefix + regularIdentifier] = _CGSizeMake(1.0, 9.0); - CPProgressIndicatorStyleSizes[prefix + smallIdentifier] = _CGSizeMake(1.0, 9.0); - CPProgressIndicatorStyleSizes[prefix + miniIdentifier] = _CGSizeMake(1.0, 9.0); - - // HUD Bar Style - prefix = CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle]; - - CPProgressIndicatorStyleSizes[prefix + regularIdentifier] = [_CGSizeMake(3.0, 15.0), _CGSizeMake(1.0, 15.0), _CGSizeMake(3.0, 15.0)]; - CPProgressIndicatorStyleSizes[prefix + smallIdentifier] = [_CGSizeMake(3.0, 15.0), _CGSizeMake(1.0, 15.0), _CGSizeMake(3.0, 15.0)]; - CPProgressIndicatorStyleSizes[prefix + miniIdentifier] = [_CGSizeMake(3.0, 15.0), _CGSizeMake(1.0, 15.0), _CGSizeMake(3.0, 15.0)]; - - prefix = CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle]; - - CPProgressIndicatorStyleSizes[prefix + regularIdentifier] = _CGSizeMake(1.0, 9.0); - CPProgressIndicatorStyleSizes[prefix + smallIdentifier] = _CGSizeMake(1.0, 9.0); - CPProgressIndicatorStyleSizes[prefix + miniIdentifier] = _CGSizeMake(1.0, 9.0); + for (var i = 0, count = prefixes.length; i 0.0 && barWidth < 4.0) + barWidth = 4.0; + + [_barView setFrameSize:CGSizeMake(barWidth, 16.0)]; } /* @ignore */ diff --git a/AppKit/CPTableColumn.j b/AppKit/CPTableColumn.j index 29c69b3dd..f0172ad15 100644 --- a/AppKit/CPTableColumn.j +++ b/AppKit/CPTableColumn.j @@ -71,8 +71,7 @@ CPTableColumnUserResizingMask = 2; [self setIdentifier:anIdentifier]; - var header = [CPTextField new]; - [header setBackgroundColor:[CPColor colorWithPatternImage:CPAppKitImage("tableview-headerview.png", CGSizeMake(1.0, 23.0))]]; + var header = [[_CPTableColumnHeaderView alloc] initWithFrame:CGRectMakeZero()]; [self setHeaderView:header]; var textDataView = [[CPTextField alloc] init]; diff --git a/AppKit/CPTableHeaderView.j b/AppKit/CPTableHeaderView.j index 061a3b2eb..30edea8a0 100644 --- a/AppKit/CPTableHeaderView.j +++ b/AppKit/CPTableHeaderView.j @@ -23,12 +23,67 @@ @import "CPTableColumn.j" @import "CPTableView.j" @import "CPView.j" + +var CPThemeStatePressed = CPThemeState("pressed"); +@implementation _CPTableColumnHeaderView : CPView +{ + CPTextField _textField; +} + +- (void)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) + { + _textField = [[CPTextField alloc] initWithFrame:[self bounds]]; + [_textField setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable]; + [self addSubview:_textField]; + } + + return self; +} + +- (void)layoutSubviews +{ + var themeState = [self themeState]; + + if((themeState & CPThemeStateSelected) && (themeState & CPThemeStatePressed)) + [self setBackgroundColor:[CPColor colorWithPatternImage:CPAppKitImage("tableview-headerview-highlighted-pressed.png", CGSizeMake(1.0, 22.0))]]; + else if (themeState == CPThemeStateSelected) + [self setBackgroundColor:[CPColor colorWithPatternImage:CPAppKitImage("tableview-headerview-highlighted.png", CGSizeMake(1.0, 22.0))]]; + else if (themeState == CPThemeStatePressed) + [self setBackgroundColor:[CPColor colorWithPatternImage:CPAppKitImage("tableview-headerview-pressed.png", CGSizeMake(1.0, 22.0))]]; + else + [self setBackgroundColor:[CPColor colorWithPatternImage:CPAppKitImage("tableview-headerview.png", CGSizeMake(1.0, 22.0))]]; +} + +- (void)setStringValue:(CPString)string +{ + [_textField setStringValue:string]; +} + +- (CPString)stringValue +{ + return [_textField stringValue]; +} + +- (void)textField +{ + return _textField; +} + +- (void)sizeToFit +{ + [_textField sizeToFit]; +} +@end @implementation CPTableHeaderView : CPView { int _resizedColumn @accessors(readonly, property=resizedColumn); int _draggedColumn @accessors(readonly, property=draggedColumn); + int _pressedColumn @accessors(readonly, property=pressedColumn); float _draggedDistance @accessors(readonly, property=draggedDistance); @@ -43,7 +98,9 @@ { _resizedColumn = CPNotFound; _draggedColumn = CPNotFound; + _pressedColumn = CPNotFound; _draggedDistance = 0.0; + [self setBackgroundColor:[CPColor colorWithPatternImage:CPAppKitImage("tableview-headerview.png", CGSizeMake(1.0, 22.0))]]; } return self; @@ -94,52 +151,163 @@ return bounds; } +- (CPRect)_resizeRectBeforeColumn:(CPInteger)column +{ + var rect = [self headerRectOfColumn:column]; + + rect.origin.x -= 10; + rect.size.width = 20; + + return rect; +} + +- (void)_setPressedColumn:(CPInteger)column +{ + if (_pressedColumn != CPNotFound) + { + var headerView = [_tableView._tableColumns[_pressedColumn] headerView]; + [headerView unsetThemeState:CPThemeStatePressed]; + } + + if (column != CPNotFound) + { + var headerView = [_tableView._tableColumns[column] headerView]; + [headerView setThemeState:CPThemeStatePressed]; + } + + _pressedColumn = column; +} + +- (void)mouseDown:(CPEvent)theEvent +{ + var location = [self convertPoint:[theEvent locationInWindow] fromView:nil], + aPoint = CGPointMakeCopy(location), + clickedColumn = [self columnAtPoint:aPoint]; + + if (clickedColumn == -1) + return; + + // Error, can't find var CPTableViewDelegate_tableView_mouseDownInHeaderOfTableColumn_ !? + if (_tableView._implementedDelegateMethods & (1 << 6)) + [[_tableView delegate] tableView:_tableView + mouseDownInHeaderOfTableColumn:[[_tableView tableColumns] objectAtIndex:clickedColumn]]; + + [self _setPressedColumn:clickedColumn]; +} + +- (void)mouseUp:(CPEvent)theEvent +{ + var location = [self convertPoint:[theEvent locationInWindow] fromView:nil], + clickedColumn = [self columnAtPoint:location]; + + [self _setPressedColumn:CPNotFound]; + + if (clickedColumn == -1) + return; + + if ([_tableView allowsColumnSelection]) + { + if ([theEvent modifierFlags] & CPCommandKeyMask) + { + if ([_tableView isColumnSelected:clickedColumn]) + [_tableView deselectColumn:clickedColumn]; + else if ([_tableView allowsMultipleSelection] == YES) + [_tableView selectColumnIndexes:[CPIndexSet indexSetWithIndex:clickedColumn] byExtendingSelection:YES]; + } + else if ([theEvent modifierFlags] & CPShiftKeyMask) + { + // should be from clickedColumn to lastClickedColum with extending:(direction == previous selection) + var selectedIndexes = [_tableView selectedColumnIndexes], + startColumn = MIN(clickedColumn, [selectedIndexes lastIndex]), + endColumn = MAX(clickedColumn, [selectedIndexes firstIndex]); + + [_tableView selectColumnIndexes:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(startColumn, endColumn - startColumn + 1)] byExtendingSelection:YES]; + } + else + [_tableView selectColumnIndexes:[CPIndexSet indexSetWithIndex:clickedColumn] byExtendingSelection:NO]; + } +} + - (void)layoutSubviews { - var tableColumns = [_tableView tableColumns], - count = [tableColumns count], - columnRect = [self bounds], - spacing = [_tableView intercellSpacing]; - - for (i = 0; i < count; ++i) + var tableColumns = [_tableView tableColumns], + count = [tableColumns count]; + + for (var i = 0; i < count; i++) { var column = [tableColumns objectAtIndex:i], headerView = [column headerView]; - - columnRect.size.width = [column width] + spacing.width; - - [headerView setFrame:columnRect]; - - columnRect.origin.x += [column width] + spacing.width; - - [self addSubview:headerView]; + + var frame = [self headerRectOfColumn:i]; + frame.size.height -= 0.5; + if (i > 0) + { + frame.origin.x += 0.5; + frame.size.width -= 1; + } + + [headerView setFrame:frame]; + + if([headerView superview] != self) + [self addSubview:headerView]; } } - (void)drawRect:(CGRect)aRect { - [[_tableView gridColor] setStroke]; - var context = [[CPGraphicsContext currentContext] graphicsPort], - exposedColumnIndexes = exposedColumnIndexes = [_tableView columnIndexesInRect:aRect], - columnsArray = []; + exposedColumnIndexes = [_tableView columnIndexesInRect:aRect], + columnsArray = [], + tableColumns = [_tableView tableColumns], + exposedTableColumns = _tableView._exposedColumns, + firstIndex = [exposedTableColumns firstIndex], + exposedRange = CPMakeRange(firstIndex, [exposedTableColumns lastIndex] - firstIndex + 1); - [exposedColumnIndexes getIndexes:columnsArray maxCount:-1 inIndexRange:nil]; + CGContextSetLineWidth(context, 1); + CGContextSetStrokeColor(context, [_tableView gridColor]); + + [exposedColumnIndexes getIndexes:columnsArray maxCount:-1 inIndexRange:exposedRange]; var columnArrayIndex = 0, - columnArrayCount = columnsArray.length; - - for(; columnArrayIndex < columnArrayCount; ++columnArrayIndex) + columnArrayCount = columnsArray.length, + columnMaxX; + + CGContextBeginPath(context); + for(; columnArrayIndex < columnArrayCount; columnArrayIndex++) { - // grab each column rect and add horizontal lines - var columnToStroke = [self headerRectOfColumn:columnArrayIndex]; - - CGContextBeginPath(context); - CGContextMoveToPoint(context, ROUND(columnToStroke.origin.x + columnToStroke.size.width) + 0.5, ROUND(columnToStroke.origin.y) + 0.5); - CGContextAddLineToPoint(context, ROUND(columnToStroke.origin.x + columnToStroke.size.width) + 0.5, ROUND(columnToStroke.origin.y + columnToStroke.size.height) + 0.5); - CGContextSetLineWidth(context, 1); - CGContextStrokePath(context); + // grab each column rect and add vertical lines + var columnIndex = columnsArray[columnArrayIndex], + columnToStroke = [self headerRectOfColumn:columnIndex]; + + columnMaxX = CGRectGetMaxX(columnToStroke); + + CGContextMoveToPoint(context, ROUND(columnMaxX) + 0.5, ROUND(CGRectGetMinY(columnToStroke))); + CGContextAddLineToPoint(context, ROUND(columnMaxX) + 0.5, ROUND(CGRectGetMaxY(columnToStroke))); } + + CGContextClosePath(context); + CGContextStrokePath(context); + +/* + var maxY = CGRectGetMaxY([self bounds]); + // draw normal gradient for remaining space + if (supportsCanvasGradient) + { + aRect.origin.x = columnMaxX - 0.5; + aRect.size.width -= columnMaxX; + CGContextBeginPath(context); + CGContextAddRect(context, CGRectMake(columnMaxX + 1, 0, CGRectGetMaxX([self bounds]) - columnMaxX, CGRectGetHeight([self bounds]))); + CGContextClosePath(context); + CGContextDrawLinearGradient(context, [_CPTableColumnHeaderView headerGradient], CGPointMake(0,0), CGPointMake(0, maxY - 1),0); + } + + // Draw bottom line + CGContextBeginPath(context); + CGContextMoveToPoint(context, 0, maxY - 0.5); + CGContextAddLineToPoint(context, CGRectGetMaxX([self bounds]), maxY - 0.5); + CGContextClosePath(context); + CGContextStrokePath(context); +*/ } @end diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 423b820f0..eeaf4fcb9 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -122,6 +122,13 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; @end +/*! + @ingroup appkit + @class CPTableView + + CPTableView object displays record-oriented data in a table and allows the user to edit values and resize and rearrange columns. + A CPTableView requires you to set a dataSource which implements numberOfRowsInTableView: and tableView:objectValueForTableColumn:row: +*/ @implementation CPTableView : CPControl { id _dataSource; @@ -146,6 +153,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; //Configuring Behavior BOOL _allowsColumnReordering; BOOL _allowsColumnResizing; + BOOL _allowsColumnSelection; BOOL _allowsMultipleSelection; BOOL _allowsEmptySelection; @@ -266,6 +274,11 @@ window.setTimeout(function(){ return self; } + +/*! + Sets the receiverŐs data source to a given object. + @param anObject The data source for the receiver. The object must implement the appropriate methods. +*/ - (void)setDataSource:(id)aDataSource { if (_dataSource === aDataSource) @@ -303,6 +316,9 @@ window.setTimeout(function(){ [self reloadData]; } +/*! + Returns the object that provides the data displayed by the receiver. +*/ - (id)dataSource { return _dataSource; @@ -310,6 +326,11 @@ window.setTimeout(function(){ //Loading Data +/*! + Reloads the data for only the specified rows and columns. + @param rowIndexes The indexes of the rows to update. + @param columnIndexes The indexes of the columns to update. +*/ - (void)reloadDataForRowIndexes:(CPIndexSet)rowIndexes columnIndexes:(CPIndexSet)columnIndexes { [self reloadData]; @@ -317,7 +338,10 @@ window.setTimeout(function(){ // [_previouslyExposedColumns removeIndexes:columnIndexes]; } - +/*! + Reloads the data for all rows and columns. + +*/ - (void)reloadData { if (!_dataSource) @@ -334,7 +358,10 @@ window.setTimeout(function(){ } //Target-action Behavior - +/*! + Sets the message sent to the target when the user double-clicks an uneditable cell or a column header to a given selector. + @param aSelector The message the receiver sends to its target when the user double-clicks an uneditable cell or a column header. +*/ - (void)setDoubleAction:(SEL)anAction { _doubleAction = anAction; @@ -371,6 +398,10 @@ window.setTimeout(function(){ return _allowsColumnResizing; } +/*! + Controls whether the user can select more than one row or column at a time. + @param aFlag YES to allow the user to select multiple rows or columns, otherwise NO. +*/ - (void)setAllowsMultipleSelection:(BOOL)shouldAllowMultipleSelection { _allowsMultipleSelection = !!shouldAllowMultipleSelection; @@ -381,6 +412,10 @@ window.setTimeout(function(){ return _allowsMultipleSelection; } +/*! + Controls whether the receiver allows zero rows or columns to be selected. + @param aFlag YES if an empty selection is allowed, otherwise NO. +*/ - (void)setAllowsEmptySelection:(BOOL)shouldAllowEmptySelection { _allowsEmptySelection = !!shouldAllowEmptySelection; @@ -391,6 +426,11 @@ window.setTimeout(function(){ return _allowsEmptySelection; } +/*! + Controls whether the user can select an entire column by clicking its header. + @param aFlag YES to allow the user to select columns, otherwise NO. +*/ + - (void)setAllowsColumnSelection:(BOOL)shouldAllowColumnSelection { _allowsColumnSelection = !!shouldAllowColumnSelection; @@ -439,13 +479,12 @@ window.setTimeout(function(){ return _rowHeight; } +/*! + Sets whether the receiver uses the standard alternating row colors for its background. + @param aFlag YES to specify standard alternating row colors for the background, NO to specify a solid color. +*/ - (void)setUsesAlternatingRowBackgroundColors:(BOOL)shouldUseAlternatingRowBackgroundColors { - // TODO:need to look at how one actually sets the alternating row, a tip at: - // http://forums.macnn.com/79/developer-center/228347/nstableview-alternating-row-colors/ - // otherwise this may not be feasible or may introduce an additional change req'd in CP - // we'd probably need to iterate through rowId % 2 == 0 and setBackgroundColor with - // whatever the alternating row color is. _usesAlternatingRowBackgroundColors = shouldUseAlternatingRowBackgroundColors; } @@ -454,6 +493,11 @@ window.setTimeout(function(){ return _usesAlternatingRowBackgroundColors; } +/*! + Sets the colors for the rows as they alternate. The number of colors can be arbitrary. By deafult these colors are white and light blue. + @param anArray an array of CPColors +*/ + - (void)setAlternatingRowBackgroundColors:(CPArray)alternatingRowBackgroundColors { if ([_alternatingRowBackgroundColors isEqual:alternatingRowBackgroundColors]) @@ -490,6 +534,11 @@ window.setTimeout(function(){ } } +/*! + Sets the highlight color for rows. By default this color is blue. + @param aColor a CPColor +*/ + - (void)setSelectionHightlightColor:(CPColor)aColor { _selectionHightlightColor = aColor; @@ -505,6 +554,10 @@ window.setTimeout(function(){ * - setIndicatorImage:inTableColumn: */ +/*! + Sets the grid color in the non highlighted state. + @param aColor a CPColor +*/ - (void)setGridColor:(CPColor)aColor { if (_gridColor === aColor) @@ -520,6 +573,11 @@ window.setTimeout(function(){ return _gridColor; } +/*! + Sets the grid style mask to specify if no grid lines, vertical grid lines, or horizontal grid lines should be displayed. + @param gridType The grid style mask. CPTableViewGridNone, CPTableViewSolidVerticalGridLineMask, CPTableViewSolidHorizontalGridLineMask +*/ + - (void)setGridStyleMask:(unsigned)aGrideStyleMask { if (_gridStyleMask === aGrideStyleMask) @@ -537,6 +595,10 @@ window.setTimeout(function(){ //Column Management +/*! + Adds a given column as the last column of the receiver. + @param aColumn The column to add to the receiver. +*/ - (void)addTableColumn:(CPTableColumn)aTableColumn { [_tableColumns addObject:aTableColumn]; @@ -550,6 +612,10 @@ window.setTimeout(function(){ [self setNeedsLayout]; } +/*! + Removes a given column from the receiver. + @param aTableColumn The column to remove from the receiver. +*/ - (void)removeTableColumn:(CPTableColumn)aTableColumn { if ([aTableColumn tableView] !== self) @@ -576,6 +642,12 @@ window.setTimeout(function(){ [self setNeedsLayout]; } + +/*! + Moves the column and heading at a given index to a new given index. + @param columnIndex The current index of the column to move. + @param newIndex The new index for the moved column. +*/ - (void)moveColumn:(unsigned)fromIndex toColumn:(unsigned)toIndex { fromIndex = +fromIndex; @@ -628,6 +700,12 @@ window.setTimeout(function(){ } //Selecting Columns and Rows + +/*! + Sets the column selection using indexes. + @param columns a CPIndexSet of columns to select + @param aFlag should extend the selection thereby retaining the previous selection +*/ - (void)selectColumnIndexes:(CPIndexSet)columns byExtendingSelection:(BOOL)shouldExtendSelection { // If we're out of range, just return @@ -656,6 +734,11 @@ window.setTimeout(function(){ [self _noteSelectionDidChange]; } +/*! + Sets the row selection using indexes. + @param rows a CPIndexSet of rows to select + @param aFlag should extend the selection thereby retaining the previous selection +*/ - (void)selectRowIndexes:(CPIndexSet)rows byExtendingSelection:(BOOL)shouldExtendSelection { if ([rows isEqualToIndexSet:_selectedRowIndexes] || (([rows firstIndex] != CPNotFound && [rows firstIndex] < 0) || [rows lastIndex] >= [self numberOfRows])) @@ -768,13 +851,17 @@ window.setTimeout(function(){ - (void)deselectColumn:(CPInteger)aColumn { - [_selectedColumnIndexes removeIndex:aColumn]; + var selectedColumnIndexes = [_selectedColumnIndexes copy]; + [selectedColumnIndexes removeIndex:aColumn]; + [self selectColumnIndexes:selectedColumnIndexes byExtendingSelection:NO]; [self _noteSelectionDidChange]; } - (void)deselectRow:(CPInteger)aRow { - [_selectedRowIndexes removeIndex:aRow]; + var selectedRowIndexes = [_selectedRowIndexes copy]; + [selectedRowIndexes removeIndex:aRow]; + [self selectColumnIndexes:selectedRowIndexes byExtendingSelection:NO]; [self _noteSelectionDidChange]; } @@ -808,6 +895,10 @@ window.setTimeout(function(){ * - allowsTypeSelect * - setAllowsTypeSelect: */ + +/*! + Deselects all rows +*/ - (void)deselectAll { [self selectRowIndexes:[CPIndexSet indexSet] byExtendingSelection:NO]; @@ -955,6 +1046,11 @@ window.setTimeout(function(){ // Complexity: // O(1) +/*! + Returns a range of indices for the rows that lie wholly or partially within the vertical boundaries of a given rectangle. + @param aRect A rectangle in the coordinate system of the receiver. +*/ + - (CPRange)rowsInRect:(CGRect)aRect { // If we have no rows, then we won't intersect anything. @@ -985,6 +1081,11 @@ window.setTimeout(function(){ // Complexity: // O(lg Columns) if table view contains no hidden columns // O(Columns) if table view contains hidden columns + +/*! + Returns the indexes of the receiverŐs columns that intersect the specified rectangle. + @param aRect A rectangle in the coordinate system of the receiver. +*/ - (CPIndexSet)columnIndexesInRect:(CGRect)aRect { var column = MAX(0, [self columnAtPoint:_CGPointMake(aRect.origin.x, 0.0)]), @@ -1180,6 +1281,10 @@ window.setTimeout(function(){ } +/*! + Sets the column autoresizing style of the receiver to a given style. + @param aStyle The column autoresizing style for the receiver. CPTableViewNoColumnAutoresizing, CPTableViewUniformColumnAutoresizingStyle, CPTableViewLastColumnOnlyAutoresizingStyle, CPTableViewFirstColumnOnlyAutoresizingStyle +*/ - (void)setColumnAutoresizingStyle:(unsigned)style { //FIX ME: CPTableViewSequentialColumnAutoresizingStyle and CPTableViewReverseSequentialColumnAutoresizingStyle are not yet implemented @@ -1191,6 +1296,9 @@ window.setTimeout(function(){ return _columnAutoResizingStyle; } +/*! + Resizes the last column if thereŐs room so the receiver fits exactly within its enclosing clip view. +*/ - (void)sizeLastColumnToFit { var superview = [self superview]; @@ -1265,11 +1373,19 @@ window.setTimeout(function(){ * - scrollColumnToVisible: */ +/*! + Scrolls the receiver vertically in an enclosing NSClipView so the row specified by rowIndex is visible. + @param aRowIndex the index of the row to scroll to. +*/ - (void)scrollRowToVisible:(int)rowIndex { [self scrollRectToVisible:[self rectOfRow:rowIndex]]; } +/*! + Scrolls the receiver and header view horizontally in an enclosing NSClipView so the column specified by columnIndex is visible. + @param aColumnIndex the index of the column to scroll to. +*/ - (void)scrollColumnToVisible:(int)columnIndex { [self scrollRectToVisible:[self rectOfColumn:columnIndex]]; @@ -1429,6 +1545,11 @@ window.setTimeout(function(){ * - setVerticalMotionCanBeginDrag: * - verticalMotionCanBeginDrag */ +/*! + Returns whether the receiver allows dragging the rows at rowIndexes with a drag initiated at mousedDownPoint. + @param rowIndexes an index set of rows to be dragged + @param aPoint the point at which the mouse was clicked. +*/ - (BOOL)canDragRowsWithIndexes:(CPIndexSet)rowIndexes atPoint:(CGPoint)mouseDownPoint { return YES; @@ -1500,8 +1621,8 @@ window.setTimeout(function(){ _dragOperationDefaultMask = mask; } -/* - this should be called inside tableView:validateDrop:... method +/*! + This should be called inside tableView:validateDrop:... method either drop on or above, specify the row as -1 to select the whole table for drop on */ @@ -1517,16 +1638,16 @@ window.setTimeout(function(){ _retargetedDropOperation = operation; } -/* - can be: +/*! + sets the feedback style for when the table is the destination of a drag operation + Can be: None Regular Source List - - FIX ME: this should vary up the highlight color, currently nothing is being done with it */ - (void)setDraggingDestinationFeedbackStyle:(CPTableViewDraggingDestinationFeedbackStyle)aStyle { + //FIX ME: this should vary up the highlight color, currently nothing is being done with it _destinationDragStyle = aStyle; } @@ -1535,6 +1656,10 @@ window.setTimeout(function(){ return _destinationDragStyle; } +/*! + Sets whether vertical motion is treated as a drag or selection change to flag. + @param aFlag If flag is NO then vertical motion will not start a drag. The default is YES. +*/ - (void)setVerticalMotionCanBeginDrag:(BOOL)aFlag { _verticalMotionCanDrag = aFlag; @@ -1818,7 +1943,10 @@ window.setTimeout(function(){ } - (void)_drawRect:(CGRect)aRect -{ +{ + // FIX ME: All three of these methods will likely need to be rewritten for 1.0 + // We've got grid drawing in highlightSelection and crap everywhere. + var exposedRect = [self _exposedRect]; [self drawBackgroundInClipRect:exposedRect]; @@ -1854,7 +1982,7 @@ window.setTimeout(function(){ // CGContextFillRect(context, CGRectIntersection(aRect, fillRect)); // console.profile("row-paint"); var exposedRows = [self rowsInRect:aRect], - firstRow = exposedRows.location, + firstRow = exposedRows.location -1, lastRow = CPMaxRange(exposedRows) - 1, colorIndex = MIN(exposedRows.length, colorCount), heightFilled = 0.0; @@ -2022,33 +2150,34 @@ window.setTimeout(function(){ CGContextBeginPath(context); gridStyleMask = [self gridStyleMask]; - for(var i=0; i < count2-1; i++) + for(var i=0; i < count2; i++) { - var rect = [self rectOfRow:indexes[i]], - minX = _CGRectGetMinX(rect) - 0.5, - maxX = _CGRectGetMaxX(rect) - 0.5, - minY = _CGRectGetMinY(rect) - 0.5, - maxY = _CGRectGetMaxY(rect) - 0.5; + var rect = objj_msgSend(self, rectSelector, indexes[i]), + minX = CGRectGetMinX(rect) - 0.5, + maxX = CGRectGetMaxX(rect) - 0.5, + minY = CGRectGetMinY(rect) - 0.5, + maxY = CGRectGetMaxY(rect) - 0.5; - //FIX ME: if there are vertical lines we need to make them white too... - /*if (gridStyleMask & CPTableViewSolidVerticalGridLineMask) + if ([_selectedRowIndexes count] >= 1 && gridStyleMask & CPTableViewSolidVerticalGridLineMask) { var exposedColumns = [self columnIndexesInRect:aRect], - columnIndexes = [], - exposedColumns2 = CPMakeRange([exposedColumns firstIndex], [exposedColumns lastIndex] - firstColumn + 1); - [exposedColumns getIndexes:columnIndexes maxCount:-1 inIndexRange:exposedColumns2], - columnCount = [exposedColumns count]; - - for(var c = 0; c < columnCount - 1; c++) + exposedColumnIndexes = [], + firstExposedColumn = [exposedColumns firstIndex], + exposedRange = CPMakeRange(firstExposedColumn, [exposedColumns lastIndex] - firstExposedColumn + 1); + [exposedColumns getIndexes:exposedColumnIndexes maxCount:-1 inIndexRange:exposedRange]; + var exposedColumnCount = [exposedColumnIndexes count]; + + for(var c = firstExposedColumn; c < exposedColumnCount; c++) { - var colRect = [self rectOfColumn:columnIndexes[c]], - colX = _CGRectGetMaxX(rect) - 0.5; - console.log("colX"); + //console.log(columnIndexes); + var colRect = [self rectOfColumn:exposedColumnIndexes[c]], + colX = CGRectGetMaxX(colRect) + 0.5; + //console.log(colX); CGContextMoveToPoint(context, colX, minY); CGContextAddLineToPoint(context, colX, maxY); } - }*/ + } CGContextMoveToPoint(context, minX, maxY); CGContextAddLineToPoint(context, maxX, maxY); @@ -2121,12 +2250,17 @@ window.setTimeout(function(){ */ +/* + @ignore +*/ - (BOOL)tracksMouseOutsideOfFrame { return YES; } -/* ignore */ +/* + @ignore +*/ - (BOOL)startTrackingAt:(CGPoint)aPoint { var row = [self rowAtPoint:aPoint]; @@ -2160,6 +2294,9 @@ window.setTimeout(function(){ return YES; } +/* + @ignore +*/ - (void)trackMouse:(CPEvent)anEvent { // Prevent CPControl from eating the mouse events when we are in a drag session @@ -2169,7 +2306,9 @@ window.setTimeout(function(){ [CPApp sendEvent:anEvent]; } -/* ignore */ +/* + @ignore +*/ - (BOOL)continueTracking:(CGPoint)lastPoint at:(CGPoint)aPoint { var row = [self rowAtPoint:aPoint]; @@ -2244,6 +2383,9 @@ window.setTimeout(function(){ return YES; } +/*! + @ignore +*/ - (void)stopTracking:(CGPoint)lastPoint at:(CGPoint)aPoint mouseIsUp:(BOOL)mouseIsUp { _isSelectingSession = NO; diff --git a/AppKit/Platform/DOM/CPPlatform.j b/AppKit/Platform/DOM/CPPlatform.j index 47af4b175..e3a621fb8 100644 --- a/AppKit/Platform/DOM/CPPlatform.j +++ b/AppKit/Platform/DOM/CPPlatform.j @@ -21,9 +21,11 @@ */ CPPlatformDidClearBodyElementNotification = @"CPPlatformDidClearBodyElementNotification"; +CPPlatformWillClearBodyElementNotification = @"CPPlatformWillClearBodyElementNotification"; var screenNeedsInitialization = NO, - mainBodyElement = nil; + mainBodyElement = nil, + elementRemovalTest = new RegExp("\\bcpdontremove\\b", "g"); @implementation CPPlatform : CPBasePlatform { @@ -91,10 +93,23 @@ var screenNeedsInitialization = NO, screenNeedsInitialization = NO; + [[CPNotificationCenter defaultCenter] + postNotificationName:CPPlatformWillClearBodyElementNotification + object:self]; + var bodyElement = [self mainBodyElement]; // Get rid of any of the original contents of the page. - bodyElement.innerHTML = ""; + var children = bodyElement.childNodes, + length = children.length; + + while (length--) + { + var element = children[length]; + if (!element.className || element.className.match(elementRemovalTest) === null) + bodyElement.removeChild(element); + } + bodyElement.style.overflow = "hidden"; if (document.documentElement) diff --git a/AppKit/Platform/DOM/CPPlatformString.j b/AppKit/Platform/DOM/CPPlatformString.j index e0431b0d4..1cbe99477 100644 --- a/AppKit/Platform/DOM/CPPlatformString.j +++ b/AppKit/Platform/DOM/CPPlatformString.j @@ -22,8 +22,8 @@ #include "../CoreGraphics/CGGeometry.h" - var DOMSpanElement = nil, + DOMIFrameElement = nil, DefaultFont = nil; @implementation CPPlatformString : CPBasePlatformString @@ -33,17 +33,11 @@ var DOMSpanElement = nil, + (void)bootstrap { [self createDOMElements]; - - [[CPNotificationCenter defaultCenter] - addObserver:self - selector:@selector(platformDidClearBodyElement:) - name:CPPlatformDidClearBodyElementNotification - object:CPPlatform]; } + (void)createDOMElements { - var DOMIFrameElement = document.createElement("iframe"); + DOMIFrameElement = document.createElement("iframe"); // necessary for Safari caching bug: DOMIFrameElement.name = "iframe_" + FLOOR(RAND() * 10000); DOMIFrameElement.style.position = "absolute"; @@ -54,6 +48,7 @@ var DOMSpanElement = nil, DOMIFrameElement.style.borderWidth = "0px"; DOMIFrameElement.style.overflow = "hidden"; DOMIFrameElement.style.zIndex = 100000000000; + DOMIFrameElement.className = "cpdontremove"; var bodyElement = [CPPlatform mainBodyElement]; @@ -80,11 +75,6 @@ var DOMSpanElement = nil, DOMDivElement.appendChild(DOMSpanElement); } -+ (void)platformDidClearBodyElement:(CPNotification)aNotification -{ - [self createDOMElements]; -} - + (CGSize)sizeOfString:(CPString)aString withFont:(CPFont)aFont forWidth:(float)aWidth { if (!aFont) @@ -97,33 +87,25 @@ var DOMSpanElement = nil, var style = DOMSpanElement.style; - if (aWidth === NULL) + if (!aWidth) { style.width = ""; style.whiteSpace = "pre"; } - else { style.width = ROUND(aWidth) + "px"; - - if (document.attachEvent) - style.wordWrap = "break-word"; - - else - { - style.whiteSpace = "-o-pre-wrap"; - style.whiteSpace = "-pre-wrap"; - style.whiteSpace = "-moz-pre-wrap"; - style.whiteSpace = "pre-wrap"; - } + style.wordWrap = "break-word"; + style.whiteSpace = "-o-pre-wrap"; + style.whiteSpace = "-pre-wrap"; + style.whiteSpace = "-moz-pre-wrap"; + style.whiteSpace = "pre-wrap"; } style.font = [aFont cssString]; if (CPFeatureIsCompatible(CPJavascriptInnerTextFeature)) DOMSpanElement.innerText = aString; - else if (CPFeatureIsCompatible(CPJavascriptTextContentFeature)) DOMSpanElement.textContent = aString; diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index 5c73c69cc..e6cff4912 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -239,6 +239,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; _DOMFocusElement.style.zIndex = "-1000"; _DOMFocusElement.style.opacity = "0"; _DOMFocusElement.style.filter = "alpha(opacity=0)"; + _DOMFocusElement.className = "cpdontremove"; _DOMBodyElement.appendChild(_DOMFocusElement); @@ -248,6 +249,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; _DOMPasteboardElement.style.position = "absolute"; _DOMPasteboardElement.style.top = "-10000px"; _DOMPasteboardElement.style.zIndex = "999"; + _DOMPasteboardElement.className = "cpdontremove"; _DOMBodyElement.appendChild(_DOMPasteboardElement); @@ -255,11 +257,6 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; _DOMPasteboardElement.blur(); } -- (void)platformDidClearBodyElement:(CPNotification)aNotification -{ - [self createDOMElements]; -} - - (void)registerDOMWindow { var theDocument = _DOMWindow.document; @@ -273,14 +270,6 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; _DOMBodyElement.webkitTouchCallout = "none"; [self createDOMElements]; - - if (window === _DOMWindow) - [[CPNotificationCenter defaultCenter] - addObserver:self - selector:@selector(platformDidClearBodyElement:) - name:CPPlatformDidClearBodyElementNotification - object:CPPlatform]; - [self _addLayers]; var theClass = [self class], diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarBarRegular.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarBarRegular.png deleted file mode 100644 index 5a4719080..000000000 Binary files a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarBarRegular.png and /dev/null differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarBarRegular0.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarBarRegular0.png new file mode 100644 index 000000000..eb8ef7760 Binary files /dev/null and b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarBarRegular0.png differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarBarRegular1.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarBarRegular1.png new file mode 100644 index 000000000..31bf729e1 Binary files /dev/null and b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarBarRegular1.png differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarBarRegular2.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarBarRegular2.png new file mode 100644 index 000000000..1a8da63e7 Binary files /dev/null and b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarBarRegular2.png differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarHUDBarRegular0.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarHUDBarRegular0.png new file mode 100644 index 000000000..499de408b Binary files /dev/null and b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarHUDBarRegular0.png differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarHUDBarRegular1.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarHUDBarRegular1.png new file mode 100644 index 000000000..f49b3f392 Binary files /dev/null and b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarHUDBarRegular1.png differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarHUDBarRegular2.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarHUDBarRegular2.png new file mode 100644 index 000000000..81691a355 Binary files /dev/null and b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarHUDBarRegular2.png differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarHUDBarSmall.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarHUDBarSmall.png deleted file mode 100644 index 5bc78a08a..000000000 Binary files a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBarHUDBarSmall.png and /dev/null differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderBarRegular0.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderBarRegular0.png index 34c84d77c..032dfca6f 100644 Binary files a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderBarRegular0.png and b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderBarRegular0.png differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderBarRegular1.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderBarRegular1.png index f555903eb..f3e7717c4 100644 Binary files a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderBarRegular1.png and b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderBarRegular1.png differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderBarRegular2.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderBarRegular2.png index 81e575fbd..075026cb3 100644 Binary files a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderBarRegular2.png and b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderBarRegular2.png differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarRegular0.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarRegular0.png new file mode 100644 index 000000000..f27ba9cb7 Binary files /dev/null and b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarRegular0.png differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarRegular1.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarRegular1.png new file mode 100644 index 000000000..e4d1fc5d5 Binary files /dev/null and b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarRegular1.png differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarRegular2.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarRegular2.png new file mode 100644 index 000000000..b6d88f15a Binary files /dev/null and b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarRegular2.png differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarSmall0.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarSmall0.png deleted file mode 100644 index ee28212f6..000000000 Binary files a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarSmall0.png and /dev/null differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarSmall1.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarSmall1.png deleted file mode 100644 index 5f8f753b6..000000000 Binary files a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarSmall1.png and /dev/null differ diff --git a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarSmall2.png b/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarSmall2.png deleted file mode 100644 index 612a5ac4a..000000000 Binary files a/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorBezelBorderHUDBarSmall2.png and /dev/null differ diff --git a/AppKit/Resources/tableview-headerview-highlighted-pressed.png b/AppKit/Resources/tableview-headerview-highlighted-pressed.png new file mode 100644 index 000000000..cd4464d36 Binary files /dev/null and b/AppKit/Resources/tableview-headerview-highlighted-pressed.png differ diff --git a/AppKit/Resources/tableview-headerview-pressed.png b/AppKit/Resources/tableview-headerview-pressed.png new file mode 100644 index 000000000..e79e72539 Binary files /dev/null and b/AppKit/Resources/tableview-headerview-pressed.png differ diff --git a/Tests/Manual/TableTest/AppController.j b/Tests/Manual/TableTest/AppController.j index f9fbb76bd..eb4b7830a 100644 --- a/Tests/Manual/TableTest/AppController.j +++ b/Tests/Manual/TableTest/AppController.j @@ -37,6 +37,7 @@ CPLogRegister(CPLogConsole); tableView = [[CPTableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 500.0, 500.0)];//[view bounds]]; [tableView setAllowsMultipleSelection:YES]; + [tableView setAllowsColumnSelection:YES]; [tableView setUsesAlternatingRowBackgroundColors:YES]; [tableView setGridStyleMask:CPTableViewSolidHorizontalGridLineMask | CPTableViewSolidVerticalGridLineMask]; @@ -68,7 +69,7 @@ CPLogRegister(CPLogConsole); // [textDataView setBackgroundColor:[[CPColor redColor] colorWithAlphaComponent:0.5]]; - for (var i = 1; i <= 3; i++) + for (var i = 1; i <= 2; i++) { var column = [[CPTableColumn alloc] initWithIdentifier:String(i)]; @@ -85,7 +86,7 @@ CPLogRegister(CPLogConsole); //[tableView selectColumnIndexes:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0,2)] byExtendingSelection:YES]; - [tableView setColumnAutoresizingStyle:CPTableViewUniformColumnAutoresizingStyle]; + // [tableView setColumnAutoresizingStyle:CPTableViewUniformColumnAutoresizingStyle]; var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([view bounds]), CGRectGetHeight([view bounds]))]; [tableView setRowHeight:22.0];