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 128 newWidth = ROUND(MIN(MAX(
width, min), max));
132 return newWidth -
width;
142 - (void)setWidth:(
float)aWidth
146 if (_width === aWidth)
151 if (_width === newWidth)
154 var oldWidth = _width;
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;
206 if (
width !== newWidth)
222 - (void)setMaxWidth:(
float)aMaxWidth
224 aMaxWidth = +aMaxWidth;
226 if (_maxWidth === aMaxWidth)
229 _maxWidth = aMaxWidth;
234 if (
width !== newWidth)
257 - (void)setResizingMask:(
unsigned)aResizingMask
259 _resizingMask = aResizingMask;
268 return _resizingMask;
276 var
width = CGRectGetWidth([_headerView
frame]);
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;
540 newNumberOfRows = [tableView _numberOfRows];
542 if ([
tableView numberOfRows] == newNumberOfRows)
545 column = [[tableView tableColumns] indexOfObjectIdenticalTo:_source],
550 [tableView _reloadDataForRowIndexes:rowIndexes columnIndexes:columnIndexes];
554 [tableView reloadData];
560 if (![
self createsSortDescriptor])
563 var keyPath = [_info objectForKey:CPObservedKeyPathKey],
564 dotIndex = keyPath.indexOf(
".");
569 var firstPart = keyPath.substring(0, dotIndex),
570 key = keyPath.substring(dotIndex + 1);
575 - (BOOL)createsSortDescriptor
577 var options = [_info objectForKey:CPOptionsKey],
578 optionValue = [options objectForKey:CPCreatesSortDescriptorBindingOption];
579 return optionValue === nil ? YES : [optionValue boolValue];
586 + (Class)_binderClassForBinding:(
CPString)aBinding
591 return [
super _binderClassForBinding:aBinding];
606 if (![aBinding
isEqual:
@"someListOfExceptedBindings(notAcceptedBindings)"])
612 var acIndex = aKeyPath.lastIndexOf(
"arrangedObjects."),
613 arrayController = anObject;
617 var firstPart = aKeyPath.substring(0, acIndex - 1);
618 arrayController = [anObject valueForKeyPath:firstPart];
621 [[
self tableView] _establishBindingsIfUnbound:arrayController];
628 - (void)_prepareDataView:(
CPView)aDataView forRow:(unsigned)aRow
631 keys = [bindingsDictionary allKeys];
633 for (var i = 0, count = [keys count]; i < count; i++)
635 var bindingName = keys[i],
636 bindingPath = [aDataView _replacementKeyPathForBinding:bindingName],
637 binding = [bindingsDictionary objectForKey:bindingName],
638 bindingInfo = binding._info,
639 destination = [bindingInfo objectForKey:CPObservedObjectKey],
640 keyPath = [bindingInfo objectForKey:CPObservedKeyPathKey],
641 dotIndex = keyPath.lastIndexOf(
"."),
645 value = [[destination valueForKeyPath:keyPath] objectAtIndex:aRow];
659 var firstPart = keyPath.substring(0, dotIndex),
660 secondPart = keyPath.substring(dotIndex + 1),
661 firstValue = [destination valueForKeyPath:firstPart];
663 if ([firstValue isKindOfClass:CPArray])
664 value = [[firstValue objectAtIndex:aRow] valueForKeyPath:secondPart];
666 value = [[firstValue valueForKeyPath:secondPart] objectAtIndex:aRow];
669 value = [binding transformValue:value withOptions:[bindingInfo objectForKey:CPOptionsKey]];
670 [aDataView setValue:value forKey:@"objectValue"];
677 - (void)_reverseSetDataView:(
CPView)aDataView forRow:(unsigned)aRow
680 keys = [bindingsDictionary allKeys],
681 newValue = [aDataView valueForKey:@"objectValue"];
683 for (var i = 0, count = [keys count]; i < count; i++)
685 var bindingName = keys[i],
686 bindingPath = [aDataView _replacementKeyPathForBinding:bindingName],
687 binding = [bindingsDictionary objectForKey:bindingName],
688 bindingInfo = binding._info,
689 destination = [bindingInfo objectForKey:CPObservedObjectKey],
690 keyPath = [bindingInfo objectForKey:CPObservedKeyPathKey],
691 options = [bindingInfo objectForKey:CPOptionsKey],
692 dotIndex = keyPath.lastIndexOf(
".");
694 newValue = [binding reverseTransformValue:newValue withOptions:options];
697 [[destination valueForKeyPath:keyPath] replaceObjectAtIndex:aRow withObject:newValue];
700 var firstPart = keyPath.substring(0, dotIndex),
701 secondPart = keyPath.substring(dotIndex + 1),
702 firstValue = [destination valueForKeyPath:firstPart];
704 if ([firstValue isKindOfClass:CPArray])
705 [[firstValue objectAtIndex:aRow] setValue:newValue forKeyPath:secondPart];
707 [[firstValue valueForKeyPath:secondPart] replaceObjectAtIndex:aRow withObject:newValue];
738 _width = [aCoder decodeFloatForKey:CPTableColumnWidthKey];
739 _minWidth = [aCoder decodeFloatForKey:CPTableColumnMinWidthKey];
740 _maxWidth = [aCoder decodeFloatForKey:CPTableColumnMaxWidthKey];
742 [
self setIdentifier:[aCoder decodeObjectForKey:CPTableColumnIdentifierKey]];
743 [
self setHeaderView:[aCoder decodeObjectForKey:CPTableColumnHeaderViewKey]];
744 [
self setDataView:[aCoder decodeObjectForKey:CPTableColumnDataViewKey]];
746 _resizingMask = [aCoder decodeIntForKey:CPTableColumnResizingMaskKey];
747 _isHidden = [aCoder decodeBoolForKey:CPTableColumnIsHiddenKey];
748 _isEditable = [aCoder decodeBoolForKey:CPTableColumnIsEditableKey];
750 _sortDescriptorPrototype = [aCoder decodeObjectForKey:CPSortDescriptorPrototypeKey];
761 [aCoder encodeObject:_identifier forKey:CPTableColumnIdentifierKey];
763 [aCoder encodeFloat:_width forKey:CPTableColumnWidthKey];
764 [aCoder encodeFloat:_minWidth forKey:CPTableColumnMinWidthKey];
765 [aCoder encodeFloat:_maxWidth forKey:CPTableColumnMaxWidthKey];
767 [aCoder encodeObject:_headerView forKey:CPTableColumnHeaderViewKey];
768 [aCoder encodeObject:_dataView forKey:CPTableColumnDataViewKey];
770 [aCoder encodeObject:_resizingMask forKey:CPTableColumnResizingMaskKey];
771 [aCoder encodeBool:_isHidden forKey:CPTableColumnIsHiddenKey];
772 [aCoder encodeBool:_isEditable forKey:CPTableColumnIsEditableKey];
774 [aCoder encodeObject:_sortDescriptorPrototype forKey:CPSortDescriptorPrototypeKey];
786 reason:@"setHeaderCell: is not supported. Use -setHeaderView:aView instead."];
795 reason:@"headCell is not supported. Use -headerView instead."];
804 reason:@"setDataCell: is not supported. Use -setDataView:aView instead."];
813 reason:@"dataCell is not supported. Use -dataView instead."];
819 - (id)dataCellForRow:(CPInteger)row
822 reason:@"dataCellForRow: is not supported. Use -dataViewForRow:row instead."];
834 return _disableResizingPosting;
840 - (void)setDisableResizingPosting:(BOOL)aValue
842 _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)
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.
CPSortDescriptor sortDescriptorPrototype()
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
var CPTableColumnIsEditableKey
void setMaxWidth:(float aMaxWidth)
var CPTableColumnMaxWidthKey
Defines methods for use when archiving & restoring (enc/decoding).
var CPTableColumnHeaderViewKey
BOOL disableResizingPosting()
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)