From 8808465e5b70fd6388ed02a2cfda6015ffc914e5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 5 Aug 2005 19:11:26 +0000 Subject: r9133: a huge import of the qooxdoo infrastructure. I decided to import all the widgets to make experimenting easy during development. We can trim this back later to only the pieces we use (This used to be commit 631a56da39ed0daae46ca89e57c10b09cf41c718) --- swat/style/qooxdoo/widgets/events/QxDataEvent.js | 2 ++ swat/style/qooxdoo/widgets/events/QxDragEvent.js | 2 ++ swat/style/qooxdoo/widgets/events/QxEvent.js | 2 ++ swat/style/qooxdoo/widgets/events/QxFocusEvent.js | 2 ++ swat/style/qooxdoo/widgets/events/QxKeyEvent.js | 4 ++++ swat/style/qooxdoo/widgets/events/QxMouseEvent.js | 2 ++ 6 files changed, 14 insertions(+) create mode 100644 swat/style/qooxdoo/widgets/events/QxDataEvent.js create mode 100644 swat/style/qooxdoo/widgets/events/QxDragEvent.js create mode 100644 swat/style/qooxdoo/widgets/events/QxEvent.js create mode 100644 swat/style/qooxdoo/widgets/events/QxFocusEvent.js create mode 100644 swat/style/qooxdoo/widgets/events/QxKeyEvent.js create mode 100644 swat/style/qooxdoo/widgets/events/QxMouseEvent.js (limited to 'swat/style/qooxdoo/widgets/events') diff --git a/swat/style/qooxdoo/widgets/events/QxDataEvent.js b/swat/style/qooxdoo/widgets/events/QxDataEvent.js new file mode 100644 index 0000000000..2634ba42a3 --- /dev/null +++ b/swat/style/qooxdoo/widgets/events/QxDataEvent.js @@ -0,0 +1,2 @@ +/* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */ +function QxDataEvent(eType,newValue,oldValue,autoDispose){QxEvent.call(this,eType,autoDispose);if(typeof newValue!="undefined"){this._newValue=newValue;};if(typeof oldValue!="undefined"){this._oldValue=oldValue;};};QxDataEvent.extend(QxEvent,"QxDataEvent");proto._propagationStopped=false;proto.getValue=proto.getData=proto.getNewValue=function(){return this._newValue;};proto.getOldValue=function(){return this._oldValue;};proto.dispose=function(){if(this._disposed){return;};this._newValue=this._oldValue=null;QxEvent.prototype.dispose.call(this);}; \ No newline at end of file diff --git a/swat/style/qooxdoo/widgets/events/QxDragEvent.js b/swat/style/qooxdoo/widgets/events/QxDragEvent.js new file mode 100644 index 0000000000..76db40803e --- /dev/null +++ b/swat/style/qooxdoo/widgets/events/QxDragEvent.js @@ -0,0 +1,2 @@ +/* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */ +function QxDragEvent(vType,vMouseEvent,vAutoDispose){this._mouseEvent=vMouseEvent;this._manager=new QxDragAndDropManager;QxMouseEvent.call(this,vType,vMouseEvent?vMouseEvent._domEvent:null,vAutoDispose);};QxDragEvent.extend(QxMouseEvent,"QxDragEvent");proto.getManager=function(){return this._manager;};proto.getMouseEvent=function(){return this._mouseEvent;};proto.startDrag=function(){if(this._type!="dragstart"){throw new Error("QxDragEvent startDrag can only be called during the dragstart event");};this.stopPropagation();this._manager.startDrag();};proto.addData=function(sType,oData){this._manager.addData(sType,oData);};proto.getData=function(sType){return this._manager.getData(sType);};proto.clearData=function(){this._manager.clearData();};proto.getDropDataTypes=function(){return this._manager.getDropDataTypes();};proto.addAction=function(sAction){this._manager.addAction(sAction);};proto.removeAction=function(sAction){this._manager.removeAction(sAction);};proto.getAction=function(){return this._manager.getCurrentAction();};proto.clearActions=function(){this._manager.clearActions();};proto._evalTarget=function(){switch(this._type){case "dragstart":case "dragend":case "dragover":case "dragout":case "dragmove":return this._target;case "dragdrop":return this._manager.getDestinationWidget();default:return QxMouseEvent.prototype._evalTarget.call(this);};};proto._evalRelatedTarget=function(){switch(this._type){case "dragover":case "dragout":return this._relatedTarget;case "dragdrop":return this._manager.getSourceWidget();case "dragend":return this._manager.getDestinationWidget();default:return QxMouseEvent.prototype._evalRelatedTarget.call(this);};};proto.dispose=function(){if(this.getDisposed()){return;};QxMouseEvent.prototype.dispose.call(this);this._relatedTarget=null;this._target=null;}; \ No newline at end of file diff --git a/swat/style/qooxdoo/widgets/events/QxEvent.js b/swat/style/qooxdoo/widgets/events/QxEvent.js new file mode 100644 index 0000000000..31960eec9c --- /dev/null +++ b/swat/style/qooxdoo/widgets/events/QxEvent.js @@ -0,0 +1,2 @@ +/* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */ +function QxEvent(eType,autoDispose){if(typeof autoDispose!="boolean"&&this.classname=="QxEvent"){autoDispose=false;};QxObject.call(this,autoDispose);if(isValid(eType)){this._type=eType;};};QxEvent.extend(QxObject,"QxEvent");proto._bubbles=false;proto._propagationStopped=true;proto._defaultPrevented=false;proto._type="";proto._target=null;proto._currentTarget=null;proto._relatedTarget=null;proto.setType=function(t){this._type=t;};proto.setBubbles=function(b){this._bubbles=b;};proto.setPropagationStopped=function(s){this._propagationStopped=s;};proto.stopPropagation=function(){this._propagationStopped=true;};proto.setPreventDefault=function(d){this._defaultPrevented=d;};proto.setTarget=function(t){this._target=t;};proto.setCurrentTarget=function(t){this._currentTarget=t;};proto.setRelatedTarget=function(t){this._relatedTarget=t;};proto.preventDefault=function(){this.setPreventDefault(true);};proto.getType=function(){return this._type;};proto.getBubbles=function(){return this._bubbles;};proto.getPropagationStopped=function(){return this._propagationStopped;};proto.getPreventDefault=function(){return this._defaultPrevented;};proto.getTarget=function(){return this._target;};proto.getCurrentTarget=function(){return this._currentTarget;};proto.getRelatedTarget=function(){return this._relatedTarget;};proto.dispose=function(){if(this._disposed){return;};this._target=null;this._currentTarget=null;this._relatedTarget=null;QxObject.prototype.dispose.call(this);}; \ No newline at end of file diff --git a/swat/style/qooxdoo/widgets/events/QxFocusEvent.js b/swat/style/qooxdoo/widgets/events/QxFocusEvent.js new file mode 100644 index 0000000000..176d59caa2 --- /dev/null +++ b/swat/style/qooxdoo/widgets/events/QxFocusEvent.js @@ -0,0 +1,2 @@ +/* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */ +function QxFocusEvent(eType,autoDispose){QxEvent.call(this,eType,autoDispose);if(eType=="focusin"||eType=="focusout"){this._bubbles=true;this._propagationStopped=false;};};QxFocusEvent.extend(QxEvent,"QxFocusEvent"); \ No newline at end of file diff --git a/swat/style/qooxdoo/widgets/events/QxKeyEvent.js b/swat/style/qooxdoo/widgets/events/QxKeyEvent.js new file mode 100644 index 0000000000..cc2808e805 --- /dev/null +++ b/swat/style/qooxdoo/widgets/events/QxKeyEvent.js @@ -0,0 +1,4 @@ +/* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */ +function QxKeyEvent(eType,domEvent,autoDispose){QxEvent.call(this,eType,autoDispose);this._domEvent=domEvent;};QxKeyEvent.extend(QxEvent,"QxKeyEvent");QxKeyEvent.keys= +{esc:27,enter:13,tab:9,space:32,up:38,down:40,left:37,right:39,shift:16,ctrl:17,alt:18,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,del:46,backspace:8,insert:45,home:36,end:35,pageup:33,pagedown:34,numlock:144,numpad_0:96,numpad_1:97,numpad_2:98,numpad_3:99,numpad_4:100,numpad_5:101,numpad_6:102,numpad_7:103,numpad_8:104,numpad_9:105,numpad_divide:111,numpad_multiply:106,numpad_minus:109,numpad_plus:107 +};QxKeyEvent.codes={};for(var i in QxKeyEvent.keys){QxKeyEvent.codes[QxKeyEvent.keys[i]]=i;};proto._domEvent=null;proto._preventDefault=false;proto._bubbles=true;proto._propagationStopped=false;proto.dispose=function(){if(this._disposed)return;this._domEvent=null;QxEvent.prototype.dispose.call(this);};proto.getDomEvent=function(){return this._domEvent;};proto.getDomTarget=function(){return this._domEvent.target||this._domEvent.srcElement;};proto.getKeyCode=function(){return this._domEvent.keyCode||this._domEvent.charCode;};proto.getCtrlKey=function(){return this._domEvent.ctrlKey;};proto.getShiftKey=function(){return this._domEvent.shiftKey;};proto.getAltKey=function(){return this._domEvent.altKey;};proto.setPreventDefault=function(d){if(!this._defaultPrevented&&d){this.preventDefault();}else {return false;};};if((new QxClient).isMshtml()){proto.preventDefault=function(){this._domEvent.returnValue=false;this._defaultPrevented=true;};}else {proto.preventDefault=function(){this._domEvent.preventDefault();this._domEvent.returnValue=false;this._defaultPrevented=true;};}; \ No newline at end of file diff --git a/swat/style/qooxdoo/widgets/events/QxMouseEvent.js b/swat/style/qooxdoo/widgets/events/QxMouseEvent.js new file mode 100644 index 0000000000..b1035ef236 --- /dev/null +++ b/swat/style/qooxdoo/widgets/events/QxMouseEvent.js @@ -0,0 +1,2 @@ +/* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */ +function QxMouseEvent(vType,vDomEvent,vAutoDispose,vTarget,vActiveTarget,vRelatedTarget){QxEvent.call(this,vType,vAutoDispose);if(vDomEvent){this._domEvent=vDomEvent;this._domTarget=vDomEvent.target||vDomEvent.srcElement;this._target=isValid(vTarget)?vTarget:this._evalTarget();this._activeTarget=isValid(vActiveTarget)?vActiveTarget:this._evalActiveTarget();this._relatedTarget=isValid(vRelatedTarget)?vRelatedTarget:this._evalRelatedTarget();this._pageX=this._evalPageX();this._pageY=this._evalPageY();this._clientX=this._evalClientX();this._clientY=this._evalClientY();switch(this._button=this._evalButton()){case "left":this._buttonLeft=true;break;case "middle":this._buttonMiddle=true;break;case "right":this._buttonRight=true;break;};};};QxMouseEvent.extend(QxEvent,"QxMouseEvent");proto._bubbles=true;proto._propagationStopped=false;proto._preventDefault=false;proto._domEvent=null;proto._domTarget=null;proto.getDomEvent=function(){return this._domEvent;};proto.getDomTarget=function(){return this._domTarget;};proto._pageX=null;proto._pageY=null;proto.getPageX=function(){return this._pageX;};proto.getPageY=function(){return this._pageY;};if((new QxClient).isGecko()){proto._evalPageX=function(){return this._domEvent.pageX;};proto._evalPageY=function(){return this._domEvent.pageY;};}else if((new QxClient).isMshtml()){if(isInvalid(document.compatMode)||document.compatMode=="BackCompat"){proto._evalPageX=function(){return this._domEvent.clientX+document.documentElement.scrollLeft;};proto._evalPageY=function(){return this._domEvent.clientY+document.documentElement.scrollTop;};}else {proto._evalPageX=function(){return this._domEvent.clientX+document.body.scrollLeft;};proto._evalPageY=function(){return this._domEvent.clientY+document.body.scrollTop;};};}else {proto._evalPageX=function(){return this._domEvent.clientX;};proto._evalPageY=function(){return this._domEvent.clientY;};};proto._clientX=null;proto._clientY=null;proto.getClientX=function(){return this._clientX;};proto.getClientY=function(){return this._clientY;};if((new QxClient).isMshtml()||(new QxClient).isGecko()){proto._evalClientX=function(){return this._domEvent.clientX;};proto._evalClientY=function(){return this._domEvent.clientY;};}else {proto._evalClientX=function(){return this._domEvent.clientX+(document.body&&document.body.scrollLeft!=null?document.body.scrollLeft:0);};proto._evalClientY=function(){return this._domEvent.clientY+(document.body&&document.body.scrollTop!=null?document.body.scrollTop:0);};};proto.getScreenX=function(){return this._domEvent.screenX;};proto.getScreenY=function(){return this._domEvent.screenY;};proto.getCtrlKey=function(){return this._domEvent.ctrlKey;};proto.getShiftKey=function(){return this._domEvent.shiftKey;};proto.getAltKey=function(){return this._domEvent.altKey;};proto.getDomTargetByTagName=function(elemTagName,stopElem){var dt=this.getDomTarget();while(dt&&dt.tagName!=elemTagName&&dt!=stopElem){dt=dt.parentNode;};if(dt&&dt.tagName==elemTagName){return dt;};return null;};if((new QxClient).isMshtml()){proto.preventDefault=function(){this._domEvent.returnValue=false;this._defaultPrevented=true;};}else {proto.preventDefault=function(){this._domEvent.preventDefault();this._domEvent.returnValue=false;this._defaultPrevented=true;};};proto.getDefaultPrevented=function(){return this._defaultPrevented;};proto._target=proto._activeTarget=proto._relatedTarget=null;proto.getTarget=function(){return this._target;};proto.getActiveTarget=function(){return this._activeTarget;};proto.getRelatedTarget=function(){return this._relatedTarget;};proto._evalTarget=function(){return QxEventManager.getTargetObjectFromEvent(this._domEvent);};proto._evalActiveTarget=function(){return QxEventManager.getActiveTargetObjectFromEvent(this._domEvent);};proto._evalRelatedTarget=function(){return QxEventManager.getRelatedActiveTargetObjectFromEvent(this._domEvent);};proto._button=0;proto.getButton=function(){return this._button;};proto.isLeftButton=function(){return this._buttonLeft;};proto.isMiddleButton=function(){return this._buttonMiddle;};proto.isRightButton=function(){return this._buttonRight;};proto.isNotLeftButton=function(){return !this._buttonLeft;};proto.isNotMiddleButton=function(){return !this._buttonMiddle;};proto.isNotRightButton=function(){return !this._buttonRight;};if((new QxClient).isMshtml()){proto._evalButton=function(){var b=this._domEvent.button;return b==1?"left":b==2?"right":b==4?"middle":null;};QxMouseEvent.buttons={left:1,right:2,middle:4};}else {proto._evalButton=function(){var b=this._domEvent.button;return b==0?"left":b==2?"right":b==1?"middle":null;};QxMouseEvent.buttons={left:0,right:2,middle:1};};proto._wheelDelta=0;proto._wheelDeltaEvaluated=false;proto.getWheelDelta=function(){if(this._wheelDeltaEvaluated){return this._wheelDelta;};this._wheelDeltaEvaluated=true;return this._wheelDelta=this._evalWheelDelta();};if((new QxClient).isMshtml()){proto._evalWheelDelta=function(){return this._domEvent.wheelDelta?this._domEvent.wheelDelta/40:0;};}else {proto._evalWheelDelta=function(){return-(this._domEvent.detail||0);};};proto.dispose=function(){if(this.getDisposed()){return;};QxEvent.prototype.dispose.call(this);this._domEvent=null;this._domTarget=null;this._target=null;this._activeTarget=null;this._relatedTarget=null;};QxMouseEvent._screenX=QxMouseEvent._screenY=QxMouseEvent._clientX=QxMouseEvent._clientY=QxMouseEvent._pageX=QxMouseEvent._pageY=0;QxMouseEvent._button=null;QxMouseEvent._storeEventState=function(e){QxMouseEvent._screenX=e.getScreenX();QxMouseEvent._screenY=e.getScreenY();QxMouseEvent._clientX=e.getClientX();QxMouseEvent._clientY=e.getClientY();QxMouseEvent._pageX=e.getPageX();QxMouseEvent._pageY=e.getPageY();QxMouseEvent._button=e.getButton();};QxMouseEvent.getScreenX=function(){return QxMouseEvent._screenX;};QxMouseEvent.getScreenY=function(){return QxMouseEvent._screenY;};QxMouseEvent.getClientX=function(){return QxMouseEvent._clientX;};QxMouseEvent.getClientY=function(){return QxMouseEvent._clientY;};QxMouseEvent.getPageX=function(){return QxMouseEvent._pageX;};QxMouseEvent.getPageY=function(){return QxMouseEvent._pageY;};QxMouseEvent.getButton=function(){return QxMouseEvent._button;}; \ No newline at end of file -- cgit