2007-09-16 01:02:06 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* $Id$
|
|
|
|
*
|
2010-01-01 21:12:04 +00:00
|
|
|
* Copyright (c) 2007-2010 Transmission authors and contributors
|
2007-09-16 01:02:06 +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.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2008-10-31 00:13:50 +00:00
|
|
|
#import "ProgressGradients.h"
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-10-31 00:13:50 +00:00
|
|
|
@implementation ProgressGradients
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
+ (NSGradient *) progressGradientForRed: (CGFloat) redComponent green: (CGFloat) greenComponent blue: (CGFloat) blueComponent
|
2007-09-16 01:02:06 +00:00
|
|
|
{
|
2008-12-26 05:57:51 +00:00
|
|
|
NSColor * baseColor = [NSColor colorWithCalibratedRed: redComponent green: greenComponent blue: blueComponent alpha: 1.0];
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
NSColor * color2 = [NSColor colorWithCalibratedRed: redComponent * 0.95 green: greenComponent * 0.95 blue: blueComponent * 0.95
|
|
|
|
alpha: 1.0];
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
NSColor * color3 = [NSColor colorWithCalibratedRed: redComponent * 0.85 green: greenComponent * 0.85 blue: blueComponent * 0.85
|
|
|
|
alpha: 1.0];
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
NSGradient * progressGradient = [[NSGradient alloc] initWithColorsAndLocations: baseColor, 0.0, color2, 0.5, color3, 0.5,
|
|
|
|
baseColor, 1.0, nil];
|
|
|
|
return [progressGradient autorelease];
|
2007-09-16 01:02:06 +00:00
|
|
|
}
|
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
NSGradient * fProgressWhiteGradient = nil;
|
|
|
|
+ (NSGradient *) progressWhiteGradient
|
2008-06-24 03:59:34 +00:00
|
|
|
{
|
2008-06-25 05:01:04 +00:00
|
|
|
if (!fProgressWhiteGradient)
|
2009-11-25 04:11:52 +00:00
|
|
|
fProgressWhiteGradient = [[[self class] progressGradientForRed: 0.95 green: 0.95 blue: 0.95] retain];
|
2008-06-25 05:01:04 +00:00
|
|
|
return fProgressWhiteGradient;
|
2008-06-24 03:59:34 +00:00
|
|
|
}
|
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
NSGradient * fProgressGrayGradient = nil;
|
|
|
|
+ (NSGradient *) progressGrayGradient
|
2007-09-16 01:02:06 +00:00
|
|
|
{
|
2008-06-25 05:01:04 +00:00
|
|
|
if (!fProgressGrayGradient)
|
2009-11-25 04:11:52 +00:00
|
|
|
fProgressGrayGradient = [[[self class] progressGradientForRed: 0.7 green: 0.7 blue: 0.7] retain];
|
2008-06-25 05:01:04 +00:00
|
|
|
return fProgressGrayGradient;
|
2007-09-16 01:02:06 +00:00
|
|
|
}
|
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
NSGradient * fProgressLightGrayGradient = nil;
|
|
|
|
+ (NSGradient *) progressLightGrayGradient
|
2007-09-16 01:02:06 +00:00
|
|
|
{
|
2008-06-25 05:01:04 +00:00
|
|
|
if (!fProgressLightGrayGradient)
|
2009-11-25 04:11:52 +00:00
|
|
|
fProgressLightGrayGradient = [[[self class] progressGradientForRed: 0.87 green: 0.87 blue: 0.87] retain];
|
2008-06-25 05:01:04 +00:00
|
|
|
return fProgressLightGrayGradient;
|
2007-09-16 01:02:06 +00:00
|
|
|
}
|
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
NSGradient * fProgressBlueGradient = nil;
|
|
|
|
+ (NSGradient *) progressBlueGradient
|
2007-09-16 01:02:06 +00:00
|
|
|
{
|
2008-06-25 05:01:04 +00:00
|
|
|
if (!fProgressBlueGradient)
|
2009-11-25 04:11:52 +00:00
|
|
|
fProgressBlueGradient = [[[self class] progressGradientForRed: 0.35 green: 0.67 blue: 0.98] retain];
|
2008-06-25 05:01:04 +00:00
|
|
|
return fProgressBlueGradient;
|
2007-09-16 01:02:06 +00:00
|
|
|
}
|
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
NSGradient * fProgressDarkBlueGradient = nil;
|
|
|
|
+ (NSGradient *) progressDarkBlueGradient
|
2007-09-16 01:02:06 +00:00
|
|
|
{
|
2008-06-25 05:01:04 +00:00
|
|
|
if (!fProgressDarkBlueGradient)
|
2009-11-25 04:11:52 +00:00
|
|
|
fProgressDarkBlueGradient = [[[self class] progressGradientForRed: 0.616 green: 0.722 blue: 0.776] retain];
|
2008-06-25 05:01:04 +00:00
|
|
|
return fProgressDarkBlueGradient;
|
2007-09-16 01:02:06 +00:00
|
|
|
}
|
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
NSGradient * fProgressGreenGradient = nil;
|
|
|
|
+ (NSGradient *) progressGreenGradient
|
2007-09-16 01:02:06 +00:00
|
|
|
{
|
2008-06-25 05:01:04 +00:00
|
|
|
if (!fProgressGreenGradient)
|
2009-11-25 04:11:52 +00:00
|
|
|
fProgressGreenGradient = [[[self class] progressGradientForRed: 0.44 green: 0.89 blue: 0.40] retain];
|
2008-06-25 05:01:04 +00:00
|
|
|
return fProgressGreenGradient;
|
2007-09-16 01:02:06 +00:00
|
|
|
}
|
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
NSGradient * fProgressLightGreenGradient = nil;
|
|
|
|
+ (NSGradient *) progressLightGreenGradient
|
2007-09-16 01:02:06 +00:00
|
|
|
{
|
2008-06-25 05:01:04 +00:00
|
|
|
if (!fProgressLightGreenGradient)
|
2009-11-25 04:11:52 +00:00
|
|
|
fProgressLightGreenGradient = [[[self class] progressGradientForRed: 0.62 green: 0.99 blue: 0.58] retain];
|
2008-06-25 05:01:04 +00:00
|
|
|
return fProgressLightGreenGradient;
|
2007-09-16 01:02:06 +00:00
|
|
|
}
|
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
NSGradient * fProgressDarkGreenGradient = nil;
|
|
|
|
+ (NSGradient *) progressDarkGreenGradient
|
2007-09-16 01:02:06 +00:00
|
|
|
{
|
2008-06-25 05:01:04 +00:00
|
|
|
if (!fProgressDarkGreenGradient)
|
2009-11-25 04:11:52 +00:00
|
|
|
fProgressDarkGreenGradient = [[[self class] progressGradientForRed: 0.627 green: 0.714 blue: 0.639] retain];
|
2008-06-25 05:01:04 +00:00
|
|
|
return fProgressDarkGreenGradient;
|
2007-09-16 01:02:06 +00:00
|
|
|
}
|
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
NSGradient * fProgressRedGradient = nil;
|
|
|
|
+ (NSGradient *) progressRedGradient
|
2007-11-11 21:45:27 +00:00
|
|
|
{
|
2008-06-25 05:01:04 +00:00
|
|
|
if (!fProgressRedGradient)
|
2009-11-25 04:11:52 +00:00
|
|
|
fProgressRedGradient = [[[self class] progressGradientForRed: 0.902 green: 0.439 blue: 0.451] retain];
|
2008-06-25 05:01:04 +00:00
|
|
|
return fProgressRedGradient;
|
2007-11-11 21:45:27 +00:00
|
|
|
}
|
|
|
|
|
2008-12-26 05:57:51 +00:00
|
|
|
NSGradient * fProgressYellowGradient = nil;
|
|
|
|
+ (NSGradient *) progressYellowGradient
|
2007-09-16 01:02:06 +00:00
|
|
|
{
|
2008-06-25 05:01:04 +00:00
|
|
|
if (!fProgressYellowGradient)
|
2009-11-25 04:11:52 +00:00
|
|
|
fProgressYellowGradient = [[[self class] progressGradientForRed: 0.933 green: 0.890 blue: 0.243] retain];
|
2008-06-25 05:01:04 +00:00
|
|
|
return fProgressYellowGradient;
|
2007-09-16 01:02:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|