diff options
author | Vincent Sanders <vince@kyllikki.org> | 2016-05-05 22:28:51 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2016-05-15 13:44:34 +0100 |
commit | d21447d096a320a08b3efb2b8768fad0dcdcfd64 (patch) | |
tree | 1a83814b7c9e94b2f13c473261f23dd3a17dee64 /frontends/cocoa/PSMTabBarControl/PSMTabDragView.m | |
parent | 2cbb337756d9af5bda4d594964d446439f602551 (diff) | |
download | netsurf-d21447d096a320a08b3efb2b8768fad0dcdcfd64.tar.gz netsurf-d21447d096a320a08b3efb2b8768fad0dcdcfd64.tar.bz2 |
move frontends into sub directory
Diffstat (limited to 'frontends/cocoa/PSMTabBarControl/PSMTabDragView.m')
-rw-r--r-- | frontends/cocoa/PSMTabBarControl/PSMTabDragView.m | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabDragView.m b/frontends/cocoa/PSMTabBarControl/PSMTabDragView.m new file mode 100644 index 000000000..2c9781dbc --- /dev/null +++ b/frontends/cocoa/PSMTabBarControl/PSMTabDragView.m @@ -0,0 +1,62 @@ +// +// 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 |