2007-09-23 16:21:03 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* $Id$
|
|
|
|
*
|
2008-01-02 16:55:05 +00:00
|
|
|
* Copyright (c) 2006-2008 Transmission authors and contributors
|
2007-09-23 16:21:03 +00:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#import "StatusBarView.h"
|
2007-12-06 00:57:10 +00:00
|
|
|
#import "NSApplicationAdditions.h"
|
2007-12-12 15:17:33 +00:00
|
|
|
#import "CTGradient.h"
|
2007-11-07 00:09:36 +00:00
|
|
|
|
2007-09-23 16:21:03 +00:00
|
|
|
@implementation StatusBarView
|
|
|
|
|
2007-11-07 00:35:03 +00:00
|
|
|
- (id) initWithFrame: (NSRect) rect
|
2007-09-23 16:21:03 +00:00
|
|
|
{
|
2007-11-07 05:02:43 +00:00
|
|
|
if ((self = [super initWithFrame: rect]))
|
2007-11-07 00:35:03 +00:00
|
|
|
{
|
2007-12-12 15:17:33 +00:00
|
|
|
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];
|
2007-12-12 15:28:09 +00:00
|
|
|
fGradient = [[CTGradient gradientWithBeginningColor: startingColor endingColor: endingColor] retain];
|
2007-11-07 05:02:43 +00:00
|
|
|
}
|
|
|
|
return self;
|
2007-11-07 00:35:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
{
|
|
|
|
[fGradient release];
|
|
|
|
[super dealloc];
|
2007-09-23 16:21:03 +00:00
|
|
|
}
|
|
|
|
|
2007-12-12 15:17:33 +00:00
|
|
|
- (void) setShowOnTiger: (BOOL) show
|
|
|
|
{
|
2007-12-13 04:31:38 +00:00
|
|
|
fShow = show || [NSApp isOnLeopardOrBetter];
|
2007-12-12 15:17:33 +00:00
|
|
|
}
|
|
|
|
|
2007-09-23 16:21:03 +00:00
|
|
|
- (BOOL) isOpaque
|
|
|
|
{
|
2007-12-12 15:17:33 +00:00
|
|
|
return fShow;
|
2007-09-23 16:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) drawRect: (NSRect) rect
|
|
|
|
{
|
2007-12-12 15:17:33 +00:00
|
|
|
if (fShow)
|
2007-12-12 15:18:16 +00:00
|
|
|
[fGradient fillRect: rect angle: 90];
|
2007-09-23 16:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|