made the scrollview line border color themeable

This commit is contained in:
Klaas Pieter Annema committed 2010-09-10 14:20:17 +02:00
1 parent bcacee2147
commit b75dcd7ac4
2 files changed
+29 -6

No files matched your search

+17 -6
View File
@@ -58,6 +58,18 @@
CPBorderType _borderType;
}
+ (CPString)themeClass
{
return @"scrollview"
}
+ (CPDictionary)themeAttributes
{
return [CPDictionary dictionaryWithJSObject:{
@"line-border-color": [CPColor blackColor],
}]
}
- (id)initWithFrame:(CGRect)aFrame
{
self = [super initWithFrame:aFrame];
@@ -770,7 +782,7 @@
switch (_borderType)
{
case CPLineBorder:
CGContextSetStrokeColor(context, [CPColor blackColor]);
CGContextSetStrokeColor(context, [self currentValueForThemeAttribute:@"line-border-color"]);
CGContextStrokeRect(context, _CGRectInset(strokeRect, 0.5, 0.5));
break;
@@ -786,20 +798,19 @@
break;
}
if (![[self verticalScroller] isHidden] && ![[self horizontalScroller] isHidden])
{
var verticalScrollerFrame = [[self verticalScroller] frame],
bottomCornerRect = CGRectMakeCopy(verticalScrollerFrame);
bottomCornerRect = CGRectMakeCopy(verticalScrollerFrame),
borderColor = [self currentValueForThemeAttribute:@"line-border-color"];
bottomCornerRect.origin.y = CGRectGetMaxY(verticalScrollerFrame);
bottomCornerRect.size.height = [CPScroller scrollerWidth];
CGContextSetFillColor(context, [CPColor colorWithRed:242.0 / 255.0 green:242.0 / 255.0 blue:243.0 / 255.0 alpha:1.0]);
CGContextSetFillColor(context, borderColor);
CGContextFillRect(context, bottomCornerRect);
CGContextSetStrokeColor(context, [CPColor colorWithRed:184.0 / 255.0 green:184.0 / 255.0 blue:184.0 / 255.0 alpha:1.0]);
CGContextSetStrokeColor(context, borderColor);
CGContextMoveToPoint(context, CGRectGetMinX(bottomCornerRect), CGRectGetMinY(bottomCornerRect));
CGContextAddLineToPoint(context, CGRectGetMaxX(bottomCornerRect), CGRectGetMinY(bottomCornerRect));
CGContextStrokePath(context);
+12
View File
@@ -528,6 +528,18 @@ var themedButtonValues = nil,
return button;
}
+ (CPScrollView)themedScrollView
{
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0.0, 0.0, 200.0, 200.0)];
[scrollView setValue:[CPColor colorWithWhite:0.0 alpha:0.2] forThemeAttribute:@"line-border-color"];
[scrollView setAutohidesScrollers:YES];
[scrollView setBorderType:CPLineBorder];
return scrollView;
}
+ (CPScroller)makeVerticalScroller
{
var scroller = [[CPScroller alloc] initWithFrame:CGRectMake(0.0, 0.0, 15.0, 170.0)];