comparison 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
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Sep 24, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.appkit.NSDragging;
8
9 import dstep.appkit.NSImage;
10 import dstep.appkit.NSPasteboard;
11 import dstep.appkit.NSWindow;
12 import dstep.foundation.NSArray;
13 import dstep.foundation.NSGeometry;
14 import dstep.foundation.NSObjCRuntime;
15 import dstep.foundation.NSObject;
16 import dstep.foundation.NSURL;
17 import dstep.objc.bridge.Bridge;
18 import dstep.objc.objc;
19
20 typedef NSUInteger NSDragOperation;
21
22 enum : NSUInteger
23 {
24 NSDragOperationNone = 0,
25 NSDragOperationCopy = 1,
26 NSDragOperationLink = 2,
27 NSDragOperationGeneric = 4,
28 NSDragOperationPrivate = 8,
29 NSDragOperationAll_Obsolete = 15,
30 NSDragOperationMove = 16,
31 NSDragOperationDelete = 32,
32 NSDragOperationEvery = (2147483647L * 2UL + 1UL)
33 }
34
35 interface INSDraggingInfo
36 {
37 NSWindow draggingDestinationWindow ();
38 uint draggingSourceOperationMask ();
39 NSPoint draggingLocation ();
40 NSPoint draggedImageLocation ();
41 NSImage draggedImage ();
42 NSPasteboard draggingPasteboard ();
43 Object draggingSource ();
44 NSInteger draggingSequenceNumber ();
45 void slideDraggedImageTo (NSPoint screenPoint);
46 NSArray namesOfPromisedFilesDroppedAtDestination (NSURL dropDestination);
47 }
48
49 const TNSDraggingSource = `
50
51 uint draggingSourceOperationMaskForLocal (bool flag)
52 {
53 return invokeObjcSelf!(uint, "draggingSourceOperationMaskForLocal:", bool)(flag);
54 }
55
56 NSArray namesOfPromisedFilesDroppedAtDestination (NSURL dropDestination)
57 {
58 return invokeObjcSelf!(NSArray, "namesOfPromisedFilesDroppedAtDestination:", NSURL)(dropDestination);
59 }
60
61 void draggedImage (NSImage image, NSPoint screenPoint)
62 {
63 return invokeObjcSelf!(void, "draggedImage:beganAt:", NSImage, NSPoint)(image, screenPoint);
64 }
65
66 void draggedImage (NSImage image, NSPoint screenPoint, uint operation)
67 {
68 return invokeObjcSelf!(void, "draggedImage:endedAt:operation:", NSImage, NSPoint, uint)(image, screenPoint, operation);
69 }
70
71 void draggedImage (NSImage image, NSPoint screenPoint)
72 {
73 return invokeObjcSelf!(void, "draggedImage:movedTo:", NSImage, NSPoint)(image, screenPoint);
74 }
75
76 bool ignoreModifierKeysWhileDragging ()
77 {
78 return invokeObjcSelf!(bool, "ignoreModifierKeysWhileDragging");
79 }
80
81 void draggedImage (NSImage image, NSPoint screenPoint, bool flag)
82 {
83 return invokeObjcSelf!(void, "draggedImage:endedAt:deposited:", NSImage, NSPoint, bool)(image, screenPoint, flag);
84 }
85
86 //mixin ObjcBindMethod!(draggingSourceOperationMaskForLocal, "draggingSourceOperationMaskForLocal:");
87 //mixin ObjcBindMethod!(namesOfPromisedFilesDroppedAtDestination, "namesOfPromisedFilesDroppedAtDestination:");
88 //mixin ObjcBindMethod!(draggedImage, "draggedImage:beganAt:");
89 //mixin ObjcBindMethod!(draggedImage, "draggedImage:endedAt:operation:");
90 //mixin ObjcBindMethod!(draggedImage, "draggedImage:movedTo:");
91 //mixin ObjcBindMethod!(ignoreModifierKeysWhileDragging, "ignoreModifierKeysWhileDragging");
92 //mixin ObjcBindMethod!(draggedImage, "draggedImage:endedAt:deposited:");
93
94 `;
95
96 const TNSDraggingDestination = `
97
98 uint draggingEntered (INSDraggingInfo sender)
99 {
100 return invokeObjcSelf!(uint, "draggingEntered:", INSDraggingInfo)(sender);
101 }
102
103 uint draggingUpdated (INSDraggingInfo sender)
104 {
105 return invokeObjcSelf!(uint, "draggingUpdated:", INSDraggingInfo)(sender);
106 }
107
108 void draggingExited (INSDraggingInfo sender)
109 {
110 return invokeObjcSelf!(void, "draggingExited:", INSDraggingInfo)(sender);
111 }
112
113 bool prepareForDragOperation (INSDraggingInfo sender)
114 {
115 return invokeObjcSelf!(bool, "prepareForDragOperation:", INSDraggingInfo)(sender);
116 }
117
118 bool performDragOperation (INSDraggingInfo sender)
119 {
120 return invokeObjcSelf!(bool, "performDragOperation:", INSDraggingInfo)(sender);
121 }
122
123 void concludeDragOperation (INSDraggingInfo sender)
124 {
125 return invokeObjcSelf!(void, "concludeDragOperation:", INSDraggingInfo)(sender);
126 }
127
128 void draggingEnded (INSDraggingInfo sender)
129 {
130 return invokeObjcSelf!(void, "draggingEnded:", INSDraggingInfo)(sender);
131 }
132
133 bool wantsPeriodicDraggingUpdates ()
134 {
135 return invokeObjcSelf!(bool, "wantsPeriodicDraggingUpdates");
136 }
137
138 //mixin ObjcBindMethod!(draggingEntered, "draggingEntered:");
139 //mixin ObjcBindMethod!(draggingUpdated, "draggingUpdated:");
140 //mixin ObjcBindMethod!(draggingExited, "draggingExited:");
141 //mixin ObjcBindMethod!(prepareForDragOperation, "prepareForDragOperation:");
142 //mixin ObjcBindMethod!(performDragOperation, "performDragOperation:");
143 //mixin ObjcBindMethod!(concludeDragOperation, "concludeDragOperation:");
144 //mixin ObjcBindMethod!(draggingEnded, "draggingEnded:");
145 //mixin ObjcBindMethod!(wantsPeriodicDraggingUpdates, "wantsPeriodicDraggingUpdates");
146
147 `;
148