diff --git a/AppKit/CPView.j b/AppKit/CPView.j index 1fe0de2e2..8a90392db 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -88,6 +88,8 @@ var DOMElementPrototype = nil, CPGraphicsContext _graphicsContext; + int _tag; + CGRect _frame; CGRect _bounds; CGAffineTransform _boundsTransform; @@ -174,6 +176,8 @@ var DOMElementPrototype = nil, _subviews = []; + _tag = -1; + _frame = _CGRectMakeCopy(aFrame); _bounds = _CGRectMake(0.0, 0.0, width, height); @@ -464,6 +468,11 @@ var DOMElementPrototype = nil, return enclosingMenuItem;*/ } +- (int)tag +{ + return _tag; +} + /* Returns whether the view is flipped. @return YES if the view is flipped. NO, otherwise. @@ -1665,6 +1674,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask", CPViewOpacityKey = @"CPViewOpacityKey", CPViewSubviewsKey = @"CPViewSubviewsKey", CPViewSuperviewKey = @"CPViewSuperviewKey", + CPViewTagKey = @"CPViewTagKey", CPViewWindowKey = @"CPViewWindowKey"; @implementation CPView (CPCoding) @@ -1692,6 +1702,11 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask", if (self) { + _tag = -1; + + if ([aCoder containsValueForKey:CPViewTagKey]) + _tag = [aCoder decodeIntForKey:CPViewTagKey]; + _window = [aCoder decodeObjectForKey:CPViewWindowKey]; _subviews = [aCoder decodeObjectForKey:CPViewSubviewsKey]; _superview = [aCoder decodeObjectForKey:CPViewSuperviewKey]; @@ -1736,6 +1751,9 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask", { [super encodeWithCoder:aCoder]; + if (_tag != -1) + [aCoder encodeInt:_tag forKey:CPViewTagKey]; + [aCoder encodeRect:_frame forKey:CPViewFrameKey]; [aCoder encodeRect:_bounds forKey:CPViewBoundsKey]; diff --git a/Tools/nib2cib/NSView.j b/Tools/nib2cib/NSView.j index 4d92d3010..dc8eb9058 100644 --- a/Tools/nib2cib/NSView.j +++ b/Tools/nib2cib/NSView.j @@ -41,6 +41,11 @@ import if (self) { + _tag = -1; + + if([aCoder containsValueForKey:@"NSTag"]) + _tag = [aCoder decodeIntForKey:@"NSTag"]; + _bounds = CGRectMake(0.0, 0.0, CGRectGetWidth(_frame), CGRectGetHeight(_frame)); _window = [aCoder decodeObjectForKey:@"NSWindow"];