Minor cleanup in NSView, add code to get NSShadowHoriz, NSShadowVert

This commit is contained in:
Gregory John Casamento 2023-12-26 11:43:33 -05:00
parent 702f7bb9af
commit cb4987ff47
3 changed files with 21 additions and 5 deletions

View file

@ -327,8 +327,8 @@ static NSArray *XmlBoolDefaultYes = nil;
@"collectionViewLayout", @"NSCollectionViewLayout",
@"shadow", @"NSViewShadow",
@"blurRadius", @"NSShadowBlurRadius",
@"width", @"NSShadowHoriz",
@"height", @"NSShadowVert",
// @"width", @"NSShadowHoriz",
// @"height", @"NSShadowVert",
@"color", @"NSShadowColor",
nil];
RETAIN(XmlKeyMapTable);
@ -450,6 +450,8 @@ static NSArray *XmlBoolDefaultYes = nil;
@"decodeSecondAttribute:", @"NSSecondAttribute",
@"decodeRelation:", @"NSRelation",
@"decodeTransitionStyle:", @"NSTransitionStyle",
@"decodeShadowOffsetHoriz:", @"NSShadowHoriz",
@"decodeShadowOffsetVert:", @"NSShadowVert",
nil];
RETAIN(XmlKeyToDecoderSelectorMap);
@ -2989,6 +2991,20 @@ didStartElement: (NSString*)elementName
return num;
}
- (id) decodeShadowOffsetHoriz: (GSXibElement *)element
{
NSSize size = [self decodeSizeForKey: @"offset"];
NSNumber *num = [NSNumber numberWithFloat: size.width];
return num;
}
- (id) decodeShadowOffsetVert: (GSXibElement *)element
{
NSSize size = [self decodeSizeForKey: @"offset"];
NSNumber *num = [NSNumber numberWithFloat: size.height];
return num;
}
- (id) _decodePlacementForObject: (id)obj
{
NSGridRowAlignment alignment = NSGridCellPlacementNone;

View file

@ -128,7 +128,7 @@
_radius = [aDecoder decodeFloatForKey: @"NSShadowBlurRadius"];
_offset = NSMakeSize([aDecoder decodeFloatForKey: @"NSShadowHoriz"],
[aDecoder decodeFloatForKey: @"NSShadowVert"]);
_color = [[aDecoder decodeObjectForKey: @"NSShadowColor"] retain];
_color = RETAIN([aDecoder decodeObjectForKey: @"NSShadowColor"]);
}
else
{
@ -136,7 +136,7 @@
[aDecoder decodeValueOfObjCType: @encode(float) at: &radius];
_radius = radius;
_offset = [aDecoder decodeSize];
_color = [[aDecoder decodeObject] retain];
_color = RETAIN([aDecoder decodeObject]);
}
return self;
}

View file

@ -4646,7 +4646,7 @@ static NSView* findByTag(NSView *view, NSInteger aTag, NSUInteger *level)
NSEnumerator *e;
NSView *sub;
NSArray *subs;
// decode the superclass...
self = [super initWithCoder: aDecoder];
if (!self)