apps-gorm/GormCore/GormDocumentWindow.m
Matt Rice 8b6d518d07 * GormCore/GNUmakefile: Add GormDocumentWindow.[h,m].
* GormCore/GormResourceManager.m: Add code to handle
        image/sound/header files.
        * GormCore/GormDocument.[h,m]: Add -viewWithTag: method.
        * GormCore/GormClassEditor.m: Remove dragging destination code
        for resources.
        * GormCore/GormResourceEditor.m: Ditto.
        * GormCore/GormObjectEditor.m: Ditto.
        (addObject:): Change the editor to the GormObjectEditor.
        * GormCore/GormDocument.m: Register the window for dragged types.
        Implement -viewWithTag:.
        * GormCore/GormDocumentWindow.[h,m]: New subclass of NSWindow which
        handles drag and drop to GormResourceManager.
        * GormCore/GormDocument.gorm: Set the main document  window to a
        GormDocumentWindow class.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@24129 72102866-910b-0410-8b05-ffd578937521
2006-11-19 00:48:34 +00:00

76 lines
1.5 KiB
Objective-C

#include "GormDocumentWindow.h"
#include "GormPrivate.h"
#include <GormLib/IBResourceManager.h>
#include <AppKit/NSDragging.h>
#include <AppKit/NSPasteboard.h>
@implementation GormDocumentWindow
- (void) setDocument:(id)document
{
_document = document;
}
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender;
{
NSPasteboard *pb = [sender draggingPasteboard];
unsigned int mask = [sender draggingSourceOperationMask];
unsigned int oper = NSDragOperationNone;
dragMgr = [_document resourceManagerForPasteboard:pb];
if (dragMgr)
{
if (mask & NSDragOperationCopy)
{
oper = NSDragOperationCopy;
}
else if (mask & NSDragOperationLink)
{
oper = NSDragOperationLink;
}
else if (mask & NSDragOperationMove)
{
oper = NSDragOperationMove;
}
else if (mask & NSDragOperationGeneric)
{
oper = NSDragOperationGeneric;
}
else if (mask & NSDragOperationPrivate)
{
oper = NSDragOperationPrivate;
}
}
return oper;
}
- (void)draggingExited:(id <NSDraggingInfo>)sender;
{
dragMgr = nil;
}
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender;
{
return !(dragMgr == nil);
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
{
[dragMgr addResourcesFromPasteboard:[sender draggingPasteboard]];
return !(dragMgr == nil);
}
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender;
{
dragMgr = nil;
}
- (void)draggingEnded: (id <NSDraggingInfo>)sender;
{
dragMgr = nil;
}
@end