Add a few flags to NSTableView and CPCoder support for gridColor and gridStyleMask in CPTableView.

This commit is contained in:
Nicholas Small committed 2010-02-04 14:14:31 -05:00
1 parent d608d34166
commit ab34ee882e
2 files changed
+22 -5

No files matched your search

+10 -5
View File
@@ -2866,7 +2866,9 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
CPTableViewRowHeightKey = @"CPTableViewRowHeightKey",
CPTableViewIntercellSpacingKey = @"CPTableViewIntercellSpacingKey",
CPTableViewMultipleSelectionKey = @"CPTableViewMultipleSelectionKey",
CPTableViewEmptySelectionKey = @"CPTableViewEmptySelectionKey";
CPTableViewEmptySelectionKey = @"CPTableViewEmptySelectionKey",
CPTableViewGridColorKey = @"CPTableViewGridColorKey",
CPTableViewGridStyleMaskKey = @"CPTableViewGridStyleMaskKey";
@implementation CPTableView (CPCoding)
@@ -2909,10 +2911,10 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
_intercellSpacing = [aCoder decodeSizeForKey:CPTableViewIntercellSpacingKey];
_selectionHightlightColor = [CPColor selectionColor];
[self setGridColor:[CPColor grayColor]];
[self setGridStyleMask:CPTableViewGridNone];
_gridColor = [aCoder decodeObjectForKey:CPTableViewGridColorKey] || [CPColor grayColor];
_gridStyleMask = [aCoder decodeIntForKey:CPTableViewGridStyleMaskKey] || CPTableViewGridNone;
_headerView = [[CPTableHeaderView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, _rowHeight)];
[_headerView setTableView:self];
@@ -2949,6 +2951,9 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
[aCoder encodeBool:_allowsEmptySelection forKey:CPTableViewEmptySelectionKey];
[aCoder encodeObject:_tableColumns forKey:CPTableViewTableColumnsKey];
[aCoder encodeObject:_gridColor forKey:CPTableViewGridColorKey];
[aCoder encodeInt:_gridStyleMask forKey:CPTableViewGridStyleMaskKey];
}
@end
+12
View File
@@ -45,10 +45,22 @@
[_tableColumns makeObjectsPerformSelector:@selector(setTableView:) withObject:self];
_rowHeight = [aCoder decodeFloatForKey:@"NSRowHeight"];
// Convert xib default to cib default
if (_rowHeight == 17)
_rowHeight = 23;
_intercellSpacing = CGSizeMake([aCoder decodeFloatForKey:"NSIntercellSpacingWidth"], [aCoder decodeFloatForKey:"NSIntercellSpacingHeight"]);
_gridColor = [aCoder decodeObjectForKey:@"NSGridColor"];
_gridStyleMask = [aCoder decodeIntForKey:@"NSGridStyleMask"];
_allowsMultipleSelection = (flags & 0x08000000) ? YES : NO;
_allowsEmptySelection = (flags & 0x10000000) ? YES : NO;
_allowsColumnSelection = (flags & 0x04000000) ? YES : NO;
_allowsColumnResizing = (flags & 0x40000000) ? YES : NO;
_allowsColumnReordering = (flags & 0x80000000) ? YES : NO;
}
return self;