From bf3a103a9c9cd8491c2847b441ac0fa1873aca64 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Thu, 6 Dec 2007 00:57:10 +0000 Subject: [PATCH] make status bar filled only on 10.5 and greater; use NSGradient instead of CTGradient (since 10.4 support isn't needed for this) --- macosx/StatusBarView.h | 2 +- macosx/StatusBarView.m | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/macosx/StatusBarView.h b/macosx/StatusBarView.h index e18a4eb74..d7ef9fc9c 100644 --- a/macosx/StatusBarView.h +++ b/macosx/StatusBarView.h @@ -28,7 +28,7 @@ @interface StatusBarView : NSView { - CTGradient * fGradient; + NSGradient * fGradient; } @end diff --git a/macosx/StatusBarView.m b/macosx/StatusBarView.m index 0736dcf6d..38c911347 100644 --- a/macosx/StatusBarView.m +++ b/macosx/StatusBarView.m @@ -23,7 +23,7 @@ *****************************************************************************/ #import "StatusBarView.h" -#import "CTGradient.h" +#import "NSApplicationAdditions.h" @implementation StatusBarView @@ -31,9 +31,12 @@ { 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]; - 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]; + if ([NSApp isOnLeopardOrBetter]) + { + 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; } @@ -46,12 +49,12 @@ - (BOOL) isOpaque { - return YES; + return [NSApp isOnLeopardOrBetter]; } - (void) drawRect: (NSRect) rect { - [fGradient fillRect: rect angle: 90]; + [fGradient drawInRect: rect angle: 90]; } @end