#import "SFTranFadeWindow.h" @implementation SFTranFadeWindow - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag { if (self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]) { [self setLevel: NSStatusWindowLevel]; //[self setLevel: NSNormalWindowLevel]; //[self setLevel: kCGDesktopIconWindowLevel]; [self setBackgroundColor: [NSColor clearColor]]; //[self setAlphaValue:0]; [self setOpaque:NO]; [self setHasShadow:NO]; [self setMovableByWindowBackground:YES]; //[self setIgnoresMouseEvents:YES]; return self; } return nil; } - (BOOL) canBecomeKeyWindow { return YES; } - (IBAction)fadeOut:(id)sender { [self fadeOut]; } - (IBAction)fadeIn:(id)sender { [self fadeIn]; } - (void) fadeOut { // Building the animation for the fade in NSDictionary *fadeIn; fadeIn = [NSDictionary dictionaryWithObjectsAndKeys: self, NSViewAnimationTargetKey, NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey, nil]; // Creating array with all the animations NSArray *animations = [NSArray arrayWithObject:fadeIn]; // Animation view NSViewAnimation *animation; animation = [[NSViewAnimation alloc] initWithViewAnimations: animations]; // Starting animation and then releasing it [animation startAnimation]; [animation release]; } - (void) fadeIn { //[self setAlphaValue:0]; //[self orderFront:self]; // Building the animation for the fade in NSDictionary *fadeIn; fadeIn = [NSDictionary dictionaryWithObjectsAndKeys: self, NSViewAnimationTargetKey, NSViewAnimationFadeInEffect, NSViewAnimationEffectKey, nil]; // Creating array with all the animations NSArray *animations = [NSArray arrayWithObject:fadeIn]; // Animation view NSViewAnimation *animation; animation = [[NSViewAnimation alloc] initWithViewAnimations: animations]; // Starting animation and then releasing it [animation startAnimation]; [animation release]; } @end