Path Cell encoding/decoding

This commit is contained in:
Gregory John Casamento 2020-05-05 08:26:13 -04:00
parent 22c1897eee
commit 9abc40727b
2 changed files with 23 additions and 3 deletions

View file

@ -33,7 +33,7 @@
extern "C" {
#endif
@class NSURL, NSAttributedString, NSImage, NSString;
@class NSURL, NSAttributedString, NSImage, NSString;
@interface NSPathControlItem : NSObject
{
@ -64,4 +64,3 @@ extern "C" {
#endif /* GS_API_MACOSX */
#endif /* _NSPathControlItem_h_GNUSTEP_GUI_INCLUDE */

View file

@ -208,7 +208,8 @@
{
[self setPathStyle: NSPathStyleStandard];
// if ([coder containsValueForKey: @"NSPathStyle"])
// if ([coder containsValueForKey: @"NSPathStyle"]) // can't seem to find it in the contains method,
// but it does when I decode it... not sure why.
{
[self setPathStyle: [coder decodeIntegerForKey: @"NSPathStyle"]];
}
@ -220,11 +221,31 @@
}
else
{
[coder decodeValueObjCType: @encode(NSUInteger)
at: &_pathStyle];
[self setPathComponentCells: [coder decodeObject]];
}
return self;
}
- (void) encodeWithCoder: (NSCoder *)coder
{
if ([coder allowsKeyedCoding])
{
[coder encodeInteger: [self pathStyle]
forKey: @"NSPathStyle"];
[coder encodeObject: [self pathComponentCells]
forKey: @"NSPathComponentCells"]
}
else
{
[coder encodeValueObjCType: @encode(NSUInteger)
at: &_pathStyle];
[coder encodeObject: [self pathComponentCells]];
}
}
@end
@implementation NSPathCell (Private)