diff --git a/AppKit/CPBox.j b/AppKit/CPBox.j index 29d0b3a08..948151f1c 100644 --- a/AppKit/CPBox.j +++ b/AppKit/CPBox.j @@ -598,7 +598,8 @@ var CPBoxTypeKey = @"CPBoxTypeKey", CPBoxBorderTypeKey = @"CPBoxBorderTypeKey", CPBoxTitle = @"CPBoxTitle", CPBoxTitlePosition = @"CPBoxTitlePosition", - CPBoxTitleView = @"CPBoxTitleView"; + CPBoxTitleView = @"CPBoxTitleView", + CPBoxContentView = @"CPBoxContentView"; @implementation CPBox (CPCoding) @@ -615,7 +616,8 @@ var CPBoxTypeKey = @"CPBoxTypeKey", _titlePosition = [aCoder decodeIntForKey:CPBoxTitlePosition]; _titleView = [aCoder decodeObjectForKey:CPBoxTitleView] || [CPTextField labelWithTitle:_title]; - _contentView = [self subviews][0]; + _contentView = [aCoder decodeObjectForKey:CPBoxContentView] || [[CPView alloc] initWithFrame:[self bounds]]; + [self replaceSubview:_contentView with:[self subviews][0]]; [self setAutoresizesSubviews:YES]; [_contentView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; @@ -635,6 +637,7 @@ var CPBoxTypeKey = @"CPBoxTypeKey", [aCoder encodeObject:_title forKey:CPBoxTitle]; [aCoder encodeInt:_titlePosition forKey:CPBoxTitlePosition]; [aCoder encodeObject:_titleView forKey:CPBoxTitleView]; + [aCoder encodeObject:_contentView forKey:CPBoxContentView]; } @end diff --git a/Tools/nib2cib/NSBox.j b/Tools/nib2cib/NSBox.j index 47b52197f..1eb41f67a 100644 --- a/Tools/nib2cib/NSBox.j +++ b/Tools/nib2cib/NSBox.j @@ -30,8 +30,8 @@ if (self) { - _boxType = [aCoder decodeIntForKey:@"NSBoxType"]; - _borderType = [aCoder decodeIntForKey:@"NSBorderType"]; + _boxType = [aCoder decodeIntForKey:@"NSBoxType"]; + _borderType = [aCoder decodeIntForKey:@"NSBorderType"]; var borderColor = [aCoder decodeObjectForKey:@"NSBorderColor2"], fillColor = [aCoder decodeObjectForKey:@"NSFillColor2"], @@ -52,7 +52,8 @@ frame.size.height -= 6; } - [self setFrame:frame]; + _frame = frame; + _bounds.size = CGSizeMakeCopy(frame.size); if (_boxType !== CPBoxPrimary && _boxType !== CPBoxSecondary) {