aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/BWToolkitFramework.framework/BWGradientBox.m
diff options
context:
space:
mode:
authoravenjamin <avenjamin@gmail.com>2009-12-20 01:19:52 +0000
committeravenjamin <avenjamin@gmail.com>2009-12-20 01:19:52 +0000
commitea1b48967ce34718d2645c4a30fab6b67e66f9fa (patch)
treea51ebe2f74a0c8e6c89f085df4240336c98aedf7 /Frameworks/BWToolkitFramework.framework/BWGradientBox.m
parentc25a2f4561a4cde2d2d9a431cd941704d79bb428 (diff)
downloadsequelpro-ea1b48967ce34718d2645c4a30fab6b67e66f9fa.tar.gz
sequelpro-ea1b48967ce34718d2645c4a30fab6b67e66f9fa.tar.bz2
sequelpro-ea1b48967ce34718d2645c4a30fab6b67e66f9fa.zip
- Updating Growl to 1.2
- Updating BWToolkit to 1.2.2 - Changed BWToolkit from building it ourselves to just include the latest release of the framework - Changed build settings to build 32 and 64 universal binaries - Changed compiler to Clang
Diffstat (limited to 'Frameworks/BWToolkitFramework.framework/BWGradientBox.m')
-rw-r--r--Frameworks/BWToolkitFramework.framework/BWGradientBox.m179
1 files changed, 0 insertions, 179 deletions
diff --git a/Frameworks/BWToolkitFramework.framework/BWGradientBox.m b/Frameworks/BWToolkitFramework.framework/BWGradientBox.m
deleted file mode 100644
index 14aa19eb..00000000
--- a/Frameworks/BWToolkitFramework.framework/BWGradientBox.m
+++ /dev/null
@@ -1,179 +0,0 @@
-//
-// BWGradientBox.m
-// BWToolkit
-//
-// Created by Brandon Walkin (www.brandonwalkin.com)
-// All code is provided under the New BSD license.
-//
-
-#import "BWGradientBox.h"
-#import "NSColor+BWAdditions.h"
-
-@implementation BWGradientBox
-
-@synthesize fillStartingColor, fillEndingColor, fillColor, topBorderColor, bottomBorderColor;
-@synthesize topInsetAlpha, bottomInsetAlpha;
-@synthesize hasTopBorder, hasBottomBorder, hasGradient;
-
-- (id)initWithCoder:(NSCoder *)decoder
-{
- if ((self = [super initWithCoder:decoder]) != nil)
- {
- [self setFillStartingColor:[decoder decodeObjectForKey:@"BWGBFillStartingColor"]];
- [self setFillEndingColor:[decoder decodeObjectForKey:@"BWGBFillEndingColor"]];
- [self setFillColor:[decoder decodeObjectForKey:@"BWGBFillColor"]];
- [self setTopBorderColor:[decoder decodeObjectForKey:@"BWGBTopBorderColor"]];
- [self setBottomBorderColor:[decoder decodeObjectForKey:@"BWGBBottomBorderColor"]];
-
- [self setHasTopBorder:[decoder decodeBoolForKey:@"BWGBHasTopBorder"]];
- [self setHasBottomBorder:[decoder decodeBoolForKey:@"BWGBHasBottomBorder"]];
- [self setHasGradient:[decoder decodeBoolForKey:@"BWGBHasGradient"]];
-
- [self setTopInsetAlpha:[decoder decodeFloatForKey:@"BWGBTopInsetAlpha"]];
- [self setBottomInsetAlpha:[decoder decodeFloatForKey:@"BWGBBottomInsetAlpha"]];
-
- if (self.fillStartingColor == nil)
- self.fillStartingColor = [NSColor whiteColor];
-
- if (self.fillEndingColor == nil)
- self.fillEndingColor = [NSColor grayColor];
-
- if (self.fillColor == nil)
- self.fillColor = [NSColor grayColor];
-
- if (self.topBorderColor == nil)
- self.topBorderColor = [NSColor blackColor];
-
- if (self.bottomBorderColor == nil)
- self.bottomBorderColor = [NSColor blackColor];
- }
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder
-{
- [super encodeWithCoder:coder];
-
- [coder encodeObject:[self fillStartingColor] forKey:@"BWGBFillStartingColor"];
- [coder encodeObject:[self fillEndingColor] forKey:@"BWGBFillEndingColor"];
- [coder encodeObject:[self fillColor] forKey:@"BWGBFillColor"];
- [coder encodeObject:[self topBorderColor] forKey:@"BWGBTopBorderColor"];
- [coder encodeObject:[self bottomBorderColor] forKey:@"BWGBBottomBorderColor"];
-
- [coder encodeBool:[self hasTopBorder] forKey:@"BWGBHasTopBorder"];
- [coder encodeBool:[self hasBottomBorder] forKey:@"BWGBHasBottomBorder"];
- [coder encodeBool:[self hasGradient] forKey:@"BWGBHasGradient"];
-
- [coder encodeFloat:[self topInsetAlpha] forKey:@"BWGBTopInsetAlpha"];
- [coder encodeFloat:[self bottomInsetAlpha] forKey:@"BWGBBottomInsetAlpha"];
-}
-
-- (void)drawRect:(NSRect)rect
-{
- if (hasGradient)
- {
- NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:fillStartingColor endingColor:fillEndingColor];
- [gradient drawInRect:self.bounds angle:90];
- [gradient release];
- }
- else
- {
- [fillColor set];
- NSRectFillUsingOperation(self.bounds, NSCompositeSourceOver);
- }
-
- if (hasTopBorder)
- {
- [topBorderColor drawPixelThickLineAtPosition:0 withInset:0 inRect:self.bounds inView:self horizontal:YES flip:NO];
- [[[NSColor whiteColor] colorWithAlphaComponent:topInsetAlpha] drawPixelThickLineAtPosition:1 withInset:0 inRect:self.bounds inView:self horizontal:YES flip:NO];
- }
- else
- {
- [[[NSColor whiteColor] colorWithAlphaComponent:topInsetAlpha] drawPixelThickLineAtPosition:0 withInset:0 inRect:self.bounds inView:self horizontal:YES flip:NO];
- }
-
-
- if (hasBottomBorder)
- {
- [bottomBorderColor drawPixelThickLineAtPosition:0 withInset:0 inRect:self.bounds inView:self horizontal:YES flip:YES];
- [[[NSColor whiteColor] colorWithAlphaComponent:bottomInsetAlpha] drawPixelThickLineAtPosition:1 withInset:0 inRect:self.bounds inView:self horizontal:YES flip:YES];
- }
- else
- {
- [[[NSColor whiteColor] colorWithAlphaComponent:bottomInsetAlpha] drawPixelThickLineAtPosition:0 withInset:0 inRect:self.bounds inView:self horizontal:YES flip:YES];
- }
-
-}
-
-- (BOOL)isFlipped
-{
- return YES;
-}
-
-- (void)setFillColor:(NSColor *)color
-{
- if (fillColor != color)
- {
- [fillColor release];
- fillColor = [color retain];
-
- [self setNeedsDisplay:YES];
- }
-}
-
-- (void)setFillStartingColor:(NSColor *)color
-{
- if (fillStartingColor != color)
- {
- [fillStartingColor release];
- fillStartingColor = [color retain];
-
- [self setNeedsDisplay:YES];
- }
-}
-
-- (void)setFillEndingColor:(NSColor *)color
-{
- if (fillEndingColor != color)
- {
- [fillEndingColor release];
- fillEndingColor = [color retain];
-
- [self setNeedsDisplay:YES];
- }
-}
-
-- (void)setTopBorderColor:(NSColor *)color
-{
- if (topBorderColor != color)
- {
- [topBorderColor release];
- topBorderColor = [color retain];
-
- [self setNeedsDisplay:YES];
- }
-}
-
-- (void)setBottomBorderColor:(NSColor *)color
-{
- if (bottomBorderColor != color)
- {
- [bottomBorderColor release];
- bottomBorderColor = [color retain];
-
- [self setNeedsDisplay:YES];
- }
-}
-
-- (void)dealloc
-{
- [fillColor release];
- [fillStartingColor release];
- [fillEndingColor release];
- [topBorderColor release];
- [bottomBorderColor release];
-
- [super dealloc];
-}
-
-@end