28 #define SHOULD_SHOW_CORNER_VIEW() (_scrollerStyle === CPScrollerStyleLegacy && _verticalScroller && ![_verticalScroller isHidden])
41 var _isBrowserUsingOverlayScrollers =
function()
56 var outer = document.createElement(
'div'),
57 inner = document.createElement(
'p');
60 outer.style.position =
"absolute";
61 outer.style.top =
"0px";
62 outer.style.left =
"0px";
63 outer.style.visibility =
"hidden";
64 outer.style.width =
"200px";
65 outer.style.height =
"150px";
66 outer.style.overflow =
"scroll";
68 inner.style.width =
"100%";
69 inner.style.height =
"200px";
70 outer.appendChild(inner);
72 document.body.appendChild(outer);
74 var usingOverlayScrollers = outer.clientWidth === outer.offsetWidth;
76 document.body.removeChild(outer);
78 return usingOverlayScrollers;
109 id <CPScrollViewDelegate> _delegate;
112 BOOL _hasVerticalScroller;
113 BOOL _hasHorizontalScroller;
114 BOOL _autohidesScrollers;
119 CPInteger _recursionCount;
120 CPInteger _implementedDelegateMethods;
122 float _verticalLineScroll;
123 float _verticalPageScroll;
124 float _horizontalLineScroll;
125 float _horizontalPageScroll;
127 CPBorderType _borderType;
132 int _scrollerKnobStyle;
137 #pragma mark Class methods
146 if (globalValue === nil || globalValue === -1)
165 + (CGSize)contentSizeForFrameSize:(CGSize)frameSize hasHorizontalScroller:(BOOL)hFlag hasVerticalScroller:(BOOL)vFlag borderType:(CPBorderType)borderType
167 var
bounds = [
self _insetBounds:CGRectMake(0.0, 0.0, frameSize.width, frameSize.height) borderType:borderType],
171 bounds.size.height -= scrollerWidth;
174 bounds.size.width -= scrollerWidth;
179 + (CGSize)frameSizeForContentSize:(CGSize)contentSize hasHorizontalScroller:(BOOL)hFlag hasVerticalScroller:(BOOL)vFlag borderType:(CPBorderType)borderType
181 var
bounds = [
self _insetBounds:CGRectMake(0.0, 0.0, contentSize.width, contentSize.height) borderType:borderType],
182 widthInset = contentSize.width -
bounds.size.width,
183 heightInset = contentSize.height -
bounds.size.height,
184 frameSize = CGSizeMake(contentSize.width + widthInset, contentSize.height + heightInset),
188 frameSize.height += scrollerWidth;
191 frameSize.width += scrollerWidth;
196 + (CGRect)_insetBounds:(CGRect)bounds borderType:(CPBorderType)borderType
202 return CGRectInset(
bounds, 1.0, 1.0);
219 + (int)globalScrollerStyle
229 + (void)setGlobalScrollerStyle:(
int)aStyle
237 #pragma mark Initialization
239 - (id)initWithFrame:(CGRect)aFrame
245 _verticalLineScroll = 10.0;
246 _verticalPageScroll = 10.0;
248 _horizontalLineScroll = 10.0;
249 _horizontalPageScroll = 10.0;
269 _implementedDelegateMethods = 0;
277 #pragma mark Getters / Setters
304 if (aDelegate === _delegate)
307 _delegate = aDelegate;
308 _implementedDelegateMethods = 0;
310 if (_delegate === nil)
313 if ([_delegate respondsToSelector:
@selector(scrollViewWillScroll:)])
316 if ([_delegate respondsToSelector:
@selector(scrollViewDidScroll:)])
322 return _scrollerStyle;
331 - (void)setScrollerStyle:(
int)aStyle
333 if (_scrollerStyle === aStyle)
336 _scrollerStyle = aStyle;
338 [
self _updateScrollerStyle];
351 - (int)scrollerKnobStyle
353 return _scrollerKnobStyle;
366 - (void)setScrollerKnobStyle:(
int)newScrollerKnobStyle
368 if (_scrollerKnobStyle === newScrollerKnobStyle)
371 _scrollerKnobStyle = newScrollerKnobStyle;
373 [
self _updateScrollerStyle];
391 if (_contentView === aContentView || !aContentView)
399 [_contentView removeFromSuperview];
401 _contentView = aContentView;
403 [_contentView setDocumentView:documentView];
414 - (CGSize)contentSize
416 return [_contentView frame].size;
424 return [_contentView documentView];
434 [_contentView setDocumentView:aView];
437 [
self _updateCornerAndHeaderView];
444 - (CPBorderType)borderType
459 - (void)setBorderType:(CPBorderType)borderType
461 if (_borderType == borderType)
464 _borderType = borderType;
476 return _horizontalScroller;
486 if (_horizontalScroller === aScroller)
489 [_horizontalScroller removeFromSuperview];
490 [_horizontalScroller setTarget:nil];
491 [_horizontalScroller setAction:nil];
493 _horizontalScroller = aScroller;
495 [_horizontalScroller setTarget:self];
496 [_horizontalScroller setAction:@selector(_horizontalScrollerDidScroll:)];
500 [
self _updateScrollerStyle];
506 - (BOOL)hasHorizontalScroller
508 return _hasHorizontalScroller;
517 - (void)setHasHorizontalScroller:(BOOL)shouldHaveHorizontalScroller
519 if (_hasHorizontalScroller === shouldHaveHorizontalScroller)
522 _hasHorizontalScroller = shouldHaveHorizontalScroller;
524 if (_hasHorizontalScroller && !_horizontalScroller)
526 var
bounds = [
self _insetBounds];
540 return _verticalScroller;
550 if (_verticalScroller === aScroller)
553 [_verticalScroller removeFromSuperview];
554 [_verticalScroller setTarget:nil];
555 [_verticalScroller setAction:nil];
557 _verticalScroller = aScroller;
559 [_verticalScroller setTarget:self];
560 [_verticalScroller setAction:@selector(_verticalScrollerDidScroll:)];
564 [
self _updateScrollerStyle];
570 - (BOOL)hasVerticalScroller
572 return _hasVerticalScroller;
582 - (void)setHasVerticalScroller:(BOOL)shouldHaveVerticalScroller
584 if (_hasVerticalScroller === shouldHaveVerticalScroller)
587 _hasVerticalScroller = shouldHaveVerticalScroller;
589 if (_hasVerticalScroller && !_verticalScroller)
591 var
bounds = [
self _insetBounds];
603 - (BOOL)autohidesScrollers
605 return _autohidesScrollers;
614 - (void)setAutohidesScrollers:(BOOL)autohidesScrollers
616 if (_autohidesScrollers == autohidesScrollers)
619 _autohidesScrollers = autohidesScrollers;
626 return _bottomCornerView;
629 - (void)setBottomCornerView:(
CPView)aBottomCornerView
631 if (_bottomCornerView === aBottomCornerView)
634 [_bottomCornerView removeFromSuperview];
636 [aBottomCornerView
setFrame:[
self _bottomCornerViewFrame]];
639 _bottomCornerView = aBottomCornerView;
641 [
self _updateCornerAndHeaderView];
657 - (void)setLineScroll:(
float)aLineScroll
666 - (float)horizontalLineScroll
668 return _horizontalLineScroll;
676 - (void)setHorizontalLineScroll:(
float)aLineScroll
678 _horizontalLineScroll = aLineScroll;
684 - (float)verticalLineScroll
686 return _verticalLineScroll;
694 - (void)setVerticalLineScroll:(
float)aLineScroll
696 _verticalLineScroll = aLineScroll;
712 - (void)setPageScroll:(
float)aPageScroll
721 - (float)horizontalPageScroll
723 return _horizontalPageScroll;
731 - (void)setHorizontalPageScroll:(
float)aPageScroll
733 _horizontalPageScroll = aPageScroll;
739 - (float)verticalPageScroll
741 return _verticalPageScroll;
749 - (void)setVerticalPageScroll:(
float)aPageScroll
751 _verticalPageScroll = aPageScroll;
756 #pragma mark Privates
759 - (void)_updateScrollerStyle
761 if (_hasHorizontalScroller)
763 [_horizontalScroller setStyle:_scrollerStyle];
764 [_horizontalScroller unsetThemeState:CPThemeStateSelected];
766 switch (_scrollerKnobStyle)
769 [_horizontalScroller unsetThemeState:CPThemeStateScrollerKnobDark];
770 [_horizontalScroller setThemeState:CPThemeStateScrollerKnobLight];
774 [_horizontalScroller unsetThemeState:CPThemeStateScrollerKnobLight];
775 [_horizontalScroller setThemeState:CPThemeStateScrollerKnobDark];
779 [_horizontalScroller unsetThemeState:CPThemeStateScrollerKnobLight];
780 [_horizontalScroller unsetThemeState:CPThemeStateScrollerKnobDark];
784 if (_hasVerticalScroller)
786 [_verticalScroller setStyle:_scrollerStyle];
787 [_verticalScroller unsetThemeState:CPThemeStateSelected];
789 switch (_scrollerKnobStyle)
792 [_verticalScroller unsetThemeState:CPThemeStateScrollerKnobDark];
793 [_verticalScroller setThemeState:CPThemeStateScrollerKnobLight];
797 [_verticalScroller unsetThemeState:CPThemeStateScrollerKnobLight];
798 [_verticalScroller setThemeState:CPThemeStateScrollerKnobDark];
802 [_verticalScroller unsetThemeState:CPThemeStateScrollerKnobLight];
803 [_verticalScroller unsetThemeState:CPThemeStateScrollerKnobDark];
809 if (_timerScrollersHide)
810 [_timerScrollersHide invalidate];
813 [[
self bottomCornerView] setHidden:YES];
816 [[
self bottomCornerView] setHidden:NO];
818 [
self reflectScrolledClipView:_contentView];
822 - (CGRect)_insetBounds
824 return [[
self class] _insetBounds:[
self bounds] borderType:_borderType];
828 - (void)_updateCornerAndHeaderView
830 var documentView = [
self documentView],
831 currentHeaderView = [
self _headerView],
832 documentHeaderView = [documentView respondsToSelector:@selector(headerView)] ? [documentView headerView] : nil;
834 if (currentHeaderView !== documentHeaderView)
836 [currentHeaderView removeFromSuperview];
837 [_headerClipView setDocumentView:documentHeaderView];
840 var documentCornerView = [documentView respondsToSelector:@selector(cornerView)] ? [documentView cornerView] : nil;
842 if (_cornerView !== documentCornerView)
844 [_cornerView removeFromSuperview];
846 _cornerView = documentCornerView;
850 [_cornerView setHidden:!SHOULD_SHOW_CORNER_VIEW()];
851 [
self addSubview:_cornerView];
855 [
self reflectScrolledClipView:_contentView];
856 [documentHeaderView setNeedsLayout];
857 [documentHeaderView setNeedsDisplay:YES];
863 return [_headerClipView documentView];
867 - (CGRect)_cornerViewFrame
870 return CGRectMakeZero();
872 var
bounds = [
self _insetBounds],
873 frame = [_cornerView frame];
875 frame.origin.x = CGRectGetMaxX(bounds) - CGRectGetWidth(
frame);
876 frame.origin.y = CGRectGetMinY(bounds);
882 - (CGRect)_headerClipViewFrame
884 var headerView = [
self _headerView];
887 return CGRectMakeZero();
889 var
frame = [
self _insetBounds];
891 frame.size.height = CGRectGetHeight([headerView frame]);
894 frame.size.width -= CGRectGetWidth([self _cornerViewFrame]);
900 - (CGRect)_bottomCornerViewFrame
902 if ([[
self horizontalScroller]
isHidden] || [[
self verticalScroller]
isHidden])
903 return CGRectMakeZero();
905 var verticalFrame = [[
self verticalScroller] frame],
906 bottomCornerFrame = CGRectMakeZero();
908 bottomCornerFrame.origin.x = CGRectGetMinX(verticalFrame);
909 bottomCornerFrame.origin.y = CGRectGetMaxY(verticalFrame);
913 return bottomCornerFrame;
917 - (void)_verticalScrollerDidScroll:(
CPScroller)aScroller
920 documentFrame = [[_contentView documentView] frame],
921 contentBounds = [_contentView bounds];
924 switch ([_verticalScroller hitPart])
927 contentBounds.origin.y -= _verticalLineScroll;
931 contentBounds.origin.y += _verticalLineScroll;
935 contentBounds.origin.y -= CGRectGetHeight(contentBounds) - _verticalPageScroll;
939 contentBounds.origin.y += CGRectGetHeight(contentBounds) - _verticalPageScroll;
946 contentBounds.origin.y = ROUND(value * (CGRectGetHeight(documentFrame) - CGRectGetHeight(contentBounds)));
949 [
self _sendDelegateMessages];
951 [_contentView scrollToPoint:contentBounds.origin];
955 - (void)_horizontalScrollerDidScroll:(
CPScroller)aScroller
958 documentFrame = [[
self documentView] frame],
959 contentBounds = [_contentView bounds];
961 switch ([_horizontalScroller hitPart])
964 contentBounds.origin.x -= _horizontalLineScroll;
968 contentBounds.origin.x += _horizontalLineScroll;
972 contentBounds.origin.x -= CGRectGetWidth(contentBounds) - _horizontalPageScroll;
976 contentBounds.origin.x += CGRectGetWidth(contentBounds) - _horizontalPageScroll;
983 contentBounds.origin.x = ROUND(value * (CGRectGetWidth(documentFrame) - CGRectGetWidth(contentBounds)));
986 [
self _sendDelegateMessages];
988 [_contentView scrollToPoint:contentBounds.origin];
989 [_headerClipView scrollToPoint:CGPointMake(contentBounds.origin.x, 0.0)];
993 - (void)_sendDelegateMessages
995 if (_implementedDelegateMethods == 0)
1000 [
self _scrollViewWillScroll];
1008 - (void)_hideScrollers:(
CPTimer)theTimer
1010 if ([_verticalScroller allowFadingOut])
1011 [_verticalScroller fadeOut];
1012 if ([_horizontalScroller allowFadingOut])
1013 [_horizontalScroller fadeOut];
1014 _timerScrollersHide = nil;
1018 - (void)_respondToScrollWheelEventWithDeltaX:(
float)deltaX deltaY:(
float)deltaY
1020 var documentFrame = [[
self documentView] frame],
1021 contentBounds = [_contentView bounds],
1022 contentFrame = [_contentView frame],
1023 enclosingScrollView = [
self enclosingScrollView];
1026 contentBounds.origin.x = ROUND(contentBounds.origin.x + deltaX);
1027 contentBounds.origin.y = ROUND(contentBounds.origin.y + deltaY);
1029 var constrainedOrigin = [_contentView constrainScrollPoint:CGPointCreateCopy(contentBounds.origin)],
1030 extraX = contentBounds.origin.x - constrainedOrigin.x,
1031 extraY = contentBounds.origin.y - constrainedOrigin.y;
1033 [
self _sendDelegateMessages];
1035 [_contentView scrollToPoint:constrainedOrigin];
1036 [_headerClipView scrollToPoint:CGPointMake(constrainedOrigin.x, 0.0)];
1038 if (extraX || extraY)
1039 [enclosingScrollView _respondToScrollWheelEventWithDeltaX:extraX deltaY:extraY];
1043 - (void)_scrollViewWillScroll
1046 [_delegate scrollViewWillScroll:self];
1050 - (void)_scrollViewDidScroll
1052 [_scrollTimer invalidate];
1056 [_delegate scrollViewDidScroll:self];
1060 - (void)_didReceiveDefaultStyleChange:(
CPNotification)aNotification
1062 [
self setScrollerStyle:CPScrollerStyleGlobal];
1068 #pragma mark Utilities
1088 if (_contentView !== aClipView)
1091 if (_recursionCount > 5)
1100 if (_autohidesScrollers)
1102 [_verticalScroller setHidden:YES];
1103 [_horizontalScroller setHidden:YES];
1106 [_contentView setFrame:[
self _insetBounds]];
1107 [_headerClipView setFrame:CGRectMakeZero()];
1114 var documentFrame = [documentView frame],
1115 contentFrame = [
self _insetBounds],
1116 headerClipViewFrame = [
self _headerClipViewFrame],
1117 headerClipViewHeight = CGRectGetHeight(headerClipViewFrame);
1119 contentFrame.origin.y += headerClipViewHeight;
1120 contentFrame.size.height -= headerClipViewHeight;
1122 var difference = CGSizeMake(CGRectGetWidth(documentFrame) - CGRectGetWidth(contentFrame), CGRectGetHeight(documentFrame) - CGRectGetHeight(contentFrame)),
1125 hasVerticalScroll = difference.height > 0.0,
1126 hasHorizontalScroll = difference.width > 0.0,
1127 shouldShowVerticalScroller = _hasVerticalScroller && (!_autohidesScrollers || hasVerticalScroll),
1128 shouldShowHorizontalScroller = _hasHorizontalScroller && (!_autohidesScrollers || hasHorizontalScroll);
1131 if (shouldShowVerticalScroller)
1134 difference.width += verticalScrollerWidth;
1135 hasHorizontalScroll = difference.width > 0.0;
1136 shouldShowHorizontalScroller = _hasHorizontalScroller && (!_autohidesScrollers || hasHorizontalScroll);
1139 if (shouldShowHorizontalScroller)
1142 difference.height += horizontalScrollerHeight;
1143 hasVerticalScroll = difference.height > 0.0;
1144 shouldShowVerticalScroller = _hasVerticalScroller && (!_autohidesScrollers || hasVerticalScroll);
1148 [_verticalScroller setHidden:!shouldShowVerticalScroller];
1149 [_verticalScroller setEnabled:hasVerticalScroll];
1151 [_horizontalScroller setHidden:!shouldShowHorizontalScroller];
1152 [_horizontalScroller setEnabled:hasHorizontalScroll];
1158 if (shouldShowVerticalScroller)
1159 contentFrame.size.width -= verticalScrollerWidth;
1161 if (shouldShowHorizontalScroller)
1162 contentFrame.size.height -= horizontalScrollerHeight;
1166 var scrollPoint = [_contentView bounds].origin,
1167 wasShowingVerticalScroller = ![_verticalScroller isHidden],
1168 wasShowingHorizontalScroller = ![_horizontalScroller isHidden];
1170 if (shouldShowVerticalScroller)
1172 var verticalScrollerY =
1173 MAX(CGRectGetMinY(contentFrame), MAX(CGRectGetMaxY([
self _cornerViewFrame]), CGRectGetMaxY(headerClipViewFrame)));
1175 var verticalScrollerHeight = CGRectGetMaxY(contentFrame) - verticalScrollerY;
1179 verticalScrollerHeight -= horizontalScrollerHeight;
1181 var documentHeight = CGRectGetHeight(documentFrame);
1182 [_verticalScroller setFloatValue:(difference.height <= 0.0) ? 0.0 : scrollPoint.y / difference.height];
1183 [_verticalScroller setKnobProportion:documentHeight > 0 ? CGRectGetHeight(contentFrame) / documentHeight : 1.0];
1184 [_verticalScroller setFrame:CGRectMake(CGRectGetMaxX(contentFrame) - overlay, verticalScrollerY, verticalScrollerWidth, verticalScrollerHeight)];
1186 else if (wasShowingVerticalScroller)
1188 [_verticalScroller setFloatValue:0.0];
1189 [_verticalScroller setKnobProportion:1.0];
1192 if (shouldShowHorizontalScroller)
1194 var horizontalScrollerWidth = CGRectGetWidth(contentFrame);
1197 horizontalScrollerWidth -= verticalScrollerWidth;
1199 var documentWidth = CGRectGetWidth(documentFrame);
1201 [_horizontalScroller setFloatValue:(difference.width <= 0.0) ? 0.0 : scrollPoint.x / difference.width];
1202 [_horizontalScroller setKnobProportion:documentWidth > 0 ? CGRectGetWidth(contentFrame) / documentWidth : 1.0];
1203 [_horizontalScroller setFrame:CGRectMake(CGRectGetMinX(contentFrame), CGRectGetMaxY(contentFrame) - overlay, horizontalScrollerWidth, horizontalScrollerHeight)];
1205 else if (wasShowingHorizontalScroller)
1207 [_horizontalScroller setFloatValue:0.0];
1208 [_horizontalScroller setKnobProportion:1.0];
1211 [_contentView setFrame:contentFrame];
1212 [_headerClipView setFrame:[
self _headerClipViewFrame]];
1213 [[_headerClipView documentView] setNeedsDisplay:YES];
1216 [_cornerView setFrame:[
self _cornerViewFrame]];
1217 [_cornerView setHidden:NO];
1220 [_cornerView setHidden:YES];
1234 - (void)flashScrollers
1239 if (_hasHorizontalScroller)
1241 [_horizontalScroller setHidden:NO];
1242 [_horizontalScroller fadeIn];
1245 if (_hasVerticalScroller)
1247 [_verticalScroller setHidden:NO];
1248 [_verticalScroller fadeIn];
1251 if (_timerScrollersHide)
1252 [_timerScrollersHide invalidate]
1258 - (void)resizeSubviewsWithOldSize:(CGSize)aSize
1263 - (CGRect)documentVisibleRect
1265 return [_contentView documentVisibleRect];
1269 #pragma mark Overrides
1272 - (void)_removeObservers
1278 name:CPScrollerStyleGlobalChangeNotification
1281 [
super _removeObservers];
1284 - (void)_addObservers
1290 [
self _didReceiveDefaultStyleChange:nil];
1294 name:CPScrollerStyleGlobalChangeNotification
1297 [
super _addObservers];
1302 - (void)drawRect:(CGRect)aRect
1309 var strokeRect = [
self bounds],
1314 switch (_borderType)
1322 [
self _drawGrayBezelInContext:context bounds:strokeRect];
1326 [
self _drawGrooveInContext:context bounds:strokeRect];
1334 - (void)_drawGrayBezelInContext:(CGContext)context bounds:(CGRect)aRect
1336 var minX = CGRectGetMinX(aRect),
1337 maxX = CGRectGetMaxX(aRect),
1338 minY = CGRectGetMinY(aRect),
1339 maxY = CGRectGetMaxY(aRect),
1368 - (void)_drawGrooveInContext:(CGContext)context bounds:(CGRect)aRect
1370 var minX = CGRectGetMinX(aRect),
1371 maxX = CGRectGetMaxX(aRect),
1372 minY = CGRectGetMinY(aRect),
1373 maxY = CGRectGetMaxY(aRect);
1403 var rect = CGRectOffset(aRect, 1.0, 1.0);
1405 rect.size.width -= 1.0;
1406 rect.size.height -= 1.0;
1426 if (_timerScrollersHide)
1427 [_timerScrollersHide invalidate];
1429 [_verticalScroller fadeIn];
1430 if (![_horizontalScroller isHidden])
1431 [_horizontalScroller fadeIn];
1432 if (![_horizontalScroller isHidden] || ![_verticalScroller isHidden])
1438 if (![anEvent hasPreciseScrollingDeltas])
1440 deltaX *= (_horizontalLineScroll || 1.0);
1441 deltaY *= (_verticalLineScroll || 1.0);
1444 [
self _respondToScrollWheelEventWithDeltaX:deltaX deltaY:deltaY];
1447 - (void)scrollPageUp:(
id)sender
1449 var contentBounds = [_contentView bounds];
1450 [
self moveByOffset:CGSizeMake(0.0, -(CGRectGetHeight(contentBounds) - _verticalPageScroll))];
1453 - (void)scrollPageDown:(
id)sender
1455 var contentBounds = [_contentView bounds];
1456 [
self moveByOffset:CGSizeMake(0.0, CGRectGetHeight(contentBounds) - _verticalPageScroll)];
1459 - (void)scrollToBeginningOfDocument:(
id)sender
1461 [_contentView scrollToPoint:CGPointMakeZero()];
1462 [_headerClipView scrollToPoint:CGPointMakeZero()];
1465 - (void)scrollToEndOfDocument:(
id)sender
1467 var contentBounds = [_contentView bounds],
1469 scrollPoint = CGPointMake(0.0, CGRectGetHeight(documentFrame) - CGRectGetHeight(contentBounds));
1471 [_contentView scrollToPoint:scrollPoint];
1472 [_headerClipView scrollToPoint:CGPointMakeZero()];
1475 - (void)moveLeft:(
id)sender
1477 [
self moveByOffset:CGSizeMake(-_horizontalLineScroll, 0.0)];
1480 - (void)moveRight:(
id)sender
1482 [
self moveByOffset:CGSizeMake(_horizontalLineScroll, 0.0)];
1485 - (void)moveUp:(
id)sender
1487 [
self moveByOffset:CGSizeMake(0.0, -_verticalLineScroll)];
1490 - (void)moveDown:(
id)sender
1492 [
self moveByOffset:CGSizeMake(0.0, _verticalLineScroll)];
1495 - (void)moveByOffset:(CGSize)aSize
1498 contentBounds = [_contentView bounds];
1500 contentBounds.origin.x += aSize.width;
1501 contentBounds.origin.y += aSize.height;
1503 [_contentView scrollToPoint:contentBounds.origin];
1504 [_headerClipView scrollToPoint:CGPointMake(contentBounds.origin.x, 0)];
1531 if (
self = [super initWithCoder:aCoder])
1533 _verticalLineScroll = [aCoder decodeFloatForKey:CPScrollViewVLineScrollKey];
1534 _verticalPageScroll = [aCoder decodeFloatForKey:CPScrollViewVPageScrollKey];
1536 _horizontalLineScroll = [aCoder decodeFloatForKey:CPScrollViewHLineScrollKey];
1537 _horizontalPageScroll = [aCoder decodeFloatForKey:CPScrollViewHPageScrollKey];
1539 _contentView = [aCoder decodeObjectForKey:CPScrollViewContentViewKey];
1540 _headerClipView = [aCoder decodeObjectForKey:CPScrollViewHeaderClipViewKey];
1542 if (!_headerClipView)
1548 _verticalScroller = [aCoder decodeObjectForKey:CPScrollViewVScrollerKey];
1549 _horizontalScroller = [aCoder decodeObjectForKey:CPScrollViewHScrollerKey];
1551 _hasVerticalScroller = [aCoder decodeBoolForKey:CPScrollViewHasVScrollerKey];
1552 _hasHorizontalScroller = [aCoder decodeBoolForKey:CPScrollViewHasHScrollerKey];
1553 _autohidesScrollers = [aCoder decodeBoolForKey:CPScrollViewAutohidesScrollerKey];
1555 _borderType = [aCoder decodeIntForKey:CPScrollViewBorderTypeKey];
1557 _cornerView = [aCoder decodeObjectForKey:CPScrollViewCornerViewKey];
1558 _bottomCornerView = [aCoder decodeObjectForKey:CPScrollViewBottomCornerViewKey];
1562 _implementedDelegateMethods = 0;
1569 name:CPScrollerStyleGlobalChangeNotification
1579 - (void)awakeFromCib
1581 [
self _updateScrollerStyle];
1582 [
self _updateCornerAndHeaderView];
1589 [aCoder encodeObject:_contentView forKey:CPScrollViewContentViewKey];
1590 [aCoder encodeObject:_headerClipView forKey:CPScrollViewHeaderClipViewKey];
1592 [aCoder encodeObject:_verticalScroller forKey:CPScrollViewVScrollerKey];
1593 [aCoder encodeObject:_horizontalScroller forKey:CPScrollViewHScrollerKey];
1595 [aCoder encodeFloat:_verticalLineScroll forKey:CPScrollViewVLineScrollKey];
1596 [aCoder encodeFloat:_verticalPageScroll forKey:CPScrollViewVPageScrollKey];
1597 [aCoder encodeFloat:_horizontalLineScroll forKey:CPScrollViewHLineScrollKey];
1598 [aCoder encodeFloat:_horizontalPageScroll forKey:CPScrollViewHPageScrollKey];
1600 [aCoder encodeBool:_hasVerticalScroller forKey:CPScrollViewHasVScrollerKey];
1601 [aCoder encodeBool:_hasHorizontalScroller forKey:CPScrollViewHasHScrollerKey];
1602 [aCoder encodeBool:_autohidesScrollers forKey:CPScrollViewAutohidesScrollerKey];
1604 [aCoder encodeObject:_cornerView forKey:CPScrollViewCornerViewKey];
1605 [aCoder encodeObject:_bottomCornerView forKey:CPScrollViewBottomCornerViewKey];
1607 [aCoder encodeInt:_borderType forKey:CPScrollViewBorderTypeKey];
1609 [aCoder encodeInt:_scrollerStyle forKey:CPScrollViewScrollerStyleKey];
1610 [aCoder encodeInt:_scrollerKnobStyle forKey:CPScrollViewScrollerKnobStyleKey];