Merge pull request #1373 from primalmotion/cappuccino

---

This patch makes CPScrollView acts like Lions NSScrollView.

A online demo can be found here: http://nightlies.archipelproject.org/CPScrollView2/
This commit is contained in:
Alexander Ljungberg
2011-10-24 20:45:58 +01:00
75 changed files with 5820 additions and 752 deletions
+777 -592
View File
File diff suppressed because it is too large Load Diff
+261 -65
View File
@@ -5,6 +5,9 @@
* Created by Francisco Tolmasky.
* Copyright 2008, 280 North, Inc.
*
* Modified to match Lion style by Antoine Mercadal 2011
* <antoine.mercadal@archipelproject.org>
*
* 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
Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 B

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 B

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 433 B

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

+198 -95
View File
@@ -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
{
@@ -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
@@ -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
@@ -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 = "<group>"; };
/* 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 = "<group>";
};
9EEC4494135749D200615446 /* Products */ = {
isa = PBXGroup;
children = (
9EEC4493135749D200615446 /* Another.app */,
9EEC44B4135749D300615446 /* AnotherTests.octest */,
);
name = Products;
sourceTree = "<group>";
};
9EEC4496135749D200615446 /* Frameworks */ = {
isa = PBXGroup;
children = (
9EEC4497135749D200615446 /* Cocoa.framework */,
9EEC4499135749D300615446 /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
9EEC4499135749D300615446 /* Other Frameworks */ = {
isa = PBXGroup;
children = (
9EEC449A135749D300615446 /* AppKit.framework */,
9EEC449B135749D300615446 /* CoreData.framework */,
9EEC449C135749D300615446 /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
/* 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 */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:scrollview.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,85 @@
/*
* AppController.j
* scrollview
*
* Created by You on October 3, 2011.
* Copyright 2011, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@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
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Main cib file base name</key>
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>scrollview</string>
</dict>
</plist>
+94
View File
@@ -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("----------------------------");
}
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

+103
View File
@@ -0,0 +1,103 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index-debug.html
scrollview
Created by You on October 3, 2011.
Copyright 2011, Your Company All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>scrollview</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
</script>
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
<script type="text/javascript">
objj_msgSend_reset();
// DEBUG OPTIONS:
// Uncomment to enable printing of backtraces on exceptions:
//objj_msgSend_decorate(objj_backtrace_decorator);
// Uncomment to supress exceptions that take place inside a message
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
// Uncomment to enable runtime type checking:
//objj_msgSend_decorate(objj_typecheck_decorator);
// Uncomment (along with both above) to print backtraces on type check errors:
//objj_typecheck_prints_backtrace = true;
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
//CPLogUnregister(CPLogDefault);
// Uncomment to enable a specific logger:
//CPLogRegister(CPLogConsole);
//CPLogRegister(CPLogPopup);
</script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading scrollview...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
+77
View File
@@ -0,0 +1,77 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index.html
scrollview
Created by You on October 3, 2011.
Copyright 2011, Your Company All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>scrollview</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
</script>
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading scrollview...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
+18
View File
@@ -0,0 +1,18 @@
/*
* AppController.j
* scrollview
*
* Created by You on October 3, 2011.
* Copyright 2011, Your Company All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}
+5
View File
@@ -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));