mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-22 10:20:43 +00:00
Added coding support for tags to CPView and nib2cib.
Reviewed by me.
This commit is contained in:
@@ -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 <code>YES</code> if the view is flipped. <code>NO</code>, 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];
|
||||
|
||||
|
||||
@@ -41,6 +41,11 @@ import <AppKit/CPView.j>
|
||||
|
||||
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"];
|
||||
|
||||
Reference in New Issue
Block a user