fix some bugs and update arts
@@ -605,7 +605,7 @@ var TIMER_INTERVAL = 0.2,
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Utilities
|
||||
#pragma mark Privates
|
||||
|
||||
/* @ignore */
|
||||
- (void)_updateScrollerStyle
|
||||
@@ -621,6 +621,13 @@ var TIMER_INTERVAL = 0.2,
|
||||
[_verticalScroller unsetThemeState:CPThemeStateSelected];
|
||||
}
|
||||
|
||||
if (_scrollerStyle == CPScrollerStyleOverlay)
|
||||
{
|
||||
if (_timerScrollersHide)
|
||||
[_timerScrollersHide invalidate];
|
||||
_timerScrollersHide = [CPTimer scheduledTimerWithTimeInterval:1.2 target:self selector:@selector(_hideScrollers:) userInfo:nil repeats:NO];
|
||||
}
|
||||
|
||||
[self reflectScrolledClipView:_contentView];
|
||||
}
|
||||
|
||||
@@ -719,24 +726,30 @@ var TIMER_INTERVAL = 0.2,
|
||||
documentFrame = [[_contentView documentView] frame],
|
||||
contentBounds = [_contentView bounds];
|
||||
|
||||
|
||||
switch ([_verticalScroller hitPart])
|
||||
{
|
||||
case CPScrollerDecrementLine: contentBounds.origin.y -= _verticalLineScroll;
|
||||
break;
|
||||
case CPScrollerDecrementLine:
|
||||
contentBounds.origin.y -= _verticalLineScroll;
|
||||
break;
|
||||
|
||||
case CPScrollerIncrementLine: contentBounds.origin.y += _verticalLineScroll;
|
||||
break;
|
||||
case CPScrollerIncrementLine:
|
||||
contentBounds.origin.y += _verticalLineScroll;
|
||||
break;
|
||||
|
||||
case CPScrollerDecrementPage: contentBounds.origin.y -= _CGRectGetHeight(contentBounds) - _verticalPageScroll;
|
||||
break;
|
||||
case CPScrollerDecrementPage:
|
||||
contentBounds.origin.y -= _CGRectGetHeight(contentBounds) - _verticalPageScroll;
|
||||
break;
|
||||
|
||||
case CPScrollerIncrementPage: contentBounds.origin.y += _CGRectGetHeight(contentBounds) - _verticalPageScroll;
|
||||
break;
|
||||
case CPScrollerIncrementPage:
|
||||
contentBounds.origin.y += _CGRectGetHeight(contentBounds) - _verticalPageScroll;
|
||||
break;
|
||||
|
||||
// We want integral bounds!
|
||||
case CPScrollerKnobSlot:
|
||||
case CPScrollerKnob:
|
||||
// We want integral bounds!
|
||||
default: contentBounds.origin.y = ROUND(value * (_CGRectGetHeight(documentFrame) - _CGRectGetHeight(contentBounds)));
|
||||
default:
|
||||
contentBounds.origin.y = ROUND(value * (_CGRectGetHeight(documentFrame) - _CGRectGetHeight(contentBounds)));
|
||||
}
|
||||
|
||||
[self _sendDelegateMessages];
|
||||
@@ -753,22 +766,27 @@ var TIMER_INTERVAL = 0.2,
|
||||
|
||||
switch ([_horizontalScroller hitPart])
|
||||
{
|
||||
case CPScrollerDecrementLine: contentBounds.origin.x -= _horizontalLineScroll;
|
||||
break;
|
||||
case CPScrollerDecrementLine:
|
||||
contentBounds.origin.x -= _horizontalLineScroll;
|
||||
break;
|
||||
|
||||
case CPScrollerIncrementLine: contentBounds.origin.x += _horizontalLineScroll;
|
||||
break;
|
||||
case CPScrollerIncrementLine:
|
||||
contentBounds.origin.x += _horizontalLineScroll;
|
||||
break;
|
||||
|
||||
case CPScrollerDecrementPage: contentBounds.origin.x -= _CGRectGetWidth(contentBounds) - _horizontalPageScroll;
|
||||
break;
|
||||
case CPScrollerDecrementPage:
|
||||
contentBounds.origin.x -= _CGRectGetWidth(contentBounds) - _horizontalPageScroll;
|
||||
break;
|
||||
|
||||
case CPScrollerIncrementPage: contentBounds.origin.x += _CGRectGetWidth(contentBounds) - _horizontalPageScroll;
|
||||
break;
|
||||
case CPScrollerIncrementPage:
|
||||
contentBounds.origin.x += _CGRectGetWidth(contentBounds) - _horizontalPageScroll;
|
||||
break;
|
||||
|
||||
// We want integral bounds!
|
||||
case CPScrollerKnobSlot:
|
||||
case CPScrollerKnob:
|
||||
// We want integral bounds!
|
||||
default: contentBounds.origin.x = ROUND(value * (_CGRectGetWidth(documentFrame) - _CGRectGetWidth(contentBounds)));
|
||||
default:
|
||||
contentBounds.origin.x = ROUND(value * (_CGRectGetWidth(documentFrame) - _CGRectGetWidth(contentBounds)));
|
||||
}
|
||||
|
||||
[self _sendDelegateMessages];
|
||||
@@ -844,6 +862,10 @@ var TIMER_INTERVAL = 0.2,
|
||||
[_delegate scrollViewDidScroll:self];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Utilities
|
||||
|
||||
/*!
|
||||
Lays out the scroll view's components.
|
||||
*/
|
||||
@@ -925,7 +947,7 @@ var TIMER_INTERVAL = 0.2,
|
||||
[_horizontalScroller setHidden:!shouldShowHorizontalScroller];
|
||||
[_horizontalScroller setEnabled:hasHorizontalScroll];
|
||||
|
||||
var overlay = 0;
|
||||
var overlay = [CPScroller scrollerOverlay];
|
||||
if (_scrollerStyle === CPScrollerStyleLegacy)
|
||||
{
|
||||
// We can thus appropriately account for them changing the content size.
|
||||
@@ -934,10 +956,7 @@ var TIMER_INTERVAL = 0.2,
|
||||
|
||||
if (shouldShowHorizontalScroller)
|
||||
contentFrame.size.height -= horizontalScrollerHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
overlay = [CPScroller scrollerOffset];
|
||||
overlay = 0;
|
||||
}
|
||||
|
||||
var scrollPoint = [_contentView bounds].origin,
|
||||
@@ -1002,9 +1021,7 @@ var TIMER_INTERVAL = 0.2,
|
||||
_timerScrollersHide = [CPTimer scheduledTimerWithTimeInterval:1.2 target:self selector:@selector(_hideScrollers:) userInfo:nil repeats:NO];
|
||||
}
|
||||
|
||||
/*
|
||||
@ignore
|
||||
*/
|
||||
/* @ignore */
|
||||
- (void)resizeSubviewsWithOldSize:(CGSize)aSize
|
||||
{
|
||||
[self reflectScrolledClipView:_contentView];
|
||||
|
||||
@@ -83,6 +83,10 @@ CPThemeStateScrollViewLegacy = CPThemeState("scroller-style-legacy");
|
||||
int _style;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Class methods
|
||||
|
||||
+ (CPString)defaultThemeClass
|
||||
{
|
||||
return "scroller";
|
||||
@@ -105,8 +109,44 @@ CPThemeStateScrollViewLegacy = CPThemeState("scroller-style-legacy");
|
||||
}]
|
||||
}
|
||||
|
||||
+ (float)scrollerWidth
|
||||
{
|
||||
return [CPScroller scrollerWidthInStyle:CPScrollerStyleLegacy];
|
||||
}
|
||||
|
||||
// Calculating Layout
|
||||
/*!
|
||||
Returns the CPScroller's width for a CPRegularControlSize.
|
||||
*/
|
||||
+ (float)scrollerWidthInStyle:(int)aStyle
|
||||
{
|
||||
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"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the width of a CPScroller for the specified CPControlSize.
|
||||
@param aControlSize the size of a controller to return the width for
|
||||
*/
|
||||
+ (float)scrollerWidthForControlSize:(CPControlSize)aControlSize
|
||||
{
|
||||
// ?? a class method using self?
|
||||
return nil//[self scrollerWidth];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Initialization
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
{
|
||||
@@ -136,20 +176,22 @@ CPThemeStateScrollViewLegacy = CPThemeState("scroller-style-legacy");
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)_adjustScrollerSize
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Getters / Setters
|
||||
|
||||
/*!
|
||||
Returns the scroller's style
|
||||
*/
|
||||
- (void)style
|
||||
{
|
||||
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];
|
||||
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)
|
||||
@@ -171,41 +213,17 @@ CPThemeStateScrollViewLegacy = CPThemeState("scroller-style-legacy");
|
||||
[self _adjustScrollerSize];
|
||||
}
|
||||
|
||||
// Determining CPScroller Size
|
||||
|
||||
+ (float)scrollerWidth
|
||||
- (void)setObjectValue:(id)aValue
|
||||
{
|
||||
return [CPScroller scrollerWidthInStyle:CPScrollerStyleLegacy];
|
||||
[super setObjectValue:MIN(1.0, MAX(0.0, +aValue))];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the CPScroller's width for a CPRegularControlSize.
|
||||
Returns the scroller's control size
|
||||
*/
|
||||
+ (float)scrollerWidthInStyle:(int)aStyle
|
||||
- (CPControlSize)controlSize
|
||||
{
|
||||
var scroller = [[CPScroller alloc] init];
|
||||
|
||||
if (aStyle == CPScrollerStyleLegacy)
|
||||
return [scroller valueForThemeAttribute:@"scroller-width" inState:CPThemeStateScrollViewLegacy];
|
||||
return [scroller currentValueForThemeAttribute:@"scroller-width"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the CPScroller's offset.
|
||||
*/
|
||||
+ (float)scrollerOffset
|
||||
{
|
||||
return [[[CPScroller alloc] init] currentValueForThemeAttribute:@"track-border-overlay"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the width of a CPScroller for the specified CPControlSize.
|
||||
@param aControlSize the size of a controller to return the width for
|
||||
*/
|
||||
+ (float)scrollerWidthForControlSize:(CPControlSize)aControlSize
|
||||
{
|
||||
// ?? a class method using self?
|
||||
return nil//[self scrollerWidth];
|
||||
return _controlSize;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -224,18 +242,17 @@ CPThemeStateScrollViewLegacy = CPThemeState("scroller-style-legacy");
|
||||
}
|
||||
|
||||
/*!
|
||||
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));
|
||||
@@ -244,25 +261,28 @@ CPThemeStateScrollViewLegacy = CPThemeState("scroller-style-legacy");
|
||||
[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
|
||||
{
|
||||
var themeState = _themeState;
|
||||
|
||||
if (NAMES_FOR_PARTS[_hitPart] + "-color" !== anAttributeName)
|
||||
themeState &= ~CPThemeStateHighlighted;
|
||||
|
||||
return [self valueForThemeAttribute:anAttributeName inState:themeState];
|
||||
}
|
||||
|
||||
// Calculating Layout
|
||||
#pragma mark -
|
||||
#pragma mark Utilities
|
||||
|
||||
- (CGRect)rectForPart:(CPScrollerPart)aPart
|
||||
{
|
||||
@@ -406,7 +426,29 @@ CPThemeStateScrollViewLegacy = CPThemeState("scroller-style-legacy");
|
||||
return _usableParts;
|
||||
}
|
||||
|
||||
// Drawing the Parts
|
||||
/*!
|
||||
Display the scroller
|
||||
*/
|
||||
- (void)fadeIn
|
||||
{
|
||||
[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
|
||||
@@ -641,6 +683,20 @@ CPThemeStateScrollViewLegacy = CPThemeState("scroller-style-legacy");
|
||||
[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])
|
||||
@@ -672,18 +728,9 @@ CPThemeStateScrollViewLegacy = CPThemeState("scroller-style-legacy");
|
||||
[self fadeOut];
|
||||
}
|
||||
|
||||
- (void)fadeIn
|
||||
{
|
||||
[self setAlphaValue:1.0];
|
||||
}
|
||||
|
||||
- (void)fadeOut
|
||||
{
|
||||
if ([self hasThemeState:CPThemeStateScrollViewLegacy])
|
||||
return;
|
||||
|
||||
[_animationScroller startAnimation];
|
||||
}
|
||||
#pragma mark -
|
||||
#pragma mark Delegates
|
||||
|
||||
- (void)animationDidEnd:(CPAnimation)animation
|
||||
{
|
||||
|
||||
|
Before Width: | Height: | Size: 997 B After Width: | Height: | Size: 115 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 146 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 146 B |
|
Before Width: | Height: | Size: 148 B After Width: | Height: | Size: 139 B |
|
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 169 B |
|
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 171 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 123 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 158 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 157 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 145 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 285 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 301 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 157 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 123 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 157 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 139 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 302 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 142 B |
|
Before Width: | Height: | Size: 994 B After Width: | Height: | Size: 112 B |
|
Before Width: | Height: | Size: 421 B |
|
Before Width: | Height: | Size: 143 B |
|
Before Width: | Height: | Size: 424 B |
|
Before Width: | Height: | Size: 1023 B After Width: | Height: | Size: 141 B |
|
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 144 B After Width: | Height: | Size: 133 B |
|
Before Width: | Height: | Size: 177 B After Width: | Height: | Size: 171 B |