/******************************************************************************
FILE:				DragBackgroundView.m
LANGUAGE:			Objective-C
SYSTEM:				UNIX 
USER-INTERFACE:		NEXTSTEP
DESCRIPTION
	This view is used as a background view for NX_PLAINSTYLE windows. 
	It allows dragging the window when clicking on it but not on an enabled
	subview.
AUTHORS
	<PJB> Pascal J. Bourguignon
MODIFICATIONS
	1998/08/12 <PJB> Creation.
BUGS
LEGAL
	Copyright Pascal J. Bourguignon 1998 - 1998
	The GNU GENERAL PUBLIC LICENSE applies to this software.
	See the file named "COPYING".
******************************************************************************/


#import "DragBackgroundView.h"


@implementation DragBackgroundView


	- initFrame:(const NXRect*)nFrame
	{
		self=[super initFrame:nFrame];
		if(self!=0){
			cell=0;
		}
		return(self);
	}//initFrame;
	

	- setCell:aCell
	{
		cell=aCell;
		//[self update];
		return(self);
	}//setCell:;
	
	
	-(id)cell
	{
		return(cell);
	}//cell;
	
	
	- drawSelf:(const NXRect*)rects :(int)rectCount
	{
		if(cell!=0){
			[cell drawSelf:&bounds inView:self];
		}
		NXDrawButton(&bounds,&bounds);
		return([super drawSelf:&bounds:1]);
	}//drawSelf::;


	- mouseDown:(NXEvent*)theEvent
	{
		View* hitSubview=[self hitTest:&(theEvent->location)];
		if(((View*)self==hitSubview)
		||(![hitSubview respondsTo:@selector(isEnabled)])
		||(![(id)hitSubview isEnabled])){
			[window dragFrom:theEvent->location.x :theEvent->location.y
					eventNum:theEvent->data.mouse.eventNum];
			return(self);
		}else{
			return([super mouseDown:theEvent]);
		}
	}//mouseDown:;
	


@end // DragBackgroundView.


/*** DragBackgroundView.m / Wed Aug 12 03:58:14 MET 1998 / PJB ***/
