100 #define NUMBER_OF_COLUMNS() (_tableColumns.length) 101 #define UPDATE_COLUMN_RANGES_IF_NECESSARY() \ 102 if (_dirtyTableColumnRangeIndex !== CPNotFound) \ 103 [self _recalculateTableColumnRanges]; 104 #define FULL_ROW_HEIGHT() (_rowHeight + _intercellSpacing.height) 105 #define ROW_BOTTOM(__heightInfo) (__heightInfo.y + __heightInfo.height + _intercellSpacing.height) 106 #define HAS_VARIABLE_ROW_HEIGHTS() (_implementedDelegateMethods & CPTableViewDelegate_tableView_heightOfRow_) 115 - (CPDragOperation)
tableView:(
CPTableView)aTableView validateDrop:(
id <
CPDraggingInfo>)info proposedRow:(CPInteger)aRowIndex proposedDropOperation:(CPTableViewDropOperation)anOperation;
116 - (CPInteger)numberOfRowsInTableView:(
CPTableView)aTableView;
126 - (BOOL)selectionShouldChangeInTableView:(
CPTableView)aTableView;
129 - (BOOL)
tableView:(
CPTableView)aTableView shouldReorderColumn:(CPInteger)columnIndex toColumn:(NSInteger)newColumnIndex;
136 - (CPInteger)
tableView:(
CPTableView)aTableView nextTypeSelectMatchFromRow:(CPInteger)startRow toRow:(CPInteger)endRow forString:(
CPString)searchString;
137 - (
CPMenu)tableViewMenuForTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRowIndex;
148 - (void)tableViewSelectionDidChange:(
CPNotification)aNotification;
149 - (void)tableViewSelectionIsChanging:(
CPNotification)aNotification;
153 @implementation _CPTableDrawView :
CPView 163 _tableView = aTableView;
168 - (void)drawRect:(CGRect)aRect
170 var
frame = [
self frame],
175 [_tableView _drawRect:aRect];
204 id <CPTableViewDataSource> _dataSource;
205 CPInteger _implementedDataSourceMethods;
207 id <CPTableViewDelegate> _delegate;
208 CPInteger _implementedDelegateMethods;
210 CPArray _tableColumns;
211 CPArray _tableColumnRanges;
212 CPInteger _dirtyTableColumnRangeIndex;
213 CPInteger _numberOfHiddenColumns;
216 BOOL _invalidateObjectValuesCache;
217 Object _objectValues;
223 Object _dataViewsForRows;
224 Object _cachedDataViews;
226 Object _unavailable_custom_cibs;
229 BOOL _allowsColumnReordering;
230 BOOL _allowsColumnResizing;
231 BOOL _allowsColumnSelection;
232 BOOL _allowsMultipleSelection;
233 BOOL _allowsEmptySelection;
235 CPArray _sortDescriptors;
238 CGSize _intercellSpacing;
241 BOOL _usesAlternatingRowBackgroundColors;
242 CPArray _alternatingRowBackgroundColors;
244 unsigned _selectionHighlightStyle;
245 CPColor _unfocusedSelectionHighlightColor;
248 unsigned _gridStyleMask;
250 unsigned _numberOfRows;
253 CPArray _cachedRowHeights;
257 BOOL _autosaveTableColumns;
260 _CPCornerView _cornerView;
264 CPInteger _selectionAnchorRow;
265 CPInteger _lastSelectedRow;
267 CGPoint _startTrackingPoint;
268 CPDate _startTrackingTimestamp;
269 BOOL _trackingPointMovedOutOfClickSlop;
270 CPInteger _editingRow;
271 CPInteger _editingColumn;
273 _CPTableDrawView _tableDrawView;
276 CPInteger _clickedRow;
277 CPInteger _clickedColumn;
278 unsigned _columnAutoResizingStyle;
280 int _lastTrackedRowIndex;
281 CGPoint _originalMouseDownPoint;
282 BOOL _verticalMotionCanDrag;
283 unsigned _destinationDragStyle;
284 BOOL _isSelectingSession;
286 BOOL _wasSelectionBroken;
288 _CPDropOperationDrawingView _dropOperationFeedbackView;
289 CPDragOperation _dragOperationDefaultMask;
290 int _retargetedDropRow;
291 CPDragOperation _retargetedDropOperation;
293 BOOL _disableAutomaticResizing;
294 BOOL _lastColumnShouldSnap;
295 BOOL _implementsCustomDrawRow;
297 BOOL _contentBindingExplicitlySet;
299 SEL _viewForTableColumnRowSelector;
301 CPInteger _draggedColumnIndex;
302 BOOL _draggedColumnIsSelected;
303 BOOL _needsDifferedTableColumnRemove;
304 CPArray _differedColumnDataToRemove;
306 Function _BlockDeselectView;
307 Function _BlockSelectView;
328 @"grid-line-thickness": 1.0,
336 @"default-row-height": 25.0,
337 @"dropview-on-background-color": [
CPNull null],
341 @"dropview-on-selected-background-color": [
CPNull null],
342 @"dropview-on-selected-border-color": [
CPNull null],
343 @"dropview-on-selected-border-width": [
CPNull null],
344 @"dropview-on-selected-border-radius": [
CPNull null],
345 @"dropview-above-border-color": [
CPNull null],
346 @"dropview-above-border-width": [
CPNull null],
347 @"dropview-above-selected-border-color": [
CPNull null],
348 @"dropview-above-selected-border-width": [
CPNull null]
352 - (id)initWithFrame:(CGRect)aFrame
359 _allowsColumnReordering = YES;
360 _allowsColumnResizing = YES;
361 _allowsMultipleSelection = NO;
362 _allowsEmptySelection = YES;
363 _allowsColumnSelection = NO;
364 _disableAutomaticResizing = NO;
374 _tableColumnRanges = [];
376 _numberOfHiddenColumns = 0;
378 _intercellSpacing = CGSizeMake(3.0, 2.0);
379 _rowHeight = [
self valueForThemeAttribute:@"default-row-height"];
387 _currentHighlightedTableColumn = nil;
390 _verticalMotionCanDrag = YES;
391 _isSelectingSession = NO;
392 _retargetedDropRow = nil;
393 _retargetedDropOperation = nil;
394 _dragOperationDefaultMask = nil;
396 _contentBindingExplicitlySet = NO;
413 _lastSelectedRow = _clickedColumn = _clickedRow = -1;
418 _dropOperationFeedbackView = [[_CPDropOperationDrawingView alloc] initWithFrame:CGRectMakeZero()];
419 [_dropOperationFeedbackView setTableView:self];
421 _lastColumnShouldSnap = NO;
423 if (!_alternatingRowBackgroundColors)
426 _tableColumnRanges = [];
427 _dirtyTableColumnRangeIndex = 0;
428 _numberOfHiddenColumns = 0;
431 _invalidateObjectValuesCache = NO;
432 _dataViewsForRows = { };
436 _cachedDataViews = { };
437 _archivedDataViews = nil;
438 _viewForTableColumnRowSelector = nil;
439 _unavailable_custom_cibs = { };
440 _cachedRowHeights = [];
444 _tableDrawView = [[_CPTableDrawView alloc] initWithTableView:self];
448 _draggedColumnIndex = -1;
449 _draggedColumnIsSelected = NO;
459 _differedColumnDataToRemove = [];
460 _needsDifferedTableColumnRemove = NO;
461 _implementsCustomDrawRow = [
self implementsSelector:@selector(drawRow:clipRect:)];
463 if (!_sortDescriptors)
464 _sortDescriptors = [];
466 [
self _initSubclass];
469 - (void)_initSubclass
471 _BlockDeselectView =
function(view, row, column)
473 [view unsetThemeState:CPThemeStateSelectedDataView];
476 _BlockSelectView =
function(view, row, column)
478 [view setThemeState:CPThemeStateSelectedDataView];
549 if (_dataSource === aDataSource)
552 _dataSource = aDataSource;
553 _implementedDataSourceMethods = 0;
558 var hasContentBinding = !![
self infoForBinding:@"content"];
560 if ([_dataSource respondsToSelector:
@selector(numberOfRowsInTableView:)])
563 if ([_dataSource respondsToSelector:
@selector(
tableView:objectValueForTableColumn:row:)])
566 if ([_dataSource respondsToSelector:
@selector(
tableView:setObjectValue:forTableColumn:row:)])
569 if ([_dataSource respondsToSelector:
@selector(
tableView:acceptDrop:row:dropOperation:)])
572 if ([_dataSource respondsToSelector:
@selector(
tableView:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:)])
575 if ([_dataSource respondsToSelector:
@selector(
tableView:validateDrop:proposedRow:proposedDropOperation:)])
578 if ([_dataSource respondsToSelector:
@selector(
tableView:writeRowsWithIndexes:toPasteboard:)])
581 if ([_dataSource respondsToSelector:
@selector(
tableView:sortDescriptorsDidChange:)])
584 [
self _reloadDataViews];
601 [
self _reloadDataViews];
617 [
self _enumerateViewsInRows:rowIndexes columns:columnIndexes usingBlock:function(view, row, column, stop)
619 var tableColumn = [_tableColumns objectAtIndex:column];
620 [
self _setObjectValueForTableColumn:tableColumn row:row forView:view useCache:NO];
626 _reloadAllRows = YES;
628 _cachedRowHeights = [];
633 [_groupRows removeAllIndexes];
640 - (void)_reloadDataViews
648 - (void)_reloadDataViewsSynchronously
662 - (void)setDoubleAction:(
SEL)anAction
664 _doubleAction = anAction;
672 return _doubleAction;
678 - (CPInteger)clickedColumn
680 return _clickedColumn;
686 - (CPInteger)clickedRow
696 - (void)setAllowsColumnReordering:(BOOL)shouldAllowColumnReordering
698 _allowsColumnReordering = !!shouldAllowColumnReordering;
704 - (BOOL)allowsColumnReordering
706 return _allowsColumnReordering;
713 - (void)setAllowsColumnResizing:(BOOL)shouldAllowColumnResizing
715 _allowsColumnResizing = !!shouldAllowColumnResizing;
721 - (BOOL)allowsColumnResizing
723 return _allowsColumnResizing;
730 - (void)setAllowsMultipleSelection:(BOOL)shouldAllowMultipleSelection
732 _allowsMultipleSelection = !!shouldAllowMultipleSelection;
740 - (BOOL)allowsMultipleSelection
742 return _allowsMultipleSelection;
749 - (void)setAllowsEmptySelection:(BOOL)shouldAllowEmptySelection
751 _allowsEmptySelection = !!shouldAllowEmptySelection;
757 - (BOOL)allowsEmptySelection
759 return _allowsEmptySelection;
767 - (void)setAllowsColumnSelection:(BOOL)shouldAllowColumnSelection
769 _allowsColumnSelection = !!shouldAllowColumnSelection;
776 - (BOOL)allowsColumnSelection
778 return _allowsColumnSelection;
788 - (void)setIntercellSpacing:(CGSize)aSize
790 if (CGSizeEqualToSize(_intercellSpacing, aSize))
793 _intercellSpacing = CGSizeMakeCopy(aSize);
795 _dirtyTableColumnRangeIndex = 0;
796 [
self _recalculateTableColumnRanges];
798 [_headerView setNeedsDisplay:YES];
799 [_headerView setNeedsLayout];
801 [
self _reloadDataViews];
807 - (CGSize)intercellSpacing
809 return CGSizeMakeCopy(_intercellSpacing);
818 - (void)setRowHeight:(
unsigned)aRowHeight
821 aRowHeight = +aRowHeight;
823 if (_rowHeight === aRowHeight)
826 _rowHeight = MAX(0.0, aRowHeight);
834 - (unsigned)rowHeight
844 - (void)setUsesAlternatingRowBackgroundColors:(BOOL)shouldUseAlternatingRowBackgroundColors
846 _usesAlternatingRowBackgroundColors = shouldUseAlternatingRowBackgroundColors;
852 - (BOOL)usesAlternatingRowBackgroundColors
854 return _usesAlternatingRowBackgroundColors;
862 - (void)setAlternatingRowBackgroundColors:(CPArray)alternatingRowBackgroundColors
872 - (CPArray)alternatingRowBackgroundColors
874 return [
self currentValueForThemeAttribute:@"alternating-row-colors"];
888 - (unsigned)selectionHighlightStyle
890 return _selectionHighlightStyle;
904 - (void)setSelectionHighlightStyle:(
unsigned)aSelectionHighlightStyle
906 _selectionHighlightStyle = aSelectionHighlightStyle;
914 [
self _updateHighlightWithOldColumns:[
CPIndexSet indexSet] newColumns:_selectedColumnIndexes];
923 - (void)setSelectionHighlightColor:(
CPColor)aColor
925 if ([[
self selectionHighlightColor]
isEqual:aColor])
937 return [
self currentValueForThemeAttribute:@"selection-color"];
945 if (!_unfocusedSelectionHighlightColor)
946 _unfocusedSelectionHighlightColor = [
self _unfocusedSelectionColorFromColor:[
self selectionHighlightColor] saturation:0];
948 return _unfocusedSelectionHighlightColor;
978 return [
self currentValueForThemeAttribute:@"sourcelist-selection-color"];
992 if (!_unfocusedSourceListSelectionColor)
996 _unfocusedSourceListSelectionColor = @{
997 CPSourceListGradient: [
self _unfocusedGradientFromGradient:[sourceListColors objectForKey:CPSourceListGradient]],
998 CPSourceListTopLineColor: [
self _unfocusedSelectionColorFromColor:[sourceListColors objectForKey:CPSourceListTopLineColor] saturation:0.2],
999 CPSourceListBottomLineColor: [
self _unfocusedSelectionColorFromColor:[sourceListColors objectForKey:CPSourceListBottomLineColor] saturation:0.2]
1003 return _unfocusedSourceListSelectionColor;
1006 - (
CPColor)_unfocusedSelectionColorFromColor:(
CPColor)aColor saturation:(float)saturation
1013 - (CGGradient)_unfocusedGradientFromGradient:(CGGradient)aGradient
1015 var colors = [aGradient.colors copy],
1016 count = [colors count];
1023 colors[count] =
CGColorCreate(aGradient.colorspace, [[hsb components] copy]);
1045 return [
self currentValueForThemeAttribute:@"grid-color"];;
1053 - (void)setGridStyleMask:(
unsigned)aGrideStyleMask
1055 if (_gridStyleMask === aGrideStyleMask)
1058 _gridStyleMask = aGrideStyleMask;
1066 - (unsigned)gridStyleMask
1068 return _gridStyleMask;
1079 [_tableColumns addObject:aTableColumn];
1082 if (_dirtyTableColumnRangeIndex < 0)
1085 _dirtyTableColumnRangeIndex = MIN(
NUMBER_OF_COLUMNS() - 1, _dirtyTableColumnRangeIndex);
1087 if ([[
self sortDescriptors] count] > 0)
1091 if (aTableColumn === [
self _tableColumnForSortDescriptor:mainSortDescriptor])
1093 var image = [mainSortDescriptor ascending] ? [
self _tableHeaderSortImage] : [
self _tableHeaderReverseSortImage];
1111 var index = [_tableColumns indexOfObjectIdenticalTo:aTableColumn];
1117 [_differedColumnDataToRemove addObject:{"column":aTableColumn, "shouldBeHidden": [aTableColumn
isHidden]}];
1118 _needsDifferedTableColumnRemove = YES;
1123 var tableColumnUID = [aTableColumn
UID];
1125 if (_objectValues[tableColumnUID])
1126 _objectValues[tableColumnUID] = nil;
1128 if (_dirtyTableColumnRangeIndex < 0)
1129 _dirtyTableColumnRangeIndex = index;
1131 _dirtyTableColumnRangeIndex = MIN(index, _dirtyTableColumnRangeIndex);
1147 if (
columnIndex === -1 && _draggedColumnIsSelected)
1148 [_selectedColumnIndexes addIndex:_draggedColumnIndex];
1157 - (void)_moveColumn:(
unsigned)fromIndex toColumn:(unsigned)toIndex
1160 fromIndex = +fromIndex;
1163 if (fromIndex === toIndex)
1166 if (_dirtyTableColumnRangeIndex < 0)
1167 _dirtyTableColumnRangeIndex = MIN(fromIndex, toIndex);
1169 _dirtyTableColumnRangeIndex = MIN(fromIndex, toIndex, _dirtyTableColumnRangeIndex);
1171 var tableColumn = _tableColumns[fromIndex],
1172 selectedTableColumns = [_tableColumns objectsAtIndexes:_selectedColumnIndexes];
1174 [_tableColumns removeObjectAtIndex:fromIndex];
1175 [_tableColumns insertObject:tableColumn atIndex:toIndex];
1180 var range =
CPMakeRange(MIN(fromIndex, toIndex), ABS(fromIndex - toIndex) + 1),
1184 [_tableColumns enumerateObjectsUsingBlock:function(tableColumn, idx, stop)
1186 if ([selectedTableColumns containsObjectIdenticalTo:tableColumn])
1190 if ([_selectedColumnIndexes containsIndex:fromIndex])
1193 if (_draggedColumnIndex !== -1)
1194 [layoutColumnIndexes removeIndex:toIndex];
1196 [
self _layoutViewsForRowIndexes:_exposedRows columnIndexes:layoutColumnIndexes];
1204 userInfo:@{ @"CPOldColumn": fromIndex, @"CPNewColumn": toIndex }];
1215 - (void)moveColumn:(CPInteger)theColumnIndex toColumn:(CPInteger)theToIndex
1217 [
self _moveColumn:theColumnIndex toColumn:theToIndex];
1225 - (void)_tableColumnVisibilityDidChange:(
CPTableColumn)aColumn
1229 if (_dirtyTableColumnRangeIndex < 0)
1232 _dirtyTableColumnRangeIndex = MIN(columnIndex, _dirtyTableColumnRangeIndex);
1244 - (CPArray)tableColumns
1246 return _tableColumns;
1255 - (CPInteger)columnWithIdentifier:(
CPString)anIdentifier
1260 for (; index < count; ++index)
1261 if ([_tableColumns[index] identifier] === anIdentifier)
1280 return _tableColumns[index];
1286 - (void)_didResizeTableColumn:(
CPTableColumn)theColumn oldWidth:(int)oldWidth
1293 userInfo:@{ @"CPTableColumn": theColumn, @"CPOldWidth": oldWidth }];
1307 - (void)selectColumnIndexes:(
CPIndexSet)columns byExtendingSelection:(BOOL)shouldExtendSelection
1310 if (([columns firstIndex] !=
CPNotFound && [columns firstIndex] < 0) || [columns
lastIndex] >= [
self numberOfColumns] || (!shouldExtendSelection && [columns
isEqualToIndexSet:_selectedColumnIndexes]) || (shouldExtendSelection && [columns count] === 0))
1314 if ([_selectedRowIndexes count] > 0)
1316 [
self _updateHighlightWithOldRows:_selectedRowIndexes newRows:[
CPIndexSet indexSet]];
1320 var previousSelectedIndexes = [_selectedColumnIndexes copy];
1322 if (shouldExtendSelection)
1323 [_selectedColumnIndexes addIndexes:columns];
1325 _selectedColumnIndexes = [columns
copy];
1327 [
self _updateHighlightWithOldColumns:previousSelectedIndexes newColumns:_selectedColumnIndexes];
1331 [_headerView setNeedsDisplay:YES];
1333 [
self _noteSelectionDidChange];
1339 - (void)_setSelectedRowIndexes:(
CPIndexSet)rows
1341 if ([_selectedRowIndexes isEqualToIndexSet:rows])
1344 var previousSelectedIndexes = _selectedRowIndexes;
1346 _lastSelectedRow = ([rows count] > 0) ? [rows lastIndex] : -1;
1347 _selectedRowIndexes = [rows copy];
1349 [
self _updateHighlightWithOldRows:previousSelectedIndexes newRows:_selectedRowIndexes];
1353 var binderClass = [[
self class] _binderClassForBinding:@"selectionIndexes"];
1354 [[binderClass getBinding:@"selectionIndexes" forObject:self] reverseSetValueFor:@"selectedRowIndexes"];
1356 [
self _noteSelectionDidChange];
1365 - (void)selectRowIndexes:(
CPIndexSet)rows byExtendingSelection:(BOOL)shouldExtendSelection
1367 if ([rows isEqualToIndexSet:_selectedRowIndexes] ||
1369 [
self numberOfColumns] <= 0)
1373 if ([_selectedColumnIndexes count] > 0)
1375 [
self _updateHighlightWithOldColumns:_selectedColumnIndexes newColumns:[
CPIndexSet indexSet]];
1378 [_headerView setNeedsDisplay:YES];
1381 var newSelectedIndexes;
1382 if (shouldExtendSelection)
1384 newSelectedIndexes = [_selectedRowIndexes copy];
1385 [newSelectedIndexes addIndexes:rows];
1388 newSelectedIndexes = [rows
copy];
1390 [
self _setSelectedRowIndexes:newSelectedIndexes];
1400 if ([
self _delegateRespondsToSelectionIndexesForProposedSelection])
1402 return [
self _sendDelegateSelectionIndexesForProposedSelection:anIndexSet];
1404 else if ([
self _delegateRespondsToShouldSelectRow])
1411 if (![
self _sendDelegateShouldSelectRow:currentIndex])
1412 [indexesToRemove addIndex:currentIndex];
1430 [
self _enumerateViewsInRows:oldRows columns:_exposedColumns usingBlock:_BlockDeselectView];
1433 [
self _enumerateViewsInRows:newRows columns:_exposedColumns usingBlock:_BlockSelectView];
1439 - (void)_updateHighlightWithOldColumns:(
CPIndexSet)oldColumns newColumns:(
CPIndexSet)newColumns
1441 var blockDeselectHeader =
function(column, stop)
1443 var headerView = [_tableColumns[column] headerView];
1444 [headerView unsetThemeState:CPThemeStateSelected];
1449 [
self _enumerateViewsInRows:_exposedRows columns:oldColumns usingBlock:_BlockDeselectView];
1450 [oldColumns enumerateIndexesUsingBlock:blockDeselectHeader];
1454 [
self _enumerateViewsInRows:_exposedRows columns:newColumns usingBlock:_BlockSelectView];
1455 [newColumns enumerateIndexesUsingBlock:function(column, stop)
1457 var headerView = [_tableColumns[column] headerView];
1466 - (int)selectedColumn
1468 return [_selectedColumnIndexes lastIndex];
1476 return _selectedColumnIndexes;
1484 return _lastSelectedRow;
1492 return [_selectedRowIndexes copy];
1500 - (void)deselectColumn:(CPInteger)anIndex
1502 var selectedColumnIndexes = [_selectedColumnIndexes copy];
1505 [
self _noteSelectionDidChange];
1513 - (void)deselectRow:(CPInteger)aRow
1515 var selectedRowIndexes = [_selectedRowIndexes copy];
1518 [
self _noteSelectionDidChange];
1524 - (CPInteger)numberOfSelectedColumns
1526 return [_selectedColumnIndexes count];
1532 - (CPInteger)numberOfSelectedRows
1534 return [_selectedRowIndexes count];
1543 - (BOOL)isColumnSelected:(CPInteger)anIndex
1545 return [_selectedColumnIndexes containsIndex:anIndex];
1554 - (BOOL)isRowSelected:(CPInteger)aRow
1556 return [_selectedRowIndexes containsIndex:aRow];
1570 - (void)selectAll:(
id)sender
1572 if (_allowsMultipleSelection)
1574 if (![
self _sendDelegateSelectionShouldChangeInTableView])
1577 if ([[
self selectedColumnIndexes] count])
1587 - (void)deselectAll:(
id)sender
1589 if ([
self allowsEmptySelection])
1591 if (![
self _sendDelegateSelectionShouldChangeInTableView])
1601 - (int)numberOfColumns
1611 return _numberOfRows;
1614 - (int)_numberOfRows
1617 contentBindingInfo = [
self infoForBinding:@"content"];
1619 if (contentBindingInfo)
1621 var destination = [contentBindingInfo objectForKey:CPObservedObjectKey],
1622 keyPath = [contentBindingInfo objectForKey:CPObservedKeyPathKey];
1624 numberOfRows = [[destination valueForKeyPath:keyPath] count];
1627 numberOfRows = [_dataSource numberOfRowsInTableView:
self] || 0;
1631 CPLog(
@"no content binding established and data source " + [_dataSource description] +
" does not implement numberOfRowsInTableView:");
1635 return numberOfRows;
1652 if (_cornerView === aView)
1655 _cornerView = aView;
1659 if ([scrollView isKindOfClass:[
CPScrollView class]] && [scrollView documentView] ===
self)
1660 [scrollView _updateCornerAndHeaderView];
1681 if (_headerView === aHeaderView)
1684 [_headerView setTableView:nil];
1686 _headerView = aHeaderView;
1690 [_headerView setTableView:self];
1691 [_headerView setFrameSize:CGSizeMake(CGRectGetWidth([
self frame]), CGRectGetHeight([_headerView frame]))];
1696 [_cornerView removeFromSuperview];
1702 if ([scrollView isKindOfClass:[
CPScrollView class]] && [scrollView documentView] ===
self)
1703 [scrollView _updateCornerAndHeaderView];
1711 - (void)_recalculateTableColumnRanges
1716 if (_dirtyTableColumnRangeIndex < 0)
1719 _numberOfHiddenColumns = 0;
1721 var index = _dirtyTableColumnRangeIndex,
1723 x = index === 0 ? 0.0 :
CPMaxRange(_tableColumnRanges[index - 1]);
1725 for (; index < count; ++index)
1727 var tableColumn = _tableColumns[index];
1731 _numberOfHiddenColumns += 1;
1736 var
width = [_tableColumns[index] width] + _intercellSpacing.width;
1738 _tableColumnRanges[index] =
CPMakeRange(x, width);
1744 _tableColumnRanges.length = count;
1754 - (CGRect)rectOfColumn:(CPInteger)aColumnIndex
1760 aColumnIndex = +aColumnIndex;
1763 return CGRectMakeZero();
1765 if ([[_tableColumns objectAtIndex:aColumnIndex]
isHidden])
1766 return CGRectMakeZero();
1770 var range = _tableColumnRanges[aColumnIndex];
1772 return CGRectMake(range.location, 0.0, range.length, CGRectGetHeight([
self bounds]));
1782 - (CGRect)_rectOfRow:(CPInteger)aRowIndex checkRange:(BOOL)checkRange
1788 validIndex = aRowIndex >= 0 && aRowIndex <= lastIndex;
1790 if (checkRange && !validIndex)
1791 return CGRectMakeZero();
1795 fixedHeightRows = 0;
1799 [
self _populateRowHeightCacheIfNeeded];
1807 heightInfo = _cachedRowHeights[aRowIndex];
1809 height = heightInfo.height + _intercellSpacing.height;
1815 if (_numberOfRows > 0)
1817 heightInfo = _cachedRowHeights[lastIndex];
1822 fixedHeightRows = aRowIndex - _numberOfRows;
1828 fixedHeightRows = aRowIndex;
1834 return CGRectMake(0.0, y, CGRectGetWidth([
self bounds]), height);
1842 - (CGRect)rectOfRow:(CPInteger)aRowIndex
1844 return [
self _rectOfRow:aRowIndex checkRange:YES];
1852 - (CPRange)rowsInRect:(CGRect)aRect
1858 if (_numberOfRows <= 0)
1864 if (!CGRectIntersectsRect(aRect,
bounds))
1867 var firstRow = [
self rowAtPoint:aRect.origin];
1873 var lastRow = [
self rowAtPoint:CGPointMake(0.0, CGRectGetMaxY(aRect))];
1877 lastRow = _numberOfRows - 1;
1879 return CPMakeRange(firstRow, lastRow - firstRow + 1);
1887 - (CPRange)_exposedRowsInRect:(CGRect)aRect
1891 rectOfLastRealRow = [
self _rectOfRow:lastRealRow checkRange:NO],
1892 bottomOfRealRows = CGRectGetMaxY(rectOfLastRealRow),
1893 rectBottom = CGRectGetMaxY(aRect);
1896 if (bottomOfRealRows >= rectBottom)
1899 var numberOfSynthesizedRows = CEIL((rectBottom - bottomOfRealRows) /
FULL_ROW_HEIGHT());
1901 rowRange.length += numberOfSynthesizedRows;
1917 var column = MAX(0, [
self columnAtPoint:CGPointMake(aRect.origin.x, 0.0)]),
1918 lastColumn = [
self columnAtPoint:CGPointMake(CGRectGetMaxX(aRect), 0.0)];
1924 if (_numberOfHiddenColumns <= 0)
1929 for (; column <= lastColumn; ++column)
1931 var tableColumn = _tableColumns[column];
1934 [indexSet addIndex:column];
1945 - (CPInteger)columnAtPoint:(CGPoint)aPoint
1953 if (!CGRectContainsPoint(
bounds, aPoint))
1960 high = _tableColumnRanges.length - 1;
1964 var middle = FLOOR(low + (high - low) / 2),
1965 range = _tableColumnRanges[middle];
1967 if (x < range.location)
1975 var numberOfColumns = _tableColumnRanges.length;
1977 while (middle < numberOfColumns && [_tableColumns[middle]
isHidden])
1980 if (middle < numberOfColumns)
1995 - (CPInteger)rowAtPoint:(CGPoint)aPoint
2004 if (aPoint.x < CGRectGetMinX(
bounds) || aPoint.x >= CGRectGetMaxX(
bounds))
2013 var heightInfo = [_cachedRowHeights lastObject];
2015 if (!heightInfo || aPoint.y >=
ROW_BOTTOM(heightInfo))
2018 return [_cachedRowHeights indexOfObject:aPoint
2021 usingComparator:function(aPoint, heightInfo)
2023 if (aPoint.y < heightInfo.y)
2024 return CPOrderedAscending;
2026 if (aPoint.y > ROW_BOTTOM(heightInfo))
2027 return CPOrderedDescending;
2029 return CPOrderedSame;
2036 return row >= _numberOfRows ? -1 : row;
2077 - (void)getColumn:(Function)columnRef row:(Function)rowRef forView:(
CPView)aView
2079 var columnResult = -1,
2082 if (aView && [aView isKindOfClass:[
CPView class]] && ![aView isKindOfClass:[
CPTableView class]])
2084 var cellView = aView,
2091 if (!cellView || cellView === contentView)
2098 var superview = [cellView superview];
2100 if ([superview isKindOfClass:[
CPTableView class]])
2106 cellView = superview;
2112 [
self _enumerateViewsInRows:_exposedRows columns:_exposedColumns usingBlock:function(view, row, column, stop)
2115 if (view === cellView)
2117 columnResult = column;
2126 columnRef(columnResult);
2139 - (CGRect)frameOfDataViewAtColumn:(CPInteger)aColumn row:(CPInteger)aRow
2143 if (aColumn > [
self numberOfColumns] || aRow > [
self numberOfRows])
2144 return CGRectMakeZero();
2146 var tableColumnRange = _tableColumnRanges[aColumn],
2148 leftInset = FLOOR(_intercellSpacing.width / 2.0),
2149 topInset = FLOOR(_intercellSpacing.height / 2.0);
2151 return CGRectMake(tableColumnRange.location + leftInset, CGRectGetMinY(rectOfRow) + topInset, tableColumnRange.length - _intercellSpacing.width, CGRectGetHeight(rectOfRow) - _intercellSpacing.height);
2157 - (void)resizeWithOldSuperviewSize:(CGSize)aSize
2161 if (_disableAutomaticResizing)
2164 var mask = _columnAutoResizingStyle;
2167 if (!_lastColumnShouldSnap)
2172 if (!superview || ![superview isKindOfClass:[
CPClipView class]])
2175 var superviewWidth = [superview bounds].size.width,
2176 lastColumnMaxX = CGRectGetMaxX([
self rectOfColumn:[
self numberOfColumns] -1]);
2179 if (lastColumnMaxX >= superviewWidth && lastColumnMaxX <= aSize.width || lastColumnMaxX <= superviewWidth && lastColumnMaxX >= aSize.width)
2180 _lastColumnShouldSnap = YES;
2186 [
self _resizeAllColumnUniformlyWithOldSize:aSize];
2190 [
self _autoResizeFirstColumn];
2196 - (void)_autoResizeFirstColumn
2206 columnToResize = nil,
2210 for (; i < count; i++)
2212 var column = _tableColumns[i];
2216 if (!columnToResize)
2217 columnToResize = column;
2218 totalWidth += [column width] + _intercellSpacing.width;
2225 var superviewSize = [superview bounds].size,
2226 newWidth = superviewSize.width - totalWidth;
2228 newWidth += [columnToResize width];
2229 [columnToResize _tryToResizeToWidth:newWidth];
2240 - (void)_resizeAllColumnUniformlyWithOldSize:(CGSize)oldSize
2246 if (!superview || ![superview isKindOfClass:[
CPClipView class]])
2251 var superviewWidth = [superview bounds].size.width,
2254 remainingSpace = 0.0,
2259 for (; i < count; i++)
2261 var tableColumn = _tableColumns[i];
2263 [resizableColumns addIndex:i];
2266 var maxXofColumns = CGRectGetMaxX([
self rectOfColumn:[resizableColumns lastIndex]]),
2267 remainingSpace = superviewWidth - maxXofColumns,
2268 resizeableColumnsCount = [resizableColumns count],
2271 while (remainingSpace && resizeableColumnsCount)
2274 proportionate += remainingSpace / resizeableColumnsCount;
2277 remainingSpace = 0.0;
2281 while ((index = [resizableColumns indexGreaterThanIndex:index]) !==
CPNotFound)
2283 var item = _tableColumns[index],
2284 proposedWidth = [item width] + proportionate,
2285 resizeLeftovers = [item _tryToResizeToWidth:proposedWidth];
2287 if (resizeLeftovers)
2289 [resizableColumns removeIndex:index];
2291 remainingSpace += resizeLeftovers;
2300 while (count-- && [_tableColumns[count]
isHidden]);
2303 var delta = superviewWidth - CGRectGetMaxX([
self rectOfColumn:count]) - ([
self intercellSpacing].width || 1),
2304 newSize = [item
width] + delta;
2306 [item _tryToResizeToWidth:newSize];
2320 - (void)setColumnAutoresizingStyle:(
unsigned)style
2323 _columnAutoResizingStyle = style;
2329 - (unsigned)columnAutoresizingStyle
2331 return _columnAutoResizingStyle;
2337 - (void)sizeLastColumnToFit
2339 _lastColumnShouldSnap = YES;
2353 while (count-- && [_tableColumns[count]
isHidden]);
2358 var columnToResize = _tableColumns[count],
2359 newSize = MAX(0.0, superviewSize.width - CGRectGetMinX([
self rectOfColumn:count]) - _intercellSpacing.width);
2361 [columnToResize _tryToResizeToWidth:newSize];
2370 - (void)noteNumberOfRowsChanged
2372 var oldNumberOfRows = _numberOfRows;
2374 _numberOfRows = [
self _numberOfRows];
2376 _cachedRowHeights = [];
2384 var hangingSelections = oldNumberOfRows - _numberOfRows;
2386 if (hangingSelections > 0)
2388 var previousSelectionCount = [_selectedRowIndexes count];
2389 [_selectedRowIndexes removeIndexesInRange:CPMakeRange(_numberOfRows, hangingSelections)];
2391 if (![_selectedRowIndexes containsIndex:[
self selectedRow]])
2395 if (previousSelectionCount > [_selectedRowIndexes count])
2396 [
self _noteSelectionDidChange];
2405 - (void)_populateRowHeightCacheIfNeeded
2407 if ([
self numberOfRows] !== _cachedRowHeights.length)
2416 - (void)_noteHeightOfRowsWithIndexesChanged:(
CPIndexSet)anIndexSet
2428 var y = i < _cachedRowHeights.length ? _cachedRowHeights[i].y : 0;
2430 for (var count = [
self numberOfRows]; i < count; ++i)
2434 if ([anIndexSet containsIndex:i])
2435 height = [
self _sendDelegateHeightOfRow:i];
2437 height = _cachedRowHeights[i].height || _rowHeight;
2439 _cachedRowHeights[i] = {y:y, height:height};
2440 y += height + _intercellSpacing.height;
2449 - (void)noteHeightOfRowsWithIndexesChanged:(
CPIndexSet)anIndexSet
2451 [
self _noteHeightOfRowsWithIndexesChanged:anIndexSet];
2452 [
self _reloadDataViews];
2462 var
width = _tableColumnRanges.length > 0 ?
CPMaxRange([_tableColumnRanges lastObject]) : 0.0,
2468 else if (_numberOfRows > 0)
2470 [
self _populateRowHeightCacheIfNeeded];
2472 var heightInfo = _cachedRowHeights[_cachedRowHeights.length - 1];
2477 if ([superview isKindOfClass:[
CPClipView class]])
2482 height = MAX(superviewSize.height, height);
2497 - (void)scrollRowToVisible:(
int)rowIndex
2502 visible.origin.y = rowRect.origin.y;
2503 visible.size.height = rowRect.size.height;
2513 - (void)scrollColumnToVisible:(
int)columnIndex
2518 visible.origin.x = colRect.origin.x;
2519 visible.size.width = colRect.size.width;
2522 [_headerView scrollRectToVisible:colRect];
2533 if (_autosaveName === theAutosaveName)
2536 _autosaveName = theAutosaveName;
2539 [
self _restoreFromAutosave];
2547 return _autosaveName;
2556 - (void)setAutosaveTableColumns:(BOOL)shouldAutosave
2558 _autosaveTableColumns = shouldAutosave;
2564 - (BOOL)autosaveTableColumns
2566 return _autosaveTableColumns;
2574 return @"CPTableView Columns " + theAutosaveName;
2580 - (BOOL)_autosaveEnabled
2593 if (![
self _autosaveEnabled])
2602 for (var i = 0; i < [columns count]; i++)
2604 var column = [columns objectAtIndex:i],
2606 @"identifier": [column identifier],
2607 @"width": [column width]
2610 [columnsSetup addObject:metaData];
2613 [userDefaults setObject:columnsSetup forKey:[
self _columnsKeyForAutosaveName:autosaveName]];
2619 - (void)_restoreFromAutosave
2621 if (![
self _autosaveEnabled])
2626 tableColumns = [userDefaults objectForKey:[
self _columnsKeyForAutosaveName:autosaveName]];
2628 if ([tableColumns count] != [[
self tableColumns] count])
2634 columnIdentifier = [metaData objectForKey:@"identifier"],
2640 [
self _moveColumn:column toColumn:i];
2641 [tableColumn setWidth:[metaData objectForKey:@"width"]];
2795 if (_delegate === aDelegate)
2798 _delegate = aDelegate;
2799 _implementedDelegateMethods = 0;
2801 if ([_delegate respondsToSelector:
@selector(selectionShouldChangeInTableView:)])
2804 if ([_delegate respondsToSelector:
@selector(
tableView:viewForTableColumn:row:)])
2806 else if ([_delegate respondsToSelector:
@selector(
tableView:dataViewForTableColumn:row:)])
2809 CPLog.warn(
"tableView:dataViewForTableColumn: is deprecated. You should use -tableView:viewForTableColumn: where you can request the view with -makeViewWithIdentifier:owner:");
2812 [
self _updateIsViewBased];
2814 if ([_delegate respondsToSelector:
@selector(
tableView:didClickTableColumn:)])
2817 if ([_delegate respondsToSelector:
@selector(
tableView:didDragTableColumn:)])
2820 if ([_delegate respondsToSelector:
@selector(
tableView:heightOfRow:)])
2823 if ([_delegate respondsToSelector:
@selector(
tableView:isGroupRow:)])
2826 if ([_delegate respondsToSelector:
@selector(
tableView:mouseDownInHeaderOfTableColumn:)])
2829 if ([_delegate respondsToSelector:
@selector(
tableView:nextTypeSelectMatchFromRow:toRow:forString:)])
2832 if ([_delegate respondsToSelector:
@selector(
tableView:selectionIndexesForProposedSelection:)])
2835 if ([_delegate respondsToSelector:
@selector(
tableView:shouldEditTableColumn:row:)])
2838 if ([_delegate respondsToSelector:
@selector(
tableView:shouldSelectRow:)])
2841 if ([_delegate respondsToSelector:
@selector(
tableView:shouldSelectTableColumn:)])
2844 if ([_delegate respondsToSelector:
@selector(
tableView:shouldShowViewExpansionForTableColumn:row:)])
2847 if ([_delegate respondsToSelector:
@selector(
tableView:shouldTrackView:forTableColumn:row:)])
2850 if ([_delegate respondsToSelector:
@selector(
tableView:shouldTypeSelectForEvent:withCurrentSearchString:)])
2853 if ([_delegate respondsToSelector:
@selector(
tableView:toolTipForView:rect:tableColumn:row:mouseLocation:)])
2856 if ([_delegate respondsToSelector:
@selector(
tableView:typeSelectStringForTableColumn:row:)])
2859 if ([_delegate respondsToSelector:
@selector(
tableView:willDisplayView:forTableColumn:row:)])
2862 if ([_delegate respondsToSelector:
@selector(
tableView:willRemoveView:forTableColumn:row:)])
2865 if ([_delegate respondsToSelector:
@selector(
tableView:menuForTableColumn:row:)])
2868 if ([_delegate respondsToSelector:
@selector(
tableView:shouldReorderColumn:toColumn:)])
2871 if ([_delegate respondsToSelector:
@selector(tableViewColumnDidMove:)])
2874 if ([_delegate respondsToSelector:
@selector(tableViewColumnDidResize:)])
2877 if ([_delegate respondsToSelector:
@selector(tableViewSelectionDidChange:)])
2880 if ([_delegate respondsToSelector:
@selector(tableViewSelectionIsChanging:)])
2895 - (void)_didClickTableColumn:(CPInteger)clickedColumn modifierFlags:(unsigned)modifierFlags
2897 [
self _changeSortDescriptorsForClickOnColumn:clickedColumn];
2899 if (_allowsColumnSelection)
2901 if ([
self _sendDelegateSelectionShouldChangeInTableView] && [
self _sendDelegateShouldSelectTableColumn:clickedColumn])
2903 [
self _noteSelectionIsChanging];
2906 if ([
self isColumnSelected:clickedColumn])
2908 else if ([
self allowsMultipleSelection] == YES)
2916 var startColumn = MIN(clickedColumn, [_selectedColumnIndexes lastIndex]),
2917 endColumn = MAX(clickedColumn, [_selectedColumnIndexes firstIndex]);
2929 [
self _sendDelegateDidClickTableColumn:clickedColumn];
2937 - (void)_changeSortDescriptorsForClickOnColumn:(CPInteger)column
2939 var tableColumn = [_tableColumns objectAtIndex:column],
2940 newMainSortDescriptor = [tableColumn sortDescriptorPrototype];
2942 if (!newMainSortDescriptor)
2945 var oldMainSortDescriptor = nil,
2947 newSortDescriptors = [CPArray arrayWithArray:oldSortDescriptors],
2949 e = [newSortDescriptors objectEnumerator],
2951 outdatedDescriptors = [CPArray array];
2953 if ([_sortDescriptors count] > 0)
2957 while ((descriptor = [e nextObject]) !== nil)
2959 if ([[descriptor key]
isEqual: [newMainSortDescriptor key]])
2960 [outdatedDescriptors addObject:descriptor];
2964 if ([[newMainSortDescriptor key]
isEqual:[oldMainSortDescriptor key]])
2965 newMainSortDescriptor = [oldMainSortDescriptor reversedSortDescriptor];
2967 [newSortDescriptors removeObjectsInArray:outdatedDescriptors];
2968 [newSortDescriptors insertObject:newMainSortDescriptor atIndex:0];
2987 if ([headerView respondsToSelector:
@selector(_setIndicatorImage:)])
2988 [headerView _setIndicatorImage:anImage];
2995 - (
CPImage)_tableHeaderSortImage
2997 return [
self currentValueForThemeAttribute:@"sort-image"];
3003 - (
CPImage)_tableHeaderReverseSortImage
3005 return [
self currentValueForThemeAttribute:@"sort-image-reversed"];
3013 return _currentHighlightedTableColumn;
3021 if (_currentHighlightedTableColumn == aTableColumn)
3026 if (_currentHighlightedTableColumn != nil)
3027 [[_currentHighlightedTableColumn headerView] unsetThemeState:CPThemeStateSelected];
3029 if (aTableColumn != nil)
3033 _currentHighlightedTableColumn = aTableColumn;
3042 - (BOOL)canDragRowsWithIndexes:(
CPIndexSet)rowIndexes atPoint:(CGPoint)mouseDownPoint
3057 - (
CPImage)dragImageForRowsWithIndexes:(
CPIndexSet)dragRows tableColumns:(CPArray)theTableColumns event:(
CPEvent)dragEvent offset:(CGPoint)dragImageOffset
3059 return [
self valueForThemeAttribute:@"image-generic-file"];
3074 - (
CPView)dragViewForRowsWithIndexes:(
CPIndexSet)theDraggedRows tableColumns:(CPArray)theTableColumns event:(
CPEvent)theDragEvent offset:(CGPoint)dragViewOffset
3077 dragView = [[
CPView alloc] initWithFrame:bounds];
3079 [dragView setAlphaValue:0.7];
3084 [
self _enumerateViewsInRows:theDraggedRows tableColumns:theTableColumns usingBlock:function(v, row, tableColumn, stop)
3086 var column = [_tableColumns indexOfObjectIdenticalTo:tableColumn],
3089 [dragView addSubview:newDataView];
3093 dragViewOffset.x = CGRectGetWidth(
bounds) / 2 - dragPoint.x;
3094 dragViewOffset.y = CGRectGetHeight(
bounds) / 2 - dragPoint.y;
3101 var headerFrame = [_headerView frame],
3105 tableColumn = [[
self tableColumns] objectAtIndex:columnIndex],
3106 tableColumnUID = [tableColumn UID],
3107 columnHeaderView = [tableColumn headerView],
3108 columnHeaderFrame = [columnHeaderView frame],
3109 frame = CGRectMake(MAX(CGRectGetMinX(columnRect) - CGRectGetMinX(visibleRect), 0.0),
3111 CGRectGetWidth(columnHeaderFrame),
3112 CGRectGetHeight(visibleRect) + CGRectGetHeight(headerFrame));
3115 var dragView = [[_CPColumnDragDrawingView alloc] initWithFrame:frame];
3117 [dragView setTableView:self];
3118 [dragView setColumnIndex:columnIndex];
3120 [dragView setAlphaValue:0.6];
3123 var columnVisRect = CGRectIntersection(columnRect, visibleRect);
3125 frame = CGRectMake(0.0, CGRectGetHeight(headerFrame), CGRectGetWidth(columnVisRect), CGRectGetHeight(columnVisRect));
3129 [dragView addSubview:columnClipView];
3130 [dragView setColumnClipView:columnClipView];
3133 var columnLeft = CGRectGetMinX(columnRect),
3134 offset = CGPointMake(columnLeft, CGRectGetMinY(visibleRect));
3136 [
self _enumerateViewsInRows:_exposedRows columns:[
CPIndexSet indexSetWithIndex:columnIndex] usingBlock:function(dataView, row, column, stop)
3138 [
self _addDraggedDataView:dataView toView:columnClipView forColumn:column row:row offset:offset];
3140 delete (_dataViewsForRows[row][tableColumnUID]);
3144 columnHeaderFrame.origin = CGPointMakeZero();
3146 var dragColumnHeaderView = [[_CPTableColumnHeaderView alloc] initWithFrame:columnHeaderFrame],
3147 image = [columnHeaderView _indicatorImage];
3149 [dragColumnHeaderView setStringValue:[columnHeaderView stringValue]];
3150 [dragColumnHeaderView setThemeState:[columnHeaderView themeState]];
3151 [dragColumnHeaderView _setIndicatorImage:image];
3154 [dragColumnHeaderView setTag:1];
3156 [dragView addSubview:dragColumnHeaderView];
3159 [_selectedColumnIndexes removeIndex:columnIndex];
3164 - (void)_addDraggedDataView:(
CPView)aDataView toView:(
CPView)aSuperview forColumn:(CPInteger)column row:(CPInteger)row offset:(CGPoint)offset
3168 dataViewFrame.origin.x -= offset.x;
3170 dataViewFrame.origin.y -= offset.y;
3172 [aDataView setFrame:dataViewFrame];
3174 [aSuperview addSubview:aDataView];
3181 - (void)setDraggingSourceOperationMask:(CPDragOperation)mask forLocal:(BOOL)isLocal
3184 _dragOperationDefaultMask = mask;
3192 - (void)setDropRow:(CPInteger)row dropOperation:(CPTableViewDropOperation)operation
3197 reason =
@"Attempt to set dropRow=" + row +
3198 " dropOperation=CPTableViewDropOn when [0 - " + numberOfRows +
"] is valid range of rows.";
3203 _retargetedDropRow = row;
3204 _retargetedDropOperation = operation;
3218 - (void)setDraggingDestinationFeedbackStyle:(CPTableViewDraggingDestinationFeedbackStyle)aStyle
3221 _destinationDragStyle = aStyle;
3234 - (CPTableViewDraggingDestinationFeedbackStyle)draggingDestinationFeedbackStyle
3236 return _destinationDragStyle;
3244 - (void)setVerticalMotionCanBeginDrag:(BOOL)aFlag
3246 _verticalMotionCanDrag = aFlag;
3252 - (BOOL)verticalMotionCanBeginDrag
3254 return _verticalMotionCanDrag;
3261 for (var i = 0; i < [tableColumns count]; i++)
3263 var tableColumn = [tableColumns objectAtIndex:i],
3264 sortDescriptorPrototype = [tableColumn sortDescriptorPrototype];
3266 if (!sortDescriptorPrototype)
3269 if ([sortDescriptorPrototype key] === [theSortDescriptor key]
3270 && [sortDescriptorPrototype selector] === [theSortDescriptor selector])
3284 - (void)setSortDescriptors:(CPArray)sortDescriptors
3287 newSortDescriptors = [CPArray array];
3289 if (sortDescriptors !== nil)
3290 [newSortDescriptors addObjectsFromArray:sortDescriptors];
3292 if ([newSortDescriptors
isEqual:oldSortDescriptors])
3295 _sortDescriptors = newSortDescriptors;
3297 var oldColumn = nil,
3300 if ([newSortDescriptors count] > 0)
3302 var newMainSortDescriptor = [newSortDescriptors objectAtIndex:0];
3303 newColumn = [
self _tableColumnForSortDescriptor:newMainSortDescriptor];
3306 if ([oldSortDescriptors count] > 0)
3308 var oldMainSortDescriptor = [oldSortDescriptors objectAtIndex:0];
3309 oldColumn = [
self _tableColumnForSortDescriptor:oldMainSortDescriptor];
3312 var image = [newMainSortDescriptor ascending] ? [
self _tableHeaderSortImage] : [
self _tableHeaderReverseSortImage];
3316 [
self _sendDataSourceSortDescriptorsDidChange:oldSortDescriptors];
3318 var binderClass = [[
self class] _binderClassForBinding:@"sortDescriptors"];
3319 [[binderClass getBinding:@"sortDescriptors" forObject:self] reverseSetValueFor:@"sortDescriptors"];
3325 - (CPArray)sortDescriptors
3327 return _sortDescriptors;
3333 - (id)_objectValueForTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRowIndex useCache:(BOOL)useCache
3337 var tableColumnUID = [aTableColumn
UID],
3338 tableColumnObjectValues = _objectValues[tableColumnUID];
3340 if (!tableColumnObjectValues)
3342 tableColumnObjectValues = [];
3343 _objectValues[tableColumnUID] = tableColumnObjectValues;
3347 objectValue = tableColumnObjectValues[aRowIndex];
3350 if (objectValue === undefined)
3352 if ([
self _dataSourceRespondsToObjectValueForTableColumn])
3354 objectValue = [
self _sendDataSourceObjectValueForTableColumn:aTableColumn row:aRowIndex];
3355 tableColumnObjectValues[aRowIndex] = objectValue;
3357 else if (!_isViewBased && ![
self infoForBinding:
@"content"])
3359 CPLog.warn(
@"no content binding established and data source " + [_dataSource description] +
" does not implement tableView:objectValueForTableColumn:row:");
3370 - (CGRect)exposedRect
3378 if ([superview isKindOfClass:[
CPClipView class]])
3379 _exposedRect = [superview bounds];
3381 _exposedRect = [
self bounds];
3384 return _exposedRect;
3394 [
self _unloadDataViewsInRows:_exposedRows columns:_exposedColumns];
3399 _reloadAllRows = NO;
3405 obscuredRows = [_exposedRows copy],
3406 obscuredColumns = [_exposedColumns copy];
3408 [obscuredRows removeIndexes:exposedRows];
3409 [obscuredColumns removeIndexes:exposedColumns];
3411 var newlyExposedRows = [exposedRows copy],
3412 newlyExposedColumns = [exposedColumns copy];
3414 [newlyExposedRows removeIndexes:_exposedRows];
3415 [newlyExposedColumns removeIndexes:_exposedColumns];
3417 var previouslyExposedRows = [exposedRows copy],
3418 previouslyExposedColumns = [exposedColumns copy];
3420 [previouslyExposedRows removeIndexes:newlyExposedRows];
3421 [previouslyExposedColumns removeIndexes:newlyExposedColumns];
3423 [
self _unloadDataViewsInRows:previouslyExposedRows columns:obscuredColumns];
3424 [
self _unloadDataViewsInRows:obscuredRows columns:previouslyExposedColumns];
3425 [
self _unloadDataViewsInRows:obscuredRows columns:obscuredColumns];
3426 [
self _unloadDataViewsInRows:newlyExposedRows columns:newlyExposedColumns];
3428 [
self _loadDataViewsInRows:previouslyExposedRows columns:newlyExposedColumns];
3429 [
self _loadDataViewsInRows:newlyExposedRows columns:previouslyExposedColumns];
3430 [
self _loadDataViewsInRows:newlyExposedRows columns:newlyExposedColumns];
3432 _exposedRows = exposedRows;
3433 _exposedColumns = exposedColumns;
3435 [_tableDrawView setFrame:exposedRect];
3441 if (_needsDifferedTableColumnRemove)
3443 var removeCount = [_differedColumnDataToRemove count],
3446 for (var i = 0; i < removeCount; i++)
3448 var data = _differedColumnDataToRemove[i],
3449 tableColumn = data.column,
3450 columnIdx = [_tableColumns indexOfObject:tableColumn];
3453 [removeIndexes addIndex:columnIdx];
3457 [
self _unloadDataViewsInRows:rowIndexes columns:removeIndexes];
3459 [_tableColumns removeObjectsAtIndexes:removeIndexes];
3461 _dirtyTableColumnRangeIndex = 0;
3462 [
self _recalculateTableColumnRanges];
3464 [_differedColumnDataToRemove removeAllObjects];
3465 _needsDifferedTableColumnRemove = NO;
3470 for (var identifier in _cachedDataViews)
3472 var dataViews = _cachedDataViews[identifier],
3473 count = dataViews.length;
3476 [dataViews[count] removeFromSuperview];
3485 if (![rowIndexes count] || ![columnIndexes count] || [columnIndexes lastIndex] >= [_tableColumns count])
3489 if ([columnIndexes containsIndex:_editingColumn] && [rowIndexes containsIndex:_editingRow])
3490 [
self _resignEditedView];
3492 var tableColumns = [_tableColumns objectsAtIndexes:columnIndexes];
3494 [
self _enumerateViewsInRows:rowIndexes tableColumns:tableColumns usingBlock:function(dataView, row, tableColumn, stop)
3496 var dataViewsForRows = _dataViewsForRows[row],
3497 tableColumnUID = [tableColumn UID];
3499 delete (dataViewsForRows[tableColumnUID]);
3501 [
self _sendDelegateWillRemoveView:dataView forTableColumn:tableColumn row:row];
3502 [
self _enqueueReusableDataView:dataView];
3511 if (![rowIndexes count] || ![columnIndexes count])
3516 if (_numberOfHiddenColumns > 0)
3519 return ![_tableColumns[idx] isHidden];
3524 if (!_dataViewsForRows[rowIndex])
3525 _dataViewsForRows[rowIndex] = {};
3527 var dataViewsForRow = _dataViewsForRows[rowIndex],
3533 var tableColumn = _tableColumns[columnIndex],
3534 tableColumnUID = [tableColumn UID],
3535 dataView = [
self _preparedViewAtColumn:columnIndex row:row isRowSelected:isRowSelected];
3537 if ([dataView superview] !== self)
3540 dataViewsForRow[tableColumnUID] = dataView;
3545 - (
CPView)preparedViewAtColumn:(CPInteger)column row:(CPInteger)row
3547 return [
self _preparedViewAtColumn:column row:row isRowSelected:[
self isRowSelected:row]];
3550 - (
CPView)_preparedViewAtColumn:(CPInteger)column row:(CPInteger)row isRowSelected:(BOOL)isRowSelected
3552 var tableColumn = _tableColumns[column],
3553 tableColumnUID = [tableColumn UID],
3554 dataView = [
self _newDataViewForRow:row tableColumn:tableColumn];
3558 [
self _setObjectValueForTableColumn:tableColumn row:row forView:dataView];
3561 _BlockSelectView(dataView, row, column);
3563 _BlockDeselectView(dataView, row, column);
3568 if ([_delegate
tableView:
self isGroupRow:row])
3570 [_groupRows addIndex:row];
3571 [dataView setThemeState:CPThemeStateGroupRow];
3575 [_groupRows removeIndexesInRange:CPMakeRange(row, 1)];
3576 [dataView unsetThemeState:CPThemeStateGroupRow];
3583 [
self _setEditingState:NO forView:dataView];
3585 [
self _sendDelegateWillDisplayView:dataView forTableColumn:tableColumn row:row];
3590 - (void)_setObjectValueForTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRow forView:(
CPView)aDataView
3592 [
self _setObjectValueForTableColumn:aTableColumn row:aRow forView:aDataView useCache:!_invalidateObjectValuesCache];
3595 - (void)_setObjectValueForTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRow forView:(
CPView)aDataView useCache:(BOOL)useCache
3598 [aDataView setObjectValue:[
self _objectValueForTableColumn:aTableColumn row:aRow useCache:useCache]];
3603 if (_contentBindingExplicitlySet)
3604 [
self _prepareContentBindedDataView:aDataView forRow:aRow];
3607 [aTableColumn _prepareDataView:aDataView forRow:aRow];
3610 - (void)_prepareContentBindedDataView:(
CPView)dataView forRow:(CPInteger)aRow
3613 content = [binder content],
3614 rowContent = [content objectAtIndex:aRow];
3616 [dataView setObjectValue:rowContent];
3622 - (void)_layoutViewsForRowIndexes:(
CPIndexSet)rowIndexes columnIndexes:(
CPIndexSet)columnIndexes
3624 [
self _enumerateViewsInRows:rowIndexes columns:columnIndexes usingBlock:function(view, row, column, stop)
3637 if (_viewForTableColumnRowSelector)
3638 view =
self.isa.objj_msgSend2(
self, _viewForTableColumnRowSelector, aTableColumn, aRow);
3654 identifier = [[aTableColumn
dataView] UID];
3658 view = [aTableColumn _newDataView];
3661 [view setIdentifier:identifier];
3679 - (id)makeViewWithIdentifier:(
CPString)anIdentifier owner:(
id)anOwner
3686 reusableViews = _cachedDataViews[anIdentifier];
3688 if (reusableViews && reusableViews.length)
3689 view = reusableViews.pop();
3691 else if (_isViewBased)
3692 view = [
self _unarchiveViewWithIdentifier:anIdentifier owner:anOwner];
3709 - (id)viewAtColumn:(CPInteger)column row:(CPInteger)row makeIfNecessary:(BOOL)makeIfNecessary
3711 if (row > (_numberOfRows - 1))
3713 reason:@"Row " + row + " out of row range [0-" + (_numberOfRows - 1) + "] for rowViewAtRow:createIfNeeded:"];
3717 reason:@"Column " + column + " out of row range [0-" + (NUMBER_OF_COLUMNS ()- 1) + "] for rowViewAtRow:createIfNeeded:"];
3719 var dataViewsForRow = _dataViewsForRows[row],
3720 tableColumn = _tableColumns[column],
3721 tableColumnUID = [tableColumn UID],
3722 view = dataViewsForRow ? dataViewsForRow[tableColumnUID] : nil;
3724 if (!makeIfNecessary)
3729 if (!dataViewsForRow)
3731 dataViewsForRow = {}
3732 _dataViewsForRows[row] = dataViewsForRow;
3740 if ([view superview] !==
self)
3743 dataViewsForRow[tableColumnUID] = view;
3745 [_exposedRows addIndex:row];
3746 [_exposedColumns addIndex:column];
3758 - (
CPView)_unarchiveViewWithIdentifier:(
CPString)anIdentifier owner:(id)anOwner
3760 var cib = [_archivedDataViews objectForKey:anIdentifier];
3762 if (!cib && !_unavailable_custom_cibs[anIdentifier])
3770 _unavailable_custom_cibs[anIdentifier] = YES;
3775 load = [cib instantiateCibWithOwner:anOwner topLevelObjects:objects];
3780 var count = objects.length;
3784 var obj = objects[count];
3786 if ([obj isKindOfClass:[
CPView class]])
3788 [obj setIdentifier:anIdentifier];
3789 [obj setAutoresizingMask:CPViewNotSizable];
3798 - (void)_updateIsViewBased
3800 if ([
self _delegateRespondsToViewForTableColumn])
3801 _viewForTableColumnRowSelector =
@selector(_sendDelegateViewForTableColumn:row:);
3802 else if ([
self _delegateRespondsToDataViewForTableColumn])
3803 _viewForTableColumnRowSelector =
@selector(_sendDelegateDataViewForTableColumn:row:);
3805 _isViewBased = (_viewForTableColumnRowSelector !== nil || _archivedDataViews !== nil);
3823 - (void)enumerateAvailableViewsUsingBlock:(Function)handler
3829 [
self _enumerateViewsInRows:_exposedRows columns:_exposedColumns usingBlock:handler];
3836 - (void)_enumerateViewsInRows:(
CPIndexSet)rowIndexes columns:(
CPIndexSet)columnIndexes usingBlock:(Function)handler
3842 var dataViewsForRow = _dataViewsForRows[rowIndex];
3844 if (!dataViewsForRow)
3851 var tableColumnUID = [_tableColumns[columnIndex] UID],
3852 view = dataViewsForRow[tableColumnUID];
3855 handler(view, row, columnIndex, stopCol);
3863 - (void)_enumerateViewsInRows:(
CPIndexSet)rowIndexes tableColumns:(CPArray)tableColumns usingBlock:(Function)handler
3869 var dataViewsForRow = _dataViewsForRows[rowIndex];
3871 if (!dataViewsForRow)
3876 [
tableColumns enumerateObjectsUsingBlock:function(tableColumn, idx, stopCol)
3878 var tableColumnUID = [tableColumn UID],
3879 view = dataViewsForRow[tableColumnUID];
3882 handler(view, row, tableColumn, stopCol);
3893 - (void)_enqueueReusableDataView:(
CPView)aDataView
3899 var identifier = [aDataView identifier];
3902 [aDataView unsetThemeState:CPThemeStateSelectedDataView];
3904 if (!_cachedDataViews[identifier])
3905 _cachedDataViews[identifier] = [aDataView];
3907 _cachedDataViews[identifier].push(aDataView);
3914 - (void)setFrameSize:(CGSize)aSize
3919 [_headerView setFrameSize:CGSizeMake(CGRectGetWidth([
self frame]), CGRectGetHeight([_headerView frame]))];
3927 - (void)setFrameOrigin:(CGPoint)aPoint
3937 - (void)setBoundsOrigin:(CGPoint)aPoint
3947 - (void)setBoundsSize:(CGSize)aSize
3960 [_tableDrawView setNeedsDisplay:aFlag];
3968 - (void)setNeedsLayout
3985 - (void)_drawRect:(CGRect)aRect
3996 if (_implementsCustomDrawRow)
3997 [
self _drawRows:_exposedRows clipRect:exposedRect];
4005 - (void)drawBackgroundInClipRect:(CGRect)aRect
4007 if (!_usesAlternatingRowBackgroundColors)
4011 colorCount = [rowColors count];
4013 if (colorCount === 0)
4018 if (colorCount === 1)
4026 var exposedRows = [
self _exposedRowsInRect:aRect],
4027 firstRow = FLOOR(exposedRows.location / colorCount) * colorCount,
4033 while (colorIndex < colorCount)
4037 for (var row = firstRow + colorIndex; row <= lastRow; row += colorCount)
4040 if (![_groupRows containsIndex:row])
4041 CGContextAddRect(context, CGRectIntersection(aRect, [
self _rectOfRow:row checkRange:NO]));
4043 groupRowRects.push(CGRectIntersection(aRect, [
self _rectOfRow:row checkRange:NO]));
4054 [
self _drawGroupRowsForRects:groupRowRects];
4061 - (void)drawGridInClipRect:(CGRect)aRect
4065 lineThickness = [
self currentValueForThemeAttribute:@"grid-line-thickness"];
4074 var exposedRows = [
self _exposedRowsInRect:aRect],
4075 row = exposedRows.location,
4077 rowY = -lineThickness / 2,
4078 minX = CGRectGetMinX(aRect),
4079 maxX = CGRectGetMaxX(aRect);
4081 for (; row <= lastRow; ++row)
4084 var rowRect = [
self _rectOfRow:row checkRange:NO],
4085 rowY = CGRectGetMaxY(rowRect) - lineThickness / 2;
4091 if (_rowHeight > 0.0)
4094 totalHeight = CGRectGetMaxY(aRect) - lineThickness / 2;
4096 while (rowY < totalHeight)
4111 [exposedColumnIndexes getIndexes:columnsArray maxCount:-1 inIndexRange:nil];
4113 var columnArrayIndex = 0,
4114 columnArrayCount = columnsArray.length,
4115 minY = CGRectGetMinY(aRect),
4116 maxY = CGRectGetMaxY(aRect);
4118 for (; columnArrayIndex < columnArrayCount; ++columnArrayIndex)
4120 var columnRect = [
self rectOfColumn:columnsArray[columnArrayIndex]],
4121 columnX = CGRectGetMaxX(columnRect) - lineThickness / 2;
4139 - (void)highlightSelectionInClipRect:(CGRect)aRect
4146 rectSelector =
@selector(rectOfRow:);
4148 if ([_selectedRowIndexes count] >= 1)
4151 firstRow = [exposedRows firstIndex],
4152 exposedRange =
CPMakeRange(firstRow, [exposedRows lastIndex] - firstRow + 1);
4154 [_selectedRowIndexes getIndexes:indexes maxCount:-1 inIndexRange:exposedRange];
4156 else if ([_selectedColumnIndexes count] >= 1)
4158 rectSelector =
@selector(rectOfColumn:);
4161 firstColumn = [exposedColumns firstIndex],
4162 exposedRange =
CPMakeRange(firstColumn, [exposedColumns lastIndex] - firstColumn + 1);
4164 [_selectedColumnIndexes getIndexes:indexes maxCount:-1 inIndexRange:exposedRange];
4168 count2 = count = [indexes count];
4175 focused = [
self _isFocused];
4182 topLineColor = [gradientCache objectForKey:CPSourceListTopLineColor],
4183 bottomLineColor = [gradientCache objectForKey:CPSourceListBottomLineColor],
4184 gradientColor = [gradientCache objectForKey:CPSourceListGradient];
4190 if ([_groupRows count])
4194 gradientGroupColor =
CGGradientCreateWithColorComponents(
CGColorSpaceCreateDeviceRGB(), [212.0 / 255.0, 212.0 / 255.0, 212.0 / 255.0, 1.0, 197.0 / 255.0, 197.0 / 255.0, 197.0 / 255.0, 1.0], [0, 1], 2);
4199 var currentIndex = indexes[count],
4200 rowRect = CGRectIntersection(
self.
isa.objj_msgSend1(
self, rectSelector, currentIndex), aRect);
4204 var shouldUseGroupGradient = [_groupRows containsIndex:currentIndex];
4206 if (drawGradient || shouldUseGroupGradient)
4208 var minX = CGRectGetMinX(rowRect),
4209 minY = CGRectGetMinY(rowRect),
4210 maxX = CGRectGetMaxX(rowRect),
4211 maxY = CGRectGetMaxY(rowRect) - deltaHeight;
4216 [normalSelectionHighlightColor setFill];
4224 CGContextDrawLinearGradient(context, (shouldUseGroupGradient) ? gradientGroupColor : gradientColor, rowRect.origin, CGPointMake(minX, maxY), 0);
4240 var radius = [
self currentValueForThemeAttribute:@"selection-radius"];
4244 var minX = CGRectGetMinX(rowRect),
4245 maxX = CGRectGetMaxX(rowRect),
4246 minY = CGRectGetMinY(rowRect),
4247 maxY = CGRectGetMaxY(rowRect);
4264 [normalSelectionHighlightColor setFill];
4272 for (var i = 0; i < count2; i++)
4274 var rect =
self.isa.objj_msgSend1(
self, rectSelector, indexes[i]),
4275 minX = CGRectGetMinX(rect) - 0.5,
4276 maxX = CGRectGetMaxX(rect) - 0.5,
4277 minY = CGRectGetMinY(rect) - 0.5,
4278 maxY = CGRectGetMaxY(rect) - 0.5;
4283 exposedColumnIndexes = [],
4284 firstExposedColumn = [exposedColumns firstIndex],
4285 exposedRange =
CPMakeRange(firstExposedColumn, [exposedColumns lastIndex] - firstExposedColumn + 1);
4287 [exposedColumns getIndexes:exposedColumnIndexes maxCount:-1 inIndexRange:exposedRange];
4289 var exposedColumnCount = [exposedColumnIndexes count];
4291 for (var c = firstExposedColumn; c < exposedColumnCount; c++)
4293 var colRect = [
self rectOfColumn:exposedColumnIndexes[c]],
4294 colX = CGRectGetMaxX(colRect) + 0.5;
4302 if ([indexes containsObject:indexes[i] + 1])
4319 - (void)_drawGroupRowsForRects:(CPArray)rects
4333 199.0 / 255.0, 199.0 / 255.0, 199.0 / 255.0, 1.0], [0, 1], 2),
4338 var rowRect = rects[i];
4344 var minX = CGRectGetMinX(rowRect),
4345 minY = CGRectGetMinY(rowRect),
4346 maxX = CGRectGetMaxX(rowRect),
4347 maxY = CGRectGetMaxY(rowRect);
4369 - (void)_drawRows:(
CPIndexSet)rowsIndexes clipRect:(CGRect)clipRect
4371 var row = [rowsIndexes firstIndex];
4376 row = [rowsIndexes indexGreaterThanIndex:row];
4386 - (void)drawRow:(CPInteger)row clipRect:(CGRect)rect
4395 - (void)layoutSubviews
4403 - (void)viewWillMoveToSuperview:(
CPView)aView
4405 if ([aView isKindOfClass:[
CPClipView class]])
4407 _observedClipView = aView;
4411 [
self _stopObservingClipView];
4412 _observedClipView = nil;
4442 - (BOOL)tracksMouseOutsideOfFrame
4450 - (BOOL)startTrackingAt:(CGPoint)aPoint
4461 if (row < 0 && _allowsEmptySelection)
4463 if ([
self _sendDelegateSelectionShouldChangeInTableView])
4465 var indexSet = [
self _sendDelegateSelectionIndexesForProposedSelection:[
CPIndexSet indexSet]];
4467 [
self _noteSelectionIsChanging];
4473 _selectionAnchorRow = (ABS([_selectedRowIndexes firstIndex] - row) < ABS([_selectedRowIndexes lastIndex] - row)) ?
4474 [_selectedRowIndexes firstIndex] : [_selectedRowIndexes lastIndex];
4476 _selectionAnchorRow = row;
4479 _startTrackingPoint = aPoint;
4480 _startTrackingTimestamp =
new Date();
4482 if ([
self _dataSourceRespondsToSetObjectValueForTableColumnRow])
4483 _trackingPointMovedOutOfClickSlop = NO;
4487 if (row >= 0 && !([
self _dataSourceRespondsToWriteRowsWithIndexesToPasteboard]))
4488 [
self _updateSelectionWithMouseAtRow:row];
4498 if (!([
self _delegateRespondsToMenuForTableColumnRow]))
4504 tableColumn = [[
self tableColumns] objectAtIndex:column];
4506 return [
self _sendDelegateMenuForTableColumn:tableColumn row:row];
4515 if (![_draggedRowIndexes count])
4521 [CPApp sendEvent:anEvent];
4533 - (BOOL)continueTracking:(CGPoint)lastPoint at:(CGPoint)aPoint
4542 if (!_isSelectingSession && [
self _dataSourceRespondsToWriteRowsWithIndexesToPasteboard])
4544 if (row >= 0 && (ABS(_startTrackingPoint.x - aPoint.x) > 3 || (_verticalMotionCanDrag && ABS(_startTrackingPoint.y - aPoint.y) > 3)) ||
4545 ([_selectedRowIndexes containsIndex:row]))
4547 if ([_selectedRowIndexes containsIndex:row])
4555 if ([
self canDragRowsWithIndexes:_draggedRowIndexes atPoint:aPoint] && [
self _sendDataSourceWriteRowsWithIndexes:_draggedRowIndexes toPasteboard:pboard])
4557 var currentEvent = [CPApp currentEvent],
4558 offset = CGPointMakeZero(),
4559 tableColumns = [_tableColumns objectsAtIndexes:_exposedColumns];
4575 view = [[
CPImageView alloc] initWithFrame:CGRectMake(0, 0, [image size].width, [image size].height)];
4576 [view setImage:image];
4579 var
bounds = [view bounds],
4580 viewLocation = CGPointMake(aPoint.x - CGRectGetWidth(bounds) / 2 + offset.x, aPoint.y - CGRectGetHeight(bounds) / 2 + offset.y);
4582 _startTrackingPoint = nil;
4590 else if (ABS(_startTrackingPoint.x - aPoint.x) < 5 && ABS(_startTrackingPoint.y - aPoint.y) < 5)
4594 _isSelectingSession = YES;
4595 if (row >= 0 && row !== _lastTrackedRowIndex)
4597 _lastTrackedRowIndex = row;
4598 [
self _updateSelectionWithMouseAtRow:row];
4601 if ([
self _dataSourceRespondsToSetObjectValueForTableColumnRow]
4602 && !_trackingPointMovedOutOfClickSlop)
4604 var CLICK_SPACE_DELTA = 5.0;
4605 if (ABS(aPoint.x - _startTrackingPoint.x) > CLICK_SPACE_DELTA
4606 || ABS(aPoint.y - _startTrackingPoint.y) > CLICK_SPACE_DELTA)
4608 _trackingPointMovedOutOfClickSlop = YES;
4618 - (void)stopTracking:(CGPoint)lastPoint at:(CGPoint)aPoint mouseIsUp:(BOOL)mouseIsUp
4620 _isSelectingSession = NO;
4622 var CLICK_TIME_DELTA = 1000,
4631 if ([
self _dataSourceRespondsToWriteRowsWithIndexesToPasteboard])
4633 rowIndex = _clickedRow;
4635 if (rowIndex !== -1)
4637 if ([_draggedRowIndexes count] > 0)
4643 _previouslySelectedRowIndexes = [_selectedRowIndexes copy];
4644 [
self _updateSelectionWithMouseAtRow:rowIndex];
4649 if (!_isViewBased && mouseIsUp
4650 && !_trackingPointMovedOutOfClickSlop
4651 && ([[
CPApp currentEvent] clickCount] > 1)
4652 && ([
self _dataSourceRespondsToSetObjectValueForTableColumnRow]
4653 || [
self infoForBinding:
@"content"]))
4659 column = _tableColumns[columnIndex];
4661 if ([column isEditable])
4665 if (rowIndex !== -1)
4667 if ([
self _sendDelegateShouldEditTableColumn:column row:rowIndex])
4679 if ([[
CPApp currentEvent] clickCount] === 2 && _doubleAction)
4686 - (CPDragOperation)draggingEntered:(
id)sender
4689 dropOperation = [
self _proposedDropOperationAtPoint:location],
4690 row = [
self _proposedRowAtPoint:location];
4692 if (_retargetedDropRow !== nil)
4693 row = _retargetedDropRow;
4696 count = [draggedTypes count],
4699 for (; i < count; i++)
4701 if ([[[sender draggingPasteboard] types] containsObject:[draggedTypes objectAtIndex: i]])
4702 return [
self _sendDataSourceValidateDrop:sender proposedRow:row proposedDropOperation:dropOperation];
4711 - (void)draggingExited:(
id)sender
4713 [_dropOperationFeedbackView removeFromSuperview];
4719 - (void)draggingEnded:(
id)sender
4721 [
self _draggingEnded];
4727 - (void)_draggingEnded
4729 _retargetedDropOperation = nil;
4730 _retargetedDropRow = nil;
4732 [_dropOperationFeedbackView removeFromSuperview];
4738 - (BOOL)wantsPeriodicDraggingUpdates
4746 - (CPTableViewDropOperation)_proposedDropOperationAtPoint:(CGPoint)theDragPoint
4748 if (_retargetedDropOperation !== nil)
4749 return _retargetedDropOperation;
4751 var row = [
self _proposedRowAtPoint:theDragPoint],
4756 if ([
self intercellSpacing].height < 5.0)
4757 rowRect = CGRectInset(rowRect, 0.0, 5.0 - [
self intercellSpacing].height);
4762 if (CGRectContainsPoint(rowRect, theDragPoint) && row < _numberOfRows)
4771 - (CPInteger)_proposedRowAtPoint:(CGPoint)dragPoint
4777 bottomPoint = CGRectGetMaxY(rect),
4778 bottomThirty = bottomPoint - ((bottomPoint - CGRectGetMinY(rect)) * 0.3),
4782 row = (CGRectGetMaxY(rect) < dragPoint.y) ? numberOfRows : row;
4783 else if (dragPoint.y > MAX(bottomThirty, bottomPoint - 6))
4786 row = MIN(numberOfRows, row);
4794 - (CGRect)_rectForDropHighlightViewOnRow:(CPInteger)theRowIndex
4796 if (theRowIndex >= [
self numberOfRows])
4799 return [
self _rectOfRow:theRowIndex checkRange:NO];
4805 - (CGRect)_rectForDropHighlightViewBetweenUpperRow:(CPInteger)theUpperRowIndex andLowerRow:(CPInteger)theLowerRowIndex offset:(CGPoint)theOffset
4807 if (theLowerRowIndex > [
self numberOfRows])
4810 return [
self _rectOfRow:theLowerRowIndex checkRange:NO];
4816 - (CPDragOperation)draggingUpdated:(
id)sender
4818 _retargetedDropRow = nil;
4819 _retargetedDropOperation = nil;
4822 dropOperation = [
self _proposedDropOperationAtPoint:location],
4824 row = [
self _proposedRowAtPoint:location],
4825 dragOperation = [
self _sendDataSourceValidateDrop:sender proposedRow:row proposedDropOperation:dropOperation];
4827 if (_retargetedDropRow !== nil)
4828 row = _retargetedDropRow;
4830 if (_retargetedDropOperation !== nil)
4831 dropOperation = _retargetedDropOperation;
4834 row = numberOfRows - 1;
4836 var rect = CGRectMakeZero();
4841 rect = [
self _rectForDropHighlightViewBetweenUpperRow:row - 1 andLowerRow:row offset:location];
4843 rect = [
self _rectForDropHighlightViewOnRow:row];
4845 [_dropOperationFeedbackView setDropOperation:row !== -1 ? dropOperation : CPDragOperationNone];
4846 [_dropOperationFeedbackView setHidden:(dragOperation == CPDragOperationNone)];
4847 [_dropOperationFeedbackView setFrame:rect];
4848 [_dropOperationFeedbackView setCurrentRow:row];
4849 [
self addSubview:_dropOperationFeedbackView];
4851 return dragOperation;
4857 - (BOOL)prepareForDragOperation:(
id)sender
4861 [_dropOperationFeedbackView removeFromSuperview];
4863 return [
self _dataSourceRespondsToValidateDropProposedRowProposedDropOperation];
4869 - (BOOL)performDragOperation:(
id)sender
4872 operation = [
self _proposedDropOperationAtPoint:location],
4873 row = _retargetedDropRow;
4876 var row = [
self _proposedRowAtPoint:location];
4878 return [
self _sendDataSourceAcceptDrop:sender row:row dropOperation:operation];
4884 - (void)concludeDragOperation:(
id)sender
4886 [
self _reloadDataViews];
4893 - (void)draggedView:(
CPImage)aView endedAt:(CGPoint)aLocation operation:(CPDragOperation)anOperation
4895 [
self _draggingEnded];
4902 - (void)_updateSelectionWithMouseAtRow:(CPInteger)aRow
4909 shouldExtendSelection = NO;
4914 if ([_selectedRowIndexes containsIndex:aRow])
4916 newSelection = [_selectedRowIndexes copy];
4918 [newSelection removeIndex:aRow];
4920 else if (_allowsMultipleSelection)
4922 newSelection = [_selectedRowIndexes copy];
4924 [newSelection addIndex:aRow];
4929 else if (_allowsMultipleSelection)
4936 ((_lastSelectedRow == [_selectedRowIndexes lastIndex] && aRow > _lastSelectedRow) ||
4937 (_lastSelectedRow == [_selectedRowIndexes firstIndex] && aRow < _lastSelectedRow));
4939 else if (aRow >= 0 && aRow < _numberOfRows)
4944 if ([newSelection isEqualToIndexSet:_selectedRowIndexes])
4947 if (![
self _sendDelegateSelectionShouldChangeInTableView])
4950 newSelection = [
self _sendDelegateSelectionIndexesForProposedSelection:newSelection];
4952 if (![
self _delegateRespondsToSelectionIndexesForProposedSelection] && [
self _delegateRespondsToShouldSelectRow])
4954 var indexArray = [];
4956 [newSelection getIndexes:indexArray maxCount:-1 inIndexRange:nil];
4958 var indexCount = indexArray.length;
4960 while (indexCount--)
4962 var index = indexArray[indexCount];
4964 if (![
self _sendDelegateShouldSelectRow:index])
4965 [newSelection removeIndex:index];
4969 if ([newSelection count] === 0)
4974 if (!_allowsEmptySelection && [newSelection count] === 0)
4977 if ([newSelection isEqualToIndexSet:_selectedRowIndexes])
4980 [
self _noteSelectionIsChanging];
4983 _lastSelectedRow = [newSelection containsIndex:aRow] ? aRow : [newSelection lastIndex];
4989 - (void)_noteSelectionIsChanging
5003 - (void)_noteSelectionDidChange
5017 - (void)becomeKeyWindow
5025 - (void)resignKeyWindow
5033 - (BOOL)acceptsFirstResponder
5041 - (BOOL)needsPanelToBecomeKey
5051 var hit = [
super hitTest:aPoint];
5056 return [
self _hitTest:hit];
5059 - (id)_hitTest:(
CPView)aView
5064 if ([aView acceptsFirstResponder])
5068 if (![
self isRowSelected:row])
5076 else if (!_isViewBased && [aView isKindOfClass:[
CPControl class]] && ![aView isKindOfClass:[
CPTextField class]])
5080 _editingColumn = column;
5089 - (void)_removeObservers
5094 [
self _stopObservingClipView];
5095 [
super _removeObservers];
5098 - (void)_addObservers
5103 [
self _startObservingClipView];
5104 [
super _addObservers];
5115 [
self _stopObservingFirstResponderForWindow:aWindow];
5118 [
self _startObservingFirstResponderForWindow:aWindow];
5121 - (void)_startObservingClipView
5123 if (!_observedClipView)
5128 [_observedClipView setPostsFrameChangedNotifications:YES];
5129 [_observedClipView setPostsBoundsChangedNotifications:YES];
5131 [defaultCenter addObserver:self
5132 selector:@selector(superviewFrameChanged:)
5133 name:CPViewFrameDidChangeNotification
5134 object:_observedClipView];
5136 [defaultCenter addObserver:self
5137 selector:@selector(superviewBoundsChanged:)
5138 name:CPViewBoundsDidChangeNotification
5139 object:_observedClipView];
5142 - (void)_stopObservingClipView
5144 if (!_observedClipView)
5149 [defaultCenter removeObserver:self
5150 name:CPViewFrameDidChangeNotification
5151 object:_observedClipView];
5153 [defaultCenter removeObserver:self
5154 name:CPViewBoundsDidChangeNotification
5155 object:_observedClipView];
5158 - (void)_startObservingFirstResponderForWindow:(
CPWindow)aWindow
5163 - (void)_stopObservingFirstResponderForWindow:(
CPWindow)aWindow
5177 _editingColumn = column;
5183 [
self _notifyViewDidResignFirstResponder];
5185 [
self _notifyViewDidBecomeFirstResponder];
5188 if (!_isViewBased && _editingRow !==
CPNotFound && [responder isKindOfClass:[
CPTextField class]] && [responder isEditable] && [responder superview] ==
self)
5190 [responder setBezeled:YES];
5191 [
self _registerForEndEditingNote:responder];
5195 - (void)_registerForEndEditingNote:(
CPView)aTextField
5200 - (void)_unregisterForEndEditingNote:(
CPView)aTextField
5209 var textField = [aNote object];
5211 [
self _unregisterForEndEditingNote:textField];
5215 [
self _setEditingState:NO forView:textField];
5216 [
self _commitDataViewObjectValue:textField];
5219 [textField setBezeled:NO];
5221 [
self _resignFirstResponderWithoutSendingAction:textField];
5224 - (void)_resignFirstResponderWithoutSendingAction:(
CPView)aView
5226 var action = [
self _disableActionIfExists:aView];
5231 [aView setAction:action];
5234 - (void)_resignEditedView
5238 if ([view respondsToSelector:
@selector(selectText:)])
5239 [view selectText:nil];
5243 [
self _unregisterForEndEditingNote:view];
5244 [
self _setEditingState:NO forView:view];
5247 [
self _resignFirstResponderWithoutSendingAction:view];
5250 - (SEL)_disableActionIfExists:(
CPView)aView
5255 if ([aView respondsToSelector:
@selector(action)] && (action = [aView action]))
5256 [aView setAction:nil];
5266 - (void)_commitDataViewObjectValue:(
id)aDataView
5268 var editingTableColumn = _tableColumns[_editingColumn];
5271 [_dataSource tableView:self setObjectValue:[aDataView objectValue] forTableColumn:editingTableColumn row:_editingRow];
5275 [editingTableColumn _reverseSetDataView:aDataView forRow:_editingRow];
5281 - (void)_setEditingState:(BOOL)editingState forView:(
CPView)aView
5283 if ([aView respondsToSelector:
@selector(setEditable:)])
5284 [aView setEditable:editingState];
5286 if ([aView respondsToSelector:
@selector(setSelectable:)])
5287 [aView setSelectable:editingState];
5290 [aView setBezeled:editingState];
5302 - (void)editColumn:(CPInteger)columnIndex row:(CPInteger)rowIndex withEvent:(
CPEvent)theEvent select:(BOOL)flag
5304 if (![
self isRowSelected:rowIndex])
5307 [
self _reloadDataViewsSynchronously];
5313 _editingRow = rowIndex;
5316 var editingTableColumnUID = [_tableColumns[_editingColumn] UID],
5317 editingView = _dataViewsForRows[_editingRow][editingTableColumnUID];
5319 [
self _setEditingState:YES forView:editingView];
5323 - (void)observeValueForKeyPath:(
CPString)keyPath ofObject:(
id)object change:(
CPDictionary)change context:(
void)context
5325 if (context ===
"editing" && [
object superview] ===
self)
5327 [object removeObserver:self forKeyPath:keyPath];
5328 [
self _commitDataViewObjectValue:object];
5337 - (CPInteger)editedColumn
5339 return _editingColumn;
5345 - (CPInteger)editedRow
5365 if ([
self numberOfRows] !== 0)
5367 [
self _moveSelectionWithEvent:anEvent upward:(character === CPUpArrowFunctionKey)];
5375 if ([
self _sendDelegateDeleteKeyPressed])
5379 [
super keyDown:anEvent];
5387 - (BOOL)_selectionIsBroken
5397 - (void)_moveSelectionWithEvent:(
CPEvent)theEvent upward:(BOOL)shouldGoUpward
5399 if (![
self _sendDelegateSelectionShouldChangeInTableView])
5404 if ([selectedIndexes count] > 0)
5409 if ([
self _selectionIsBroken])
5411 while ([selectedIndexes containsIndex:i])
5413 shouldGoUpward ? i-- : i++;
5415 _wasSelectionBroken =
true;
5417 else if (_wasSelectionBroken && ((shouldGoUpward && i !== [selectedIndexes firstIndex]) || (!shouldGoUpward && i !== [selectedIndexes lastIndex])))
5419 shouldGoUpward ? i = [selectedIndexes firstIndex] - 1 : i = [selectedIndexes lastIndex];
5420 _wasSelectionBroken =
false;
5424 shouldGoUpward ? i-- : i++;
5431 if ([
self numberOfRows] > 0)
5435 if (i >= [
self numberOfRows] || i < 0)
5438 if ([
self _delegateRespondsToSelectionIndexesForProposedSelection] || [
self _delegateRespondsToShouldSelectRow])
5446 while (!shouldSelect && (i < [
self numberOfRows] && i > 0))
5448 shouldGoUpward ? --i : ++i;
5457 if (extend && [selectedIndexes containsIndex:i])
5460 var differedLastSelectedRow = i;
5463 shouldGoUpward ? i++ : i--;
5465 [selectedIndexes removeIndex:i];
5472 if ([selectedIndexes containsIndex:i])
5474 i = shouldGoUpward ? [selectedIndexes firstIndex] -1 : [selectedIndexes lastIndex] + 1;
5475 i = MIN(MAX(i, 0), [
self numberOfRows] - 1);
5478 [selectedIndexes addIndex:i];
5479 var differedLastSelectedRow = i;
5484 var differedLastSelectedRow = i;
5487 selectedIndexes = [
self _sendDelegateSelectionIndexesForProposedSelection:selectedIndexes];
5492 _lastSelectedRow = differedLastSelectedRow;
5507 - (BOOL)_dataSourceRespondsToObjectValueForTableColumn
5516 - (BOOL)_dataSourceRespondsToWriteRowsWithIndexesToPasteboard
5525 - (BOOL)_dataSourceRespondsToSetObjectValueForTableColumnRow
5534 - (BOOL)_dataSourceRespondsToValidateDropProposedRowProposedDropOperation
5543 - (BOOL)_dataSourceRespondsToNumberOfRowsinTableView
5553 - (int)_sendDataSourceNumberOfRowsInTableView
5558 return [_dataSource numberOfRowsInTableView:self];
5566 - (id)_sendDataSourceObjectValueForTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
5571 return [_dataSource tableView:self objectValueForTableColumn:aTableColumn row:aRowIndex];
5578 - (void)_sendDataSourceSetObjectValue:(
id)anObject forTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
5583 [_dataSource tableView:self setObjectValue:anObject forTableColumn:aTableColumn row:aRowIndex];
5590 - (void)_sendDataSourceSortDescriptorsDidChange:(CPArray)descriptors
5595 [_dataSource tableView:self sortDescriptorsDidChange:descriptors];
5602 - (BOOL)_sendDataSourceAcceptDrop:(
id)info row:(CPInteger)aRowIndex dropOperation:(CPTableViewDropOperation)operation
5607 return [_dataSource tableView:self acceptDrop:info row:aRowIndex dropOperation:operation];
5614 - (CPDragOperation)_sendDataSourceValidateDrop:(
id)info proposedRow:(CPInteger)aRowIndex proposedDropOperation:(CPTableViewDropOperation)operation
5619 return [_dataSource tableView:self validateDrop:info proposedRow:aRowIndex proposedDropOperation:operation];
5631 return [_dataSource tableView:self writeRowsWithIndexes:rowIndexes toPasteboard:pboard];
5637 - (void)draggedImage:(
CPImage)anImage endedAt:(CGPoint)aLocation operation:(CPDragOperation)anOperation
5639 if ([_dataSource respondsToSelector:
@selector(
tableView:didEndDraggedImage:atPosition:operation:)])
5640 [_dataSource
tableView:
self didEndDraggedImage:anImage atPosition:aLocation operation:anOperation];
5645 #pragma mark DataSource methods to implement 5651 - (CPArray)_sendDataSourceNamesOfPromisedFilesDroppedAtDestination:(
CPURL)dropDestination forDraggedRowsWithIndexes:(
CPIndexSet)indexSet
5656 return [_dataSource tableView:self namesOfPromisedFilesDroppedAtDestination:dropDestination forDraggedRowsWithIndexes:indexSet];
5668 - (BOOL)_delegateRespondsToDataViewForTableColumn
5677 - (BOOL)_delegateRespondsToViewForTableColumn
5686 - (BOOL)_delegateRespondsToShouldSelectRow
5695 - (BOOL)_delegateRespondsToSelectionShouldChangeInTableView
5704 - (BOOL)_delegateRespondsToSelectionIndexesForProposedSelection
5713 - (BOOL)_delegateRespondsToMenuForTableColumnRow
5722 - (void)_sendDelegateDidClickTableColumn:(CPInteger)column
5725 [_delegate tableView:self didClickTableColumn:_tableColumns[column]];
5732 - (void)_sendDelegateDidDragTableColumn:(CPInteger)column
5735 [_delegate tableView:self didDragTableColumn:_tableColumns[column]];
5742 - (void)_sendDelegateMouseDownInHeaderOfTableColumn:(CPInteger)column
5745 [_delegate tableView:self mouseDownInHeaderOfTableColumn:_tableColumns[column]];
5752 - (BOOL)_sendDelegateDeleteKeyPressed
5754 if ([_delegate respondsToSelector:
@selector(tableViewDeleteKeyPressed:)])
5756 [_delegate tableViewDeleteKeyPressed:self];
5767 - (BOOL)_sendDelegateSelectionShouldChangeInTableView
5772 return [_delegate selectionShouldChangeInTableView:self];
5779 - (BOOL)_sendDelegateIsGroupRow:(CPInteger)anIndex
5784 return [_delegate tableView:self isGroupRow:anIndex];
5791 - (BOOL)_sendDelegateShouldSelectRow:(CPInteger)anIndex
5796 return [_delegate tableView:self shouldSelectRow:anIndex];
5803 - (void)_sendDelegateWillDisplayView:(
id)aCell forTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
5808 [_delegate tableView:self willDisplayView:aCell forTableColumn:aTableColumn row:aRowIndex];
5815 - (void)_sendDelegateWillRemoveView:(
id)aCell forTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
5820 [_delegate tableView:self willRemoveView:aCell forTableColumn:aTableColumn row:aRowIndex];
5832 return [_delegate tableView:self menuForTableColumn:aTableColumn row:aRowIndex];
5841 - (BOOL)_sendDelegateShouldReorderColumn:(CPInteger)
columnIndex toColumn:(CPInteger)newColumnIndex
5843 if ([
self allowsColumnReordering] &&
5846 return [_delegate tableView:self shouldReorderColumn:columnIndex toColumn:newColumnIndex];
5856 - (float)_sendDelegateHeightOfRow:(CPInteger)anIndex
5859 return [
self rowHeight];
5861 return [_delegate tableView:self heightOfRow:anIndex];
5868 - (BOOL)_sendDelegateShouldEditTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
5873 return [_delegate tableView:self shouldEditTableColumn:aTableColumn row:aRowIndex];
5885 return [_delegate tableView:self selectionIndexesForProposedSelection:anIndexSet];
5892 - (
CPView)_sendDelegateViewForTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
5897 return [_delegate tableView:self viewForTableColumn:aTableColumn row:aRowIndex];
5904 - (
CPView)_sendDelegateDataViewForTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
5909 return [_delegate tableView:self dataViewForTableColumn:aTableColumn row:aRowIndex];
5914 #pragma mark Delegate methods to implement 5920 - (BOOL)_sendDelegateShouldSelectTableColumn:(
CPTableColumn)aTableColumn
5925 return [_delegate tableView:self shouldSelectTableColumn:aTableColumn];
5932 - (
CPString)_sendDelegateToolTipForView:(
id)aView rect:(CGRect)aRect tableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRowIndex mouseLocation:(CGPoint)aPoint
5937 return [_delegate tableView:self toolTipForView:aView rect:aRect tableColumn:aTableColumn row:aRowIndex mouseLocation:aPoint];
5944 - (BOOL)_sendDelegateShouldTrackView:(
id)aView forTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
5949 return [_delegate tableView:self shouldTrackView:aView forTableColumn:aTableColumn row:aRowIndex];
5956 - (BOOL)_sendDelegateShouldShowViewExpansionForTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
5961 return [_delegate tableView:self shouldShowViewExpansionForTableColumn:aTableColumn row:aRowIndex];
5968 - (BOOL)_sendDelegateShouldTypeSelectForEvent:(
CPEvent)anEvent withCurrentSearchString:(
CPString)aString
5973 return [_delegate tableView:self shouldTypeSelectForEvent:anEvent withCurrentSearchString:aString];
5980 - (
CPString)_sendDelegateTypeSelectStringForTableColumn:(
CPTableColumn)aTableColumn row:(CPInteger)aRowIndex
5985 return [_delegate tableView:self typeSelectStringForTableColumn:aTableColumn row:aRowIndex];
5992 - (int)_sendDelegateNextTypeSelectMatchFromRow:(CPInteger)aRowIndex toRow:(CPInteger)aSecondRowIndex forString:(
CPString)aString
5997 return [_delegate tableView:self nextTypeSelectMatchFromRow:aRowIndex toRow:aSecondRowIndex forString:aString];
6004 + (Class)_binderClassForBinding:(
CPString)aBinding
6006 if (aBinding ==
@"content")
6009 return [
super _binderClassForBinding:aBinding];
6017 if (aBinding ===
@"selectionIndexes")
6018 return @"selectedRowIndexes";
6020 return [
super _replacementKeyPathForBinding:aBinding];
6026 - (void)_establishBindingsIfUnbound:(
id)destination
6030 [
super bind:@"content" toObject:destination withKeyPath:@"arrangedObjects" options:nil];
6031 _contentBindingExplicitlySet = NO;
6035 if (!_contentBindingExplicitlySet)
6037 if ([[
self infoForBinding:
@"selectionIndexes"] objectForKey:
CPObservedObjectKey] !== destination)
6040 if ([[
self infoForBinding:
@"sortDescriptors"] objectForKey:
CPObservedObjectKey] !== destination)
6047 if (aBinding ==
@"content")
6048 _contentBindingExplicitlySet = YES;
6050 [
super bind:aBinding toObject:anObject withKeyPath:aKeyPath options:options];
6063 var destination = [_info objectForKey:CPObservedObjectKey],
6064 keyPath = [_info objectForKey:CPObservedKeyPathKey];
6066 _content = [destination valueForKey:keyPath];
6068 [_source _reloadDataViews];
6105 _allowsColumnReordering = [aCoder decodeBoolForKey:CPTableViewColumnReorderingKey];
6106 _allowsColumnResizing = [aCoder decodeBoolForKey:CPTableViewColumnResizingKey];
6107 _allowsMultipleSelection = [aCoder decodeBoolForKey:CPTableViewMultipleSelectionKey];
6108 _allowsEmptySelection = [aCoder decodeBoolForKey:CPTableViewEmptySelectionKey];
6109 _allowsColumnSelection = [aCoder decodeBoolForKey:CPTableViewColumnSelectionKey];
6112 _selectionHighlightStyle = [aCoder decodeIntForKey:CPTableViewSelectionHighlightStyleKey];
6113 _columnAutoResizingStyle = [aCoder decodeIntForKey:CPTableViewColumnAutoresizingStyleKey];
6115 _tableColumns = [aCoder decodeObjectForKey:CPTableViewTableColumnsKey] || [];
6116 [_tableColumns makeObjectsPerformSelector:@selector(setTableView:) withObject:self];
6118 _rowHeight = [aCoder decodeFloatForKey:CPTableViewRowHeightKey] || [
self valueForThemeAttribute:@"default-row-height"];
6119 _intercellSpacing = [aCoder decodeSizeForKey:CPTableViewIntercellSpacingKey];
6121 if (CGSizeEqualToSize(_intercellSpacing, CGSizeMakeZero()))
6122 _intercellSpacing = CGSizeMake(3.0, 2.0);
6124 [
self setGridColor:[aCoder decodeObjectForKey:CPTableViewGridColorKey]];
6125 _gridStyleMask = [aCoder decodeIntForKey:CPTableViewGridStyleMaskKey];
6127 _usesAlternatingRowBackgroundColors = [aCoder decodeObjectForKey:CPTableViewUsesAlternatingBackgroundKey];
6130 _headerView = [aCoder decodeObjectForKey:CPTableViewHeaderViewKey];
6131 _cornerView = [aCoder decodeObjectForKey:CPTableViewCornerViewKey];
6133 [
self setDataSource:[aCoder decodeObjectForKey:CPTableViewDataSourceKey]];
6134 [
self setDelegate:[aCoder decodeObjectForKey:CPTableViewDelegateKey]];
6139 _archivedDataViews = [aCoder decodeObjectForKey:CPTableViewArchivedReusableViewsKey];
6141 [
self _updateIsViewBased];
6146 [
self setAutosaveName:[aCoder decodeObjectForKey:CPTableViewAutosaveNameKey]];
6159 [_tableDrawView removeFromSuperview];
6161 [aCoder encodeObject:_dataSource forKey:CPTableViewDataSourceKey];
6162 [aCoder encodeObject:_delegate forKey:CPTableViewDelegateKey];
6164 [aCoder encodeFloat:_rowHeight forKey:CPTableViewRowHeightKey];
6165 [aCoder encodeSize:_intercellSpacing forKey:CPTableViewIntercellSpacingKey];
6167 [aCoder encodeInt:_selectionHighlightStyle forKey:CPTableViewSelectionHighlightStyleKey];
6168 [aCoder encodeInt:_columnAutoResizingStyle forKey:CPTableViewColumnAutoresizingStyleKey];
6170 [aCoder encodeBool:_allowsMultipleSelection forKey:CPTableViewMultipleSelectionKey];
6171 [aCoder encodeBool:_allowsEmptySelection forKey:CPTableViewEmptySelectionKey];
6172 [aCoder encodeBool:_allowsColumnReordering forKey:CPTableViewColumnReorderingKey];
6173 [aCoder encodeBool:_allowsColumnResizing forKey:CPTableViewColumnResizingKey];
6174 [aCoder encodeBool:_allowsColumnSelection forKey:CPTableViewColumnSelectionKey];
6176 [aCoder encodeObject:_tableColumns forKey:CPTableViewTableColumnsKey];
6178 [aCoder encodeObject:[
self gridColor] forKey:CPTableViewGridColorKey];
6179 [aCoder encodeInt:_gridStyleMask forKey:CPTableViewGridStyleMaskKey];
6181 [aCoder encodeBool:_usesAlternatingRowBackgroundColors forKey:CPTableViewUsesAlternatingBackgroundKey];
6184 [aCoder encodeObject:_cornerView forKey:CPTableViewCornerViewKey];
6185 [aCoder encodeObject:_headerView forKey:CPTableViewHeaderViewKey];
6187 [aCoder encodeObject:_autosaveName forKey:CPTableViewAutosaveNameKey];
6189 if (_archivedDataViews)
6190 [aCoder encodeObject:_archivedDataViews forKey:CPTableViewArchivedReusableViewsKey];
6195 @implementation _CPDropOperationDrawingView :
CPView 6197 unsigned dropOperation;
6203 - (void)drawRect:(CGRect)aRect
6216 borderColor = [tableView valueForThemeAttribute:@"dropview-on-border-color"];
6217 borderWidth = [tableView valueForThemeAttribute:@"dropview-on-border-width"];
6227 var selectedRows = [tableView selectedRowIndexes],
6228 newRect = CGRectMake(aRect.origin.x + 2, aRect.origin.y + 2, aRect.size.width - 4, aRect.size.height - 5);
6232 borderRadius = [tableView valueForThemeAttribute:@"dropview-on-selected-border-radius"];
6233 borderColor = [tableView valueForThemeAttribute:@"dropview-on-selected-border-color"];
6234 borderWidth = [tableView valueForThemeAttribute:@"dropview-on-selected-border-width"];
6235 backgroundColor = [tableView valueForThemeAttribute:@"dropview-on-selected-background-color"];
6239 borderRadius = [tableView valueForThemeAttribute:@"dropview-on-border-radius"];
6240 borderColor = [tableView valueForThemeAttribute:@"dropview-on-border-color"];
6241 borderWidth = [tableView valueForThemeAttribute:@"dropview-on-border-width"];
6242 backgroundColor = [tableView valueForThemeAttribute:@"dropview-on-background-color"];
6255 [
self setFrameOrigin:CGPointMake(_frame.origin.x, _frame.origin.y - 8)];
6257 var selectedRows = [tableView selectedRowIndexes];
6261 borderColor = [tableView valueForThemeAttribute:@"dropview-above-selected-border-color"];
6262 borderWidth = [tableView valueForThemeAttribute:@"dropview-above-selected-border-width"];
6266 borderColor = [tableView valueForThemeAttribute:@"dropview-above-border-color"];
6267 borderWidth = [tableView valueForThemeAttribute:@"dropview-above-border-width"];
6288 var showCallback =
function()
6290 [
self setHidden: NO];
6294 var hideCallback =
function()
6296 [
self setHidden: YES];
6300 [
self setHidden: YES];
6309 @implementation _CPColumnDragDrawingView :
CPView 6316 - (void)drawRect:(CGRect)dirtyRect
6319 columnRect = [tableView rectOfColumn:columnIndex],
6321 bounds = [columnClipView bounds],
6322 visibleRect = [tableView visibleRect],
6323 xScroll = CGRectGetMinX(visibleRect),
6324 yScroll = CGRectGetMinY(visibleRect);
6332 bounds.origin.x = CGRectGetMinX(columnRect) - xScroll;
6333 bounds.size.height += yScroll;
6346 [tableView highlightSelectionInClipRect:bounds];
6350 var minX = CGRectGetMinX(
bounds) + 0.5,
6351 maxX = CGRectGetMaxX(
bounds) - 0.5;
6378 - (void)awakeFromCib
6380 [
super awakeFromCib];
6396 - (void)recursivelyPerformSelector:(
SEL)selector withObject:(
id)anObject startingFrom:(
id)aView
6398 [[aView subviews] enumerateObjectsUsingBlock:function(view, idx)
6400 [view performSelector:selector withObject:anObject];
6402 if (![view isKindOfClass:[
self class]])
6409 return "<" + [
self className] +
" 0x" + [
CPString stringWithHash:[
self UID]] +
" identifier=" + [
self identifier] +
">";
6419 - (BOOL)disableAutomaticResizing
6421 return _disableAutomaticResizing;
6427 - (void)setDisableAutomaticResizing:(BOOL)aValue
6429 _disableAutomaticResizing = aValue;
6447 - (void)setContent:(
id)aValue
6461 return _objectValue;
6467 - (void)setObjectValue:(
id)aValue
6469 _objectValue = aValue;
6485 _textField = aValue;
6501 _imageView = aValue;
CPColor selectionHighlightColor()
CPColor unfocusedSelectionHighlightColor()
var CPTableViewDelegate_tableView_shouldReorderColumn_toColumn_
Used to implement exception handling (creating & raising).
var CPTableViewDelegate_tableView_shouldEditTableColumn_row_
function CGContextTranslateCTM(aContext, tx, ty)
CPTableViewSolidHorizontalGridLineMask
global CPApp CPTableViewColumnDidMoveNotification
BOOL makeFirstResponder:(CPResponder aResponder)
#define FULL_ROW_HEIGHT()
void getColumn:row:forView:(Function columnRef, [row] Function rowRef, [forView] CPView aView)
function CGGradientCreateWithColorComponents(aColorSpace, components, locations, count)
function CGContextStrokeEllipseInRect(aContext, aRect)
function CGColorSpaceCreateDeviceRGB()
void drawGridInClipRect:(CGRect aRect)
var CPTableViewDataSource_numberOfRowsInTableView_
CPIndexSet selectedRowIndexes()
void addSubview:(CPView aSubview)
void dragView:at:offset:event:pasteboard:source:slideBack:(CPView aView, [at] CGPoint aLocation, [offset] CGSize mouseOffset, [event] CPEvent anEvent, [pasteboard] CPPasteboard aPasteboard, [source] id aSourceObject, [slideBack] BOOL slideBack)
A CALayer is similar to a CPView
var CPTableViewDelegate_tableView_shouldSelectRow_
CPColor colorWithHexString:(string hex)
void setAutosaveTableColumns:(BOOL shouldAutosave)
BOOL setThemeState:(ThemeState aState)
var CPTableViewDataSource_tableView_sortDescriptorsDidChange_
var CPTableViewDelegate_tableView_dataViewForTableColumn_row_
CGRect frameOfDataViewAtColumn:row:(CPInteger aColumn, [row] CPInteger aRow)
void setGridColor:(CPColor aColor)
void setAutosaveName:(CPString theAutosaveName)
void trackMouse:(CPEvent anEvent)
var CPTableViewCornerViewKey
function CGContextAddArcToPoint(aContext, x1, y1, x2, y2, radius)
A representation of a single point in time.
CPGraphicsContext currentContext()
void postNotificationName:object:userInfo:(CPString aNotificationName, [object] id anObject, [userInfo] CPDictionary aUserInfo)
CPIndexSet indexesPassingTest:(Function/*(int anIndex)*/aPredicate)
An object representation of nil.
CPArray sortDescriptors()
CPInteger columnWithIdentifier:(CPString anIdentifier)
void setGridStyleMask:(unsigned aGrideStyleMask)
var CPTableViewDelegate_tableView_didClickTableColumn_
CPDragOperation CPDragOperationNone
CGSize intercellSpacing()
var CPTableViewGridColorKey
BOOL setThemeState:(ThemeState aState)
CPTableViewFirstColumnOnlyAutoresizingStyle
function CGContextDrawLinearGradient(aContext, aGradient, aStartPoint, anEndPoint, options)
void setHighlightedTableColumn:(CPTableColumn aTableColumn)
BOOL autoscroll:(CPEvent anEvent)
#define ROW_BOTTOM(__heightInfo)
The main run loop for the application.
function CGContextSetStrokeColor(aContext, aColor)
void recursivelyPerformSelector:withObject:startingFrom:(SEL selector, [withObject] id anObject, [startingFrom] id aView)
void deselectColumn:(CPInteger anIndex)
var CPTableViewMultipleSelectionKey
void addObserver:selector:name:object:(id anObserver, [selector] SEL aSelector, [name] CPString aNotificationName, [object] id anObject)
unsigned mouseDownFlags()
CPResponder firstResponder()
var CPTableViewSelectionHighlightStyleKey
CGPoint locationInWindow()
CPInteger indexGreaterThanOrEqualToIndex:(CPInteger anIndex)
BOOL autosaveTableColumns()
var CPTableViewColumnResizingKey
BOOL isColumnSelected:(CPInteger anIndex)
id initWithFrame:(CGRect aFrame)
var CPTableViewDelegate_tableView_selectionIndexesForProposedSelection_
void raise:reason:(CPString aName, [reason] CPString aReason)
var CPTableViewDataSource_tableView_validateDrop_proposedRow_proposedDropOperation_
var CPTableViewDelegate_tableView_shouldSelectTableColumn_
CPArray registeredDraggedTypes()
#define NUMBER_OF_COLUMNS()
A collection of unique integers.
CPString charactersIgnoringModifiers()
void setHidden:(BOOL shouldBeHidden)
void viewWillMoveToWindow:(CPWindow aWindow)
CPTimer scheduledTimerWithTimeInterval:callback:repeats:(CPTimeInterval seconds, [callback] Function aFunction, [repeats] BOOL shouldRepeat)
void reloadDataForRowIndexes:columnIndexes:(CPIndexSet rowIndexes, [columnIndexes] CPIndexSet columnIndexes)
CPView hitTest:(CGPoint aPoint)
CPColor unfocusedSelectionGradientColors()
function CGContextAddLineToPoint(aContext, x, y)
var CPTableViewIntercellSpacingKey
var CPTableViewTableColumnsKey
void setValue:forThemeAttribute:(id aValue, [forThemeAttribute] CPString aName)
var CPTableViewDataSourceKey
function CGContextStrokePath(aContext)
var CPTableViewDelegate_tableView_typeSelectStringForTableColumn_row_
CPTableViewSelectionIsChangingNotification
CPNotificationCenter defaultCenter()
A mutable key-value pair collection.
CPScrollView enclosingScrollView()
var CPTableViewDelegate_tableViewColumnDidMove_
id standardUserDefaults()
function ThemeState(stateNames)
function CGContextSetLineWidth(aContext, aLineWidth)
void setUsesAlternatingRowBackgroundColors:(BOOL shouldUseAlternatingRowBackgroundColors)
CPRunLoop currentRunLoop()
function CGContextClosePath(aContext)
CPTableViewDraggingDestinationFeedbackStyleSourceList
var CPTableViewDataSource_tableView_setObjectValue_forTableColumn_row_
void setBoundsOrigin:(CGPoint aPoint)
function CGColorCreate(aColorSpace, components)
var CPTableViewDelegate_tableView_willDisplayView_forTableColumn_row_
id initWithIndexSet:(CPIndexSet anIndexSet)
CGRect rectOfColumn:(CPInteger aColumnIndex)
void selectRowIndexes:byExtendingSelection:(CPIndexSet rows, [byExtendingSelection] BOOL shouldExtendSelection)
var CPTableViewDelegate_tableView_mouseDownInHeaderOfTableColumn_
void setSortDescriptors:(CPArray sortDescriptors)
void setNeedsDisplay:(BOOL aFlag)
var CPTableViewDelegate_tableView_willRemoveView_forTableColumn_row_
CPTableColumn tableColumnWithIdentifier:(CPString anIdentifier)
void viewWillMoveToSuperview:(CPView aView)
void viewWillMoveToSuperview:(CPView aView)
var CPTableViewRowHeightKey
CPTableViewSequentialColumnAutoresizingStyle
CPTableViewSelectionHighlightStyleRegular
void resizeWithOldSuperviewSize:(CGSize aSize)
var CPTableViewDelegate_tableView_didDragTableColumn_
id initWithName:object:userInfo:(CPString aNotificationName, [object] id anObject, [userInfo] CPDictionary aUserInfo)
function CPMaxRange(aRange)
An immutable string (collection of characters).
CGPoint convertPoint:fromView:(CGPoint aPoint, [fromView] CPView aView)
void setTableView:(CPTableView aTableView)
BOOL isRowSelected:(CPInteger aRow)
void setFrameSize:(CGSize aSize)
CPInteger indexGreaterThanIndex:(CPInteger anIndex)
void drawRow:clipRect:(CPInteger row, [clipRect] CGRect rect)
CPDictionary selectionGradientColors()
var CPTableViewDataSource_tableView_writeRowsWithIndexes_toPasteboard_
CPInteger columnAtPoint:(CGPoint aPoint)
void highlightSelectionInClipRect:(CGRect aRect)
function CGContextSetAlpha(aContext, anAlpha)
BOOL sendAction:to:(SEL anAction, [to] id anObject)
function CPFeatureIsCompatible(aFeature)
CPColor colorWithCalibratedWhite:alpha:(float white, [alpha] float alpha)
id initWithCoder:(CPCoder aCoder)
void addIndex:(CPInteger anIndex)
CPColor colorWithRed:green:blue:alpha:(float red, [green] float green, [blue] float blue, [alpha] float alpha)
Holds attributes necessary to describe how to sort a set of objects.
var CPTableViewDelegate_tableView_isGroupRow_
function CGContextSetFillColor(aContext, aColor)
CPBinder getBinding:forObject:(CPString aBinding, [forObject] id anObject)
CPTableColumnAutoresizingMask
void setNeedsDisplay:(BOOL aFlag)
CPView dragViewForRowsWithIndexes:tableColumns:event:offset:(CPIndexSet theDraggedRows, [tableColumns] CPArray theTableColumns, [event] CPEvent theDragEvent, [offset] CGPoint dragViewOffset)
CPMenu menuForEvent:(CPEvent anEvent)
CPTableViewNoColumnAutoresizing
CPInteger rowAtPoint:(CGPoint aPoint)
void enumerateIndexesUsingBlock:(Function/*(int idx,@ref BOOL stop)*/aFunction)
void addObserver:forKeyPath:options:context:(id anObserver, [forKeyPath] CPString aPath, [options] CPKeyValueObservingOptions options, [context] id aContext)
var CPTableViewDataSource_tableView_namesOfPromisedFilesDroppedAtDestination_forDraggedRowsWithIndexes_
var CPTableViewEmptySelectionKey
function CGContextStrokeRoundedRectangleInRect(aContext, aRect, aRadius, ne, se, sw, nw)
function CGContextBeginPath(aContext)
id stringWithHash:(unsigned aHash)
CPView preparedViewAtColumn:row:(CPInteger column, [row] CPInteger row)
void setDelegate:(id< CPTableViewDelegate > aDelegate)
CPColor backgroundColor()
CPThemeStateSelectedDataView
A notification that can be posted to a CPNotificationCenter.
var CPTableViewArchivedReusableViewsKey
void selectColumnIndexes:byExtendingSelection:(CPIndexSet columns, [byExtendingSelection] BOOL shouldExtendSelection)
CPDate limitDateForMode:(CPString aMode)
CPTableViewLastColumnOnlyAutoresizingStyle
id makeViewWithIdentifier:owner:(CPString anIdentifier, [owner] id anOwner)
var CPTableViewDelegateKey
var CPTableViewDataSource_tableView_objectValueForTableColumn_row_
var CPTableViewGridStyleMaskKey
CPColor colorWithHue:saturation:brightness:(float hue, [saturation] float saturation, [brightness] float brightness)
var CPTableViewDelegate_tableViewSelectionIsChanging_
CPTableViewSelectionDidChangeNotification
var CPTableViewDelegate_tableViewColumnDidResize_
void noteHeightOfRowsWithIndexesChanged:(CPIndexSet anIndexSet)
var CPTableViewDelegate_tableView_shouldTypeSelectForEvent_withCurrentSearchString_
A timer object that can send a message after the given time interval.
Defines methods for use when archiving & restoring (enc/decoding).
void editColumn:row:withEvent:select:(CPInteger columnIndex, [row] CPInteger rowIndex, [withEvent] CPEvent theEvent, [select] BOOL flag)
function CGContextStrokeRect(aContext, aRect)
BOOL unsetThemeState:(ThemeState aState)
BOOL allowsColumnReordering()
Sends messages (CPNotification) between objects.
CPIndexSet selectedColumnIndexes()
#define HAS_VARIABLE_ROW_HEIGHTS()
var CPTableViewDelegate_tableView_shouldTrackView_forTableColumn_row_
void setIndicatorImage:inTableColumn:(CPImage anImage, [inTableColumn] CPTableColumn aTableColumn)
CPImage dragImageForRowsWithIndexes:tableColumns:event:offset:(CPIndexSet dragRows, [tableColumns] CPArray theTableColumns, [event] CPEvent dragEvent, [offset] CGPoint dragImageOffset)
var CPTableViewDelegate_tableViewSelectionDidChange_
#define UPDATE_COLUMN_RANGES_IF_NECESSARY()
var CPTableViewAutosaveNameKey
void setBackgroundColor:(CPColor aColor)
var CPTableViewDelegate_selectionShouldChangeInTableView_
void setBoundsSize:(CGSize aSize)
function CGContextFillRoundedRectangleInRect(aContext, aRect, aRadius, ne, se, sw, nw)
void scrollColumnToVisible:(int columnIndex)
CPBundle bundleForClass:(Class aClass)
void setFrameSize:(CGSize aSize)
var CPTableViewColumnSelectionKey
void sizeLastColumnToFit()
function CGContextFillRect(aContext, aRect)
void bind:toObject:withKeyPath:options:(CPString aBinding, [toObject] id anObject, [withKeyPath] CPString aKeyPath, [options] CPDictionary options)
var CPTableViewColumnReorderingKey
CPTableViewSelectionHighlightStyleNone
var CPTableViewDelegate_tableView_toolTipForView_rect_tableColumn_row_mouseLocation_
var CPTableViewHeaderViewKey
var CPTableViewDataSource_tableView_acceptDrop_row_dropOperation_
void removeObserver:name:object:(id anObserver, [name] CPString aNotificationName, [object] id anObject)
id indexSetWithIndexesInRange:(CPRange aRange)
CPTableViewUniformColumnAutoresizingStyle
var CPTableViewUsesAlternatingBackgroundKey
var CPTableViewDelegate_tableView_heightOfRow_
CPTableViewSelectionHighlightStyleSourceList
CGRect rectOfRow:(CPInteger aRowIndex)
void drawBackgroundInClipRect:(CGRect aRect)
CPArray alternatingRowBackgroundColors()
var CPTableViewDelegate_tableView_nextTypeSelectMatchFromRow_toRow_forString_
void draggedImage:endedAt:operation:(CPImage anImage, [endedAt] CGPoint aLocation, [operation] CPDragOperation anOperation)
var CPTableViewDelegate_tableViewMenuForTableColumn_row_
void removeIndexes:(CPIndexSet anIndexSet)
void setAlternatingRowBackgroundColors:(CPArray alternatingRowBackgroundColors)
CPRange rowsInRect:(CGRect aRect)
void scrollRowToVisible:(int rowIndex)
CPIndexSet columnIndexesInRect:(CGRect aRect)
void removeIndex:(CPInteger anIndex)
BOOL isEqualToIndexSet:(CPIndexSet anIndexSet)
BOOL scrollRectToVisible:(CGRect aRect)
function CGContextFillPath(aContext)
void setCornerView:(CPView aView)
void setDataSource:(id< CPTableViewDataSource > aDataSource)
id indexSetWithIndex:(int anIndex)
var CPTableViewAlternatingRowColorsKey
var CPTableViewDelegate_tableView_viewForTableColumn_row_
function CGContextMoveToPoint(aContext, x, y)
void encodeWithCoder:(CPCoder aCoder)
void setFrameOrigin:(CGPoint aPoint)
void setHeaderView:(CPView aHeaderView)
CPTableViewReverseSequentialColumnAutoresizingStyle
CPRange function CPMakeRange(location, length)
id initWithCibNamed:bundle:(CPString aName, [bundle] CPBundle aBundle)
function CGContextAddRect(aContext, aRect)
var CPTableViewDelegate_tableView_shouldShowViewExpansionForTableColumn_row_
void noteNumberOfRowsChanged()
id pasteboardWithName:(CPString aName)
CPException exceptionWithName:reason:userInfo:(CPString aName, [reason] CPString aReason, [userInfo] CPDictionary aUserInfo)
CPTableViewColumnDidResizeNotification
CPTableViewDraggingDestinationFeedbackStyleNone
CPSourceListBottomLineColor
var CPTableViewColumnAutoresizingStyleKey
CPTableViewSolidVerticalGridLineMask
CPTableViewDraggingDestinationFeedbackStyleRegular
function CGGradientCreateWithColors(aColorSpace, colors, locations)