/* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */ function QxDragAndDropManager(){if(QxDragAndDropManager._instance){return QxDragAndDropManager._instance;};QxTarget.call(this);this._k1={};this._k2={};this._k3={};var d=window.application.getClientWindow().getClientDocument();var a=["move","copy","alias","nodrop"];var c;for(var i=0;i5||Math.abs(e.getScreenY()-this._k6.startScreenY)>5){this._k6.sourceWidget.dispatchEvent(new QxDragEvent("dragstart",e));this._k6.hasFiredDragStart=true;if(this._k6.dragHandlerActive){this._fireUserEvents(this._k6.currentDropWidget,this._k6.sourceWidget,e);this._k6.currentDropWidget=this._k6.sourceWidget;var clientDocument=window.application.getClientWindow().getClientDocument();clientDocument.setCapture(true);clientDocument.addEventListener("losecapture",this.cancelDrag,this);};};};};proto._handleMouseUp=function(e){if(!this._k6){return;};if(this._k6.dragHandlerActive){this._endDrag(this.getDropTarget(e),e);}else {this._k6=null;};};proto.handleKeyEvent=function(e){if(!this._k6){return;};switch(e.getType()){case "keydown":this._handleKeyDown(e);return;case "keyup":this._handleKeyUp(e);return;};};proto._handleKeyDown=function(e){if(e.getKeyCode()==QxKeyEvent.keys.esc){this.cancelDrag();}else if(this.getCurrentAction()!=null){switch(e.getKeyCode()){case QxKeyEvent.keys.shift:case QxKeyEvent.keys.ctrl:case QxKeyEvent.keys.alt:this.setAction(this._evalNewAction(e.getShiftKey(),e.getCtrlKey(),e.getAltKey()));this._renderCursor();};};};proto._handleKeyUp=function(e){var bShiftPressed=e.getKeyCode()==QxKeyEvent.keys.shift;var bCtrlPressed=e.getKeyCode()==QxKeyEvent.keys.strl;var bAltPressed=e.getKeyCode()==QxKeyEvent.keys.alt;if(bShiftPressed||bCtrlPressed||bAltPressed){if(this.getCurrentAction()!=null){this.setAction(this._evalNewAction(!bShiftPressed&&e.getShiftKey(),! bCtrlPressed&&e.getCtrlKey(),!bAltPressed&&e.getAltKey()));this._renderCursor();};};e.preventDefault();};proto.cancelDrag=function(e){this._endDrag(null,e);};proto.globalCancelDrag=function(){if(this._k6&&this._k6.dragHandlerActive){this._endDragCore();};};proto._endDrag=function(currentDestinationWidget,e){if(currentDestinationWidget){this._k5=e;this.setDestinationWidget(currentDestinationWidget);};this.getSourceWidget().dispatchEvent(new QxDragEvent("dragend",e));this._fireUserEvents(this._k6&&this._k6.currentDropWidget,null,e);this._endDragCore();};proto._endDragCore=function(){this.setCursor(null);var d=window.application.getClientWindow().getClientDocument();d.removeEventListener("losecapture",this.cancelDrag,this);d.setCapture(false);if(this._k6){this._k6.currentDropWidget=null;this._k6=null;};this.clearData();this.clearActions();this.setSourceWidget(null);this.setDestinationWidget(null);};proto._renderCursor=function(){var newCursor;switch(this.getCurrentAction()){case "move":newCursor=this._k3.move;break;case "copy":newCursor=this._k3.copy;break;case "alias":newCursor=this._k3.alias;break;default:newCursor=this._k3.nodrop;};newCursor._d3Horizontal(this._k6.pageX+5);newCursor._d3Vertical(this._k6.pageY+15);this.setCursor(newCursor);};proto._modifyCursor=function(_b1,_b2,_b3,_b4){if(_b2){_b2.setStyleProperty("display","none");};if(_b1){_b1.removeStyleProperty("display");};return true;};proto.supportsDrop=function(vWidget){var types=vWidget.getDropDataTypes();if(!types){return false;};for(var i=0;i