1318 |
alexandre_ |
1 |
/*
|
|
|
2 |
Copyright (c) 2004-2006, The Dojo Foundation
|
|
|
3 |
All Rights Reserved.
|
|
|
4 |
|
|
|
5 |
Licensed under the Academic Free License version 2.1 or above OR the
|
|
|
6 |
modified BSD license. For more information on Dojo licensing, see:
|
|
|
7 |
|
|
|
8 |
http://dojotoolkit.org/community/licensing.shtml
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
dojo.require("dojo.lang.common");
|
|
|
12 |
dojo.require("dojo.lang.func");
|
|
|
13 |
dojo.require("dojo.lang.declare");
|
|
|
14 |
dojo.provide("dojo.dnd.DragAndDrop");
|
|
|
15 |
dojo.declare("dojo.dnd.DragSource", null, {type:"", onDragEnd:function (evt) {
|
|
|
16 |
}, onDragStart:function (evt) {
|
|
|
17 |
}, onSelected:function (evt) {
|
|
|
18 |
}, unregister:function () {
|
|
|
19 |
dojo.dnd.dragManager.unregisterDragSource(this);
|
|
|
20 |
}, reregister:function () {
|
|
|
21 |
dojo.dnd.dragManager.registerDragSource(this);
|
|
|
22 |
}});
|
|
|
23 |
dojo.declare("dojo.dnd.DragObject", null, {type:"", register:function () {
|
|
|
24 |
var dm = dojo.dnd.dragManager;
|
|
|
25 |
if (dm["registerDragObject"]) {
|
|
|
26 |
dm.registerDragObject(this);
|
|
|
27 |
}
|
|
|
28 |
}, onDragStart:function (evt) {
|
|
|
29 |
}, onDragMove:function (evt) {
|
|
|
30 |
}, onDragOver:function (evt) {
|
|
|
31 |
}, onDragOut:function (evt) {
|
|
|
32 |
}, onDragEnd:function (evt) {
|
|
|
33 |
}, onDragLeave:dojo.lang.forward("onDragOut"), onDragEnter:dojo.lang.forward("onDragOver"), ondragout:dojo.lang.forward("onDragOut"), ondragover:dojo.lang.forward("onDragOver")});
|
|
|
34 |
dojo.declare("dojo.dnd.DropTarget", null, {acceptsType:function (type) {
|
|
|
35 |
if (!dojo.lang.inArray(this.acceptedTypes, "*")) {
|
|
|
36 |
if (!dojo.lang.inArray(this.acceptedTypes, type)) {
|
|
|
37 |
return false;
|
|
|
38 |
}
|
|
|
39 |
}
|
|
|
40 |
return true;
|
|
|
41 |
}, accepts:function (dragObjects) {
|
|
|
42 |
if (!dojo.lang.inArray(this.acceptedTypes, "*")) {
|
|
|
43 |
for (var i = 0; i < dragObjects.length; i++) {
|
|
|
44 |
if (!dojo.lang.inArray(this.acceptedTypes, dragObjects[i].type)) {
|
|
|
45 |
return false;
|
|
|
46 |
}
|
|
|
47 |
}
|
|
|
48 |
}
|
|
|
49 |
return true;
|
|
|
50 |
}, unregister:function () {
|
|
|
51 |
dojo.dnd.dragManager.unregisterDropTarget(this);
|
|
|
52 |
}, onDragOver:function (evt) {
|
|
|
53 |
}, onDragOut:function (evt) {
|
|
|
54 |
}, onDragMove:function (evt) {
|
|
|
55 |
}, onDropStart:function (evt) {
|
|
|
56 |
}, onDrop:function (evt) {
|
|
|
57 |
}, onDropEnd:function () {
|
|
|
58 |
}}, function () {
|
|
|
59 |
this.acceptedTypes = [];
|
|
|
60 |
});
|
|
|
61 |
dojo.dnd.DragEvent = function () {
|
|
|
62 |
this.dragSource = null;
|
|
|
63 |
this.dragObject = null;
|
|
|
64 |
this.target = null;
|
|
|
65 |
this.eventStatus = "success";
|
|
|
66 |
};
|
|
|
67 |
dojo.declare("dojo.dnd.DragManager", null, {selectedSources:[], dragObjects:[], dragSources:[], registerDragSource:function (source) {
|
|
|
68 |
}, dropTargets:[], registerDropTarget:function (target) {
|
|
|
69 |
}, lastDragTarget:null, currentDragTarget:null, onKeyDown:function () {
|
|
|
70 |
}, onMouseOut:function () {
|
|
|
71 |
}, onMouseMove:function () {
|
|
|
72 |
}, onMouseUp:function () {
|
|
|
73 |
}});
|
|
|
74 |
|