ftp.nice.ch/pub/next/developer/apps/ClassEditor.0.4.NIHS.bsd.tar.gz#/ClassEditor.0.4.NIHS.bsd/Source/CEBrowserCell.m

This is CEBrowserCell.m in view mode; [Download] [Up]

/* CEBrowserCell.m				 
 *
 * This object controls the data of a beaker (molecules, cameras, groups etc.)
 * It is the main document of BeakerBoy and controls everything from loading to
 * setting up the browser which does most of the other work.
 *
 * For interface-info see the header file. The comments in this file mostly
 * cover only the real implementation details.
 *
 * Written by: 		Thomas Engel
 * Created:    		23.10.1993 (Copyleft)
 * Last modified: 	12.11.1994
 */

#define CURRENT_VERSION 1

#import <CEBrowserCell.h>

@implementation CEBrowserCell

+ initialize
{
	if ( self == [CEBrowserCell class] )
		[CEBrowserCell setVersion:CURRENT_VERSION];

	return self;
}

- free
{
	// Don't free the objects...we might need them.
	
	[dragSources free];
	return self;
}

- mouseDown:(NXEvent *)theEvent forView:aView
{
	id	dragSource;
	id  dragPB;
	NXPoint	zero = { 0.0, 0.0 };
	NXPoint	theSpot;
	
	// Only continue if there is someone who will handle the drags !
	
	if( [dragSources count] < 1 ) return self;
	
	dragPB = [Pasteboard newName:NXDragPboard];

	theSpot.x = (theEvent->location).x - 24;
	theSpot.y = (theEvent->location).y - 24;
	[aView convertPoint:&theSpot fromView:nil];

	// restrict the dragging on the first tab.
	// BUG: this should be really automatic !!
	
	if( theSpot.x > 18 - 24 ) return self;
	
	dragSource = [dragSources objectAt:0];
	[dragSource prepareDraggingPboard:dragPB];
	
	// The source should normally be the object itself.
	// Butcurrently this is only for finding out about
	// what the drag should be able to do..perhaps this fits better
	// into the cells (= self) responsiblilty.
	
	[aView dragImage:[dragSource dragImage] 
				at:&theSpot 
				offset:&zero 
				event:theEvent	
				pasteboard:dragPB 
				source:self 
				slideBack:NO];		
	
	return nil;	
}

- setSource:theObject
{
	source = theObject;
	return self;
}

- source
{
	return source;
}

- (NXDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
{
	if( isLocal )
		return NX_DragOperationCopy;
	return NX_DragOperationAll;
}

- setDraggingSource:anObject at:(unsigned)index
{
	// This is not implemented properly !!
	
	if( !dragSources )
		dragSources = [List new];
	
	[dragSources addObject:anObject];
	return self;
}

@end

/*
 * History: 13.01.95 Buh
 *			
 *
 * Bugs: - ...
 */

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.