mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-01 22:56:17 +00:00
Some scroll view nib fixes.
Reviewed by me.
This commit is contained in:
@@ -691,6 +691,49 @@
|
||||
|
||||
@end
|
||||
|
||||
var CPCollectionViewMinItemSizeKey = @"CPCollectionViewMinItemSizeKey",
|
||||
CPCollectionViewMaxItemSizeKey = @"CPCollectionViewMaxItemSizeKey",
|
||||
CPCollectionViewVerticalMarginKey = @"CPCollectionViewVerticalMarginKey";
|
||||
|
||||
|
||||
@implementation CPCollectionView (CPCoding)
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super initWithCoder:aCoder];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_items = [];
|
||||
_content = [];
|
||||
|
||||
_cachedItems = [];
|
||||
|
||||
_itemSize = CGSizeMakeZero();
|
||||
_minItemSize = [aCoder decodeSizeForKey:CPCollectionViewMinItemSizeKey];
|
||||
_maxItemSize = [aCoder decodeSizeForKey:CPCollectionViewMaxItemSizeKey];
|
||||
|
||||
_verticalMargin = [aCoder decodeSizeForKey:CPCollectionViewVerticalMarginKey];
|
||||
_tileWidth = -1.0;
|
||||
|
||||
_selectionIndexes = [CPIndexSet indexSet];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
[aCoder encodeSize:_minItemSize forKey:CPCollectionViewMinItemSizeKey];
|
||||
[aCoder encodeSize:_maxItemSize forKey:CPCollectionViewMaxItemSizeKey];
|
||||
|
||||
[aCoder encodeSize:_verticalMargin forKey:CPCollectionViewVerticalMarginKey];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPCollectionViewItemViewKey = @"CPCollectionViewItemViewKey";
|
||||
|
||||
@implementation CPCollectionViewItem (CPCoding)
|
||||
|
||||
+5
-5
@@ -597,10 +597,10 @@ var __Deprecated__CPImageViewImageKey = @"CPImageViewImageKey";
|
||||
_controlState = [aCoder decodeObjectForKey:CPControlControlStateKey];
|
||||
|
||||
[self setObjectValue:[aCoder decodeObjectForKey:CPControlValueKey]];
|
||||
|
||||
/*
|
||||
|
||||
[self setTarget:[aCoder decodeObjectForKey:CPControlTargetKey]];
|
||||
[self setAction:[aCoder decodeObjectForKey:CPControlActionKey]];*/
|
||||
[self setAction:[aCoder decodeObjectForKey:CPControlActionKey]];
|
||||
|
||||
[self sendActionOn:[aCoder decodeIntForKey:CPControlSendActionOnKey]];
|
||||
}
|
||||
|
||||
@@ -635,10 +635,10 @@ var __Deprecated__CPImageViewImageKey = @"CPImageViewImageKey";
|
||||
[aCoder encodeObject:_value forKey:CPControlValueKey];
|
||||
|
||||
/*[aCoder encodeBool:_isEnabled forKey:CPControlIsEnabledKey];
|
||||
|
||||
*/
|
||||
[aCoder encodeConditionalObject:_target forKey:CPControlTargetKey];
|
||||
[aCoder encodeObject:_action forKey:CPControlActionKey];
|
||||
*/
|
||||
|
||||
[aCoder encodeInt:_sendActionOn forKey:CPControlSendActionOnKey];
|
||||
}
|
||||
|
||||
|
||||
@@ -199,7 +199,22 @@ var _CPCibObjectDataNamesKeysKey = @"_CPCibObjectDataNamesKeysKey
|
||||
var instantiatedObject = [object _cibInstantiate];
|
||||
|
||||
if (instantiatedObject !== object)
|
||||
{
|
||||
_replacementObjects[[object hash]] = instantiatedObject;
|
||||
|
||||
if ([instantiatedObject isKindOfClass:[CPView class]])
|
||||
{
|
||||
var clipView = [instantiatedObject superview];
|
||||
|
||||
if ([clipView isKindOfClass:[CPClipView class]])
|
||||
{
|
||||
var scrollView = [clipView superview];
|
||||
|
||||
if ([scrollView isKindOfClass:[CPScrollView class]])
|
||||
[scrollView setDocumentView:instantiatedObject];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (topLevelObjects && parent === _fileOwner && object !== _fileOwner)
|
||||
|
||||
@@ -47,6 +47,9 @@
|
||||
|
||||
[self setEnabled:[aCoder decodeObjectForKey:@"NSEnabled"]];
|
||||
[self setContinuous:[cell isContinuous]];
|
||||
|
||||
[self setTarget:[aCoder decodeObjectForKey:@"NSTarget"]];
|
||||
[self setAction:[aCoder decodeObjectForKey:@"NSAction"]];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@@ -44,8 +44,14 @@
|
||||
// Cocoa uses NSCurValue instead of NSControl's NSContents
|
||||
if ([aCoder containsValueForKey:"NSCurValue"])
|
||||
_value = [aCoder decodeFloatForKey:"NSCurValue"];
|
||||
|
||||
if (CPStringFromSelector([self action]) === @"_doScroller:")
|
||||
if ([self isVertical])
|
||||
[self setAction:@selector(_verticalScrollerDidScroll)];
|
||||
else
|
||||
[self setAction:@selector(_horizontalScrollerDidScroll)];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user