28 #define SHOULD_SHOW_CORNER_VIEW() (_scrollerStyle === CPScrollerStyleLegacy && _verticalScroller && ![_verticalScroller isHidden])
32 var _isSystemUsingOverlayScrollers =
function()
35 var inner = document.createElement(
'p'),
36 outer = document.createElement(
'div');
38 inner.style.width =
"100%";
39 inner.style.height =
"200px";
41 outer.style.position =
"absolute";
42 outer.style.top =
"0px";
43 outer.style.left =
"0px";
44 outer.style.visibility =
"hidden";
45 outer.style.width =
"200px";
46 outer.style.height =
"150px";
47 outer.style.overflow =
"hidden";
48 outer.appendChild (inner);
50 document.body.appendChild (outer);
51 var w1 = inner.offsetWidth;
52 outer.style.overflow =
'scroll';
53 var w2 = inner.offsetWidth;
55 w2 = outer.clientWidth;
57 document.body.removeChild (outer);
59 return (w1 - w2 == 0);
94 BOOL _hasVerticalScroller;
95 BOOL _hasHorizontalScroller;
96 BOOL _autohidesScrollers;
101 CPInteger _recursionCount;
102 CPInteger _implementedDelegateMethods;
104 float _verticalLineScroll;
105 float _verticalPageScroll;
106 float _horizontalLineScroll;
107 float _horizontalPageScroll;
109 CPBorderType _borderType;
114 int _scrollerKnobStyle;
119 #pragma mark Class methods
128 if (globalValue == nil || globalValue == -1)
147 + (CGSize)contentSizeForFrameSize:(CGSize)frameSize hasHorizontalScroller:(BOOL)hFlag hasVerticalScroller:(BOOL)vFlag borderType:(CPBorderType)borderType
149 var bounds = [
self _insetBounds:_CGRectMake(0.0, 0.0, frameSize.width, frameSize.height) borderType:borderType],
153 bounds.size.height -= scrollerWidth;
156 bounds.size.width -= scrollerWidth;
161 + (CGSize)frameSizeForContentSize:(CGSize)contentSize hasHorizontalScroller:(BOOL)hFlag hasVerticalScroller:(BOOL)vFlag borderType:(CPBorderType)borderType
163 var bounds = [
self _insetBounds:_CGRectMake(0.0, 0.0, contentSize.width, contentSize.height) borderType:borderType],
164 widthInset = contentSize.width - bounds.size.width,
165 heightInset = contentSize.height - bounds.size.height,
166 frameSize = _CGSizeMake(contentSize.width + widthInset, contentSize.height + heightInset),
170 frameSize.height += scrollerWidth;
173 frameSize.width += scrollerWidth;
178 + (CGRect)_insetBounds:(CGRect)bounds borderType:(CPBorderType)borderType
184 return _CGRectInset(bounds, 1.0, 1.0);
187 bounds = _CGRectInset(bounds, 2.0, 2.0);
189 --bounds.size.height;
201 + (int)globalScrollerStyle
211 + (void)setGlobalScrollerStyle:(
int)aStyle
219 #pragma mark Initialization
221 - (id)initWithFrame:(CGRect)aFrame
227 _verticalLineScroll = 10.0;
228 _verticalPageScroll = 10.0;
230 _horizontalLineScroll = 10.0;
231 _horizontalPageScroll = 10.0;
251 _implementedDelegateMethods = 0;
255 name:CPScrollerStyleGlobalChangeNotification
264 #pragma mark Getters / Setters
289 - (void)setDelegate:(
id)aDelegate
291 if (aDelegate === _delegate)
294 _delegate = aDelegate;
295 _implementedDelegateMethods = 0;
297 if (_delegate === nil)
300 if ([_delegate respondsToSelector:
@selector(scrollViewWillScroll:)])
303 if ([_delegate respondsToSelector:
@selector(scrollViewDidScroll:)])
309 return _scrollerStyle;
318 - (void)setScrollerStyle:(
int)aStyle
320 if (_scrollerStyle === aStyle)
323 _scrollerStyle = aStyle;
325 [
self _updateScrollerStyle];
338 - (int)scrollerKnobStyle
340 return _scrollerKnobStyle;
353 - (void)setScrollerKnobStyle:(
int)newScrollerKnobStyle
355 if (_scrollerKnobStyle === newScrollerKnobStyle)
358 _scrollerKnobStyle = newScrollerKnobStyle;
360 [
self _updateScrollerStyle];
378 if (_contentView === aContentView || !aContentView)
386 [_contentView removeFromSuperview];
388 _contentView = aContentView;
390 [_contentView setDocumentView:documentView];
401 - (CGSize)contentSize
403 return [_contentView frame].size;
411 return [_contentView documentView];
421 [_contentView setDocumentView:aView];
424 [
self _updateCornerAndHeaderView];
431 - (CPBorderType)borderType
446 - (void)setBorderType:(CPBorderType)borderType
448 if (_borderType == borderType)
451 _borderType = borderType;
463 return _horizontalScroller;
473 if (_horizontalScroller === aScroller)
476 [_horizontalScroller removeFromSuperview];
477 [_horizontalScroller setTarget:nil];
478 [_horizontalScroller setAction:nil];
480 _horizontalScroller = aScroller;
482 [_horizontalScroller setTarget:self];
483 [_horizontalScroller setAction:@selector(_horizontalScrollerDidScroll:)];
487 [
self _updateScrollerStyle];
493 - (BOOL)hasHorizontalScroller
495 return _hasHorizontalScroller;
504 - (void)setHasHorizontalScroller:(BOOL)shouldHaveHorizontalScroller
506 if (_hasHorizontalScroller === shouldHaveHorizontalScroller)
509 _hasHorizontalScroller = shouldHaveHorizontalScroller;
511 if (_hasHorizontalScroller && !_horizontalScroller)
513 var bounds = [
self _insetBounds];
527 return _verticalScroller;
537 if (_verticalScroller === aScroller)
540 [_verticalScroller removeFromSuperview];
541 [_verticalScroller setTarget:nil];
542 [_verticalScroller setAction:nil];
544 _verticalScroller = aScroller;
546 [_verticalScroller setTarget:self];
547 [_verticalScroller setAction:@selector(_verticalScrollerDidScroll:)];
551 [
self _updateScrollerStyle];
557 - (BOOL)hasVerticalScroller
559 return _hasVerticalScroller;
569 - (void)setHasVerticalScroller:(BOOL)shouldHaveVerticalScroller
571 if (_hasVerticalScroller === shouldHaveVerticalScroller)
574 _hasVerticalScroller = shouldHaveVerticalScroller;
576 if (_hasVerticalScroller && !_verticalScroller)
578 var bounds = [
self _insetBounds];
590 - (BOOL)autohidesScrollers
592 return _autohidesScrollers;
601 - (void)setAutohidesScrollers:(BOOL)autohidesScrollers
603 if (_autohidesScrollers == autohidesScrollers)
606 _autohidesScrollers = autohidesScrollers;
613 return _bottomCornerView;
616 - (void)setBottomCornerView:(
CPView)aBottomCornerView
618 if (_bottomCornerView === aBottomCornerView)
621 [_bottomCornerView removeFromSuperview];
623 [aBottomCornerView
setFrame:[
self _bottomCornerViewFrame]];
626 _bottomCornerView = aBottomCornerView;
628 [
self _updateCornerAndHeaderView];
644 - (void)setLineScroll:(
float)aLineScroll
653 - (float)horizontalLineScroll
655 return _horizontalLineScroll;
663 - (void)setHorizontalLineScroll:(
float)aLineScroll
665 _horizontalLineScroll = aLineScroll;
671 - (float)verticalLineScroll
673 return _verticalLineScroll;
681 - (void)setVerticalLineScroll:(
float)aLineScroll
683 _verticalLineScroll = aLineScroll;
699 - (void)setPageScroll:(
float)aPageScroll
708 - (float)horizontalPageScroll
710 return _horizontalPageScroll;
718 - (void)setHorizontalPageScroll:(
float)aPageScroll
720 _horizontalPageScroll = aPageScroll;
726 - (float)verticalPageScroll
728 return _verticalPageScroll;
736 - (void)setVerticalPageScroll:(
float)aPageScroll
738 _verticalPageScroll = aPageScroll;
743 #pragma mark Privates
746 - (void)_updateScrollerStyle
748 if (_hasHorizontalScroller)
750 [_horizontalScroller setStyle:_scrollerStyle];
751 [_horizontalScroller unsetThemeState:CPThemeStateSelected];
753 switch (_scrollerKnobStyle)
756 [_horizontalScroller unsetThemeState:CPThemeStateScrollerKnobDark];
757 [_horizontalScroller setThemeState:CPThemeStateScrollerKnobLight];
761 [_horizontalScroller unsetThemeState:CPThemeStateScrollerKnobLight];
762 [_horizontalScroller setThemeState:CPThemeStateScrollerKnobDark];
766 [_horizontalScroller unsetThemeState:CPThemeStateScrollerKnobLight];
767 [_horizontalScroller unsetThemeState:CPThemeStateScrollerKnobDark];
771 if (_hasVerticalScroller)
773 [_verticalScroller setStyle:_scrollerStyle];
774 [_verticalScroller unsetThemeState:CPThemeStateSelected];
776 switch (_scrollerKnobStyle)
779 [_verticalScroller unsetThemeState:CPThemeStateScrollerKnobDark];
780 [_verticalScroller setThemeState:CPThemeStateScrollerKnobLight];
784 [_verticalScroller unsetThemeState:CPThemeStateScrollerKnobLight];
785 [_verticalScroller setThemeState:CPThemeStateScrollerKnobDark];
789 [_verticalScroller unsetThemeState:CPThemeStateScrollerKnobLight];
790 [_verticalScroller unsetThemeState:CPThemeStateScrollerKnobDark];
796 if (_timerScrollersHide)
797 [_timerScrollersHide invalidate];
800 [[
self bottomCornerView] setHidden:YES];
803 [[
self bottomCornerView] setHidden:NO];
805 [
self reflectScrolledClipView:_contentView];
809 - (CGRect)_insetBounds
811 return [[
self class] _insetBounds:[
self bounds] borderType:_borderType];
815 - (void)_updateCornerAndHeaderView
817 var documentView = [
self documentView],
818 currentHeaderView = [
self _headerView],
819 documentHeaderView = [documentView respondsToSelector:@selector(headerView)] ? [documentView headerView] : nil;
821 if (currentHeaderView !== documentHeaderView)
823 [currentHeaderView removeFromSuperview];
824 [_headerClipView setDocumentView:documentHeaderView];
827 var documentCornerView = [documentView respondsToSelector:@selector(cornerView)] ? [documentView cornerView] : nil;
829 if (_cornerView !== documentCornerView)
831 [_cornerView removeFromSuperview];
833 _cornerView = documentCornerView;
837 [_cornerView setHidden:!SHOULD_SHOW_CORNER_VIEW()];
838 [
self addSubview:_cornerView];
842 [
self reflectScrolledClipView:_contentView];
843 [documentHeaderView setNeedsLayout];
844 [documentHeaderView setNeedsDisplay:YES];
850 return [_headerClipView documentView];
854 - (CGRect)_cornerViewFrame
857 return _CGRectMakeZero();
859 var bounds = [
self _insetBounds],
860 frame = [_cornerView frame];
862 frame.origin.x = _CGRectGetMaxX(bounds) - _CGRectGetWidth(
frame);
863 frame.origin.y = _CGRectGetMinY(bounds);
869 - (CGRect)_headerClipViewFrame
871 var headerView = [
self _headerView];
874 return _CGRectMakeZero();
876 var
frame = [
self _insetBounds];
878 frame.size.height = _CGRectGetHeight([headerView frame]);
881 frame.size.width -= _CGRectGetWidth([self _cornerViewFrame]);
887 - (CGRect)_bottomCornerViewFrame
889 if ([[
self horizontalScroller] isHidden] || [[
self verticalScroller] isHidden])
890 return CGRectMakeZero();
892 var verticalFrame = [[
self verticalScroller] frame],
893 bottomCornerFrame = CGRectMakeZero();
895 bottomCornerFrame.origin.x = CGRectGetMinX(verticalFrame);
896 bottomCornerFrame.origin.y = CGRectGetMaxY(verticalFrame);
900 return bottomCornerFrame;
904 - (void)_verticalScrollerDidScroll:(
CPScroller)aScroller
907 documentFrame = [[_contentView documentView] frame],
908 contentBounds = [_contentView bounds];
911 switch ([_verticalScroller hitPart])
914 contentBounds.origin.y -= _verticalLineScroll;
918 contentBounds.origin.y += _verticalLineScroll;
922 contentBounds.origin.y -= _CGRectGetHeight(contentBounds) - _verticalPageScroll;
926 contentBounds.origin.y += _CGRectGetHeight(contentBounds) - _verticalPageScroll;
933 contentBounds.origin.y = ROUND(value * (_CGRectGetHeight(documentFrame) - _CGRectGetHeight(contentBounds)));
936 [
self _sendDelegateMessages];
938 [_contentView scrollToPoint:contentBounds.origin];
942 - (void)_horizontalScrollerDidScroll:(
CPScroller)aScroller
945 documentFrame = [[
self documentView] frame],
946 contentBounds = [_contentView bounds];
948 switch ([_horizontalScroller hitPart])
951 contentBounds.origin.x -= _horizontalLineScroll;
955 contentBounds.origin.x += _horizontalLineScroll;
959 contentBounds.origin.x -= _CGRectGetWidth(contentBounds) - _horizontalPageScroll;
963 contentBounds.origin.x += _CGRectGetWidth(contentBounds) - _horizontalPageScroll;
970 contentBounds.origin.x = ROUND(value * (_CGRectGetWidth(documentFrame) - _CGRectGetWidth(contentBounds)));
973 [
self _sendDelegateMessages];
975 [_contentView scrollToPoint:contentBounds.origin];
976 [_headerClipView scrollToPoint:CGPointMake(contentBounds.origin.x, 0.0)];
980 - (void)_sendDelegateMessages
982 if (_implementedDelegateMethods == 0)
987 [
self _scrollViewWillScroll];
995 - (void)_hideScrollers:(
CPTimer)theTimer
997 if ([_verticalScroller allowFadingOut])
998 [_verticalScroller fadeOut];
999 if ([_horizontalScroller allowFadingOut])
1000 [_horizontalScroller fadeOut];
1001 _timerScrollersHide = nil;
1005 - (void)_respondToScrollWheelEventWithDeltaX:(
float)deltaX deltaY:(
float)deltaY
1007 var documentFrame = [[
self documentView] frame],
1008 contentBounds = [_contentView bounds],
1009 contentFrame = [_contentView frame],
1010 enclosingScrollView = [
self enclosingScrollView];
1013 contentBounds.origin.x = ROUND(contentBounds.origin.x + deltaX);
1014 contentBounds.origin.y = ROUND(contentBounds.origin.y + deltaY);
1016 var constrainedOrigin = [_contentView constrainScrollPoint:CGPointCreateCopy(contentBounds.origin)],
1017 extraX = contentBounds.origin.x - constrainedOrigin.x,
1018 extraY = contentBounds.origin.y - constrainedOrigin.y;
1020 [
self _sendDelegateMessages];
1022 [_contentView scrollToPoint:constrainedOrigin];
1023 [_headerClipView scrollToPoint:CGPointMake(constrainedOrigin.x, 0.0)];
1025 if (extraX || extraY)
1026 [enclosingScrollView _respondToScrollWheelEventWithDeltaX:extraX deltaY:extraY];
1030 - (void)_scrollViewWillScroll
1033 [_delegate scrollViewWillScroll:self];
1037 - (void)_scrollViewDidScroll
1039 [_scrollTimer invalidate];
1043 [_delegate scrollViewDidScroll:self];
1047 - (void)_didReceiveDefaultStyleChange:(
CPNotification)aNotification
1049 [
self setScrollerStyle:CPScrollerStyleGlobal];
1055 #pragma mark Utilities
1075 if (_contentView !== aClipView)
1078 if (_recursionCount > 5)
1087 if (_autohidesScrollers)
1089 [_verticalScroller setHidden:YES];
1090 [_horizontalScroller setHidden:YES];
1093 [_contentView setFrame:[
self _insetBounds]];
1094 [_headerClipView setFrame:_CGRectMakeZero()];
1101 var documentFrame = [documentView frame],
1102 contentFrame = [
self _insetBounds],
1103 headerClipViewFrame = [
self _headerClipViewFrame],
1104 headerClipViewHeight = _CGRectGetHeight(headerClipViewFrame);
1106 contentFrame.origin.y += headerClipViewHeight;
1107 contentFrame.size.height -= headerClipViewHeight;
1109 var difference = _CGSizeMake(_CGRectGetWidth(documentFrame) - _CGRectGetWidth(contentFrame), _CGRectGetHeight(documentFrame) - _CGRectGetHeight(contentFrame)),
1110 verticalScrollerWidth = _CGRectGetWidth([_verticalScroller frame]),
1111 horizontalScrollerHeight = _CGRectGetHeight([_horizontalScroller frame]),
1112 hasVerticalScroll = difference.height > 0.0,
1113 hasHorizontalScroll = difference.width > 0.0,
1114 shouldShowVerticalScroller = _hasVerticalScroller && (!_autohidesScrollers || hasVerticalScroll),
1115 shouldShowHorizontalScroller = _hasHorizontalScroller && (!_autohidesScrollers || hasHorizontalScroll);
1118 if (shouldShowVerticalScroller)
1121 difference.width += verticalScrollerWidth;
1122 hasHorizontalScroll = difference.width > 0.0;
1123 shouldShowHorizontalScroller = _hasHorizontalScroller && (!_autohidesScrollers || hasHorizontalScroll);
1126 if (shouldShowHorizontalScroller)
1129 difference.height += horizontalScrollerHeight;
1130 hasVerticalScroll = difference.height > 0.0;
1131 shouldShowVerticalScroller = _hasVerticalScroller && (!_autohidesScrollers || hasVerticalScroll);
1135 [_verticalScroller setHidden:!shouldShowVerticalScroller];
1136 [_verticalScroller setEnabled:hasVerticalScroll];
1138 [_horizontalScroller setHidden:!shouldShowHorizontalScroller];
1139 [_horizontalScroller setEnabled:hasHorizontalScroll];
1145 if (shouldShowVerticalScroller)
1146 contentFrame.size.width -= verticalScrollerWidth;
1148 if (shouldShowHorizontalScroller)
1149 contentFrame.size.height -= horizontalScrollerHeight;
1153 var scrollPoint = [_contentView bounds].origin,
1154 wasShowingVerticalScroller = ![_verticalScroller isHidden],
1155 wasShowingHorizontalScroller = ![_horizontalScroller isHidden];
1157 if (shouldShowVerticalScroller)
1159 var verticalScrollerY =
1160 MAX(_CGRectGetMinY(contentFrame), MAX(_CGRectGetMaxY([
self _cornerViewFrame]), _CGRectGetMaxY(headerClipViewFrame)));
1162 var verticalScrollerHeight = _CGRectGetMaxY(contentFrame) - verticalScrollerY;
1166 verticalScrollerHeight -= horizontalScrollerHeight;
1168 var documentHeight = _CGRectGetHeight(documentFrame);
1169 [_verticalScroller setFloatValue:(difference.height <= 0.0) ? 0.0 : scrollPoint.y / difference.height];
1170 [_verticalScroller setKnobProportion:documentHeight > 0 ? _CGRectGetHeight(contentFrame) / documentHeight : 1.0];
1171 [_verticalScroller setFrame:_CGRectMake(_CGRectGetMaxX(contentFrame) - overlay, verticalScrollerY, verticalScrollerWidth, verticalScrollerHeight)];
1173 else if (wasShowingVerticalScroller)
1175 [_verticalScroller setFloatValue:0.0];
1176 [_verticalScroller setKnobProportion:1.0];
1179 if (shouldShowHorizontalScroller)
1181 var horizontalScrollerWidth = _CGRectGetWidth(contentFrame);
1184 horizontalScrollerWidth -= verticalScrollerWidth;
1186 var documentWidth = _CGRectGetWidth(documentFrame);
1188 [_horizontalScroller setFloatValue:(difference.width <= 0.0) ? 0.0 : scrollPoint.x / difference.width];
1189 [_horizontalScroller setKnobProportion:documentWidth > 0 ? _CGRectGetWidth(contentFrame) / documentWidth : 1.0];
1190 [_horizontalScroller setFrame:_CGRectMake(_CGRectGetMinX(contentFrame), _CGRectGetMaxY(contentFrame) - overlay, horizontalScrollerWidth, horizontalScrollerHeight)];
1192 else if (wasShowingHorizontalScroller)
1194 [_horizontalScroller setFloatValue:0.0];
1195 [_horizontalScroller setKnobProportion:1.0];
1198 [_contentView setFrame:contentFrame];
1199 [_headerClipView setFrame:[
self _headerClipViewFrame]];
1200 [[_headerClipView documentView] setNeedsDisplay:YES];
1203 [_cornerView setFrame:[
self _cornerViewFrame]];
1204 [_cornerView setHidden:NO];
1207 [_cornerView setHidden:YES];
1221 - (void)flashScrollers
1226 if (_hasHorizontalScroller)
1228 [_horizontalScroller setHidden:NO];
1229 [_horizontalScroller fadeIn];
1232 if (_hasVerticalScroller)
1234 [_verticalScroller setHidden:NO];
1235 [_verticalScroller fadeIn];
1238 if (_timerScrollersHide)
1239 [_timerScrollersHide invalidate]
1245 - (void)resizeSubviewsWithOldSize:(CGSize)aSize
1252 #pragma mark Overrides
1254 - (void)drawRect:(CPRect)aRect
1261 var strokeRect = [
self bounds],
1266 switch (_borderType)
1274 [
self _drawGrayBezelInContext:context bounds:strokeRect];
1278 [
self _drawGrooveInContext:context bounds:strokeRect];
1286 - (void)_drawGrayBezelInContext:(CGContext)context bounds:(CGRect)aRect
1288 var minX = _CGRectGetMinX(aRect),
1289 maxX = _CGRectGetMaxX(aRect),
1290 minY = _CGRectGetMinY(aRect),
1291 maxY = _CGRectGetMaxY(aRect),
1320 - (void)_drawGrooveInContext:(CGContext)context bounds:(CGRect)aRect
1322 var minX = _CGRectGetMinX(aRect),
1323 maxX = _CGRectGetMaxX(aRect),
1324 minY = _CGRectGetMinY(aRect),
1325 maxY = _CGRectGetMaxY(aRect);
1355 var rect = _CGRectOffset(aRect, 1.0, 1.0);
1357 rect.size.width -= 1.0;
1358 rect.size.height -= 1.0;
1378 if (_timerScrollersHide)
1379 [_timerScrollersHide invalidate];
1380 if (![_verticalScroller isHidden])
1381 [_verticalScroller fadeIn];
1382 if (![_horizontalScroller isHidden])
1383 [_horizontalScroller fadeIn];
1384 if (![_horizontalScroller isHidden] || ![_verticalScroller isHidden])
1387 [
self _respondToScrollWheelEventWithDeltaX:[anEvent
deltaX] deltaY:[anEvent
deltaY]];
1390 - (void)scrollPageUp:(
id)sender
1392 var contentBounds = [_contentView bounds];
1393 [
self moveByOffset:CGSizeMake(0.0, -(_CGRectGetHeight(contentBounds) - _verticalPageScroll))];
1396 - (void)scrollPageDown:(
id)sender
1398 var contentBounds = [_contentView bounds];
1399 [
self moveByOffset:CGSizeMake(0.0, _CGRectGetHeight(contentBounds) - _verticalPageScroll)];
1402 - (void)scrollToBeginningOfDocument:(
id)sender
1404 [_contentView scrollToPoint:_CGPointMakeZero()];
1405 [_headerClipView scrollToPoint:_CGPointMakeZero()];
1408 - (void)scrollToEndOfDocument:(
id)sender
1410 var contentBounds = [_contentView bounds],
1412 scrollPoint = _CGPointMake(0.0, _CGRectGetHeight(documentFrame) - _CGRectGetHeight(contentBounds));
1414 [_contentView scrollToPoint:scrollPoint];
1415 [_headerClipView scrollToPoint:_CGPointMakeZero()];
1418 - (void)moveLeft:(
id)sender
1420 [
self moveByOffset:CGSizeMake(-_horizontalLineScroll, 0.0)];
1423 - (void)moveRight:(
id)sender
1425 [
self moveByOffset:CGSizeMake(_horizontalLineScroll, 0.0)];
1428 - (void)moveUp:(
id)sender
1430 [
self moveByOffset:CGSizeMake(0.0, -_verticalLineScroll)];
1433 - (void)moveDown:(
id)sender
1435 [
self moveByOffset:CGSizeMake(0.0, _verticalLineScroll)];
1438 - (void)moveByOffset:(CGSize)aSize
1441 contentBounds = [_contentView bounds];
1443 contentBounds.origin.x += aSize.width;
1444 contentBounds.origin.y += aSize.height;
1446 [_contentView scrollToPoint:contentBounds.origin];
1447 [_headerClipView scrollToPoint:CGPointMake(contentBounds.origin.x, 0)];
1474 if (
self = [super initWithCoder:aCoder])
1476 _verticalLineScroll = [aCoder decodeFloatForKey:CPScrollViewVLineScrollKey];
1477 _verticalPageScroll = [aCoder decodeFloatForKey:CPScrollViewVPageScrollKey];
1479 _horizontalLineScroll = [aCoder decodeFloatForKey:CPScrollViewHLineScrollKey];
1480 _horizontalPageScroll = [aCoder decodeFloatForKey:CPScrollViewHPageScrollKey];
1482 _contentView = [aCoder decodeObjectForKey:CPScrollViewContentViewKey];
1483 _headerClipView = [aCoder decodeObjectForKey:CPScrollViewHeaderClipViewKey];
1485 if (!_headerClipView)
1491 _verticalScroller = [aCoder decodeObjectForKey:CPScrollViewVScrollerKey];
1492 _horizontalScroller = [aCoder decodeObjectForKey:CPScrollViewHScrollerKey];
1494 _hasVerticalScroller = [aCoder decodeBoolForKey:CPScrollViewHasVScrollerKey];
1495 _hasHorizontalScroller = [aCoder decodeBoolForKey:CPScrollViewHasHScrollerKey];
1496 _autohidesScrollers = [aCoder decodeBoolForKey:CPScrollViewAutohidesScrollerKey];
1498 _borderType = [aCoder decodeIntForKey:CPScrollViewBorderTypeKey];
1500 _cornerView = [aCoder decodeObjectForKey:CPScrollViewCornerViewKey];
1501 _bottomCornerView = [aCoder decodeObjectForKey:CPScrollViewBottomCornerViewKey];
1505 _implementedDelegateMethods = 0;
1512 name:CPScrollerStyleGlobalChangeNotification
1522 - (void)awakeFromCib
1524 [
self _updateScrollerStyle];
1525 [
self _updateCornerAndHeaderView];
1532 [aCoder encodeObject:_contentView forKey:CPScrollViewContentViewKey];
1533 [aCoder encodeObject:_headerClipView forKey:CPScrollViewHeaderClipViewKey];
1535 [aCoder encodeObject:_verticalScroller forKey:CPScrollViewVScrollerKey];
1536 [aCoder encodeObject:_horizontalScroller forKey:CPScrollViewHScrollerKey];
1538 [aCoder encodeFloat:_verticalLineScroll forKey:CPScrollViewVLineScrollKey];
1539 [aCoder encodeFloat:_verticalPageScroll forKey:CPScrollViewVPageScrollKey];
1540 [aCoder encodeFloat:_horizontalLineScroll forKey:CPScrollViewHLineScrollKey];
1541 [aCoder encodeFloat:_horizontalPageScroll forKey:CPScrollViewHPageScrollKey];
1543 [aCoder encodeBool:_hasVerticalScroller forKey:CPScrollViewHasVScrollerKey];
1544 [aCoder encodeBool:_hasHorizontalScroller forKey:CPScrollViewHasHScrollerKey];
1545 [aCoder encodeBool:_autohidesScrollers forKey:CPScrollViewAutohidesScrollerKey];
1547 [aCoder encodeObject:_cornerView forKey:CPScrollViewCornerViewKey];
1548 [aCoder encodeObject:_bottomCornerView forKey:CPScrollViewBottomCornerViewKey];
1550 [aCoder encodeInt:_borderType forKey:CPScrollViewBorderTypeKey];
1552 [aCoder encodeInt:_scrollerStyle forKey:CPScrollViewScrollerStyleKey];
1553 [aCoder encodeInt:_scrollerKnobStyle forKey:CPScrollViewScrollerKnobStyleKey];