1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

make status bar filled only on 10.5 and greater; use NSGradient instead of CTGradient (since 10.4 support isn't needed for this)

This commit is contained in:
Mitchell Livingston 2007-12-06 00:57:10 +00:00
parent 40d5a4a39a
commit bf3a103a9c
2 changed files with 10 additions and 7 deletions

View file

@ -28,7 +28,7 @@
@interface StatusBarView : NSView @interface StatusBarView : NSView
{ {
CTGradient * fGradient; NSGradient * fGradient;
} }
@end @end

View file

@ -23,7 +23,7 @@
*****************************************************************************/ *****************************************************************************/
#import "StatusBarView.h" #import "StatusBarView.h"
#import "CTGradient.h" #import "NSApplicationAdditions.h"
@implementation StatusBarView @implementation StatusBarView
@ -31,9 +31,12 @@
{ {
if ((self = [super initWithFrame: rect])) if ((self = [super initWithFrame: rect]))
{ {
NSColor * beginningColor = [NSColor colorWithCalibratedRed: 208.0/255.0 green: 208.0/255.0 blue: 208.0/255.0 alpha: 1.0]; if ([NSApp isOnLeopardOrBetter])
NSColor * endingColor = [NSColor colorWithCalibratedRed: 233.0/255.0 green: 233.0/255.0 blue: 233.0/255.0 alpha: 1.0]; {
fGradient = [[CTGradient gradientWithBeginningColor: beginningColor endingColor: endingColor] retain]; NSColor * startingColor = [NSColor colorWithCalibratedRed: 208.0/255.0 green: 208.0/255.0 blue: 208.0/255.0 alpha: 1.0];
NSColor * endingColor = [NSColor colorWithCalibratedRed: 233.0/255.0 green: 233.0/255.0 blue: 233.0/255.0 alpha: 1.0];
fGradient = [[NSGradient alloc] initWithStartingColor: startingColor endingColor: endingColor];
}
} }
return self; return self;
} }
@ -46,12 +49,12 @@
- (BOOL) isOpaque - (BOOL) isOpaque
{ {
return YES; return [NSApp isOnLeopardOrBetter];
} }
- (void) drawRect: (NSRect) rect - (void) drawRect: (NSRect) rect
{ {
[fGradient fillRect: rect angle: 90]; [fGradient drawInRect: rect angle: 90];
} }
@end @end