diff --git a/AppKit/CPScrollView.j b/AppKit/CPScrollView.j index fc4768a8f..aee3597c3 100644 --- a/AppKit/CPScrollView.j +++ b/AppKit/CPScrollView.j @@ -5,6 +5,10 @@ * Created by Francisco Tolmasky. * Copyright 2008, 280 North, Inc. * + * Modified to match Lion style by Antoine Mercadal 2011 + * + * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -40,6 +44,7 @@ var TIMER_INTERVAL = 0.2, CPScrollViewDelegate_scrollViewDidScroll_ = 1 << 1; + @implementation CPScrollView : CPView { CPClipView _contentView; @@ -66,8 +71,17 @@ var TIMER_INTERVAL = 0.2, float _horizontalPageScroll; CPBorderType _borderType; + + CPTimer _timerScrollersHide; + + int _scrollerStyle; + int _scrollerKnobStyle; } + +#pragma mark - +#pragma mark Class methods + + (CPString)defaultThemeClass { return @"scrollview" @@ -81,64 +95,6 @@ var TIMER_INTERVAL = 0.2, }]; } -- (id)initWithFrame:(CGRect)aFrame -{ - self = [super initWithFrame:aFrame]; - - if (self) - { - _verticalLineScroll = 10.0; - _verticalPageScroll = 10.0; - - _horizontalLineScroll = 10.0; - _horizontalPageScroll = 10.0; - - _borderType = CPNoBorder; - - _contentView = [[CPClipView alloc] initWithFrame:[self _insetBounds]]; - [self addSubview:_contentView]; - - _headerClipView = [[CPClipView alloc] init]; - [self addSubview:_headerClipView]; - - _bottomCornerView = [[CPView alloc] init]; - [self addSubview:_bottomCornerView]; - - [self setHasVerticalScroller:YES]; - [self setHasHorizontalScroller:YES]; - - _delegate = nil; - _scrollTimer = nil; - _implementedDelegateMethods = 0; - } - - return self; -} - -- (id)delegate -{ - return _delegate; -} - -- (void)setDelegate:(id)aDelegate -{ - if (aDelegate === _delegate) - return; - - _delegate = aDelegate; - _implementedDelegateMethods = 0; - - if (_delegate === nil) - return; - - if ([_delegate respondsToSelector:@selector(scrollViewWillScroll:)]) - _implementedDelegateMethods |= CPScrollViewDelegate_scrollViewWillScroll_; - - if ([_delegate respondsToSelector:@selector(scrollViewDidScroll:)]) - _implementedDelegateMethods |= CPScrollViewDelegate_scrollViewDidScroll_; -} -// Calculating Layout - + (CGSize)contentSizeForFrameSize:(CGSize)frameSize hasHorizontalScroller:(BOOL)hFlag hasVerticalScroller:(BOOL)vFlag borderType:(CPBorderType)borderType { var bounds = [self _insetBounds:_CGRectMake(0.0, 0.0, frameSize.width, frameSize.height) borderType:borderType], @@ -182,7 +138,6 @@ var TIMER_INTERVAL = 0.2, bounds = _CGRectInset(bounds, 2.0, 2.0); ++bounds.origin.y; --bounds.size.height; - return bounds; case CPNoBorder: @@ -191,26 +146,120 @@ var TIMER_INTERVAL = 0.2, } } -- (CGRect)_insetBounds + +#pragma mark - +#pragma mark Initialization + +- (id)initWithFrame:(CGRect)aFrame { - return [[self class] _insetBounds:[self bounds] borderType:_borderType]; + self = [super initWithFrame:aFrame]; + + if (self) + { + _verticalLineScroll = 10.0; + _verticalPageScroll = 10.0; + + _horizontalLineScroll = 10.0; + _horizontalPageScroll = 10.0; + + _borderType = CPNoBorder; + + _contentView = [[CPClipView alloc] initWithFrame:[self _insetBounds]]; + [self addSubview:_contentView]; + + _headerClipView = [[CPClipView alloc] init]; + [self addSubview:_headerClipView]; + + _bottomCornerView = [[CPView alloc] init]; + [self addSubview:_bottomCornerView]; + + [self setHasVerticalScroller:YES]; + [self setHasHorizontalScroller:YES]; + _scrollerKnobStyle = CPScrollerKnobStyleDefault; + [self setScrollerStyle:CPScrollerStyleOverlay]; + + _delegate = nil; + _scrollTimer = nil; + _implementedDelegateMethods = 0; + } + + return self; } -// Determining component sizes + +#pragma mark - +#pragma mark Getters / Setters + /*! - Returns the size of the scroll view's content view. + The delegate of the scrol view */ -- (CGSize)contentSize +- (id)delegate { - return [_contentView frame].size; + return _delegate; } /*! - Returns the view that is scrolled for the user. + Set the delegate of the scroll view */ -- (id)documentView +- (void)setDelegate:(id)aDelegate { - return [_contentView documentView]; + if (aDelegate === _delegate) + return; + + _delegate = aDelegate; + _implementedDelegateMethods = 0; + + if (_delegate === nil) + return; + + if ([_delegate respondsToSelector:@selector(scrollViewWillScroll:)]) + _implementedDelegateMethods |= CPScrollViewDelegate_scrollViewWillScroll_; + + if ([_delegate respondsToSelector:@selector(scrollViewDidScroll:)]) + _implementedDelegateMethods |= CPScrollViewDelegate_scrollViewDidScroll_; +} + +- (int)scrollerStyle +{ + return _scrollerStyle; +} + +/*! + Set the scroller styles + - CPScrollerStyleLegacy: Standard scroller like prior 10.7 + - CPScrollerStyleOverlay: scrollers like 10.7+ +*/ +- (void)setScrollerStyle:(int)aStyle +{ + if (_scrollerStyle === aStyle) + return; + + _scrollerStyle = aStyle; + + [self _updateScrollerStyle]; +} + +- (int)scrollerKnobStyle +{ + return _scrollerKnobStyle; +} + +- (void)setScrollerKnobStyle:(int)newScrollerKnobStyle +{ + if (_scrollerKnobStyle === newScrollerKnobStyle) + return; + + _scrollerKnobStyle = newScrollerKnobStyle; + + [self _updateScrollerStyle]; +} + +/*! + Returns the content view that clips the document. +*/ +- (CPClipView)contentView +{ + return _contentView; } /*! @@ -239,12 +288,21 @@ var TIMER_INTERVAL = 0.2, [self reflectScrolledClipView:_contentView]; } + /*! - Returns the content view that clips the document. + Returns the size of the scroll view's content view. */ -- (CPClipView)contentView +- (CGSize)contentSize { - return _contentView; + return [_contentView frame].size; +} + +/*! + Returns the view that is scrolled for the user. +*/ +- (id)documentView +{ + return [_contentView documentView]; } /*! @@ -260,6 +318,610 @@ var TIMER_INTERVAL = 0.2, [self reflectScrolledClipView:_contentView]; } +/*! + Returns the border type drawn around the view. +*/ +- (CPBorderType)borderType +{ + return _borderType; +} + +/*! + Sets the type of border to be drawn around the view. + Valid types are: +
+    CPNoBorder
+    CPLineBorder
+    CPBezelBorder
+    CPGrooveBorder
+*/ +- (void)setBorderType:(CPBorderType)borderType +{ + if (_borderType == borderType) + return; + + _borderType = borderType; + + [self reflectScrolledClipView:_contentView]; + [self setNeedsDisplay:YES]; +} + + +/*! + Returns the scroll view's horizontal scroller +*/ +- (CPScroller)horizontalScroller +{ + return _horizontalScroller; +} + +/*! + Sets the scroll view's horizontal scroller. + @param aScroller the horizontal scroller for the scroll view +*/ +- (void)setHorizontalScroller:(CPScroller)aScroller +{ + if (_horizontalScroller === aScroller) + return; + + [_horizontalScroller removeFromSuperview]; + [_horizontalScroller setTarget:nil]; + [_horizontalScroller setAction:nil]; + + _horizontalScroller = aScroller; + + [_horizontalScroller setTarget:self]; + [_horizontalScroller setAction:@selector(_horizontalScrollerDidScroll:)]; + + [self addSubview:_horizontalScroller]; + + [self _updateScrollerStyle]; +} + +/*! + Returns \c YES if the scroll view can have a horizontal scroller. +*/ +- (BOOL)hasHorizontalScroller +{ + return _hasHorizontalScroller; +} + +/*! + Specifies whether the scroll view can have a horizontal scroller. + @param hasHorizontalScroller \c YES lets the scroll view + allocate a horizontal scroller if necessary. +*/ +- (void)setHasHorizontalScroller:(BOOL)shouldHaveHorizontalScroller +{ + if (_hasHorizontalScroller === shouldHaveHorizontalScroller) + return; + + _hasHorizontalScroller = shouldHaveHorizontalScroller; + + if (_hasHorizontalScroller && !_horizontalScroller) + { + var bounds = [self _insetBounds]; + + [self setHorizontalScroller:[[CPScroller alloc] initWithFrame:CGRectMake(0.0, 0.0, MAX(_CGRectGetWidth(bounds), [CPScroller scrollerWidthInStyle:_scrollerStyle] + 1), [CPScroller scrollerWidthInStyle:_scrollerStyle])]]; + [[self horizontalScroller] setFrameSize:CGSizeMake(_CGRectGetWidth(bounds), [CPScroller scrollerWidthInStyle:_scrollerStyle])]; + } + + [self reflectScrolledClipView:_contentView]; +} + +/*! + Return's the scroll view's vertical scroller +*/ +- (CPScroller)verticalScroller +{ + return _verticalScroller; +} + +/*! + Sets the scroll view's vertical scroller. + @param aScroller the vertical scroller +*/ +- (void)setVerticalScroller:(CPScroller)aScroller +{ + if (_verticalScroller === aScroller) + return; + + [_verticalScroller removeFromSuperview]; + [_verticalScroller setTarget:nil]; + [_verticalScroller setAction:nil]; + + _verticalScroller = aScroller; + + [_verticalScroller setTarget:self]; + [_verticalScroller setAction:@selector(_verticalScrollerDidScroll:)]; + + [self addSubview:_verticalScroller]; + + [self _updateScrollerStyle]; +} + +/*! + Returns \c YES if the scroll view can have a vertical scroller. +*/ +- (BOOL)hasVerticalScroller +{ + return _hasVerticalScroller; +} + +/*! + Specifies whether the scroll view has can have + a vertical scroller. It allocates it if necessary. + @param hasVerticalScroller \c YES allows + the scroll view to display a vertical scroller +*/ +- (void)setHasVerticalScroller:(BOOL)shouldHaveVerticalScroller +{ + if (_hasVerticalScroller === shouldHaveVerticalScroller) + return; + + _hasVerticalScroller = shouldHaveVerticalScroller; + + if (_hasVerticalScroller && !_verticalScroller) + { + var bounds = [self _insetBounds]; + + [self setVerticalScroller:[[CPScroller alloc] initWithFrame:_CGRectMake(0.0, 0.0, [CPScroller scrollerWidthInStyle:_scrollerStyle], MAX(_CGRectGetHeight(bounds), [CPScroller scrollerWidthInStyle:_scrollerStyle] + 1))]]; + [[self verticalScroller] setFrameSize:CGSizeMake([CPScroller scrollerWidthInStyle:_scrollerStyle], _CGRectGetHeight(bounds))]; + } + + [self reflectScrolledClipView:_contentView]; +} + +/*! + Returns \c YES if the scroll view hides its scroll + bars when not necessary. +*/ +- (BOOL)autohidesScrollers +{ + return _autohidesScrollers; +} + +/*! + Sets whether the scroll view hides its scroll bars when not needed. + @param autohidesScrollers \c YES causes the scroll bars + to be hidden when not needed. +*/ +- (void)setAutohidesScrollers:(BOOL)autohidesScrollers +{ + if (_autohidesScrollers == autohidesScrollers) + return; + + _autohidesScrollers = autohidesScrollers; + + [self reflectScrolledClipView:_contentView]; +} + +- (CPView)bottomCornerView +{ + return _bottomCornerView; +} + +- (void)setBottomCornerView:(CPView)aBottomCornerView +{ + if (_bottomCornerView === aBottomCornerView) + return; + + [_bottomCornerView removeFromSuperview]; + + [aBottomCornerView setFrame:[self _bottomCornerViewFrame]]; + [self addSubview:aBottomCornerView]; + + _bottomCornerView = aBottomCornerView; + + [self _updateCornerAndHeaderView]; +} + +/*! + Returns how much the document moves when scrolled +*/ +- (float)lineScroll +{ + return [self horizontalLineScroll]; +} + +/*! + Sets how much the document moves when scrolled. Sets the vertical and horizontal scroll. + @param aLineScroll the amount to move the document when scrolled +*/ +- (void)setLineScroll:(float)aLineScroll +{ + [self setHorizontalLineScroll:aLineScroll]; + [self setVerticalLineScroll:aLineScroll]; +} + +/*! + Returns how much the document moves horizontally when scrolled. +*/ +- (float)horizontalLineScroll +{ + return _horizontalLineScroll; +} + +/*! + Sets how much the document moves when scrolled horizontally. + @param aLineScroll the amount to move horizontally when scrolled. +*/ +- (void)setHorizontalLineScroll:(float)aLineScroll +{ + _horizontalLineScroll = aLineScroll; +} + +/*! + Returns how much the document moves vertically when scrolled. +*/ +- (float)verticalLineScroll +{ + return _verticalLineScroll; +} + +/*! + Sets how much the document moves when scrolled vertically. + @param aLineScroll the new amount to move vertically when scrolled. +*/ +- (void)setVerticalLineScroll:(float)aLineScroll +{ + _verticalLineScroll = aLineScroll; +} + +/*! + Returns the vertical and horizontal page scroll amount. +*/ +- (float)pageScroll +{ + return [self horizontalPageScroll]; +} + +/*! + Sets the horizontal and vertical page scroll amount. + @param aPageScroll the new horizontal and vertical page scroll amount +*/ +- (void)setPageScroll:(float)aPageScroll +{ + [self setHorizontalPageScroll:aPageScroll]; + [self setVerticalPageScroll:aPageScroll]; +} + +/*! + Returns the horizontal page scroll amount. +*/ +- (float)horizontalPageScroll +{ + return _horizontalPageScroll; +} + +/*! + Sets the horizontal page scroll amount. + @param aPageScroll the new horizontal page scroll amount +*/ +- (void)setHorizontalPageScroll:(float)aPageScroll +{ + _horizontalPageScroll = aPageScroll; +} + +/*! + Returns the vertical page scroll amount. +*/ +- (float)verticalPageScroll +{ + return _verticalPageScroll; +} + +/*! + Sets the vertical page scroll amount. + @param aPageScroll the new vertical page scroll amount +*/ +- (void)setVerticalPageScroll:(float)aPageScroll +{ + _verticalPageScroll = aPageScroll; +} + + +#pragma mark - +#pragma mark Privates + +/* @ignore */ +- (void)_updateScrollerStyle +{ + if (_hasHorizontalScroller) + { + [_horizontalScroller setStyle:_scrollerStyle]; + [_horizontalScroller unsetThemeState:CPThemeStateSelected]; + switch (_scrollerKnobStyle) + { + case CPScrollerKnobStyleLight: + [_horizontalScroller unsetThemeState:CPThemeStateScrollerKnobDark]; + [_horizontalScroller setThemeState:CPThemeStateScrollerKnobLight]; + break; + case CPScrollerKnobStyleDark: + [_horizontalScroller unsetThemeState:CPThemeStateScrollerKnobLight]; + [_horizontalScroller setThemeState:CPThemeStateScrollerKnobDark]; + break; + default: + [_horizontalScroller unsetThemeState:CPThemeStateScrollerKnobLight]; + [_horizontalScroller unsetThemeState:CPThemeStateScrollerKnobDark]; + } + } + if (_hasVerticalScroller) + { + [_verticalScroller setStyle:_scrollerStyle]; + [_verticalScroller unsetThemeState:CPThemeStateSelected]; + switch (_scrollerKnobStyle) + { + case CPScrollerKnobStyleLight: + [_verticalScroller unsetThemeState:CPThemeStateScrollerKnobDark]; + [_verticalScroller setThemeState:CPThemeStateScrollerKnobLight]; + break; + case CPScrollerKnobStyleDark: + [_verticalScroller unsetThemeState:CPThemeStateScrollerKnobLight]; + [_verticalScroller setThemeState:CPThemeStateScrollerKnobDark]; + break; + default: + [_verticalScroller unsetThemeState:CPThemeStateScrollerKnobLight]; + [_verticalScroller unsetThemeState:CPThemeStateScrollerKnobDark]; + } + } + + if (_scrollerStyle == CPScrollerStyleOverlay) + { + if (_timerScrollersHide) + [_timerScrollersHide invalidate]; + _timerScrollersHide = [CPTimer scheduledTimerWithTimeInterval:1.2 target:self selector:@selector(_hideScrollers:) userInfo:nil repeats:NO]; + } + + [self reflectScrolledClipView:_contentView]; +} + +/* @ignore */ +- (CGRect)_insetBounds +{ + return [[self class] _insetBounds:[self bounds] borderType:_borderType]; +} + +/* @ignore */ +- (void)_updateCornerAndHeaderView +{ + var documentView = [self documentView], + currentHeaderView = [self _headerView], + documentHeaderView = [documentView respondsToSelector:@selector(headerView)] ? [documentView headerView] : nil; + + if (currentHeaderView !== documentHeaderView) + { + [currentHeaderView removeFromSuperview]; + [_headerClipView setDocumentView:documentHeaderView]; + } + + var documentCornerView = [documentView respondsToSelector:@selector(cornerView)] ? [documentView cornerView] : nil; + + if (_cornerView !== documentCornerView) + { + [_cornerView removeFromSuperview]; + + _cornerView = documentCornerView; + + if (_cornerView) + [self addSubview:_cornerView]; + } + + [self reflectScrolledClipView:_contentView]; +} + +/* @ignore */ +- (CPView)_headerView +{ + return [_headerClipView documentView]; +} + +/* @ignore */ +- (CGRect)_cornerViewFrame +{ + if (!_cornerView) + return _CGRectMakeZero(); + + var bounds = [self _insetBounds], + frame = [_cornerView frame]; + + frame.origin.x = _CGRectGetMaxX(bounds) - _CGRectGetWidth(frame); + frame.origin.y = _CGRectGetMinY(bounds); + + return frame; +} + +/* @ignore */ +- (CGRect)_headerClipViewFrame +{ + var headerView = [self _headerView]; + + if (!headerView) + return _CGRectMakeZero(); + + var frame = [self _insetBounds]; + + frame.size.height = _CGRectGetHeight([headerView frame]); + frame.size.width -= _CGRectGetWidth([self _cornerViewFrame]); + + return frame; +} + +/* @ignore */ +- (CGRect)_bottomCornerViewFrame +{ + if ([[self horizontalScroller] isHidden] || [[self verticalScroller] isHidden]) + return CGRectMakeZero(); + + var verticalFrame = [[self verticalScroller] frame], + bottomCornerFrame = CGRectMakeZero(); + + bottomCornerFrame.origin.x = CGRectGetMinX(verticalFrame); + bottomCornerFrame.origin.y = CGRectGetMaxY(verticalFrame); + bottomCornerFrame.size.width = [CPScroller scrollerWidthInStyle:_scrollerStyle]; + bottomCornerFrame.size.height = [CPScroller scrollerWidthInStyle:_scrollerStyle]; + + return bottomCornerFrame; +} + +/* @ignore */ +- (void)_verticalScrollerDidScroll:(CPScroller)aScroller +{ + var value = [aScroller floatValue], + documentFrame = [[_contentView documentView] frame], + contentBounds = [_contentView bounds]; + + + switch ([_verticalScroller hitPart]) + { + case CPScrollerDecrementLine: + contentBounds.origin.y -= _verticalLineScroll; + break; + + case CPScrollerIncrementLine: + contentBounds.origin.y += _verticalLineScroll; + break; + + case CPScrollerDecrementPage: + contentBounds.origin.y -= _CGRectGetHeight(contentBounds) - _verticalPageScroll; + break; + + case CPScrollerIncrementPage: + contentBounds.origin.y += _CGRectGetHeight(contentBounds) - _verticalPageScroll; + break; + + // We want integral bounds! + case CPScrollerKnobSlot: + case CPScrollerKnob: + default: + contentBounds.origin.y = ROUND(value * (_CGRectGetHeight(documentFrame) - _CGRectGetHeight(contentBounds))); + } + + [self _sendDelegateMessages]; + + [_contentView scrollToPoint:contentBounds.origin]; +} + +/* @ignore */ +- (void)_horizontalScrollerDidScroll:(CPScroller)aScroller +{ + var value = [aScroller floatValue], + documentFrame = [[self documentView] frame], + contentBounds = [_contentView bounds]; + + switch ([_horizontalScroller hitPart]) + { + case CPScrollerDecrementLine: + contentBounds.origin.x -= _horizontalLineScroll; + break; + + case CPScrollerIncrementLine: + contentBounds.origin.x += _horizontalLineScroll; + break; + + case CPScrollerDecrementPage: + contentBounds.origin.x -= _CGRectGetWidth(contentBounds) - _horizontalPageScroll; + break; + + case CPScrollerIncrementPage: + contentBounds.origin.x += _CGRectGetWidth(contentBounds) - _horizontalPageScroll; + break; + + // We want integral bounds! + case CPScrollerKnobSlot: + case CPScrollerKnob: + default: + contentBounds.origin.x = ROUND(value * (_CGRectGetWidth(documentFrame) - _CGRectGetWidth(contentBounds))); + } + + [self _sendDelegateMessages]; + + [_contentView scrollToPoint:contentBounds.origin]; + [_headerClipView scrollToPoint:CGPointMake(contentBounds.origin.x, 0.0)]; +} + +/* @ignore */ +- (void)_sendDelegateMessages +{ + if (_implementedDelegateMethods == 0) + return; + + if (!_scrollTimer) + { + [self _scrollViewWillScroll]; + _scrollTimer = [CPTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(_scrollViewDidScroll) userInfo:nil repeats:YES]; + } + else + [_scrollTimer setFireDate:[CPDate dateWithTimeIntervalSinceNow:TIMER_INTERVAL]]; +} + +/* @ignore */ +- (void)_hideScrollers:(CPTimer)theTimer +{ + if ([_verticalScroller allowFadingOut]) + [_verticalScroller fadeOut]; + if ([_horizontalScroller allowFadingOut]) + [_horizontalScroller fadeOut]; + _timerScrollersHide = nil; +} + +/* @ignore */ +- (void)_respondToScrollWheelEventWithDeltaX:(float)deltaX deltaY:(float)deltaY +{ + var documentFrame = [[self documentView] frame], + contentBounds = [_contentView bounds], + contentFrame = [_contentView frame], + enclosingScrollView = [self enclosingScrollView]; + + // We want integral bounds! + contentBounds.origin.x = ROUND(contentBounds.origin.x + deltaX); + contentBounds.origin.y = ROUND(contentBounds.origin.y + deltaY); + + var constrainedOrigin = [_contentView constrainScrollPoint:CGPointCreateCopy(contentBounds.origin)], + extraX = contentBounds.origin.x - constrainedOrigin.x, + extraY = contentBounds.origin.y - constrainedOrigin.y; + + [self _sendDelegateMessages]; + + [_contentView scrollToPoint:constrainedOrigin]; + [_headerClipView scrollToPoint:CGPointMake(constrainedOrigin.x, 0.0)]; + + if (extraX || extraY) + [enclosingScrollView _respondToScrollWheelEventWithDeltaX:extraX deltaY:extraY]; +} + +/* @ignore */ +- (void)_scrollViewWillScroll +{ + if (_implementedDelegateMethods & CPScrollViewDelegate_scrollViewWillScroll_) + [_delegate scrollViewWillScroll:self]; +} + +/* @ignore */ +- (void)_scrollViewDidScroll +{ + [_scrollTimer invalidate]; + _scrollTimer = nil; + + if (_implementedDelegateMethods & CPScrollViewDelegate_scrollViewDidScroll_) + [_delegate scrollViewDidScroll:self]; +} + + +#pragma mark - +#pragma mark Utilities + +/*! + Lays out the scroll view's components. +*/ +- (void)tile +{ + // yuck. + // RESIZE: tile->setHidden AND refl + // Outside Change: refl->tile->setHidden AND refl + // scroll: refl. +} + /*! Resizes the scroll view to contain the specified clip view. @param aClipView the clip view to resize to @@ -283,11 +945,6 @@ var TIMER_INTERVAL = 0.2, [_verticalScroller setHidden:YES]; [_horizontalScroller setHidden:YES]; } - else - { -// [_verticalScroller setEnabled:NO]; -// [_horizontalScroller setEnabled:NO]; - } [_contentView setFrame:[self _insetBounds]]; [_headerClipView setFrame:_CGRectMakeZero()]; @@ -335,12 +992,17 @@ var TIMER_INTERVAL = 0.2, [_horizontalScroller setHidden:!shouldShowHorizontalScroller]; [_horizontalScroller setEnabled:hasHorizontalScroll]; - // We can thus appropriately account for them changing the content size. - if (shouldShowVerticalScroller) - contentFrame.size.width -= verticalScrollerWidth; + var overlay = [CPScroller scrollerOverlay]; + if (_scrollerStyle === CPScrollerStyleLegacy) + { + // We can thus appropriately account for them changing the content size. + if (shouldShowVerticalScroller) + contentFrame.size.width -= verticalScrollerWidth; - if (shouldShowHorizontalScroller) - contentFrame.size.height -= horizontalScrollerHeight; + if (shouldShowHorizontalScroller) + contentFrame.size.height -= horizontalScrollerHeight; + overlay = 0; + } var scrollPoint = [_contentView bounds].origin, wasShowingVerticalScroller = ![_verticalScroller isHidden], @@ -355,7 +1017,7 @@ var TIMER_INTERVAL = 0.2, [_verticalScroller setFloatValue:(difference.height <= 0.0) ? 0.0 : scrollPoint.y / difference.height]; [_verticalScroller setKnobProportion:_CGRectGetHeight(contentFrame) / _CGRectGetHeight(documentFrame)]; - [_verticalScroller setFrame:_CGRectMake(_CGRectGetMaxX(contentFrame), verticalScrollerY, verticalScrollerWidth, verticalScrollerHeight)]; + [_verticalScroller setFrame:_CGRectMake(_CGRectGetMaxX(contentFrame) - overlay, verticalScrollerY, verticalScrollerWidth, verticalScrollerHeight)]; } else if (wasShowingVerticalScroller) { @@ -367,7 +1029,7 @@ var TIMER_INTERVAL = 0.2, { [_horizontalScroller setFloatValue:(difference.width <= 0.0) ? 0.0 : scrollPoint.x / difference.width]; [_horizontalScroller setKnobProportion:_CGRectGetWidth(contentFrame) / _CGRectGetWidth(documentFrame)]; - [_horizontalScroller setFrame:_CGRectMake(_CGRectGetMinX(contentFrame), _CGRectGetMaxY(contentFrame), _CGRectGetWidth(contentFrame), horizontalScrollerHeight)]; + [_horizontalScroller setFrame:_CGRectMake(_CGRectGetMinX(contentFrame), _CGRectGetMaxY(contentFrame) - overlay, _CGRectGetWidth(contentFrame), horizontalScrollerHeight)]; } else if (wasShowingHorizontalScroller) { @@ -386,473 +1048,33 @@ var TIMER_INTERVAL = 0.2, --_recursionCount; } -// Managing Graphics Attributes - /*! - Sets the type of border to be drawn around the view. - Valid types are: -
-    CPNoBorder
-    CPLineBorder
-    CPBezelBorder
-    CPGrooveBorder
+ Momentary display the scrollers */ -- (void)setBorderType:(CPBorderType)borderType +- (void)flashScrollers { - if (_borderType == borderType) + if (_scrollerStyle == CPScrollerStyleLegacy) return; - _borderType = borderType; + if (_hasHorizontalScroller) + [_horizontalScroller fadeIn]; + if (_hasVerticalScroller) + [_verticalScroller fadeIn]; - [self reflectScrolledClipView:_contentView]; - [self setNeedsDisplay:YES]; -} - -/*! - Returns the border type drawn around the view. -*/ -- (CPBorderType)borderType -{ - return _borderType; -} - -// Managing Scrollers -/*! - Sets the scroll view's horizontal scroller. - @param aScroller the horizontal scroller for the scroll view -*/ -- (void)setHorizontalScroller:(CPScroller)aScroller -{ - if (_horizontalScroller === aScroller) - return; - - [_horizontalScroller removeFromSuperview]; - [_horizontalScroller setTarget:nil]; - [_horizontalScroller setAction:nil]; - - _horizontalScroller = aScroller; - - [_horizontalScroller setTarget:self]; - [_horizontalScroller setAction:@selector(_horizontalScrollerDidScroll:)]; - - [self addSubview:_horizontalScroller]; - - [self reflectScrolledClipView:_contentView]; -} - -/*! - Returns the scroll view's horizontal scroller -*/ -- (CPScroller)horizontalScroller -{ - return _horizontalScroller; -} - -/*! - Specifies whether the scroll view can have a horizontal scroller. - @param hasHorizontalScroller \c YES lets the scroll view - allocate a horizontal scroller if necessary. -*/ -- (void)setHasHorizontalScroller:(BOOL)shouldHaveHorizontalScroller -{ - if (_hasHorizontalScroller === shouldHaveHorizontalScroller) - return; - - _hasHorizontalScroller = shouldHaveHorizontalScroller; - - if (_hasHorizontalScroller && !_horizontalScroller) - { - var bounds = [self _insetBounds]; - - [self setHorizontalScroller:[[CPScroller alloc] initWithFrame:CGRectMake(0.0, 0.0, MAX(_CGRectGetWidth(bounds), [CPScroller scrollerWidth] + 1), [CPScroller scrollerWidth])]]; - [[self horizontalScroller] setFrameSize:CGSizeMake(_CGRectGetWidth(bounds), [CPScroller scrollerWidth])]; - } - - [self reflectScrolledClipView:_contentView]; -} - -/*! - Returns \c YES if the scroll view can have a horizontal scroller. -*/ -- (BOOL)hasHorizontalScroller -{ - return _hasHorizontalScroller; -} - -/*! - Sets the scroll view's vertical scroller. - @param aScroller the vertical scroller -*/ -- (void)setVerticalScroller:(CPScroller)aScroller -{ - if (_verticalScroller === aScroller) - return; - - [_verticalScroller removeFromSuperview]; - [_verticalScroller setTarget:nil]; - [_verticalScroller setAction:nil]; - - _verticalScroller = aScroller; - - [_verticalScroller setTarget:self]; - [_verticalScroller setAction:@selector(_verticalScrollerDidScroll:)]; - - [self addSubview:_verticalScroller]; - - [self reflectScrolledClipView:_contentView]; -} - -/*! - Return's the scroll view's vertical scroller -*/ -- (CPScroller)verticalScroller -{ - return _verticalScroller; -} - -/*! - Specifies whether the scroll view has can have - a vertical scroller. It allocates it if necessary. - @param hasVerticalScroller \c YES allows - the scroll view to display a vertical scroller -*/ -- (void)setHasVerticalScroller:(BOOL)shouldHaveVerticalScroller -{ - if (_hasVerticalScroller === shouldHaveVerticalScroller) - return; - - _hasVerticalScroller = shouldHaveVerticalScroller; - - if (_hasVerticalScroller && !_verticalScroller) - { - var bounds = [self _insetBounds]; - - [self setVerticalScroller:[[CPScroller alloc] initWithFrame:_CGRectMake(0.0, 0.0, [CPScroller scrollerWidth], MAX(_CGRectGetHeight(bounds), [CPScroller scrollerWidth] + 1))]]; - [[self verticalScroller] setFrameSize:CGSizeMake([CPScroller scrollerWidth], _CGRectGetHeight(bounds))]; - } - - [self reflectScrolledClipView:_contentView]; -} - -/*! - Returns \c YES if the scroll view can have a vertical scroller. -*/ -- (BOOL)hasVerticalScroller -{ - return _hasVerticalScroller; -} - -/*! - Sets whether the scroll view hides its scroll bars when not needed. - @param autohidesScrollers \c YES causes the scroll bars - to be hidden when not needed. -*/ -- (void)setAutohidesScrollers:(BOOL)autohidesScrollers -{ - if (_autohidesScrollers == autohidesScrollers) - return; - - _autohidesScrollers = autohidesScrollers; - - [self reflectScrolledClipView:_contentView]; -} - -/*! - Returns \c YES if the scroll view hides its scroll - bars when not necessary. -*/ -- (BOOL)autohidesScrollers -{ - return _autohidesScrollers; -} - -- (void)_updateCornerAndHeaderView -{ - var documentView = [self documentView], - currentHeaderView = [self _headerView], - documentHeaderView = [documentView respondsToSelector:@selector(headerView)] ? [documentView headerView] : nil; - - if (currentHeaderView !== documentHeaderView) - { - [currentHeaderView removeFromSuperview]; - [_headerClipView setDocumentView:documentHeaderView]; - } - - var documentCornerView = [documentView respondsToSelector:@selector(cornerView)] ? [documentView cornerView] : nil; - - if (_cornerView !== documentCornerView) - { - [_cornerView removeFromSuperview]; - - _cornerView = documentCornerView; - - if (_cornerView) - [self addSubview:_cornerView]; - } - - [self reflectScrolledClipView:_contentView]; -} - -- (CPView)_headerView -{ - return [_headerClipView documentView]; -} - -- (CGRect)_cornerViewFrame -{ - if (!_cornerView) - return _CGRectMakeZero(); - - var bounds = [self _insetBounds], - frame = [_cornerView frame]; - - frame.origin.x = _CGRectGetMaxX(bounds) - _CGRectGetWidth(frame); - frame.origin.y = _CGRectGetMinY(bounds); - - return frame; -} - -- (CGRect)_headerClipViewFrame -{ - var headerView = [self _headerView]; - - if (!headerView) - return _CGRectMakeZero(); - - var frame = [self _insetBounds]; - - frame.size.height = _CGRectGetHeight([headerView frame]); - frame.size.width -= _CGRectGetWidth([self _cornerViewFrame]); - - return frame; -} - -- (CGRect)_bottomCornerViewFrame -{ - if ([[self horizontalScroller] isHidden] || [[self verticalScroller] isHidden]) - return CGRectMakeZero(); - - var verticalFrame = [[self verticalScroller] frame], - bottomCornerFrame = CGRectMakeZero(); - - bottomCornerFrame.origin.x = CGRectGetMinX(verticalFrame); - bottomCornerFrame.origin.y = CGRectGetMaxY(verticalFrame); - bottomCornerFrame.size.width = [CPScroller scrollerWidth]; - bottomCornerFrame.size.height = [CPScroller scrollerWidth]; - - return bottomCornerFrame; -} - -- (void)setBottomCornerView:(CPView)aBottomCornerView -{ - if (_bottomCornerView === aBottomCornerView) - return; - - [_bottomCornerView removeFromSuperview]; - - [aBottomCornerView setFrame:[self _bottomCornerViewFrame]]; - [self addSubview:aBottomCornerView]; - - _bottomCornerView = aBottomCornerView; - - [self _updateCornerAndHeaderView]; -} - -- (CPView)bottomCornerView -{ - return _bottomCornerView; + if (_timerScrollersHide) + [_timerScrollersHide invalidate] + _timerScrollersHide = [CPTimer scheduledTimerWithTimeInterval:1.2 target:self selector:@selector(_hideScrollers:) userInfo:nil repeats:NO]; } /* @ignore */ -- (void)_verticalScrollerDidScroll:(CPScroller)aScroller -{ - var value = [aScroller floatValue], - documentFrame = [[_contentView documentView] frame], - contentBounds = [_contentView bounds]; - - switch ([_verticalScroller hitPart]) - { - case CPScrollerDecrementLine: contentBounds.origin.y -= _verticalLineScroll; - break; - - case CPScrollerIncrementLine: contentBounds.origin.y += _verticalLineScroll; - break; - - case CPScrollerDecrementPage: contentBounds.origin.y -= _CGRectGetHeight(contentBounds) - _verticalPageScroll; - break; - - case CPScrollerIncrementPage: contentBounds.origin.y += _CGRectGetHeight(contentBounds) - _verticalPageScroll; - break; - - case CPScrollerKnobSlot: - case CPScrollerKnob: - // We want integral bounds! - default: contentBounds.origin.y = ROUND(value * (_CGRectGetHeight(documentFrame) - _CGRectGetHeight(contentBounds))); - } - - [self _sendDelegateMessages]; - - [_contentView scrollToPoint:contentBounds.origin]; -} - -/* @ignore */ -- (void)_horizontalScrollerDidScroll:(CPScroller)aScroller -{ - var value = [aScroller floatValue], - documentFrame = [[self documentView] frame], - contentBounds = [_contentView bounds]; - - switch ([_horizontalScroller hitPart]) - { - case CPScrollerDecrementLine: contentBounds.origin.x -= _horizontalLineScroll; - break; - - case CPScrollerIncrementLine: contentBounds.origin.x += _horizontalLineScroll; - break; - - case CPScrollerDecrementPage: contentBounds.origin.x -= _CGRectGetWidth(contentBounds) - _horizontalPageScroll; - break; - - case CPScrollerIncrementPage: contentBounds.origin.x += _CGRectGetWidth(contentBounds) - _horizontalPageScroll; - break; - - case CPScrollerKnobSlot: - case CPScrollerKnob: - // We want integral bounds! - default: contentBounds.origin.x = ROUND(value * (_CGRectGetWidth(documentFrame) - _CGRectGetWidth(contentBounds))); - } - - [self _sendDelegateMessages]; - - [_contentView scrollToPoint:contentBounds.origin]; - [_headerClipView scrollToPoint:CGPointMake(contentBounds.origin.x, 0.0)]; -} - -/*! - Lays out the scroll view's components. -*/ -- (void)tile -{ - // yuck. - // RESIZE: tile->setHidden AND refl - // Outside Change: refl->tile->setHidden AND refl - // scroll: refl. -} - -/* - @ignore -*/ - (void)resizeSubviewsWithOldSize:(CGSize)aSize { [self reflectScrolledClipView:_contentView]; } -// Setting Scrolling Behavior -/*! - Sets how much the document moves when scrolled. Sets the vertical and horizontal scroll. - @param aLineScroll the amount to move the document when scrolled -*/ -- (void)setLineScroll:(float)aLineScroll -{ - [self setHorizontalLineScroll:aLineScroll]; - [self setVerticalLineScroll:aLineScroll]; -} -/*! - Returns how much the document moves when scrolled -*/ -- (float)lineScroll -{ - return [self horizontalLineScroll]; -} - -/*! - Sets how much the document moves when scrolled horizontally. - @param aLineScroll the amount to move horizontally when scrolled. -*/ -- (void)setHorizontalLineScroll:(float)aLineScroll -{ - _horizontalLineScroll = aLineScroll; -} - -/*! - Returns how much the document moves horizontally when scrolled. -*/ -- (float)horizontalLineScroll -{ - return _horizontalLineScroll; -} - -/*! - Sets how much the document moves when scrolled vertically. - @param aLineScroll the new amount to move vertically when scrolled. -*/ -- (void)setVerticalLineScroll:(float)aLineScroll -{ - _verticalLineScroll = aLineScroll; -} - -/*! - Returns how much the document moves vertically when scrolled. -*/ -- (float)verticalLineScroll -{ - return _verticalLineScroll; -} - -/*! - Sets the horizontal and vertical page scroll amount. - @param aPageScroll the new horizontal and vertical page scroll amount -*/ -- (void)setPageScroll:(float)aPageScroll -{ - [self setHorizontalPageScroll:aPageScroll]; - [self setVerticalPageScroll:aPageScroll]; -} - -/*! - Returns the vertical and horizontal page scroll amount. -*/ -- (float)pageScroll -{ - return [self horizontalPageScroll]; -} - -/*! - Sets the horizontal page scroll amount. - @param aPageScroll the new horizontal page scroll amount -*/ -- (void)setHorizontalPageScroll:(float)aPageScroll -{ - _horizontalPageScroll = aPageScroll; -} - -/*! - Returns the horizontal page scroll amount. -*/ -- (float)horizontalPageScroll -{ - return _horizontalPageScroll; -} - -/*! - Sets the vertical page scroll amount. - @param aPageScroll the new vertical page scroll amount -*/ -- (void)setVerticalPageScroll:(float)aPageScroll -{ - _verticalPageScroll = aPageScroll; -} - -/*! - Returns the vertical page scroll amount. -*/ -- (float)verticalPageScroll -{ - return _verticalPageScroll; -} - -// CPView Overrides +#pragma mark - +#pragma mark Overrides - (void)drawRect:(CPRect)aRect { @@ -974,42 +1196,24 @@ var TIMER_INTERVAL = 0.2, CGContextStrokePath(context); } - -// CPResponder Overrides - /*! Handles a scroll wheel event from the user. @param anEvent the scroll wheel event */ - (void)scrollWheel:(CPEvent)anEvent { + if (_timerScrollersHide) + [_timerScrollersHide invalidate]; + if (![_verticalScroller isHidden]) + [_verticalScroller fadeIn]; + if (![_horizontalScroller isHidden]) + [_horizontalScroller fadeIn]; + if (![_horizontalScroller isHidden] || ![_verticalScroller isHidden]) + _timerScrollersHide = [CPTimer scheduledTimerWithTimeInterval:1.2 target:self selector:@selector(_hideScrollers:) userInfo:nil repeats:NO]; + [self _respondToScrollWheelEventWithDeltaX:[anEvent deltaX] deltaY:[anEvent deltaY]]; } -- (void)_respondToScrollWheelEventWithDeltaX:(float)deltaX deltaY:(float)deltaY -{ - var documentFrame = [[self documentView] frame], - contentBounds = [_contentView bounds], - contentFrame = [_contentView frame], - enclosingScrollView = [self enclosingScrollView]; - - // We want integral bounds! - contentBounds.origin.x = ROUND(contentBounds.origin.x + deltaX); - contentBounds.origin.y = ROUND(contentBounds.origin.y + deltaY); - - var constrainedOrigin = [_contentView constrainScrollPoint:CGPointCreateCopy(contentBounds.origin)], - extraX = contentBounds.origin.x - constrainedOrigin.x, - extraY = contentBounds.origin.y - constrainedOrigin.y; - - [self _sendDelegateMessages]; - - [_contentView scrollToPoint:constrainedOrigin]; - [_headerClipView scrollToPoint:CGPointMake(constrainedOrigin.x, 0.0)]; - - if (extraX || extraY) - [enclosingScrollView _respondToScrollWheelEventWithDeltaX:extraX deltaY:extraY]; -} - - (void)scrollPageUp:(id)sender { var contentBounds = [_contentView bounds]; @@ -1070,37 +1274,9 @@ var TIMER_INTERVAL = 0.2, [_headerClipView scrollToPoint:CGPointMake(contentBounds.origin.x, 0)]; } -- (void)_sendDelegateMessages -{ - if (_implementedDelegateMethods == 0) - return; - - if (!_scrollTimer) - { - [self _scrollViewWillScroll]; - _scrollTimer = [CPTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(_scrollViewDidScroll) userInfo:nil repeats:YES]; - } - else - [_scrollTimer setFireDate:[CPDate dateWithTimeIntervalSinceNow:TIMER_INTERVAL]]; -} - -- (void)_scrollViewWillScroll -{ - if (_implementedDelegateMethods & CPScrollViewDelegate_scrollViewWillScroll_) - [_delegate scrollViewWillScroll:self]; -} - -- (void)_scrollViewDidScroll -{ - [_scrollTimer invalidate]; - _scrollTimer = nil; - - if (_implementedDelegateMethods & CPScrollViewDelegate_scrollViewDidScroll_) - [_delegate scrollViewDidScroll:self]; -} - @end + var CPScrollViewContentViewKey = @"CPScrollViewContentView", CPScrollViewHeaderClipViewKey = @"CPScrollViewHeaderClipViewKey", CPScrollViewVLineScrollKey = @"CPScrollViewVLineScroll", @@ -1114,7 +1290,9 @@ var CPScrollViewContentViewKey = @"CPScrollViewContentView", CPScrollViewAutohidesScrollerKey = @"CPScrollViewAutohidesScroller", CPScrollViewCornerViewKey = @"CPScrollViewCornerViewKey", CPScrollViewBottomCornerViewKey = @"CPScrollViewBottomCornerViewKey", - CPScrollViewBorderTypeKey = @"CPScrollViewBorderTypeKey"; + CPScrollViewBorderTypeKey = @"CPScrollViewBorderTypeKey", + CPScrollViewScrollerStyleKey = @"CPScrollViewScrollerStyleKey", + CPScrollViewScrollerKnobStyleKey = @"CPScrollViewScrollerKnobStyleKey"; @implementation CPScrollView (CPCoding) @@ -1152,8 +1330,12 @@ var CPScrollViewContentViewKey = @"CPScrollViewContentView", _delegate = nil; _scrollTimer = nil; _implementedDelegateMethods = 0; + // Due to the anything goes nature of decoding, our subviews may not exist yet, so layout at the end of the run loop when we're sure everything is in a correct state. [[CPRunLoop currentRunLoop] performSelector:@selector(_updateCornerAndHeaderView) target:self argument:_contentView order:0 modes:[CPDefaultRunLoopMode]]; + + [self setScrollerStyle:[aCoder decodeIntForKey:CPScrollViewScrollerStyleKey] || CPScrollerStyleOverlay]; + [self setScrollerKnobStyle:[aCoder decodeIntForKey:CPScrollViewScrollerKnobStyleKey] || CPScrollerKnobStyleDefault]; } return self; @@ -1182,6 +1364,9 @@ var CPScrollViewContentViewKey = @"CPScrollViewContentView", [aCoder encodeObject:_bottomCornerView forKey:CPScrollViewBottomCornerViewKey]; [aCoder encodeInt:_borderType forKey:CPScrollViewBorderTypeKey]; + + [aCoder encodeInt:_scrollerStyle forKey:CPScrollViewScrollerStyleKey]; + [aCoder encodeInt:_scrollerKnobStyle forKey:CPScrollViewScrollerKnobStyleKey]; } @end diff --git a/AppKit/CPScroller.j b/AppKit/CPScroller.j index c07f0afc4..fb2e97953 100644 --- a/AppKit/CPScroller.j +++ b/AppKit/CPScroller.j @@ -5,6 +5,9 @@ * Created by Francisco Tolmasky. * Copyright 2008, 280 North, Inc. * + * Modified to match Lion style by Antoine Mercadal 2011 + * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -22,7 +25,6 @@ @import "CPControl.j" - // CPScroller Constants CPScrollerNoPart = 0; CPScrollerDecrementPage = 1; @@ -54,6 +56,18 @@ NAMES_FOR_PARTS[CPScrollerKnobSlot] = @"knob-slot"; NAMES_FOR_PARTS[CPScrollerKnob] = @"knob"; +CPScrollerStyleLegacy = 0; +CPScrollerStyleOverlay = 1; + +CPScrollerKnobStyleDefault = 0; +CPScrollerKnobStyleDark = 1; +CPScrollerKnobStyleLight = 2; + +CPThemeStateScrollViewLegacy = CPThemeState("scroller-style-legacy"); +CPThemeStateScrollerKnobLight = CPThemeState("scroller-knob-light"); +CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark"); + + @implementation CPScroller : CPControl { CPControlSize _controlSize; @@ -68,8 +82,19 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob"; CPScrollerPart _trackingPart; float _trackingFloatValue; CGPoint _trackingStartPoint; + + CPViewAnimation _animationScroller; + + BOOL _allowFadingOut @accessors(getter=allowFadingOut); + int _style; + CPTimer _timerFadeOut; + BOOL _isMouseOver; } + +#pragma mark - +#pragma mark Class methods + + (CPString)defaultThemeClass { return "scroller"; @@ -78,49 +103,43 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob"; + (id)themeAttributes { return [CPDictionary dictionaryWithJSObject:{ - @"scroller-width": 15.0, - @"knob-slot-color": [CPColor lightGrayColor], + @"scroller-width": 7.0, + @"knob-slot-color": [CPNull null], @"decrement-line-color": [CPNull null], @"increment-line-color": [CPNull null], - @"knob-color": [CPColor grayColor], + @"knob-color": [CPNull null], @"decrement-line-size":_CGSizeMakeZero(), @"increment-line-size":_CGSizeMakeZero(), @"track-inset":_CGInsetMakeZero(), @"knob-inset": _CGInsetMakeZero(), - @"minimum-knob-length":21.0 + @"minimum-knob-length":21.0, + @"track-border-overlay": 9.0, }] } - -// Calculating Layout - -- (id)initWithFrame:(CGRect)aFrame ++ (float)scrollerWidth { - self = [super initWithFrame:aFrame]; - - if (self) - { - _controlSize = CPRegularControlSize; - _partRects = []; - - [self setFloatValue:0.0]; - [self setKnobProportion:1.0]; - - _hitPart = CPScrollerNoPart; - - [self _calculateIsVertical]; - } - - return self; + return [CPScroller scrollerWidthInStyle:CPScrollerStyleLegacy]; } -// Determining CPScroller Size /*! Returns the CPScroller's width for a CPRegularControlSize. */ -+ (float)scrollerWidth ++ (float)scrollerWidthInStyle:(int)aStyle { - return [[[CPScroller alloc] init] currentValueForThemeAttribute:@"scroller-width"]; + var scroller = [[CPScroller alloc] init]; + + if (aStyle == CPScrollerStyleLegacy) + return [scroller valueForThemeAttribute:@"scroller-width" inState:CPThemeStateScrollViewLegacy]; + return [scroller currentValueForThemeAttribute:@"scroller-width"]; +} + +/*! + Returns the CPScroller's overlay value. +*/ ++ (float)scrollerOverlay +{ + return [[[CPScroller alloc] init] currentValueForThemeAttribute:@"track-border-overlay"]; } /*! @@ -129,9 +148,91 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob"; */ + (float)scrollerWidthForControlSize:(CPControlSize)aControlSize { + // ?? a class method using self? return [self scrollerWidth]; } + +#pragma mark - +#pragma mark Initialization + +- (id)initWithFrame:(CGRect)aFrame +{ + if (self = [super initWithFrame:aFrame]) + { + _controlSize = CPRegularControlSize; + _partRects = []; + + [self setFloatValue:0.0]; + [self setKnobProportion:1.0]; + + _hitPart = CPScrollerNoPart; + _allowFadingOut = YES; + _isMouseOver = NO; + _style = CPScrollerStyleOverlay; + var paramAnimFadeOut = [CPDictionary dictionaryWithObjects:[self, CPViewAnimationFadeOutEffect] + forKeys:[CPViewAnimationTargetKey, CPViewAnimationEffectKey]]; + + _animationScroller = [[CPViewAnimation alloc] initWithDuration:0.2 animationCurve:CPAnimationEaseInOut]; + [_animationScroller setViewAnimations:[paramAnimFadeOut]]; + [_animationScroller setDelegate:self]; + [self setAlphaValue:0.0]; + [self _calculateIsVertical]; + } + + return self; +} + + +#pragma mark - +#pragma mark Getters / Setters + +/*! + Returns the scroller's style +*/ +- (void)style +{ + return _style +} + +/*! + Set the scroller's control size + @param aStyle the scroller style: CPScrollerStyleLegacy or CPScrollerStyleOverlay +*/ +- (void)setStyle:(id)aStyle +{ + if (_style != nil && _style === aStyle) + return; + + _style = aStyle; + + if (_style === CPScrollerStyleLegacy) + { + [self fadeIn]; + [self setThemeState:CPThemeStateScrollViewLegacy]; + } + else + { + _allowFadingOut = YES; + [self unsetThemeState:CPThemeStateScrollViewLegacy]; + } + + [self _adjustScrollerSize]; +} + +- (void)setObjectValue:(id)aValue +{ + [super setObjectValue:MIN(1.0, MAX(0.0, +aValue))]; +} + +/*! + Returns the scroller's control size +*/ +- (CPControlSize)controlSize +{ + return _controlSize; +} + /*! Sets the scroller's size. @param aControlSize the scroller's size @@ -148,18 +249,17 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob"; } /*! - Returns the scroller's control size + Return's the knob's proportion */ -- (CPControlSize)controlSize +- (float)knobProportion { - return _controlSize; -} - -- (void)setObjectValue:(id)aValue -{ - [super setObjectValue:MIN(1.0, MAX(0.0, +aValue))]; + return _knobProportion; } +/*! + Set the knob's proportion + @param aProportion the desired proportion +*/ - (void)setKnobProportion:(float)aProportion { _knobProportion = MIN(1.0, MAX(0.0001, aProportion)); @@ -168,25 +268,35 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob"; [self setNeedsLayout]; } -/*! - Return's the knob's proportion -*/ -- (float)knobProportion + +#pragma mark - +#pragma mark Privates + +/*! @ignore */ +- (void)_adjustScrollerSize { - return _knobProportion; + var frame = [self frame], + scrollerWidth = [self currentValueForThemeAttribute:@"scroller-width"]; + + if ([self isVertical] && CGRectGetWidth(frame) !== scrollerWidth) + frame.size.width = scrollerWidth; + + if (![self isVertical] && CGRectGetHeight(frame) !== scrollerWidth) + frame.size.height = scrollerWidth; + + [self setFrame:frame]; } -- (id)currentValueForThemeAttribute:(CPString)anAttributeName +/*! @ignore */ +- (void)_performFadeOut:(CPTimer)aTimer { - var themeState = _themeState; - - if (NAMES_FOR_PARTS[_hitPart] + "-color" !== anAttributeName) - themeState &= ~CPThemeStateHighlighted; - - return [self valueForThemeAttribute:anAttributeName inState:themeState]; + [self fadeOut]; + _timerFadeOut = nil; } -// Calculating Layout + +#pragma mark - +#pragma mark Utilities - (CGRect)rectForPart:(CPScrollerPart)aPart { @@ -208,6 +318,9 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob"; // The ordering of these tests is important. We check the knob and // page rects first since they may overlap with the arrows. + if (![self hasThemeState:CPThemeStateSelected]) + return CPScrollerNoPart; + if (CGRectContainsPoint([self rectForPart:CPScrollerKnob], aPoint)) return CPScrollerKnob; @@ -330,7 +443,35 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob"; return _usableParts; } -// Drawing the Parts +/*! + Display the scroller +*/ +- (void)fadeIn +{ + if (_isMouseOver && _knobProportion != 1.0) + [self setThemeState:CPThemeStateSelected]; + + if (_timerFadeOut) + [_timerFadeOut invalidate]; + + [self setAlphaValue:1.0]; +} + +/*! + Start the fade out anination +*/ +- (void)fadeOut +{ + if ([self hasThemeState:CPThemeStateScrollViewLegacy]) + return; + + [_animationScroller startAnimation]; +} + + +#pragma mark - +#pragma mark Drawing + /*! Draws the specified arrow and sets the highlight. @param anArrow the arrow to draw @@ -457,7 +598,7 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob"; } [CPApp setTarget:self selector:@selector(trackKnob:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES]; - + if (type === CPLeftMouseDragged) [self sendAction:[self action] to:[self target]]; } @@ -565,6 +706,20 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob"; [self setNeedsLayout]; } + +#pragma mark - +#pragma mark Overrides + +- (id)currentValueForThemeAttribute:(CPString)anAttributeName +{ + var themeState = _themeState; + + if (NAMES_FOR_PARTS[_hitPart] + "-color" !== anAttributeName) + themeState &= ~CPThemeStateHighlighted; + + return [self valueForThemeAttribute:anAttributeName inState:themeState]; +} + - (void)mouseDown:(CPEvent)anEvent { if (![self isEnabled]) @@ -583,10 +738,52 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob"; } } +- (void)mouseEntered:(CPEvent)anEvent +{ + [super mouseEntered:anEvent]; + + if (_timerFadeOut) + [_timerFadeOut invalidate]; + + if (![self isEnabled]) + return; + + _allowFadingOut = NO; + _isMouseOver = YES; + + if ([self alphaValue] > 0 && _knobProportion != 1.0) + [self setThemeState:CPThemeStateSelected]; +} + +- (void)mouseExited:(CPEvent)anEvent +{ + [super mouseExited:anEvent]; + + if ([self isHidden] || ![self isEnabled] || !_isMouseOver) + return; + + _allowFadingOut = YES; + _isMouseOver = NO; + + if (_timerFadeOut) + [_timerFadeOut invalidate]; + _timerFadeOut = [CPTimer scheduledTimerWithTimeInterval:1.2 target:self selector:@selector(_performFadeOut:) userInfo:nil repeats:NO]; +} + + +#pragma mark - +#pragma mark Delegates + +- (void)animationDidEnd:(CPAnimation)animation +{ + [self unsetThemeState:CPThemeStateSelected]; +} + @end -var CPScrollerControlSizeKey = "CPScrollerControlSize", - CPScrollerKnobProportionKey = "CPScrollerKnobProportion"; +var CPScrollerControlSizeKey = @"CPScrollerControlSize", + CPScrollerKnobProportionKey = @"CPScrollerKnobProportion", + CPScrollerStyleKey = @"CPScrollerStyleKey"; @implementation CPScroller (CPCoding) @@ -606,20 +803,18 @@ var CPScrollerControlSizeKey = "CPScrollerControlSize", _hitPart = CPScrollerNoPart; + _allowFadingOut = YES; + _isMouseOver = NO; + var paramAnimFadeOut = [CPDictionary dictionaryWithObjects:[self, CPViewAnimationFadeOutEffect] + forKeys:[CPViewAnimationTargetKey, CPViewAnimationEffectKey]]; + _animationScroller = [[CPViewAnimation alloc] initWithDuration:0.2 animationCurve:CPAnimationEaseInOut]; + [_animationScroller setViewAnimations:[paramAnimFadeOut]]; + [_animationScroller setDelegate:self]; + [self setAlphaValue:0.0]; + [self _calculateIsVertical]; - // Adjust the size of the scroller if the size from cib - // isn't equal to the scrollerWidth - var frame = [self frame], - scrollerWidth = [CPScroller scrollerWidth]; - - if ([self isVertical] && CGRectGetWidth(frame) !== scrollerWidth) - frame.size.width = scrollerWidth; - - if (![self isVertical] && CGRectGetHeight(frame) !== scrollerWidth) - frame.size.height = scrollerWidth; - - [self setFrame:frame]; + [self setStyle:[aCoder decodeIntForKey:CPScrollerStyleKey]]; } return self; @@ -631,6 +826,7 @@ var CPScrollerControlSizeKey = "CPScrollerControlSize", [aCoder encodeInt:_controlSize forKey:CPScrollerControlSizeKey]; [aCoder encodeFloat:_knobProportion forKey:CPScrollerKnobProportionKey]; + [aCoder encodeInt:_style forKey:CPScrollerStyleKey]; } @end diff --git a/AppKit/Themes/Aristo/Resources/HUD/scroller-horizontal-track.png b/AppKit/Themes/Aristo/Resources/HUD/scroller-horizontal-track.png deleted file mode 100644 index eec906ccc..000000000 Binary files a/AppKit/Themes/Aristo/Resources/HUD/scroller-horizontal-track.png and /dev/null differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-center.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-center.png index efb115efd..4ebac465a 100644 Binary files a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-center.png and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-dark-center.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-dark-center.png new file mode 100644 index 000000000..7ed9e6f3a Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-dark-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-dark-left.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-dark-left.png new file mode 100644 index 000000000..dbc02bf1f Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-dark-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-dark-right.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-dark-right.png new file mode 100644 index 000000000..79665d41b Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-dark-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-disabled-center.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-disabled-center.png deleted file mode 100644 index 7ae79b060..000000000 Binary files a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-disabled-center.png and /dev/null differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-disabled-left.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-disabled-left.png deleted file mode 100644 index 1417e8c34..000000000 Binary files a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-disabled-left.png and /dev/null differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-disabled-right.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-disabled-right.png deleted file mode 100644 index ed2cd290e..000000000 Binary files a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-disabled-right.png and /dev/null differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-left.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-left.png index 29324f7e9..4bbacbb9c 100644 Binary files a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-left.png and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-light-center.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-light-center.png new file mode 100644 index 000000000..4ac50a74a Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-light-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-light-left.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-light-left.png new file mode 100644 index 000000000..f9c28c326 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-light-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-light-right.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-light-right.png new file mode 100644 index 000000000..3de61a69d Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-light-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-right.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-right.png index 66fb7a400..93ae51239 100644 Binary files a/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-right.png and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-knob-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-center.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-center.png new file mode 100644 index 000000000..9cbdf526c Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-dark-center.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-dark-center.png new file mode 100644 index 000000000..fd0543a46 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-dark-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-dark-left.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-dark-left.png new file mode 100644 index 000000000..58f127169 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-dark-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-dark-right.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-dark-right.png new file mode 100644 index 000000000..7df58e92b Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-dark-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-disabled.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-disabled.png deleted file mode 100644 index efc26ba8b..000000000 Binary files a/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-disabled.png and /dev/null differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-left.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-left.png new file mode 100644 index 000000000..814f29f61 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-light-center.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-light-center.png new file mode 100644 index 000000000..8454e45d4 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-light-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-light-left.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-light-left.png new file mode 100644 index 000000000..1befa86cd Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-light-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-light-right.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-light-right.png new file mode 100644 index 000000000..183e7f326 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-light-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-right.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-right.png new file mode 100644 index 000000000..91f415300 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-horizontal-track.png b/AppKit/Themes/Aristo/Resources/scroller-horizontal-track.png deleted file mode 100644 index 43c938474..000000000 Binary files a/AppKit/Themes/Aristo/Resources/scroller-horizontal-track.png and /dev/null differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-knob-center.png b/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-knob-center.png new file mode 100644 index 000000000..b2112661b Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-knob-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-knob-left.png b/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-knob-left.png new file mode 100644 index 000000000..7c3245347 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-knob-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-knob-right.png b/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-knob-right.png new file mode 100644 index 000000000..750fa003f Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-knob-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-track-center.png b/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-track-center.png new file mode 100644 index 000000000..cd48f0513 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-track-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-track-left.png b/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-track-left.png new file mode 100644 index 000000000..b2f76be02 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-track-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-track-right.png b/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-track-right.png new file mode 100644 index 000000000..7c338ed9e Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-legacy-horizontal-track-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-knob-bottom.png b/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-knob-bottom.png new file mode 100644 index 000000000..f2a83216b Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-knob-bottom.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-knob-center.png b/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-knob-center.png new file mode 100644 index 000000000..8e9272da9 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-knob-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-knob-top.png b/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-knob-top.png new file mode 100644 index 000000000..d34e638b8 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-knob-top.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-track-bottom.png b/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-track-bottom.png new file mode 100644 index 000000000..7f53deda9 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-track-bottom.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-track-center.png b/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-track-center.png new file mode 100644 index 000000000..0f708cd9b Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-track-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-track-top.png b/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-track-top.png new file mode 100644 index 000000000..af2421264 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-legacy-vertical-track-top.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-bottom.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-bottom.png index 1724145f3..df32cc981 100644 Binary files a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-bottom.png and b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-bottom.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-center.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-center.png index bf06624cb..e193dfde3 100644 Binary files a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-center.png and b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-dark-bottom.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-dark-bottom.png new file mode 100644 index 000000000..9604bc4fc Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-dark-bottom.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-dark-center.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-dark-center.png new file mode 100644 index 000000000..c285ecd81 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-dark-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-dark-top.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-dark-top.png new file mode 100644 index 000000000..b4de055ff Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-dark-top.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-disabled-bottom.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-disabled-bottom.png deleted file mode 100644 index 1cb147b84..000000000 Binary files a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-disabled-bottom.png and /dev/null differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-disabled-center.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-disabled-center.png deleted file mode 100644 index 2756a41ca..000000000 Binary files a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-disabled-center.png and /dev/null differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-disabled-top.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-disabled-top.png deleted file mode 100644 index 6ca32cb88..000000000 Binary files a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-disabled-top.png and /dev/null differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-light-bottom.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-light-bottom.png new file mode 100644 index 000000000..3085360e1 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-light-bottom.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-light-center.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-light-center.png new file mode 100644 index 000000000..222956a22 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-light-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-light-top.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-light-top.png new file mode 100644 index 000000000..ddaea84ca Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-light-top.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-top.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-top.png index 14b19bf8b..52958547d 100644 Binary files a/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-top.png and b/AppKit/Themes/Aristo/Resources/scroller-vertical-knob-top.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-track-bottom.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-bottom.png new file mode 100644 index 000000000..c7d089297 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-bottom.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-track-center.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-center.png new file mode 100644 index 000000000..2c153cb72 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-track-dark-bottom.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-dark-bottom.png new file mode 100644 index 000000000..e71064c82 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-dark-bottom.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-track-dark-center.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-dark-center.png new file mode 100644 index 000000000..663fd52e0 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-dark-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-track-dark-top.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-dark-top.png new file mode 100644 index 000000000..76cfb290f Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-dark-top.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-track-left.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-left.png new file mode 100644 index 000000000..814f29f61 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-track-light-bottom.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-light-bottom.png new file mode 100644 index 000000000..2fb4d0724 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-light-bottom.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-track-light-center.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-light-center.png new file mode 100644 index 000000000..981c98ac2 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-light-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-track-light-top.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-light-top.png new file mode 100644 index 000000000..64a6fd631 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-light-top.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-track-right.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-right.png new file mode 100644 index 000000000..e7d47fc90 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/scroller-vertical-track-top.png b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-top.png new file mode 100644 index 000000000..17e29c9e6 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/scroller-vertical-track-top.png differ diff --git a/AppKit/Themes/Aristo/ThemeDescriptors.j b/AppKit/Themes/Aristo/ThemeDescriptors.j index 34b52cfbb..a5bf8c5ee 100755 --- a/AppKit/Themes/Aristo/ThemeDescriptors.j +++ b/AppKit/Themes/Aristo/ThemeDescriptors.j @@ -633,54 +633,107 @@ var themedButtonValues = nil, + (CPScroller)themedVerticalScroller { var scroller = [self makeVerticalScroller], - trackColor = PatternColor("scroller-vertical-track.png", 15.0, 1.0), - disabledTrackColor = PatternColor("scroller-vertical-track-disabled.png", 15.0, 1.0), - - upArrowColor = PatternColor("scroller-up-arrow.png", 15.0, 24.0), - highlightedUpArrowColor = PatternColor("scroller-up-arrow-highlighted.png", 15.0, 24.0), - disabledUpArrowColor = PatternColor("scroller-up-arrow-disabled.png", 15.0, 24.0), - - downArrowColor = PatternColor("scroller-down-arrow.png", 15.0, 24.0), - highlightedDownArrowColor = PatternColor("scroller-down-arrow-highlighted.png", 15.0, 24.0), - disabledDownArrowColor = PatternColor("scroller-down-arrow-disabled.png", 15.0, 24.0), - - knobColor = PatternColor( + trackColor = PatternColor( [ - ["scroller-vertical-knob-top.png", 15.0, 10.0], - ["scroller-vertical-knob-center.png", 15.0, 1.0], - ["scroller-vertical-knob-bottom.png", 15.0, 10.0] + ["scroller-vertical-track-top.png", 9.0, 4.0], + ["scroller-vertical-track-center.png", 9.0, 1.0], + ["scroller-vertical-track-bottom.png", 9.0, 4.0] ], PatternIsVertical), - disabledKnobColor = PatternColor( + trackColorLight = PatternColor( [ - ["scroller-vertical-knob-disabled-top.png", 15.0, 10.0], - ["scroller-vertical-knob-disabled-center.png", 15.0, 1.0], - ["scroller-vertical-knob-disabled-bottom.png", 15.0, 10.0] + ["scroller-vertical-track-light-top.png", 9.0, 4.0], + ["scroller-vertical-track-light-center.png", 9.0, 1.0], + ["scroller-vertical-track-light-bottom.png", 9.0, 4.0] ], - PatternIsVertical); + PatternIsVertical), + + trackColorDark = PatternColor( + [ + ["scroller-vertical-track-dark-top.png", 9.0, 4.0], + ["scroller-vertical-track-dark-center.png", 9.0, 1.0], + ["scroller-vertical-track-dark-bottom.png", 9.0, 4.0] + ], + PatternIsVertical), + + trackColorLegacy = PatternColor("scroller-legacy-vertical-track-center.png", 14.0, 1.0), + incrementColorLegacy = PatternColor("scroller-legacy-vertical-track-bottom.png", 14.0, 11.0), + decrementColorLegacy = PatternColor("scroller-legacy-vertical-track-top.png", 14.0, 11.0), + + knobColor = PatternColor( + [ + ["scroller-vertical-knob-top.png", 9.0, 4.0], + ["scroller-vertical-knob-center.png", 9.0, 1.0], + ["scroller-vertical-knob-bottom.png", 9.0, 4.0] + ], + PatternIsVertical), + + knobColorLight = PatternColor( + [ + ["scroller-vertical-knob-light-top.png", 9.0, 4.0], + ["scroller-vertical-knob-light-center.png", 9.0, 1.0], + ["scroller-vertical-knob-light-bottom.png", 9.0, 4.0] + ], + PatternIsVertical), + + knobColorDark = PatternColor( + [ + ["scroller-vertical-knob-dark-top.png", 9.0, 4.0], + ["scroller-vertical-knob-dark-center.png", 9.0, 1.0], + ["scroller-vertical-knob-dark-bottom.png", 9.0, 4.0] + ], + PatternIsVertical), + + knobColorLegacy = PatternColor( + [ + ["scroller-legacy-vertical-knob-top.png", 14.0, 3.0], + ["scroller-legacy-vertical-knob-center.png", 14.0, 1.0], + ["scroller-legacy-vertical-knob-bottom.png", 14.0, 3.0] + ], + PatternIsVertical), + themedVerticalScrollerValues = [ - [@"minimum-knob-length", 21.0, CPThemeStateVertical], - [@"knob-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateVertical], - [@"track-inset", CGInsetMake(-10.0, 0.0, -10.0, 0.0), CPThemeStateVertical], + // Common + [@"minimum-knob-length", 21.0, CPThemeStateVertical], - [@"knob-color", knobColor, CPThemeStateVertical], - [@"knob-color", disabledKnobColor, CPThemeStateVertical | CPThemeStateDisabled], + // Overlay + [@"scroller-width", 9.0, CPThemeStateVertical], + [@"knob-inset", CGInsetMake(2.0, 0.0, 0.0, 0.0), CPThemeStateVertical], + [@"track-inset", CGInsetMake(2.0, 0.0, 11.0, 0.0), CPThemeStateVertical], + [@"track-border-overlay", 12.0, CPThemeStateVertical], + [@"knob-slot-color", [CPNull null], CPThemeStateVertical], + [@"knob-slot-color", trackColor, CPThemeStateVertical | CPThemeStateSelected], + [@"knob-slot-color", trackColorLight, CPThemeStateVertical | CPThemeStateSelected | CPThemeStateScrollerKnobLight], + [@"knob-slot-color", trackColorDark, CPThemeStateVertical | CPThemeStateSelected | CPThemeStateScrollerKnobDark], + [@"knob-color", knobColor, CPThemeStateVertical], + [@"knob-color", knobColorLight, CPThemeStateVertical | CPThemeStateScrollerKnobLight], + [@"knob-color", knobColorDark, CPThemeStateVertical | CPThemeStateScrollerKnobDark], + [@"increment-line-color", [CPNull null], CPThemeStateVertical], + [@"decrement-line-color", [CPNull null], CPThemeStateVertical], + [@"decrement-line-size", CPSizeMakeZero(), CPThemeStateVertical], + [@"increment-line-size", CPSizeMakeZero(), CPThemeStateVertical], - [@"knob-slot-color", trackColor, CPThemeStateVertical], - [@"knob-slot-color", disabledTrackColor, CPThemeStateVertical | CPThemeStateDisabled], - - [@"decrement-line-size", CGSizeMake(15.0, 24.0), CPThemeStateVertical], - [@"decrement-line-color", upArrowColor, CPThemeStateVertical], - [@"decrement-line-color", highlightedUpArrowColor, CPThemeStateVertical | CPThemeStateHighlighted], - [@"decrement-line-color", disabledUpArrowColor, CPThemeStateVertical | CPThemeStateDisabled], - - [@"increment-line-size", CGSizeMake(15.0, 24.0), CPThemeStateVertical], - [@"increment-line-color", downArrowColor, CPThemeStateVertical], - [@"increment-line-color", highlightedDownArrowColor, CPThemeStateVertical | CPThemeStateHighlighted], - [@"increment-line-color", disabledDownArrowColor, CPThemeStateVertical | CPThemeStateDisabled] + // Legacy + [@"scroller-width", 14.0, CPThemeStateVertical | CPThemeStateScrollViewLegacy], + [@"knob-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateVertical | CPThemeStateScrollViewLegacy], + [@"track-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateVertical | CPThemeStateScrollViewLegacy], + [@"track-border-overlay", 0.0, CPThemeStateVertical | CPThemeStateScrollViewLegacy], + [@"knob-slot-color", trackColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy], + [@"knob-slot-color", trackColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateSelected], + [@"knob-slot-color", trackColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateSelected | CPThemeStateScrollerKnobLight], + [@"knob-slot-color", trackColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateSelected | CPThemeStateScrollerKnobDark], + [@"knob-slot-color", trackColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobDark], + [@"knob-slot-color", trackColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobLight], + [@"knob-color", knobColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy], + [@"knob-color", knobColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobLight], + [@"knob-color", knobColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobDark], + [@"increment-line-color", incrementColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy], + [@"decrement-line-color", decrementColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy], + [@"decrement-line-size", CPSizeMake(14.0, 11.0), CPThemeStateVertical | CPThemeStateScrollViewLegacy], + [@"increment-line-size", CPSizeMake(14.0, 11.0), CPThemeStateVertical | CPThemeStateScrollViewLegacy] ]; [self registerThemeValues:themedVerticalScrollerValues forView:scroller]; @@ -701,54 +754,102 @@ var themedButtonValues = nil, + (CPScroller)themedHorizontalScroller { var scroller = [self makeHorizontalScroller], - trackColor = PatternColor("scroller-horizontal-track.png", 1.0, 15.0), - disabledTrackColor = PatternColor("scroller-horizontal-track-disabled.png", 1.0, 15.0), - - leftArrowColor = PatternColor("scroller-left-arrow.png", 24.0, 15.0), - highlightedLeftArrowColor = PatternColor("scroller-left-arrow-highlighted.png", 24.0, 15.0), - disabledLeftArrowColor = PatternColor("scroller-left-arrow-disabled.png", 24.0, 15.0), - - rightArrowColor = PatternColor("scroller-right-arrow.png", 24.0, 15.0), - highlightedRightArrowColor = PatternColor("scroller-right-arrow-highlighted.png", 24.0, 15.0), - disabledRightArrowColor = PatternColor("scroller-right-arrow-disabled.png", 24.0, 15.0), - - knobColor = PatternColor( + trackColor = PatternColor( [ - ["scroller-horizontal-knob-left.png", 10.0, 15.0], - ["scroller-horizontal-knob-center.png", 1.0, 15.0], - ["scroller-horizontal-knob-right.png", 10.0, 15.0] + ["scroller-horizontal-track-left.png", 4.0, 9.0], + ["scroller-horizontal-track-center.png", 1.0, 9.0], + ["scroller-horizontal-track-right.png", 4.0, 9.0] ], PatternIsHorizontal), - disabledKnobColor = PatternColor( + trackColorLight = PatternColor( [ - ["scroller-horizontal-knob-disabled-left.png", 10.0, 15.0], - ["scroller-horizontal-knob-disabled-center.png", 1.0, 15.0], - ["scroller-horizontal-knob-disabled-right.png", 10.0, 15.0] + ["scroller-horizontal-track-light-left.png", 4.0, 9.0], + ["scroller-horizontal-track-light-center.png", 1.0, 9.0], + ["scroller-horizontal-track-light-right.png", 4.0, 9.0] + ], + PatternIsHorizontal), + + trackColorDark = PatternColor( + [ + ["scroller-horizontal-track-dark-left.png", 4.0, 9.0], + ["scroller-horizontal-track-dark-center.png", 1.0, 9.0], + ["scroller-horizontal-track-dark-right.png", 4.0, 9.0] + ], + PatternIsHorizontal), + + trackColorLegacy = PatternColor("scroller-legacy-horizontal-track-center.png", 1.0, 14.0), + incrementColorLegacy = PatternColor("scroller-legacy-horizontal-track-right.png", 11.0, 14.0), + decrementColorLegacy = PatternColor("scroller-legacy-horizontal-track-left.png", 11.0, 14.0), + + knobColor = PatternColor( + [ + ["scroller-horizontal-knob-left.png", 4.0, 9.0], + ["scroller-horizontal-knob-center.png", 1.0, 9.0], + ["scroller-horizontal-knob-right.png", 4.0, 9.0] + ], + PatternIsHorizontal), + + knobColorLight = PatternColor( + [ + ["scroller-horizontal-knob-light-left.png", 4.0, 9.0], + ["scroller-horizontal-knob-light-center.png", 1.0, 9.0], + ["scroller-horizontal-knob-light-right.png", 4.0, 9.0] + ], + PatternIsHorizontal), + + knobColorDark = PatternColor( + [ + ["scroller-horizontal-knob-dark-left.png", 4.0, 9.0], + ["scroller-horizontal-knob-dark-center.png", 1.0, 9.0], + ["scroller-horizontal-knob-dark-right.png", 4.0, 9.0] + ], + PatternIsHorizontal), + + knobColorLegacy = PatternColor( + [ + ["scroller-legacy-horizontal-knob-left.png", 3.0, 14.0], + ["scroller-legacy-horizontal-knob-center.png", 1.0, 14.0], + ["scroller-legacy-horizontal-knob-right.png", 3.0, 14.0] ], PatternIsHorizontal); themedHorizontalScrollerValues = [ + // Common [@"minimum-knob-length", 21.0], - [@"knob-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0)], - [@"track-inset", CGInsetMake(0.0, -10.0, 0.0, -11.0)], + // Overlay + [@"scroller-width", 9.0], + [@"knob-inset", CGInsetMake(0.0, 0.0, 0.0, 2.0)], + [@"track-inset", CGInsetMake(0.0, 11.0, 0.0, 2.0)], + [@"track-border-overlay", 12.0], + [@"knob-slot-color", [CPNull null]], + [@"knob-slot-color", trackColor, CPThemeStateSelected], + [@"knob-slot-color", trackColorLight, CPThemeStateSelected | CPThemeStateScrollerKnobLight], + [@"knob-slot-color", trackColorDark, CPThemeStateSelected | CPThemeStateScrollerKnobDark], [@"knob-color", knobColor], - [@"knob-color", disabledKnobColor, CPThemeStateDisabled], + [@"knob-color", knobColorLight, CPThemeStateScrollerKnobLight], + [@"knob-color", knobColorDark, CPThemeStateScrollerKnobDark], + [@"decrement-line-size", CPSizeMakeZero()], + [@"increment-line-size", CPSizeMakeZero()], - [@"knob-slot-color", trackColor], - [@"knob-slot-color", disabledTrackColor, CPThemeStateDisabled], - - [@"decrement-line-size", CGSizeMake(24.0, 15.0)], - [@"decrement-line-color", leftArrowColor], - [@"decrement-line-color", highlightedLeftArrowColor, CPThemeStateHighlighted], - [@"decrement-line-color", disabledLeftArrowColor, CPThemeStateDisabled], - - [@"increment-line-size", CGSizeMake(24.0, 15.0)], - [@"increment-line-color", rightArrowColor], - [@"increment-line-color", highlightedRightArrowColor, CPThemeStateHighlighted], - [@"increment-line-color", disabledRightArrowColor, CPThemeStateDisabled] + // Legacy + [@"scroller-width", 14.0, CPThemeStateScrollViewLegacy], + [@"knob-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateScrollViewLegacy], + [@"track-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateScrollViewLegacy], + [@"track-border-overlay", 0.0, CPThemeStateScrollViewLegacy], + [@"knob-slot-color", trackColorLegacy, CPThemeStateScrollViewLegacy], + [@"knob-slot-color", trackColorLegacy, CPThemeStateScrollViewLegacy | CPThemeStateSelected], + [@"knob-slot-color", trackColorLegacy, CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobLight], + [@"knob-slot-color", trackColorLegacy, CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobDark], + [@"knob-color", knobColorLegacy, CPThemeStateScrollViewLegacy], + [@"knob-color", knobColorLegacy, CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobLight], + [@"knob-color", knobColorLegacy, CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobDark], + [@"increment-line-color", incrementColorLegacy, CPThemeStateScrollViewLegacy], + [@"decrement-line-color", decrementColorLegacy, CPThemeStateScrollViewLegacy], + [@"decrement-line-size", CPSizeMake(11.0, 14.0), CPThemeStateScrollViewLegacy], + [@"increment-line-size", CPSizeMake(11.0, 14.0), CPThemeStateScrollViewLegacy] ]; [self registerThemeValues:themedHorizontalScrollerValues forView:scroller]; @@ -1739,31 +1840,33 @@ var themedButtonValues = nil, return button; } -+ (CPScroller)themedVerticalScroller -{ - var scroller = [AristoThemeDescriptor makeVerticalScroller], - overrides = - [ - [@"knob-color", nil, CPThemeStateVertical | CPThemeStateDisabled] - ]; +// We need an artwork for the legacy scroller here. +// For the moment I just deactivate it to avoid 404 with HUD theme +// + (CPScroller)themedVerticalScroller +// { +// var scroller = [AristoThemeDescriptor makeVerticalScroller], +// overrides = +// [ +// [@"knob-color", nil, CPThemeStateVertical | CPThemeStateDisabled] +// ]; +// +// [self registerThemeValues:[self defaultThemeOverridesAddedTo:overrides] forView:scroller inherit:themedVerticalScrollerValues]; +// +// return scroller; +// } - [self registerThemeValues:[self defaultThemeOverridesAddedTo:overrides] forView:scroller inherit:themedVerticalScrollerValues]; - - return scroller; -} - -+ (CPScroller)themedHorizontalScroller -{ - var scroller = [AristoThemeDescriptor makeHorizontalScroller], - overrides = - [ - [@"knob-color", nil, CPThemeStateDisabled] - ]; - - [self registerThemeValues:[self defaultThemeOverridesAddedTo:overrides] forView:scroller inherit:themedHorizontalScrollerValues]; - - return scroller; -} +// + (CPScroller)themedHorizontalScroller +// { +// var scroller = [AristoThemeDescriptor makeHorizontalScroller], +// overrides = +// [ +// [@"knob-color", nil, CPThemeStateDisabled] +// ]; +// +// [self registerThemeValues:[self defaultThemeOverridesAddedTo:overrides] forView:scroller inherit:themedHorizontalScrollerValues]; +// +// return scroller; +// } + (CPSlider)themedHorizontalSlider { diff --git a/Tests/Manual/CPScrollView2/.xCodeSupport/Sources/_Users_Tonio_Desktop_scrollview_AppController.h b/Tests/Manual/CPScrollView2/.xCodeSupport/Sources/_Users_Tonio_Desktop_scrollview_AppController.h new file mode 100644 index 000000000..fc861f06e --- /dev/null +++ b/Tests/Manual/CPScrollView2/.xCodeSupport/Sources/_Users_Tonio_Desktop_scrollview_AppController.h @@ -0,0 +1,13 @@ + +@interface AppController : NSObject +{ + IBOutlet NSScrollView* scrollView; + IBOutlet NSView* contentView; +} +- (IBAction)change:(id)aSender; +- (IBAction)changeKnob:(id)aSender; +- (IBAction)changeBackground:(id)aSender; +- (IBAction)makeBigDocView:(id)aSender; +- (IBAction)makeSmallDocView:(id)aSender; +- (IBAction)flash:(id)aSender; +@end \ No newline at end of file diff --git a/Tests/Manual/CPScrollView2/.xCodeSupport/Sources/_Users_Tonio_Desktop_scrollview__AppController.h b/Tests/Manual/CPScrollView2/.xCodeSupport/Sources/_Users_Tonio_Desktop_scrollview__AppController.h new file mode 100644 index 000000000..fc861f06e --- /dev/null +++ b/Tests/Manual/CPScrollView2/.xCodeSupport/Sources/_Users_Tonio_Desktop_scrollview__AppController.h @@ -0,0 +1,13 @@ + +@interface AppController : NSObject +{ + IBOutlet NSScrollView* scrollView; + IBOutlet NSView* contentView; +} +- (IBAction)change:(id)aSender; +- (IBAction)changeKnob:(id)aSender; +- (IBAction)changeBackground:(id)aSender; +- (IBAction)makeBigDocView:(id)aSender; +- (IBAction)makeSmallDocView:(id)aSender; +- (IBAction)flash:(id)aSender; +@end \ No newline at end of file diff --git a/Tests/Manual/CPScrollView2/.xCodeSupport/scrollview.xcodeproj/project.pbxproj b/Tests/Manual/CPScrollView2/.xCodeSupport/scrollview.xcodeproj/project.pbxproj new file mode 100644 index 000000000..2760e2941 --- /dev/null +++ b/Tests/Manual/CPScrollView2/.xCodeSupport/scrollview.xcodeproj/project.pbxproj @@ -0,0 +1,354 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 9EEC4498135749D200615446 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EEC4497135749D200615446 /* Cocoa.framework */; }; + 9EEC44B5135749D300615446 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EEC4497135749D200615446 /* Cocoa.framework */; }; + 9EEC44CC13574A0B00615446 /* scrollview in Resources */ = {isa = PBXBuildFile; fileRef = 9EEC44CB13574A0B00615446 /* scrollview */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 9EEC44B6135749D300615446 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9EEC448A135749D200615446 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 9EEC4492135749D200615446; + remoteInfo = Another; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 9EEC4493135749D200615446 /* Another.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Another.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 9EEC4497135749D200615446 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 9EEC449A135749D300615446 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + 9EEC449B135749D300615446 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; + 9EEC449C135749D300615446 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 9EEC44B4135749D300615446 /* AnotherTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AnotherTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; + 9EEC44CB13574A0B00615446 /* scrollview */ = {isa = PBXFileReference; lastKnownFileType = folder; name = scrollview; path = ..; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9EEC4490135749D200615446 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9EEC4498135749D200615446 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9EEC44B0135749D300615446 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9EEC44B5135749D300615446 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9EEC4488135749D200615446 = { + isa = PBXGroup; + children = ( + 9EEC44CB13574A0B00615446 /* scrollview */, + 9EEC4496135749D200615446 /* Frameworks */, + 9EEC4494135749D200615446 /* Products */, + ); + sourceTree = ""; + }; + 9EEC4494135749D200615446 /* Products */ = { + isa = PBXGroup; + children = ( + 9EEC4493135749D200615446 /* Another.app */, + 9EEC44B4135749D300615446 /* AnotherTests.octest */, + ); + name = Products; + sourceTree = ""; + }; + 9EEC4496135749D200615446 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 9EEC4497135749D200615446 /* Cocoa.framework */, + 9EEC4499135749D300615446 /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 9EEC4499135749D300615446 /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 9EEC449A135749D300615446 /* AppKit.framework */, + 9EEC449B135749D300615446 /* CoreData.framework */, + 9EEC449C135749D300615446 /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 9EEC4492135749D200615446 /* Another */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9EEC44C5135749D300615446 /* Build configuration list for PBXNativeTarget "Another" */; + buildPhases = ( + 9EEC448F135749D200615446 /* Sources */, + 9EEC4490135749D200615446 /* Frameworks */, + 9EEC4491135749D200615446 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Another; + productName = Another; + productReference = 9EEC4493135749D200615446 /* Another.app */; + productType = "com.apple.product-type.application"; + }; + 9EEC44B3135749D300615446 /* AnotherTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9EEC44C8135749D300615446 /* Build configuration list for PBXNativeTarget "AnotherTests" */; + buildPhases = ( + 9EEC44AF135749D300615446 /* Sources */, + 9EEC44B0135749D300615446 /* Frameworks */, + 9EEC44B1135749D300615446 /* Resources */, + 9EEC44B2135749D300615446 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 9EEC44B7135749D300615446 /* PBXTargetDependency */, + ); + name = AnotherTests; + productName = AnotherTests; + productReference = 9EEC44B4135749D300615446 /* AnotherTests.octest */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 9EEC448A135749D200615446 /* Project object */ = { + isa = PBXProject; + attributes = { + ORGANIZATIONNAME = "280 North, Inc."; + }; + buildConfigurationList = 9EEC448D135749D200615446 /* Build configuration list for PBXProject "Another" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 9EEC4488135749D200615446; + productRefGroup = 9EEC4494135749D200615446 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 9EEC4492135749D200615446 /* Another */, + 9EEC44B3135749D300615446 /* AnotherTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 9EEC4491135749D200615446 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9EEC44CC13574A0B00615446 /* scrollview in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9EEC44B1135749D300615446 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 9EEC44B2135749D300615446 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 9EEC448F135749D200615446 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9EEC44AF135749D300615446 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 9EEC44B7135749D300615446 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 9EEC4492135749D200615446 /* Another */; + targetProxy = 9EEC44B6135749D300615446 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 9EEC44C3135749D300615446 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = DEBUG; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 9EEC44C4135749D300615446 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; + SDKROOT = macosx; + }; + name = Release; + }; + 9EEC44C6135749D300615446 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Another/Another-Prefix.pch"; + INFOPLIST_FILE = "Another/Another-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 9EEC44C7135749D300615446 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Another/Another-Prefix.pch"; + INFOPLIST_FILE = "Another/Another-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + 9EEC44C9135749D300615446 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Another.app/Contents/MacOS/Another"; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "AnotherTests/AnotherTests-Prefix.pch"; + INFOPLIST_FILE = "AnotherTests/AnotherTests-Info.plist"; + OTHER_LDFLAGS = ( + "-framework", + SenTestingKit, + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = octest; + }; + name = Debug; + }; + 9EEC44CA135749D300615446 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Another.app/Contents/MacOS/Another"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "AnotherTests/AnotherTests-Prefix.pch"; + INFOPLIST_FILE = "AnotherTests/AnotherTests-Info.plist"; + OTHER_LDFLAGS = ( + "-framework", + SenTestingKit, + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = octest; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 9EEC448D135749D200615446 /* Build configuration list for PBXProject "Another" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9EEC44C3135749D300615446 /* Debug */, + 9EEC44C4135749D300615446 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9EEC44C5135749D300615446 /* Build configuration list for PBXNativeTarget "Another" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9EEC44C6135749D300615446 /* Debug */, + 9EEC44C7135749D300615446 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 9EEC44C8135749D300615446 /* Build configuration list for PBXNativeTarget "AnotherTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9EEC44C9135749D300615446 /* Debug */, + 9EEC44CA135749D300615446 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 9EEC448A135749D200615446 /* Project object */; +} diff --git a/Tests/Manual/CPScrollView2/.xCodeSupport/scrollview.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Tests/Manual/CPScrollView2/.xCodeSupport/scrollview.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..966480d22 --- /dev/null +++ b/Tests/Manual/CPScrollView2/.xCodeSupport/scrollview.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Tests/Manual/CPScrollView2/AppController.j b/Tests/Manual/CPScrollView2/AppController.j new file mode 100644 index 000000000..773bc4a3e --- /dev/null +++ b/Tests/Manual/CPScrollView2/AppController.j @@ -0,0 +1,85 @@ +/* + * AppController.j + * scrollview + * + * Created by You on October 3, 2011. + * Copyright 2011, Your Company All rights reserved. + */ + +@import + + +@implementation AppController : CPObject +{ + CPWindow theWindow; //this "outlet" is connected automatically by the Cib + @outlet CPScrollView scrollView; + @outlet CPView contentView; +} + +- (void)awakeFromCib +{ + [theWindow setFullPlatformWindow:YES]; + + [contentView setBackgroundColor:[CPColor colorWithHexString:@"f3f3f3"]]; + [contentView setAutoresizingMask:CPViewWidthSizable]; + // [scrollView setAutohidesScrollers:YES]; + [scrollView setDocumentView:contentView]; +} + +- (IBAction)change:(id)aSender +{ + if ([scrollView scrollerStyle] == CPScrollerStyleLegacy) + [scrollView setScrollerStyle:CPScrollerStyleOverlay]; + else + [scrollView setScrollerStyle:CPScrollerStyleLegacy]; +} + +- (IBAction)changeKnob:(id)aSender +{ + var style = [aSender title]; + + switch(style) + { + case "Default": + [scrollView setScrollerKnobStyle:CPScrollerKnobStyleDefault]; + break; + case "Dark": + [scrollView setScrollerKnobStyle:CPScrollerKnobStyleDark]; + break; + case "Light": + [scrollView setScrollerKnobStyle:CPScrollerKnobStyleLight]; + break; + } +} + +- (IBAction)changeBackground:(id)aSender +{ + var style = [aSender title]; + + switch(style) + { + case "Light": + [[scrollView documentView] setBackgroundColor:[CPColor colorWithHexString:@"f3f3f3"]]; + break; + case "Dark": + [[scrollView documentView] setBackgroundColor:[CPColor colorWithHexString:@"333"]]; + break; + } +} + +- (IBAction)makeBigDocView:(id)aSender +{ + [contentView setFrameSize:CPSizeMake(1000, 1000)]; +} + +- (IBAction)makeSmallDocView:(id)aSender +{ + [contentView setFrameSize:CPSizeMake(30, 30)]; +} + +- (IBAction)flash:(id)aSender +{ + [scrollView flashScrollers]; +} + +@end diff --git a/Tests/Manual/CPScrollView2/Info.plist b/Tests/Manual/CPScrollView2/Info.plist new file mode 100644 index 000000000..e2e477f2c --- /dev/null +++ b/Tests/Manual/CPScrollView2/Info.plist @@ -0,0 +1,10 @@ + + + + + Main cib file base name + MainMenu.cib + CPBundleName + scrollview + + diff --git a/Tests/Manual/CPScrollView2/Jakefile b/Tests/Manual/CPScrollView2/Jakefile new file mode 100644 index 000000000..e2630179d --- /dev/null +++ b/Tests/Manual/CPScrollView2/Jakefile @@ -0,0 +1,94 @@ +/* + * Jakefile + * scrollview + * + * Created by You on October 3, 2011. + * Copyright 2011, Your Company All rights reserved. + */ + +var ENV = require("system").env, + FILE = require("file"), + JAKE = require("jake"), + task = JAKE.task, + FileList = JAKE.FileList, + app = require("cappuccino/jake").app, + configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug", + OS = require("os"); + +app ("scrollview", function(task) +{ + task.setBuildIntermediatesPath(FILE.join("Build", "scrollview.build", configuration)); + task.setBuildPath(FILE.join("Build", configuration)); + + task.setProductName("scrollview"); + task.setIdentifier("com.yourcompany.scrollview"); + task.setVersion("1.0"); + task.setAuthor("Your Company"); + task.setEmail("feedback @nospam@ yourcompany.com"); + task.setSummary("scrollview"); + task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**"))); + task.setResources(new FileList("Resources/**")); + task.setIndexFilePath("index.html"); + task.setInfoPlistPath("Info.plist"); + task.setNib2CibFlags("-R Resources/"); + + if (configuration === "Debug") + task.setCompilerFlags("-DDEBUG -g"); + else + task.setCompilerFlags("-O"); +}); + +task ("default", ["scrollview"], function() +{ + printResults(configuration); +}); + +task ("build", ["default"]); + +task ("debug", function() +{ + ENV["CONFIGURATION"] = "Debug"; + JAKE.subjake(["."], "build", ENV); +}); + +task ("release", function() +{ + ENV["CONFIGURATION"] = "Release"; + JAKE.subjake(["."], "build", ENV); +}); + +task ("run", ["debug"], function() +{ + OS.system(["open", FILE.join("Build", "Debug", "scrollview", "index.html")]); +}); + +task ("run-release", ["release"], function() +{ + OS.system(["open", FILE.join("Build", "Release", "scrollview", "index.html")]); +}); + +task ("deploy", ["release"], function() +{ + FILE.mkdirs(FILE.join("Build", "Deployment", "scrollview")); + OS.system(["press", "-f", FILE.join("Build", "Release", "scrollview"), FILE.join("Build", "Deployment", "scrollview")]); + printResults("Deployment") +}); + +task ("desktop", ["release"], function() +{ + FILE.mkdirs(FILE.join("Build", "Desktop", "scrollview")); + require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "scrollview"), FILE.join("Build", "Desktop", "scrollview", "scrollview.app")); + printResults("Desktop") +}); + +task ("run-desktop", ["desktop"], function() +{ + OS.system([FILE.join("Build", "Desktop", "scrollview", "scrollview.app", "Contents", "MacOS", "NativeHost"), "-i"]); +}); + +function printResults(configuration) +{ + print("----------------------------"); + print(configuration+" app built at path: "+FILE.join("Build", configuration, "scrollview")); + print("----------------------------"); +} diff --git a/Tests/Manual/CPScrollView2/Resources/MainMenu.xib b/Tests/Manual/CPScrollView2/Resources/MainMenu.xib new file mode 100644 index 000000000..853fdab56 --- /dev/null +++ b/Tests/Manual/CPScrollView2/Resources/MainMenu.xib @@ -0,0 +1,3805 @@ + + + + 1050 + 11C71 + 1617 + 1138.23 + 567.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 1617 + + + YES + NSPopUpButton + NSScroller + NSMenuItem + NSMenu + NSScrollView + NSButtonCell + NSButton + NSTextFieldCell + NSCustomView + NSCustomObject + NSView + NSWindowTemplate + NSPopUpButtonCell + NSTextField + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + NewApplication + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + NewApplication + + YES + + + About NewApplication + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide NewApplication + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit NewApplication + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + Save As… + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + Show Spelling… + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + 7 + 2 + {{335, 390}, {609, 372}} + 1946157056 + Window + NSWindow + + + + + 256 + + YES + + + 268 + + YES + + + 2304 + + YES + + + 274 + {552, 244} + + + _NS:414 + + + {{1, 1}, {567, 259}} + + + _NS:412 + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + 4 + + + + 256 + {{553, 1}, {15, 253}} + + _NS:419 + + _doScroller: + 1 + 0.96363627910614014 + + + + 256 + {{1, 245}, {561, 15}} + + + _NS:423 + 1 + + _doScroller: + 0.50602412223815918 + + + {{20, 20}, {569, 261}} + + + _NS:410 + 133169 + + + + + + + 268 + {{326, 324}, {136, 32}} + + + _NS:161 + YES + + 67239424 + 134217728 + Flash scrollers + + LucidaGrande + 13 + 1044 + + _NS:161 + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{462, 323}, {133, 32}} + + + _NS:161 + YES + + 67239424 + 134217728 + Big Doc view + + _NS:161 + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{460, 292}, {135, 32}} + + + _NS:161 + YES + + 67239424 + 134217728 + Small Doc view + + _NS:161 + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{326, 293}, {136, 32}} + + + _NS:161 + YES + + 67239424 + 134217728 + Scroller style + + _NS:161 + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{147, 327}, {148, 26}} + + + _NS:179 + YES + + -2076049856 + 2048 + + _NS:179 + + 109199615 + 129 + + + 400 + 75 + + + Dark + + 1048576 + 2147483647 + 1 + + + _popUpItemAction: + + + YES + + OtherViews + + YES + + + + Light + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Default + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + + 1 + YES + YES + 2 + + + + + 268 + {{147, 297}, {148, 26}} + + + _NS:179 + YES + + -2076049856 + 2048 + + _NS:179 + + 109199615 + 129 + + + 400 + 75 + + + Light + + 1048576 + 2147483647 + 1 + + + _popUpItemAction: + + + YES + + OtherViews + + YES + + + + Dark + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + + 1 + YES + YES + 2 + + + + + 268 + {{17, 334}, {125, 17}} + + + _NS:3936 + YES + + 68288064 + 71304192 + Srcoller knob style: + + _NS:3936 + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 268 + {{17, 303}, {125, 17}} + + + _NS:3936 + YES + + 68288064 + 71304192 + Background color: + + _NS:3936 + + + + + + + {609, 372} + + + {{0, 0}, {1680, 1028}} + {10000000000000, 10000000000000} + YES + + + AppController + + + + 268 + + YES + + + 289 + {{481, 20}, {84, 17}} + + + _NS:3936 + YES + + 70385217 + 71304192 + Bottom right + + _NS:3936 + + + + + + + + 265 + {{478, 512}, {87, 17}} + + + + _NS:3936 + YES + + 70385217 + 71304192 + Top right + + _NS:3936 + + + + + + + + 292 + {{17, 20}, {75, 17}} + + + + _NS:3936 + YES + + 70385217 + 272630784 + Bottom left + + _NS:3936 + + + + + + + + 268 + {{17, 512}, {54, 17}} + + + + _NS:3936 + YES + + 70385217 + 272630784 + Top left + + _NS:3936 + + + + + + + {582, 549} + + + + _NS:499 + NSView + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + alignLeft: + + + + 442 + + + + alignJustified: + + + + 443 + + + + copyRuler: + + + + 444 + + + + alignCenter: + + + + 445 + + + + toggleRuler: + + + + 446 + + + + alignRight: + + + + 447 + + + + pasteRuler: + + + + 448 + + + + terminate: + + + + 449 + + + + delegate + + + + 451 + + + + theWindow + + + + 459 + + + + contentView + + + + 469 + + + + scrollView + + + + 470 + + + + flash: + + + + 495 + + + + change: + + + + 496 + + + + changeKnob: + + + + 497 + + + + changeBackground: + + + + 507 + + + + makeBigDocView: + + + + 514 + + + + makeSmallDocView: + + + + 515 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + YES + + + + + + 372 + + + YES + + + + + + + + + + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + + 377 + + + YES + + + + + + 378 + + + YES + + + + + + 379 + + + YES + + + + + + + + + + + + + 380 + + + + + 381 + + + + + 382 + + + + + 383 + + + + + 384 + + + + + 385 + + + + + 386 + + + + + 387 + + + + + 388 + + + YES + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + YES + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + YES + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + YES + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + YES + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 450 + + + + + 464 + + + YES + + + + + + + + 465 + + + + + 466 + + + + + 467 + + + + + 468 + + + YES + + + + + + + + + 471 + + + YES + + + + + + 472 + + + + + 473 + + + YES + + + + + + 474 + + + + + 475 + + + YES + + + + + + 476 + + + YES + + + + + + 477 + + + YES + + + + + + + + 478 + + + + + 479 + + + + + 480 + + + + + 481 + + + YES + + + + + + 482 + + + YES + + + + + + 483 + + + YES + + + + + + + 485 + + + + + 486 + + + + + 487 + + + YES + + + + + + 488 + + + + + 489 + + + YES + + + + + + 490 + + + + + 499 + + + YES + + + + + + 500 + + + + + 501 + + + YES + + + + + + 502 + + + + + 503 + + + YES + + + + + + 504 + + + YES + + + + + + 505 + + + + + 506 + + + + + 508 + + + YES + + + + + + 509 + + + + + 511 + + + YES + + + + + + 512 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 106.IBPluginDependency + 111.IBPluginDependency + 112.IBPluginDependency + 124.IBPluginDependency + 125.IBPluginDependency + 126.IBPluginDependency + 129.IBPluginDependency + 130.IBPluginDependency + 131.IBPluginDependency + 134.IBPluginDependency + 136.IBPluginDependency + 143.IBPluginDependency + 144.IBPluginDependency + 145.IBPluginDependency + 149.IBPluginDependency + 150.IBPluginDependency + 19.IBPluginDependency + 195.IBPluginDependency + 196.IBPluginDependency + 197.IBPluginDependency + 198.IBPluginDependency + 199.IBPluginDependency + 200.IBPluginDependency + 201.IBPluginDependency + 202.IBPluginDependency + 203.IBPluginDependency + 204.IBPluginDependency + 205.IBPluginDependency + 206.IBPluginDependency + 207.IBPluginDependency + 208.IBPluginDependency + 209.IBPluginDependency + 210.IBPluginDependency + 211.IBPluginDependency + 212.IBPluginDependency + 213.IBPluginDependency + 214.IBPluginDependency + 215.IBPluginDependency + 216.IBPluginDependency + 217.IBPluginDependency + 218.IBPluginDependency + 219.IBPluginDependency + 220.IBPluginDependency + 221.IBPluginDependency + 23.IBPluginDependency + 236.IBPluginDependency + 239.IBPluginDependency + 24.IBPluginDependency + 29.IBPluginDependency + 295.IBPluginDependency + 296.IBPluginDependency + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 348.IBPluginDependency + 349.IBPluginDependency + 350.IBPluginDependency + 351.IBPluginDependency + 354.IBPluginDependency + 371.IBPluginDependency + 371.IBWindowTemplateEditedContentRect + 371.NSWindowTemplate.visibleAtLaunch + 372.IBPluginDependency + 375.IBPluginDependency + 376.IBPluginDependency + 377.IBPluginDependency + 378.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 381.IBPluginDependency + 382.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency + 385.IBPluginDependency + 386.IBPluginDependency + 387.IBPluginDependency + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 419.IBPluginDependency + 450.IBPluginDependency + 464.IBPluginDependency + 465.IBPluginDependency + 466.IBPluginDependency + 467.IBPluginDependency + 468.IBPluginDependency + 471.IBPluginDependency + 472.IBPluginDependency + 473.IBPluginDependency + 474.IBPluginDependency + 475.IBPluginDependency + 476.IBPluginDependency + 477.IBPluginDependency + 478.IBPluginDependency + 479.IBPluginDependency + 480.IBPluginDependency + 481.IBPluginDependency + 482.IBPluginDependency + 483.IBPluginDependency + 485.IBPluginDependency + 486.IBPluginDependency + 487.IBPluginDependency + 488.IBPluginDependency + 489.IBPluginDependency + 490.IBPluginDependency + 499.IBPluginDependency + 5.IBPluginDependency + 500.IBPluginDependency + 501.IBPluginDependency + 502.IBPluginDependency + 503.IBPluginDependency + 504.IBPluginDependency + 505.IBPluginDependency + 506.IBPluginDependency + 508.IBPluginDependency + 509.IBPluginDependency + 511.IBPluginDependency + 512.IBPluginDependency + 56.IBPluginDependency + 57.IBPluginDependency + 58.IBPluginDependency + 72.IBPluginDependency + 73.IBPluginDependency + 74.IBPluginDependency + 75.IBPluginDependency + 77.IBPluginDependency + 78.IBPluginDependency + 79.IBPluginDependency + 80.IBPluginDependency + 81.IBPluginDependency + 82.IBPluginDependency + 83.IBPluginDependency + 92.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{303, 221}, {480, 360}} + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + + + + + YES + + + + + 515 + + + + YES + + AppController + NSObject + + YES + + YES + change: + changeBackground: + changeKnob: + flash: + makeBigDocView: + makeSmallDocView: + + + YES + id + id + id + id + id + id + + + + YES + + YES + change: + changeBackground: + changeKnob: + flash: + makeBigDocView: + makeSmallDocView: + + + YES + + change: + id + + + changeBackground: + id + + + changeKnob: + id + + + flash: + id + + + makeBigDocView: + id + + + makeSmallDocView: + id + + + + + YES + + YES + contentView + scrollView + + + YES + NSView + NSScrollView + + + + YES + + YES + contentView + scrollView + + + YES + + contentView + NSView + + + scrollView + NSScrollView + + + + + IBProjectSource + ./Classes/AppController.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + 3 + + YES + + YES + NSMenuCheckmark + NSMenuMixedState + + + YES + {9, 8} + {7, 2} + + + + diff --git a/Tests/Manual/CPScrollView2/Resources/spinner.gif b/Tests/Manual/CPScrollView2/Resources/spinner.gif new file mode 100644 index 000000000..06dbc2bc2 Binary files /dev/null and b/Tests/Manual/CPScrollView2/Resources/spinner.gif differ diff --git a/Tests/Manual/CPScrollView2/index-debug.html b/Tests/Manual/CPScrollView2/index-debug.html new file mode 100644 index 000000000..0b45db901 --- /dev/null +++ b/Tests/Manual/CPScrollView2/index-debug.html @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + scrollview + + + + + + + + + + + + + + +
+
+ + + +
+
+ + + diff --git a/Tests/Manual/CPScrollView2/index.html b/Tests/Manual/CPScrollView2/index.html new file mode 100644 index 000000000..426f900a2 --- /dev/null +++ b/Tests/Manual/CPScrollView2/index.html @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + scrollview + + + + + + + + + + + + +
+
+ + + +
+
+ + + diff --git a/Tests/Manual/CPScrollView2/main.j b/Tests/Manual/CPScrollView2/main.j new file mode 100644 index 000000000..f9bcb7c8d --- /dev/null +++ b/Tests/Manual/CPScrollView2/main.j @@ -0,0 +1,18 @@ +/* + * AppController.j + * scrollview + * + * Created by You on October 3, 2011. + * Copyright 2011, Your Company All rights reserved. + */ + +@import +@import + +@import "AppController.j" + + +function main(args, namedArgs) +{ + CPApplicationMain(args, namedArgs); +} diff --git a/Tools/nib2cib/NSScrollView.j b/Tools/nib2cib/NSScrollView.j index 43b6d5e8f..2d1b76d11 100644 --- a/Tools/nib2cib/NSScrollView.j +++ b/Tools/nib2cib/NSScrollView.j @@ -41,6 +41,11 @@ [self addSubview:_bottomCornerView]; + var knobStyle = 0; + try { knobStyle = [aCoder decodeObjectForKey:"NSScrollerKnobStyle"]; } catch (e){} + + [self setScrollerKnobStyle:knobStyle]; + _hasVerticalScroller = !!(flags & (1 << 4)); _hasHorizontalScroller = !!(flags & (1 << 5)); _autohidesScrollers = !!(flags & (1 << 9));