//
//  NSViewDragHighlight.m
//  AudioFileUtility
//
//  Created by doug on Tue Jun 10 2003.
//  Copyright (c) 2003 __MyCompanyName__. All rights reserved.
//

#import "NSViewDragHighlight.h"


@implementation NSView (DragHighlight)
- (void)drawDragHighlightOutside:(BOOL)anOutside
{
	NSView  		* theDrawView;
	
	theDrawView = ( anOutside ) ? [self superview] : self;
	
	if( theDrawView != nil )
	{
		NSRect  				theRect, winRect;
		
		theRect = ( anOutside ) ? NSInsetRect([theDrawView frame], -3, -3 ) : [theDrawView bounds];
		winRect = theRect;
		winRect = [theDrawView convertRect: theRect toView: nil];
		[[self window] cacheImageInRect:winRect];
		
		[theDrawView lockFocus];
		
		[[NSColor selectedControlColor] set];
		NSFrameRectWithWidthUsingOperation( theRect, 3, NSCompositeSourceOver );
		[[NSGraphicsContext currentContext] flushGraphics];
		
		[theDrawView unlockFocus];
	}
}
- (void)clearDragHighlightOutside
{
	[[self window] restoreCachedImage];
	[[self window] flushWindow];
}
@end
