//**********************************************************************************************************************
//
//  NSView_OverlayWindow.h
//
//  Author:		Peter Baumgartner, peter@baumgartner.com
//  Copyright:	©2008 by IMAGINE GbR. All rights reserved.
//	Abstract:	This category on NSView can create views overlays by dynamically creating child windows
//
//**********************************************************************************************************************


	#pragma mark CLASSES
	
	@class NSView;
	@class BXOverlayHelperView;
	@class BXOverlayChildWindow;
	
	
//----------------------------------------------------------------------------------------------------------------------

	#pragma mark

	@interface NSView (BXOverlay)

	- (void) addOverlayWithView:(NSView <NSWindowDelegate> *)inOverlayView
						  frame:(NSRect)inFrame
				   resizingMask:(NSUInteger)inRezisingMask
						ordered:(NSWindowOrderingMode)inOrdered;

	- (void) removeOverlayWithView:(NSView*)inOverlayView;
	
	@end


	@interface NSView (BXOverlayDelegate)
	
	- (void) viewWillBecomeOverlay;
	- (void) viewDidBecomeOverlay;
	- (void) viewWillResignOverlay;
	- (void) viewDidResignOverlay;
	
	@end


//----------------------------------------------------------------------------------------------------------------------


	#pragma mark

	
	@interface BXOverlayChildWindow : NSWindow
	{
		NSWindow* _parentWindow;
		NSView* _parentView;
		BXOverlayHelperView* _helperView;
		NSWindowOrderingMode _order;
	}

	- (id) initWithContentRect:(NSRect)inContentRect 
		   styleMask:(NSUInteger)inStyle
		   backing:(NSBackingStoreType)inBufferingType 
		   defer:(BOOL)inFlag
		   parentView:(NSView*)inParentView 
		   helperView:(BXOverlayHelperView*)inHelperView 
		   ordered:(NSWindowOrderingMode)inOrdered;
		
	- (void) parentViewWillMoveToWindow:(NSWindow*)inWindow;
	- (void) parentViewDidMoveToWindow;
	- (void) resizeWithOldSuperviewSize:(NSSize)inBoundsSize;

	- (BXOverlayHelperView*) helperView;

	@end


//----------------------------------------------------------------------------------------------------------------------


	#pragma mark

	@interface BXOverlayHelperView : NSView
	{
		BXOverlayChildWindow* _childWindow;
	}
	
	- (void) setChildWindow:(BXOverlayChildWindow*)inWindow;
	
	@end


//----------------------------------------------------------------------------------------------------------------------
