50 unsigned _resizingMask;
58 BOOL _disableResizingPosting;
73 - (id)initWithIdentifier:(
id)anIdentifier
83 _maxWidth = 1000000.0;
85 _disableResizingPosting = NO;
89 var header = [[_CPTableColumnHeaderView alloc] initWithFrame:CGRectMakeZero()];
103 _tableView = aTableView;
124 - (int)_tryToResizeToWidth:(
int)width
126 var min = [
self minWidth],
127 max = [
self maxWidth],
128 newWidth = ROUND(MIN(MAX(
width, min), max));
130 [
self setWidth:newWidth];
132 return newWidth -
width;
142 - (void)setWidth:(
float)aWidth
146 if (_width === aWidth)
149 var newWidth = MIN(MAX(aWidth, [
self minWidth]), [
self maxWidth]);
151 if (_width === newWidth)
154 var oldWidth = _width;
162 var index = [[tableView tableColumns] indexOfObjectIdenticalTo:self],
163 dirtyTableColumnRangeIndex =
tableView._dirtyTableColumnRangeIndex;
165 if (dirtyTableColumnRangeIndex < 0)
166 tableView._dirtyTableColumnRangeIndex = index;
168 tableView._dirtyTableColumnRangeIndex = MIN(index,
tableView._dirtyTableColumnRangeIndex);
174 [tableView _layoutViewsForRowIndexes:rows columnIndexes:columns];
177 if (!_disableResizingPosting)
178 [[
self tableView] _didResizeTableColumn:self oldWidth:oldWidth];
194 - (void)setMinWidth:(
float)aMinWidth
196 aMinWidth = +aMinWidth;
198 if (_minWidth === aMinWidth)
201 _minWidth = aMinWidth;
204 newWidth = MAX(
width, [
self minWidth]);
206 if (
width !== newWidth)
222 - (void)setMaxWidth:(
float)aMaxWidth
224 aMaxWidth = +aMaxWidth;
226 if (_maxWidth === aMaxWidth)
229 _maxWidth = aMaxWidth;
232 newWidth = MIN(
width, [
self maxWidth]);
234 if (
width !== newWidth)
257 - (void)setResizingMask:(
unsigned)aResizingMask
259 _resizingMask = aResizingMask;
266 - (unsigned)resizingMask
268 return _resizingMask;
276 var
width = CGRectGetWidth([_headerView
frame]);
278 if (
width < [
self minWidth])
280 else if (
width > [
self maxWidth])
283 if (_width !==
width)
304 var tableHeaderView = [_tableView headerView];
306 [tableHeaderView setNeedsLayout];
307 [tableHeaderView setNeedsDisplay:YES];
387 if (_dataView === aView)
409 - (id)dataViewForRow:(CPInteger)aRowIndex
423 [newDataView setAutoresizingMask:CPViewNotSizable];
433 - (void)setIdentifier:(
id)anIdentifier
435 _identifier = anIdentifier;
451 - (void)setEditable:(BOOL)shouldBeEditable
453 _isEditable = shouldBeEditable;
470 _sortDescriptorPrototype = aSortDescriptor;
478 if (_sortDescriptorPrototype)
479 return _sortDescriptorPrototype;
481 var binderClass = [[
self class] _binderClassForBinding:CPValueBinding],
482 binding = [binderClass getBinding:CPValueBinding forObject:self];
484 return [binding _defaultSortDescriptorPrototype];
491 - (void)setHidden:(BOOL)shouldBeHidden
493 shouldBeHidden = !!shouldBeHidden;
495 if (_isHidden === shouldBeHidden)
498 _isHidden = shouldBeHidden;
501 [[
self tableView] _tableColumnVisibilityDidChange:self];
520 _headerToolTip = aToolTip;
528 return _headerToolTip;
548 newNumberOfRows = [tableView _numberOfRows];
550 if ([
tableView numberOfRows] == newNumberOfRows)
553 column = [[tableView tableColumns] indexOfObjectIdenticalTo:_source],
558 [tableView _reloadDataForRowIndexes:rowIndexes columnIndexes:columnIndexes];
562 [tableView reloadData];
568 if (![
self createsSortDescriptor])
571 var keyPath = [_info objectForKey:CPObservedKeyPathKey],
572 dotIndex = keyPath.indexOf(
".");
577 var firstPart = keyPath.substring(0, dotIndex),
578 key = keyPath.substring(dotIndex + 1);
583 - (BOOL)createsSortDescriptor
585 var options = [_info objectForKey:CPOptionsKey],
586 optionValue = [options objectForKey:CPCreatesSortDescriptorBindingOption];
587 return optionValue === nil ? YES : [optionValue boolValue];
594 + (Class)_binderClassForBinding:(
CPString)aBinding
596 if (aBinding == CPValueBinding)
599 return [
super _binderClassForBinding:aBinding];
614 if (![aBinding
isEqual:
@"someListOfExceptedBindings(notAcceptedBindings)"])
620 var acIndex = aKeyPath.lastIndexOf(
"arrangedObjects."),
621 arrayController = anObject;
625 var firstPart = aKeyPath.substring(0, acIndex - 1);
626 arrayController = [anObject valueForKeyPath:firstPart];
629 [[
self tableView] _establishBindingsIfUnbound:arrayController];
636 - (void)_prepareDataView:(
CPView)aDataView forRow:(
unsigned)aRow
639 keys = [bindingsDictionary allKeys];
641 for (var i = 0, count = [keys count]; i < count; i++)
643 var bindingName = keys[i],
644 bindingPath = [aDataView _replacementKeyPathForBinding:bindingName],
645 binding = [bindingsDictionary objectForKey:bindingName],
646 bindingInfo = binding._info,
647 destination = [bindingInfo objectForKey:CPObservedObjectKey],
648 keyPath = [bindingInfo objectForKey:CPObservedKeyPathKey],
649 dotIndex = keyPath.lastIndexOf(
"."),
653 value = [[destination valueForKeyPath:keyPath] objectAtIndex:aRow];
667 var firstPart = keyPath.substring(0, dotIndex),
668 secondPart = keyPath.substring(dotIndex + 1),
669 firstValue = [destination valueForKeyPath:firstPart];
671 if ([firstValue isKindOfClass:CPArray])
672 value = [[firstValue objectAtIndex:aRow] valueForKeyPath:secondPart];
674 value = [[firstValue valueForKeyPath:secondPart] objectAtIndex:aRow];
677 value = [binding transformValue:value withOptions:[bindingInfo objectForKey:CPOptionsKey]];
678 [aDataView setValue:value forKey:@"objectValue"];
685 - (void)_reverseSetDataView:(
CPView)aDataView forRow:(
unsigned)aRow
688 keys = [bindingsDictionary allKeys],
689 newValue = [aDataView valueForKey:@"objectValue"];
691 for (var i = 0, count = [keys count]; i < count; i++)
693 var bindingName = keys[i],
694 bindingPath = [aDataView _replacementKeyPathForBinding:bindingName],
695 binding = [bindingsDictionary objectForKey:bindingName],
696 bindingInfo = binding._info,
697 destination = [bindingInfo objectForKey:CPObservedObjectKey],
698 keyPath = [bindingInfo objectForKey:CPObservedKeyPathKey],
699 options = [bindingInfo objectForKey:CPOptionsKey],
700 dotIndex = keyPath.lastIndexOf(
".");
702 newValue = [binding reverseTransformValue:newValue withOptions:options];
705 [[destination valueForKeyPath:keyPath] replaceObjectAtIndex:aRow withObject:newValue];
708 var firstPart = keyPath.substring(0, dotIndex),
709 secondPart = keyPath.substring(dotIndex + 1),
710 firstValue = [destination valueForKeyPath:firstPart];
712 if ([firstValue isKindOfClass:CPArray])
713 [[firstValue objectAtIndex:aRow] setValue:newValue forKeyPath:secondPart];
715 [[firstValue valueForKeyPath:secondPart] replaceObjectAtIndex:aRow withObject:newValue];
746 _width = [aCoder decodeFloatForKey:CPTableColumnWidthKey];
747 _minWidth = [aCoder decodeFloatForKey:CPTableColumnMinWidthKey];
748 _maxWidth = [aCoder decodeFloatForKey:CPTableColumnMaxWidthKey];
750 [
self setIdentifier:[aCoder decodeObjectForKey:CPTableColumnIdentifierKey]];
751 [
self setHeaderView:[aCoder decodeObjectForKey:CPTableColumnHeaderViewKey]];
752 [
self setDataView:[aCoder decodeObjectForKey:CPTableColumnDataViewKey]];
754 _resizingMask = [aCoder decodeIntForKey:CPTableColumnResizingMaskKey];
755 _isHidden = [aCoder decodeBoolForKey:CPTableColumnIsHiddenKey];
756 _isEditable = [aCoder decodeBoolForKey:CPTableColumnIsEditableKey];
758 _sortDescriptorPrototype = [aCoder decodeObjectForKey:CPSortDescriptorPrototypeKey];
769 [aCoder encodeObject:_identifier forKey:CPTableColumnIdentifierKey];
771 [aCoder encodeFloat:_width forKey:CPTableColumnWidthKey];
772 [aCoder encodeFloat:_minWidth forKey:CPTableColumnMinWidthKey];
773 [aCoder encodeFloat:_maxWidth forKey:CPTableColumnMaxWidthKey];
775 [aCoder encodeObject:_headerView forKey:CPTableColumnHeaderViewKey];
776 [aCoder encodeObject:_dataView forKey:CPTableColumnDataViewKey];
778 [aCoder encodeObject:_resizingMask forKey:CPTableColumnResizingMaskKey];
779 [aCoder encodeBool:_isHidden forKey:CPTableColumnIsHiddenKey];
780 [aCoder encodeBool:_isEditable forKey:CPTableColumnIsEditableKey];
782 [aCoder encodeObject:_sortDescriptorPrototype forKey:CPSortDescriptorPrototypeKey];
794 reason:@"setHeaderCell: is not supported. Use -setHeaderView:aView instead."];
803 reason:@"headCell is not supported. Use -headerView instead."];
812 reason:@"setDataCell: is not supported. Use -setDataView:aView instead."];
821 reason:@"dataCell is not supported. Use -dataView instead."];
827 - (id)dataCellForRow:(CPInteger)row
830 reason:@"dataCellForRow: is not supported. Use -dataViewForRow:row instead."];
840 - (BOOL)disableResizingPosting
842 return _disableResizingPosting;
848 - (void)setDisableResizingPosting:(BOOL)aValue
850 _disableResizingPosting = aValue;
Used to implement exception handling (creating & raising).
void bind:toObject:withKeyPath:options:(CPString aBinding, [toObject] id anObject, [withKeyPath] CPString aKeyPath, [options] CPDictionary options)
BOOL setThemeState:(ThemeState aState)
FrameUpdater prototype identifier
void setMinWidth:(float aMinWidth)
CPTableColumnUserResizingMask
void setHeaderView:(CPView aView)
var CPSortDescriptorPrototypeKey
A Cappuccino wrapper for any data type.
void raise:reason:(CPString aName, [reason] CPString aReason)
A collection of unique integers.
Unarchives objects created using CPKeyedArchiver.
id sortDescriptorWithKey:ascending:(CPString aKey, [ascending] BOOL isAscending)
A mutable key-value pair collection.
id initWithIdentifier:(id anIdentifier)
var CPTableColumnIdentifierKey
void setIdentifier:(id anIdentifier)
Implements keyed archiving of object graphs (e.g. for storing data).
An immutable string (collection of characters).
void setWidth:(float aWidth)
var CPTableColumnIsHiddenKey
Holds attributes necessary to describe how to sort a set of objects.
void setHidden:(BOOL aFlag)
var CPTableColumnMinWidthKey
CPTableColumnAutoresizingMask
var CPTableColumnDataViewKey
id stringWithHash:(unsigned aHash)
var CPTableColumnIsEditableKey
void setMaxWidth:(float aMaxWidth)
var CPTableColumnMaxWidthKey
Defines methods for use when archiving & restoring (enc/decoding).
var CPTableColumnHeaderViewKey
CPDictionary allBindingsForObject:(id anObject)
id unarchiveObjectWithData:(CPData aData)
id indexSetWithIndexesInRange:(CPRange aRange)
var CPTableColumnWidthKey
id indexSetWithIndex:(int anIndex)
var CPTableColumnResizingMaskKey
void setDataView:(CPView aView)
CPData archivedDataWithRootObject:(id anObject)
id stringWithFormat:(CPString format, [,] ...)
FrameUpdater prototype description