Mercurial > projects > dstep
diff dstep/appkit/NSDragging.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSDragging.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,148 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSDragging; + +import dstep.appkit.NSImage; +import dstep.appkit.NSPasteboard; +import dstep.appkit.NSWindow; +import dstep.foundation.NSArray; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +typedef NSUInteger NSDragOperation; + +enum : NSUInteger +{ + NSDragOperationNone = 0, + NSDragOperationCopy = 1, + NSDragOperationLink = 2, + NSDragOperationGeneric = 4, + NSDragOperationPrivate = 8, + NSDragOperationAll_Obsolete = 15, + NSDragOperationMove = 16, + NSDragOperationDelete = 32, + NSDragOperationEvery = (2147483647L * 2UL + 1UL) +} + +interface INSDraggingInfo +{ + NSWindow draggingDestinationWindow (); + uint draggingSourceOperationMask (); + NSPoint draggingLocation (); + NSPoint draggedImageLocation (); + NSImage draggedImage (); + NSPasteboard draggingPasteboard (); + Object draggingSource (); + NSInteger draggingSequenceNumber (); + void slideDraggedImageTo (NSPoint screenPoint); + NSArray namesOfPromisedFilesDroppedAtDestination (NSURL dropDestination); +} + +const TNSDraggingSource = ` + + uint draggingSourceOperationMaskForLocal (bool flag) + { + return invokeObjcSelf!(uint, "draggingSourceOperationMaskForLocal:", bool)(flag); + } + + NSArray namesOfPromisedFilesDroppedAtDestination (NSURL dropDestination) + { + return invokeObjcSelf!(NSArray, "namesOfPromisedFilesDroppedAtDestination:", NSURL)(dropDestination); + } + + void draggedImage (NSImage image, NSPoint screenPoint) + { + return invokeObjcSelf!(void, "draggedImage:beganAt:", NSImage, NSPoint)(image, screenPoint); + } + + void draggedImage (NSImage image, NSPoint screenPoint, uint operation) + { + return invokeObjcSelf!(void, "draggedImage:endedAt:operation:", NSImage, NSPoint, uint)(image, screenPoint, operation); + } + + void draggedImage (NSImage image, NSPoint screenPoint) + { + return invokeObjcSelf!(void, "draggedImage:movedTo:", NSImage, NSPoint)(image, screenPoint); + } + + bool ignoreModifierKeysWhileDragging () + { + return invokeObjcSelf!(bool, "ignoreModifierKeysWhileDragging"); + } + + void draggedImage (NSImage image, NSPoint screenPoint, bool flag) + { + return invokeObjcSelf!(void, "draggedImage:endedAt:deposited:", NSImage, NSPoint, bool)(image, screenPoint, flag); + } + + //mixin ObjcBindMethod!(draggingSourceOperationMaskForLocal, "draggingSourceOperationMaskForLocal:"); + //mixin ObjcBindMethod!(namesOfPromisedFilesDroppedAtDestination, "namesOfPromisedFilesDroppedAtDestination:"); + //mixin ObjcBindMethod!(draggedImage, "draggedImage:beganAt:"); + //mixin ObjcBindMethod!(draggedImage, "draggedImage:endedAt:operation:"); + //mixin ObjcBindMethod!(draggedImage, "draggedImage:movedTo:"); + //mixin ObjcBindMethod!(ignoreModifierKeysWhileDragging, "ignoreModifierKeysWhileDragging"); + //mixin ObjcBindMethod!(draggedImage, "draggedImage:endedAt:deposited:"); + +`; + +const TNSDraggingDestination = ` + + uint draggingEntered (INSDraggingInfo sender) + { + return invokeObjcSelf!(uint, "draggingEntered:", INSDraggingInfo)(sender); + } + + uint draggingUpdated (INSDraggingInfo sender) + { + return invokeObjcSelf!(uint, "draggingUpdated:", INSDraggingInfo)(sender); + } + + void draggingExited (INSDraggingInfo sender) + { + return invokeObjcSelf!(void, "draggingExited:", INSDraggingInfo)(sender); + } + + bool prepareForDragOperation (INSDraggingInfo sender) + { + return invokeObjcSelf!(bool, "prepareForDragOperation:", INSDraggingInfo)(sender); + } + + bool performDragOperation (INSDraggingInfo sender) + { + return invokeObjcSelf!(bool, "performDragOperation:", INSDraggingInfo)(sender); + } + + void concludeDragOperation (INSDraggingInfo sender) + { + return invokeObjcSelf!(void, "concludeDragOperation:", INSDraggingInfo)(sender); + } + + void draggingEnded (INSDraggingInfo sender) + { + return invokeObjcSelf!(void, "draggingEnded:", INSDraggingInfo)(sender); + } + + bool wantsPeriodicDraggingUpdates () + { + return invokeObjcSelf!(bool, "wantsPeriodicDraggingUpdates"); + } + + //mixin ObjcBindMethod!(draggingEntered, "draggingEntered:"); + //mixin ObjcBindMethod!(draggingUpdated, "draggingUpdated:"); + //mixin ObjcBindMethod!(draggingExited, "draggingExited:"); + //mixin ObjcBindMethod!(prepareForDragOperation, "prepareForDragOperation:"); + //mixin ObjcBindMethod!(performDragOperation, "performDragOperation:"); + //mixin ObjcBindMethod!(concludeDragOperation, "concludeDragOperation:"); + //mixin ObjcBindMethod!(draggingEnded, "draggingEnded:"); + //mixin ObjcBindMethod!(wantsPeriodicDraggingUpdates, "wantsPeriodicDraggingUpdates"); + +`; +