support for changing scroller styles
No files matched your search
@@ -40,6 +40,7 @@ var TIMER_INTERVAL = 0.2,
|
||||
CPScrollViewDelegate_scrollViewDidScroll_ = 1 << 1;
|
||||
|
||||
|
||||
|
||||
@implementation CPScrollView : CPView
|
||||
{
|
||||
CPClipView _contentView;
|
||||
@@ -68,6 +69,8 @@ var TIMER_INTERVAL = 0.2,
|
||||
CPBorderType _borderType;
|
||||
|
||||
CPTimer _timerScrollersHide;
|
||||
|
||||
int _scrollerStyle @accessors(getter=scrollerStyle);
|
||||
}
|
||||
|
||||
+ (CPString)defaultThemeClass
|
||||
@@ -108,6 +111,7 @@ var TIMER_INTERVAL = 0.2,
|
||||
|
||||
[self setHasVerticalScroller:YES];
|
||||
[self setHasHorizontalScroller:YES];
|
||||
[self setScrollerStyle:CPScrollerStyleOverlay];
|
||||
|
||||
_delegate = nil;
|
||||
_scrollTimer = nil;
|
||||
@@ -139,6 +143,38 @@ var TIMER_INTERVAL = 0.2,
|
||||
if ([_delegate respondsToSelector:@selector(scrollViewDidScroll:)])
|
||||
_implementedDelegateMethods |= CPScrollViewDelegate_scrollViewDidScroll_;
|
||||
}
|
||||
|
||||
/*!
|
||||
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];
|
||||
}
|
||||
|
||||
- (void)_updateScrollerStyle
|
||||
{
|
||||
if (_hasHorizontalScroller)
|
||||
{
|
||||
[_horizontalScroller setStyle:_scrollerStyle];
|
||||
[_horizontalScroller unsetThemeState:CPThemeStateSelected];
|
||||
}
|
||||
if (_hasVerticalScroller)
|
||||
{
|
||||
[_verticalScroller setStyle:_scrollerStyle];
|
||||
[_verticalScroller unsetThemeState:CPThemeStateSelected];
|
||||
}
|
||||
|
||||
[self reflectScrolledClipView:_contentView];
|
||||
}
|
||||
|
||||
// Calculating Layout
|
||||
|
||||
+ (CGSize)contentSizeForFrameSize:(CGSize)frameSize hasHorizontalScroller:(BOOL)hFlag hasVerticalScroller:(BOOL)vFlag borderType:(CPBorderType)borderType
|
||||
@@ -184,7 +220,6 @@ var TIMER_INTERVAL = 0.2,
|
||||
bounds = _CGRectInset(bounds, 2.0, 2.0);
|
||||
++bounds.origin.y;
|
||||
--bounds.size.height;
|
||||
|
||||
return bounds;
|
||||
|
||||
case CPNoBorder:
|
||||
@@ -332,6 +367,21 @@ var TIMER_INTERVAL = 0.2,
|
||||
[_horizontalScroller setHidden:!shouldShowHorizontalScroller];
|
||||
[_horizontalScroller setEnabled:hasHorizontalScroll];
|
||||
|
||||
var overlay = 0;
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
overlay = [CPScroller scrollerOffset];
|
||||
}
|
||||
|
||||
var scrollPoint = [_contentView bounds].origin,
|
||||
wasShowingVerticalScroller = ![_verticalScroller isHidden],
|
||||
wasShowingHorizontalScroller = ![_horizontalScroller isHidden];
|
||||
@@ -345,7 +395,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) - [CPScroller scrollerOffset], verticalScrollerY, verticalScrollerWidth, verticalScrollerHeight)];
|
||||
[_verticalScroller setFrame:_CGRectMake(_CGRectGetMaxX(contentFrame) - overlay, verticalScrollerY, verticalScrollerWidth, verticalScrollerHeight)];
|
||||
}
|
||||
else if (wasShowingVerticalScroller)
|
||||
{
|
||||
@@ -357,7 +407,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) - [CPScroller scrollerOffset], _CGRectGetWidth(contentFrame), horizontalScrollerHeight)];
|
||||
[_horizontalScroller setFrame:_CGRectMake(_CGRectGetMinX(contentFrame), _CGRectGetMaxY(contentFrame) - overlay, _CGRectGetWidth(contentFrame), horizontalScrollerHeight)];
|
||||
}
|
||||
else if (wasShowingHorizontalScroller)
|
||||
{
|
||||
@@ -365,6 +415,8 @@ var TIMER_INTERVAL = 0.2,
|
||||
[_horizontalScroller setKnobProportion:1.0];
|
||||
}
|
||||
|
||||
console.log(contentFrame)
|
||||
debugger;
|
||||
[_contentView setFrame:contentFrame];
|
||||
[_headerClipView setFrame:headerClipViewFrame];
|
||||
[[_headerClipView documentView] setNeedsDisplay:YES];
|
||||
@@ -376,6 +428,24 @@ var TIMER_INTERVAL = 0.2,
|
||||
--_recursionCount;
|
||||
}
|
||||
|
||||
/*!
|
||||
Momentary display the scrollers
|
||||
*/
|
||||
- (void)flashScrollers
|
||||
{
|
||||
if (_scrollerStyle == CPScrollerStyleLegacy)
|
||||
return;
|
||||
|
||||
if (_hasHorizontalScroller)
|
||||
[_horizontalScroller fadeIn];
|
||||
if (_hasVerticalScroller)
|
||||
[_verticalScroller fadeIn];
|
||||
|
||||
if (_timerScrollersHide)
|
||||
[_timerScrollersHide invalidate]
|
||||
_timerScrollersHide = [CPTimer scheduledTimerWithTimeInterval:1.2 target:self selector:@selector(_hideScrollers:) userInfo:nil repeats:NO];
|
||||
}
|
||||
|
||||
// Managing Graphics Attributes
|
||||
|
||||
/*!
|
||||
@@ -427,7 +497,7 @@ var TIMER_INTERVAL = 0.2,
|
||||
|
||||
[self addSubview:_horizontalScroller];
|
||||
|
||||
[self reflectScrolledClipView:_contentView];
|
||||
[self _updateScrollerStyle];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -454,8 +524,8 @@ var TIMER_INTERVAL = 0.2,
|
||||
{
|
||||
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 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];
|
||||
@@ -489,7 +559,7 @@ var TIMER_INTERVAL = 0.2,
|
||||
|
||||
[self addSubview:_verticalScroller];
|
||||
|
||||
[self reflectScrolledClipView:_contentView];
|
||||
[self _updateScrollerStyle];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -517,8 +587,8 @@ var TIMER_INTERVAL = 0.2,
|
||||
{
|
||||
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 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];
|
||||
@@ -627,8 +697,8 @@ var TIMER_INTERVAL = 0.2,
|
||||
|
||||
bottomCornerFrame.origin.x = CGRectGetMinX(verticalFrame);
|
||||
bottomCornerFrame.origin.y = CGRectGetMaxY(verticalFrame);
|
||||
bottomCornerFrame.size.width = [CPScroller scrollerWidth];
|
||||
bottomCornerFrame.size.height = [CPScroller scrollerWidth];
|
||||
bottomCornerFrame.size.width = [CPScroller scrollerWidthInStyle:_scrollerStyle];
|
||||
bottomCornerFrame.size.height = [CPScroller scrollerWidthInStyle:_scrollerStyle];
|
||||
|
||||
return bottomCornerFrame;
|
||||
}
|
||||
@@ -1122,7 +1192,8 @@ var CPScrollViewContentViewKey = @"CPScrollViewContentView",
|
||||
CPScrollViewAutohidesScrollerKey = @"CPScrollViewAutohidesScroller",
|
||||
CPScrollViewCornerViewKey = @"CPScrollViewCornerViewKey",
|
||||
CPScrollViewBottomCornerViewKey = @"CPScrollViewBottomCornerViewKey",
|
||||
CPScrollViewBorderTypeKey = @"CPScrollViewBorderTypeKey";
|
||||
CPScrollViewBorderTypeKey = @"CPScrollViewBorderTypeKey",
|
||||
CPScrollViewScrollerStyleKey = @"CPScrollViewScrollerStyleKey";
|
||||
|
||||
@implementation CPScrollView (CPCoding)
|
||||
|
||||
@@ -1160,8 +1231,11 @@ 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];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -1190,6 +1264,8 @@ var CPScrollViewContentViewKey = @"CPScrollViewContentView",
|
||||
[aCoder encodeObject:_bottomCornerView forKey:CPScrollViewBottomCornerViewKey];
|
||||
|
||||
[aCoder encodeInt:_borderType forKey:CPScrollViewBorderTypeKey];
|
||||
|
||||
[aCoder encodeInt:_scrollerStyle forKey:CPScrollViewScrollerStyleKey];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -24,7 +24,6 @@
|
||||
*/
|
||||
|
||||
@import "CPControl.j"
|
||||
@import "CPViewAnimation.j"
|
||||
|
||||
// CPScroller Constants
|
||||
CPScrollerNoPart = 0;
|
||||
@@ -57,6 +56,12 @@ NAMES_FOR_PARTS[CPScrollerKnobSlot] = @"knob-slot";
|
||||
NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
|
||||
|
||||
CPScrollerStyleLegacy = 1;
|
||||
CPScrollerStyleOverlay = 2;
|
||||
|
||||
CPThemeStateScrollViewLegacy = CPThemeState("scroller-style-legacy");
|
||||
|
||||
|
||||
@implementation CPScroller : CPControl
|
||||
{
|
||||
CPControlSize _controlSize;
|
||||
@@ -75,6 +80,7 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
CPViewAnimation _animationScroller;
|
||||
|
||||
BOOL _allowFadingOut @accessors(getter=allowFadingOut);
|
||||
int _style;
|
||||
}
|
||||
|
||||
+ (CPString)defaultThemeClass
|
||||
@@ -95,7 +101,7 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
@"track-inset":_CGInsetMakeZero(),
|
||||
@"knob-inset": _CGInsetMakeZero(),
|
||||
@"minimum-knob-length":21.0,
|
||||
@"track-border-offset": 9.0,
|
||||
@"track-border-overlay": 9.0,
|
||||
}]
|
||||
}
|
||||
|
||||
@@ -116,6 +122,7 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
|
||||
_hitPart = CPScrollerNoPart;
|
||||
_allowFadingOut = YES;
|
||||
_style = CPScrollerStyleOverlay;
|
||||
_paramAnimFadeOut = [CPDictionary dictionaryWithObjects:[self, CPViewAnimationFadeOutEffect]
|
||||
forKeys:[CPViewAnimationTargetKey, CPViewAnimationEffectKey]];
|
||||
|
||||
@@ -129,13 +136,58 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)_adjustScrollerSize
|
||||
{
|
||||
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];
|
||||
}
|
||||
|
||||
- (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];
|
||||
}
|
||||
|
||||
// Determining CPScroller Size
|
||||
|
||||
+ (float)scrollerWidth
|
||||
{
|
||||
return [CPScroller scrollerWidthInStyle:CPScrollerStyleLegacy];
|
||||
}
|
||||
|
||||
/*!
|
||||
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"];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -143,7 +195,7 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
*/
|
||||
+ (float)scrollerOffset
|
||||
{
|
||||
return [[[CPScroller alloc] init] currentValueForThemeAttribute:@"track-border-offset"];
|
||||
return [[[CPScroller alloc] init] currentValueForThemeAttribute:@"track-border-overlay"];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -152,7 +204,8 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
*/
|
||||
+ (float)scrollerWidthForControlSize:(CPControlSize)aControlSize
|
||||
{
|
||||
return [self scrollerWidth];
|
||||
// ?? a class method using self?
|
||||
return nil//[self scrollerWidth];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -626,6 +679,9 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
|
||||
- (void)fadeOut
|
||||
{
|
||||
if ([self hasThemeState:CPThemeStateScrollViewLegacy])
|
||||
return;
|
||||
|
||||
[_animationScroller startAnimation];
|
||||
}
|
||||
|
||||
@@ -637,8 +693,9 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
|
||||
@end
|
||||
|
||||
var CPScrollerControlSizeKey = "CPScrollerControlSize",
|
||||
CPScrollerKnobProportionKey = "CPScrollerKnobProportion";
|
||||
var CPScrollerControlSizeKey = @"CPScrollerControlSize",
|
||||
CPScrollerKnobProportionKey = @"CPScrollerKnobProportion",
|
||||
CPScrollerStyleKey = @"CPScrollerStyleKey";
|
||||
|
||||
@implementation CPScroller (CPCoding)
|
||||
|
||||
@@ -668,18 +725,7 @@ var CPScrollerControlSizeKey = "CPScrollerControlSize",
|
||||
|
||||
[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;
|
||||
@@ -691,6 +737,7 @@ var CPScrollerControlSizeKey = "CPScrollerControlSize",
|
||||
|
||||
[aCoder encodeInt:_controlSize forKey:CPScrollerControlSizeKey];
|
||||
[aCoder encodeFloat:_knobProportion forKey:CPScrollerKnobProportionKey];
|
||||
[aCoder encodeInt:_style forKey:CPScrollerStyleKey];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
Before Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 436 B |
|
Before Width: | Height: | Size: 452 B |
|
Before Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
@@ -641,13 +641,9 @@ var themedButtonValues = nil,
|
||||
],
|
||||
PatternIsVertical),
|
||||
|
||||
disabledTrackColor = PatternColor(
|
||||
[
|
||||
["scroller-vertical-track-top.png", 7.0, 3.0],
|
||||
["scroller-vertical-track-center.png", 7.0, 1.0],
|
||||
["scroller-vertical-track-bottom.png", 7.0, 3.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(
|
||||
[
|
||||
@@ -657,35 +653,45 @@ var themedButtonValues = nil,
|
||||
],
|
||||
PatternIsVertical),
|
||||
|
||||
disabledKnobColor = PatternColor(
|
||||
knobColorLegacy = PatternColor(
|
||||
[
|
||||
["scroller-vertical-knob-disabled-top.png", 7.0, 3.0],
|
||||
["scroller-vertical-knob-disabled-center.png", 7.0, 1.0],
|
||||
["scroller-vertical-knob-disabled-bottom.png", 7.0, 3.0]
|
||||
["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);
|
||||
PatternIsVertical),
|
||||
|
||||
|
||||
themedVerticalScrollerValues =
|
||||
[
|
||||
// Common
|
||||
[@"minimum-knob-length", 21.0, CPThemeStateVertical],
|
||||
|
||||
// Overlay
|
||||
[@"scroller-width", 7.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-offset", 9.0, CPThemeStateVertical],
|
||||
[@"track-border-overlay", 9.0, CPThemeStateVertical],
|
||||
[@"knob-slot-color", [CPNull null], CPThemeStateVertical],
|
||||
[@"knob-slot-color", trackColor, CPThemeStateVertical | CPThemeStateSelected],
|
||||
[@"knob-color", knobColor, CPThemeStateVertical],
|
||||
[@"increment-line-color", [CPNull null], CPThemeStateVertical],
|
||||
[@"decrement-line-color", [CPNull null], CPThemeStateVertical],
|
||||
[@"decrement-line-size", CPSizeMakeZero(), CPThemeStateVertical],
|
||||
[@"increment-line-size", CPSizeMakeZero(), CPThemeStateVertical],
|
||||
|
||||
[@"knob-color", knobColor, CPThemeStateVertical],
|
||||
[@"knob-color", disabledKnobColor, CPThemeStateVertical | CPThemeStateDisabled],
|
||||
|
||||
[@"knob-slot-color", [CPNull null], CPThemeStateVertical],
|
||||
[@"knob-slot-color", [CPNull null], CPThemeStateVertical | CPThemeStateDisabled],
|
||||
|
||||
[@"knob-slot-color", trackColor, CPThemeStateVertical | CPThemeStateSelected],
|
||||
[@"knob-slot-color", disabledTrackColor, CPThemeStateVertical | CPThemeStateDisabled | CPThemeStateSelected],
|
||||
|
||||
[@"decrement-line-size", CPSizeMakeZero(), CPThemeStateVertical],
|
||||
[@"decrement-line-color", [CPNull null], CPThemeStateVertical],
|
||||
|
||||
[@"increment-line-size", CPSizeMakeZero(), CPThemeStateVertical],
|
||||
[@"increment-line-color", [CPNull null], CPThemeStateVertical]
|
||||
// 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-color", knobColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy],
|
||||
[@"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];
|
||||
@@ -713,14 +719,9 @@ var themedButtonValues = nil,
|
||||
["scroller-horizontal-track-right.png", 3.0, 7.0]
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
disabledTrackColor = PatternColor(
|
||||
[
|
||||
["scroller-horizontal-track-left.png", 3.0, 7.0],
|
||||
["scroller-horizontal-track-center.png", 1.0, 7.0],
|
||||
["scroller-horizontal-track-right.png", 3.0, 7.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(
|
||||
[
|
||||
@@ -730,32 +731,40 @@ var themedButtonValues = nil,
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
disabledKnobColor = PatternColor(
|
||||
knobColorLegacy = PatternColor(
|
||||
[
|
||||
["scroller-horizontal-knob-disabled-left.png", 3.0, 7.0],
|
||||
["scroller-horizontal-knob-disabled-center.png", 1.0, 7.0],
|
||||
["scroller-horizontal-knob-disabled-right.png", 3.0, 7.0]
|
||||
["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, 2.0)],
|
||||
[@"track-inset", CGInsetMake(0.0, 11.0, 0.0, 2.0)],
|
||||
[@"track-border-offset", 9.0],
|
||||
|
||||
[@"knob-color", knobColor],
|
||||
[@"knob-color", disabledKnobColor, CPThemeStateDisabled],
|
||||
|
||||
[@"track-border-overlay", 9.0],
|
||||
[@"knob-slot-color", [CPNull null]],
|
||||
[@"knob-slot-color", [CPNull null], CPThemeStateDisabled],
|
||||
|
||||
[@"knob-slot-color", trackColor, CPThemeStateSelected],
|
||||
[@"knob-slot-color", disabledTrackColor, CPThemeStateDisabled | CPThemeStateSelected],
|
||||
|
||||
[@"knob-slot-color", trackColor, CPThemeStateSelected],
|
||||
[@"knob-color", knobColor],
|
||||
[@"decrement-line-size", CPSizeMakeZero()],
|
||||
[@"increment-line-size", CPSizeMakeZero()]
|
||||
[@"increment-line-size", CPSizeMakeZero()],
|
||||
|
||||
// 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-color", knobColorLegacy, CPThemeStateScrollViewLegacy],
|
||||
[@"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];
|
||||
|
||||