1 from pyjamas import DOM
4 """
5 emulates a drag event.
6 http://dev.w3.org/html5/spec/dnd.html#dragevent
7 """
8 relatedTarget = None
9 detail = 0
10 returnValue = True
11 - def __init__(self, evt, type, dataTransfer, target=None):
12 self.evt = evt
13 self.type = type
14 self.setTarget(target)
15 self.dataTransfer = dataTransfer
16 self.canBubble = True
17 if self.type in ['dragleave', 'dragend']:
18 self.cancelable = False
19 else:
20 self.cancelable = True
21
23 if target is not None:
24 self.target = target
25 else:
26 self.target = DOM.eventGetTarget(self.evt)
27
28
29
30
31
34
35 @property
38
39 @property
42
43 @property
46
47 @property
50
51 @property
54
55 @property
58
59 @property
62
63 @property
66
67 @property
70
71 @property
74
75 @property
78
80 """
81 ie6 sets returnValue to False, so we do, too.
82 """
83 self.returnValue = False
84
85 - def initDragEvent(self, type, canBubble, cancelable, dummy, detail, screenX,
86 screenY, clientX, clientY, ctrlKey, altKey, shiftKey,
87 metaKey, button, relatedTarget, dataTransfer):
88 """
89 Just raise NotImplemented. Provided only for completeness with the
90 Interface.
91 """
92 raise NotImplemented("Instanciate this class with a mouse event.")
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109