summaryrefslogtreecommitdiff
path: root/cocoa/PSMTabBarControl/PSMTabDragView.m
diff options
context:
space:
mode:
authorSven Weidauer <sven.weidauer@gmail.com>2011-01-19 20:19:43 +0000
committerSven Weidauer <sven.weidauer@gmail.com>2011-01-19 20:19:43 +0000
commitf85335a7f9fdbff012409bb2af8fecc81740eab0 (patch)
treef4f6678aa78b89b76fab7a10094f0cdd1b22be0f /cocoa/PSMTabBarControl/PSMTabDragView.m
parent5a259dadeb6b6b31f5cfe628cc62bfb7d86e25b4 (diff)
downloadnetsurf-f85335a7f9fdbff012409bb2af8fecc81740eab0.tar.gz
netsurf-f85335a7f9fdbff012409bb2af8fecc81740eab0.tar.bz2
Implementing tabs and fixing scrolling.
svn path=/trunk/netsurf/; revision=11396
Diffstat (limited to 'cocoa/PSMTabBarControl/PSMTabDragView.m')
-rw-r--r--cocoa/PSMTabBarControl/PSMTabDragView.m68
1 files changed, 68 insertions, 0 deletions
diff --git a/cocoa/PSMTabBarControl/PSMTabDragView.m b/cocoa/PSMTabBarControl/PSMTabDragView.m
new file mode 100644
index 000000000..259116ae8
--- /dev/null
+++ b/cocoa/PSMTabBarControl/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