aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPFavoriteTextFieldCell.m42
1 files changed, 42 insertions, 0 deletions
diff --git a/Source/SPFavoriteTextFieldCell.m b/Source/SPFavoriteTextFieldCell.m
index 00c05da1..cf9f6a05 100644
--- a/Source/SPFavoriteTextFieldCell.m
+++ b/Source/SPFavoriteTextFieldCell.m
@@ -90,12 +90,54 @@ extern BOOL isOSAtLeast10_10_0(void);
[bg fill];
}
else {
+ // Draw main background gradient
NSGradient * gradient = [[NSGradient alloc] initWithColorsAndLocations:
[labelColor highlightWithLevel:0.33], 0.0,
labelColor, 0.5,
[labelColor shadowWithLevel:0.15], 1.0, nil];
[gradient drawInBezierPath:bg angle:90.0];
[gradient release];
+
+ //replace the shadow color of the highlighted item (the default is dark blue)
+ if([self isHighlighted]) {
+ NSMutableAttributedString *mas = [[self attributedStringValue] mutableCopy];
+ NSShadow *strShadow = [mas attribute:NSShadowAttributeName atIndex:0 effectiveRange:NULL];
+ if(strShadow) {
+ [strShadow setShadowColor:[labelColor shadowWithLevel:0.4]];
+ [self setAttributedStringValue:mas];
+ }
+ [mas release];
+ }
+
+ // Add a little border at the top half (technically this is an inner shadow)
+ CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+
+ NSShadow* shadow = [[NSShadow alloc] init];
+ [shadow setShadowColor:labelColor];
+ [shadow setShadowOffset: NSMakeSize(0.1, -1.2)];
+ [shadow setShadowBlurRadius: 1];
+
+ [NSGraphicsContext saveGraphicsState];
+ NSRectClip([bg bounds]);
+ CGContextSetShadowWithColor(context, CGSizeZero, 0, NULL);
+
+ CGContextSetAlpha(context, [[shadow shadowColor] alphaComponent]);
+ CGContextBeginTransparencyLayer(context, NULL);
+ {
+ [shadow set];
+
+ CGContextSetBlendMode(context, kCGBlendModeSourceOut);
+ CGContextBeginTransparencyLayer(context, NULL);
+
+ [[shadow shadowColor] setFill];
+ [bg fill];
+
+ CGContextEndTransparencyLayer(context);
+ }
+ CGContextEndTransparencyLayer(context);
+ [NSGraphicsContext restoreGraphicsState];
+
+ [shadow release];
}
}