aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PSMTabBar/PSMTabDragView.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-06-07 23:31:59 +0000
committerrowanbeentje <rowan@beent.je>2010-06-07 23:31:59 +0000
commit664c0e238ec9feb873cfabc6e5ab5e43213323f9 (patch)
treee7dbac121287ac3d6ec170c844aa159497189188 /Frameworks/PSMTabBar/PSMTabDragView.m
parentceffd765f621e4ad1f9d4d6775c8e55d2f136bfb (diff)
downloadsequelpro-664c0e238ec9feb873cfabc6e5ab5e43213323f9.tar.gz
sequelpro-664c0e238ec9feb873cfabc6e5ab5e43213323f9.tar.bz2
sequelpro-664c0e238ec9feb873cfabc6e5ab5e43213323f9.zip
- Replace the precompiled PSMTabBar framework with a build-from-source dependency, in preparation for future code and style changes
Diffstat (limited to 'Frameworks/PSMTabBar/PSMTabDragView.m')
-rw-r--r--Frameworks/PSMTabBar/PSMTabDragView.m68
1 files changed, 68 insertions, 0 deletions
diff --git a/Frameworks/PSMTabBar/PSMTabDragView.m b/Frameworks/PSMTabBar/PSMTabDragView.m
new file mode 100644
index 00000000..259116ae
--- /dev/null
+++ b/Frameworks/PSMTabBar/PSMTabDragView.m
@@ -0,0 +1,68 @@
+//
+// PSMTabDragView.m
+// PSMTabBarControl
+//
+// Created by Kent Sutherland on 6/17/07.
+// Copyright 2007 Kent Sutherland. All rights reserved.
+//
+
+#import "PSMTabDragView.h"
+
+
+@implementation PSMTabDragView
+
+- (id)initWithFrame:(NSRect)frame {
+ if ( (self = [super initWithFrame:frame]) ) {
+ _alpha = 1.0;
+ }
+ return self;
+}
+
+- (void)dealloc
+{
+ [_image release];
+ [_alternateImage release];
+ [super dealloc];
+}
+
+- (void)drawRect:(NSRect)rect {
+ //1.0 fade means show the primary image
+ //0.0 fade means show the secondary image
+ CGFloat primaryAlpha = _alpha + 0.001f, alternateAlpha = 1.001f - _alpha;
+ NSRect srcRect;
+ srcRect.origin = NSZeroPoint;
+ srcRect.size = [_image size];
+
+ [_image drawInRect:[self bounds] fromRect:srcRect operation:NSCompositeSourceOver fraction:primaryAlpha];
+ srcRect.size = [_alternateImage size];
+ [_alternateImage drawInRect:[self bounds] fromRect:srcRect operation:NSCompositeSourceOver fraction:alternateAlpha];
+}
+
+- (void)setFadeValue:(CGFloat)value
+{
+ _alpha = value;
+}
+
+- (NSImage *)image
+{
+ return _image;
+}
+
+- (void)setImage:(NSImage *)image
+{
+ [_image release];
+ _image = [image retain];
+}
+
+- (NSImage *)alternateImage
+{
+ return _alternateImage;
+}
+
+- (void)setAlternateImage:(NSImage *)image
+{
+ [_alternateImage release];
+ _alternateImage = [image retain];
+}
+
+@end