diff --git a/AppKit/CPTableColumn.j b/AppKit/CPTableColumn.j index e8b6f1c5e..14f239484 100644 --- a/AppKit/CPTableColumn.j +++ b/AppKit/CPTableColumn.j @@ -396,7 +396,8 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey", CPTableColumnMinWidthKey = @"CPTableColumnMinWidthKey", CPTableColumnMaxWidthKey = @"CPTableColumnMaxWidthKey", CPTableColumnResizingMaskKey = @"CPTableColumnResizingMaskKey", - CPTableColumnIsHiddenkey = @"CPTableColumnIsHiddenKey"; + CPTableColumnIsHiddenkey = @"CPTableColumnIsHiddenKey", + CPSortDescriptorPrototypeKey = @"CPSortDescriptorPrototypeKey"; @implementation CPTableColumn (CPCoding) @@ -419,6 +420,8 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey", _resizingMask = [aCoder decodeBoolForKey:CPTableColumnResizingMaskKey]; _isHidden = [aCoder decodeBoolForKey:CPTableColumnIsHiddenkey]; + + _sortDescriptorPrototype = [aCoder decodeObjectForKey:CPSortDescriptorPrototypeKey]; } return self; @@ -437,6 +440,8 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey", [aCoder encodeObject:_resizingMask forKey:CPTableColumnResizingMaskKey]; [aCoder encodeBool:_isHidden forKey:CPTableColumnIsHiddenkey]; + + [aCoder encodeObject:_sortDescriptorPrototype forKey:CPSortDescriptorPrototypeKey]; } @end diff --git a/Foundation/CPSortDescriptor.j b/Foundation/CPSortDescriptor.j index c7b78c840..c7d29f16a 100755 --- a/Foundation/CPSortDescriptor.j +++ b/Foundation/CPSortDescriptor.j @@ -149,3 +149,31 @@ CPOrderedDescending = 1; } @end + +var CPSortDescriptorKeyKey = @"CPSortDescriptorKeyKey", // Don't you just love naming schemes ;) + CPSortDescriptorAscendingKey = @"CPSortDescriptorAscendingKey", + CPSortDescriptorSelectorKey = @"CPSortDescriptorSelectorKey"; + +@implementation CPSortDescriptor (CPCoding) + +- (id)initWithCoder:(CPCoder)aCoder +{ + if (self = [super init]) + { + _key = [aCoder decodeObjectForKey:CPSortDescriptorKeyKey]; + _ascending = [aCoder decodeBoolForKey:CPSortDescriptorAscendingKey]; + _selector = CPSelectorFromString([aCoder decodeObjectForKey:CPSortDescriptorSelectorKey]); + } + + return self; +} + +- (void)encodeWithCoder:(CPCoder)aCoder +{ + [aCoder encodeObject:_key forKey:CPSortDescriptorKeyKey]; + [aCoder encodeBool:_ascending forKey:CPSortDescriptorAscendingKey]; + [aCoder encodeObject:CPStringFromSelector(_selector) forKey:CPSortDescriptorSelectorKey]; +} + +@end + diff --git a/Tools/nib2cib/NSAppKit.j b/Tools/nib2cib/NSAppKit.j index 8a54fb2d1..96a3a52b8 100644 --- a/Tools/nib2cib/NSAppKit.j +++ b/Tools/nib2cib/NSAppKit.j @@ -67,6 +67,7 @@ @import "NSViewController.j" @import "NSWindowTemplate.j" @import "WebView.j" +@import "NSSortDescriptor.j" function CP_NSMapClassName(aClassName) diff --git a/Tools/nib2cib/NSSortDescriptor.j b/Tools/nib2cib/NSSortDescriptor.j new file mode 100644 index 000000000..c4f0beb87 --- /dev/null +++ b/Tools/nib2cib/NSSortDescriptor.j @@ -0,0 +1,35 @@ +@import + +@implementation CPSortDescriptor (NSCoding) +{ +} + +- (id)NS_initWithCoder:(CPCoder)aCoder +{ + if (self = [super init]) + { + _key = [aCoder decodeObjectForKey:@"NSKey"]; + _selector = CPSelectorFromString([aCoder decodeObjectForKey:@"NSSelector"]); + _ascending = [aCoder decodeBoolForKey:@"NSAscending"]; + } + + return self; +} + +@end + +@implementation NSSortDescriptor : CPSortDescriptor +{ +} + +- (id)initWithCoder:(CPCoder)aCoder +{ + return [self NS_initWithCoder:aCoder]; +} + +- (Class)classForKeyedArchiver +{ + return [CPSortDescriptor class]; +} + +@end \ No newline at end of file diff --git a/Tools/nib2cib/NSTableColumn.j b/Tools/nib2cib/NSTableColumn.j index bcbea7422..bdafee212 100644 --- a/Tools/nib2cib/NSTableColumn.j +++ b/Tools/nib2cib/NSTableColumn.j @@ -53,6 +53,8 @@ _resizingMask = [aCoder decodeBoolForKey:@"NSIsResizeable"] ? CPTableColumnUserResizingMask : CPTableColumnAutoresizingMask; _isHidden = [aCoder decodeBoolForKey:@"NSHidden"]; + + _sortDescriptorPrototype = [aCoder decodeObjectForKey:@"NSSortDescriptorPrototype"]; } return self;