color the background of the status bar on tiger

This commit is contained in:
Mitchell Livingston 2007-12-12 15:17:33 +00:00
parent bc295fe78e
commit cf4f43f090
3 changed files with 20 additions and 9 deletions

View File

@ -290,6 +290,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
//set up status bar
[fStatusBar setHidden: YES];
[fStatusBar setShowOnTiger: YES];
[fTotalDLField setToolTip: NSLocalizedString(@"Total download speed", "Status Bar -> speed tooltip")];
[fTotalULField setToolTip: NSLocalizedString(@"Total upload speed", "Status Bar -> speed tooltip")];

View File

@ -28,7 +28,11 @@
@interface StatusBarView : NSView
{
NSGradient * fGradient;
BOOL fShow;
CTGradient * fGradient;
}
- (void) setShowOnTiger: (BOOL) show;
@end

View File

@ -24,6 +24,7 @@
#import "StatusBarView.h"
#import "NSApplicationAdditions.h"
#import "CTGradient.h"
@implementation StatusBarView
@ -31,12 +32,11 @@
{
if ((self = [super initWithFrame: rect]))
{
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];
}
fShow = [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;
}
@ -47,14 +47,20 @@
[super dealloc];
}
- (void) setShowOnTiger: (BOOL) show
{
fShow = [NSApp isOnLeopardOrBetter] || show;
}
- (BOOL) isOpaque
{
return [NSApp isOnLeopardOrBetter];
return fShow;
}
- (void) drawRect: (NSRect) rect
{
[fGradient drawInRect: rect angle: 90];
if (fShow)
[fGradient drawInRect: rect angle: 90];
}
@end