diff options
Diffstat (limited to 'webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type')
7 files changed, 1135 insertions, 0 deletions
diff --git a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/DataEvent.js b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/DataEvent.js new file mode 100644 index 0000000000..47e08a1771 --- /dev/null +++ b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/DataEvent.js @@ -0,0 +1,50 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2007 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL: http://www.gnu.org/licenses/lgpl.html + EPL: http://www.eclipse.org/org/documents/epl-v10.php + See the LICENSE file in the project's top-level directory for details. + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(core) + +************************************************************************ */ + +/*! + Event object for property changes. +*/ +qx.OO.defineClass("qx.event.type.DataEvent", qx.event.type.Event, +function(vType, vData) +{ + qx.event.type.Event.call(this, vType); + + this.setData(vData); +}); + +qx.OO.addFastProperty({ name : "propagationStopped", defaultValue : false }); +qx.OO.addFastProperty({ name : "data" }); + +qx.Proto.dispose = function() +{ + if(this.getDisposed()) { + return; + } + + this._valueData = null; + + return qx.event.type.Event.prototype.dispose.call(this); +} diff --git a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/DomEvent.js b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/DomEvent.js new file mode 100644 index 0000000000..b6fb710c7a --- /dev/null +++ b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/DomEvent.js @@ -0,0 +1,229 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2007 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL: http://www.gnu.org/licenses/lgpl.html + EPL: http://www.eclipse.org/org/documents/epl-v10.php + See the LICENSE file in the project's top-level directory for details. + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_core) + +************************************************************************ */ + +qx.OO.defineClass("qx.event.type.DomEvent", qx.event.type.Event, +function(vType, vDomEvent, vDomTarget, vTarget, vOriginalTarget) +{ + qx.event.type.Event.call(this, vType); + + this.setDomEvent(vDomEvent); + this.setDomTarget(vDomTarget); + + this.setTarget(vTarget); + this.setOriginalTarget(vOriginalTarget); +}); + +qx.OO.addFastProperty({ name : "bubbles", defaultValue : true, noCompute : true }); +qx.OO.addFastProperty({ name : "propagationStopped", defaultValue : false, noCompute : true }); + +qx.OO.addFastProperty({ name : "domEvent", setOnlyOnce : true, noCompute : true }); +qx.OO.addFastProperty({ name : "domTarget", setOnlyOnce : true, noCompute : true }); + +/** + * The modifiers. A mask of the pressed modifier keys. This is an OR-combination of + * {@link #SHIFT_MASK}, {@link #CTRL_MASK}, {@link #ALT_MASK} and {@link #META_MASK}. + */ +qx.OO.addCachedProperty({ name : "modifiers", defaultValue : null }); + + +// property computer +qx.Proto._computeModifiers = function() { + var mask = 0; + var evt = this.getDomEvent(); + if (evt.shiftKey) mask |= qx.event.type.DomEvent.SHIFT_MASK; + if (evt.ctrlKey) mask |= qx.event.type.DomEvent.CTRL_MASK; + if (evt.altKey) mask |= qx.event.type.DomEvent.ALT_MASK; + if (evt.metaKey) mask |= qx.event.type.DomEvent.META_MASK; + return mask; +} + + + + + + +/* +--------------------------------------------------------------------------- + SPECIAL KEY SUPPORT +--------------------------------------------------------------------------- +*/ + +/** + * Returns whether the the ctrl key is pressed. + * + * @return {Boolean} whether the the ctrl key is pressed. + */ +qx.Proto.isCtrlPressed = function() { + return this.getDomEvent().ctrlKey; +} + +/** + * Returns whether the the ctrl key is pressed. + * + * @return {Boolean} whether the the ctrl key is pressed. + * @deprecated Use {@link #isCtrlPressed} instead. + */ +qx.Proto.getCtrlKey = qx.Proto.isCtrlPressed; + + +/** + * Returns whether the the shift key is pressed. + * + * @return {Boolean} whether the the shift key is pressed. + */ +qx.Proto.isShiftPressed = function() { + return this.getDomEvent().shiftKey; +} + +/** + * Returns whether the the shift key is pressed. + * + * @return {Boolean} whether the the shift key is pressed. + * @deprecated Use {@link #isShiftPressed} instead. + */ +qx.Proto.getShiftKey = qx.Proto.isShiftPressed; + + +/** + * Returns whether the the alt key is pressed. + * + * @return {Boolean} whether the the alt key is pressed. + */ +qx.Proto.isAltPressed = function() { + return this.getDomEvent().altKey; +} + +/** + * Returns whether the the alt key is pressed. + * + * @return {Boolean} whether the the alt key is pressed. + * @deprecated Use {@link #isAltPressed} instead. + */ +qx.Proto.getAltKey = qx.Proto.isAltPressed; + + +/** + * Returns whether the the meta key is pressed. + * + * @return {Boolean} whether the the meta key is pressed. + */ +qx.Proto.isMetaPressed = function() { + return this.getDomEvent().metaKey; +} + + +/** + * Returns whether the ctrl key or (on the Mac) the command key is pressed. + * + * @return {Boolean} <code>true</code> if the command key is pressed on the Mac + * or the ctrl key is pressed on another system. + */ +qx.Proto.isCtrlOrCommandPressed = function() { + if (qx.core.Client.getInstance().runsOnMacintosh()) { + return this.getDomEvent().metaKey; + } else { + return this.getDomEvent().ctrlKey; + } +} + + + + + + + +/* +--------------------------------------------------------------------------- + PREVENT DEFAULT +--------------------------------------------------------------------------- +*/ + +if(qx.core.Client.getInstance().isMshtml()) +{ + qx.Proto.setDefaultPrevented = function(vValue) + { + if (!vValue) { + return this.error("It is not possible to set preventDefault to false if it was true before!", "setDefaultPrevented"); + } + + this.getDomEvent().returnValue = false; + + qx.event.type.Event.prototype.setDefaultPrevented.call(this, vValue); + } +} +else +{ + qx.Proto.setDefaultPrevented = function(vValue) + { + if (!vValue) { + return this.error("It is not possible to set preventDefault to false if it was true before!", "setDefaultPrevented"); + } + + this.getDomEvent().preventDefault(); + this.getDomEvent().returnValue = false; + + qx.event.type.Event.prototype.setDefaultPrevented.call(this, vValue); + } +} + + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return; + } + + this._valueDomEvent = null; + this._valueDomTarget = null; + + return qx.event.type.Event.prototype.dispose.call(this); +} + + + + +/** {int} The modifier mask for the shift key. */ +qx.Class.SHIFT_MASK = 1; + +/** {int} The modifier mask for the control key. */ +qx.Class.CTRL_MASK = 2; + +/** {int} The modifier mask for the alt key. */ +qx.Class.ALT_MASK = 4; + +/** {int} The modifier mask for the meta key (e.g. apple key on Macs). */ +qx.Class.META_MASK = 8; diff --git a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/DragEvent.js b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/DragEvent.js new file mode 100644 index 0000000000..a6bd360bbe --- /dev/null +++ b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/DragEvent.js @@ -0,0 +1,207 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2007 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL: http://www.gnu.org/licenses/lgpl.html + EPL: http://www.eclipse.org/org/documents/epl-v10.php + See the LICENSE file in the project's top-level directory for details. + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_dragdrop) + +************************************************************************ */ + +/*! + The event object for drag and drop sessions +*/ +qx.OO.defineClass("qx.event.type.DragEvent", qx.event.type.MouseEvent, +function(vType, vMouseEvent, vTarget, vRelatedTarget) +{ + this._mouseEvent = vMouseEvent; + + var vOriginalTarget = null; + + switch(vType) + { + case "dragstart": + case "dragover": + vOriginalTarget = vMouseEvent.getOriginalTarget(); + } + + qx.event.type.MouseEvent.call(this, vType, vMouseEvent.getDomEvent(), vTarget.getElement(), vTarget, vOriginalTarget, vRelatedTarget); +}); + + + + + +/* +--------------------------------------------------------------------------- + UTILITIY +--------------------------------------------------------------------------- +*/ + +qx.Proto.getMouseEvent = function() { + return this._mouseEvent; +} + + + + + + +/* +--------------------------------------------------------------------------- + APPLICATION CONNECTION +--------------------------------------------------------------------------- +*/ + +qx.Proto.startDrag = function() +{ + if (this.getType() != "dragstart") { + throw new Error("qx.event.type.DragEvent startDrag can only be called during the dragstart event: " + this.getType()); + } + + this.stopPropagation(); + qx.event.handler.DragAndDropHandler.getInstance().startDrag(); +} + + + + + + +/* +--------------------------------------------------------------------------- + DATA SUPPORT +--------------------------------------------------------------------------- +*/ + +qx.Proto.addData = function(sType, oData) { + qx.event.handler.DragAndDropHandler.getInstance().addData(sType, oData); +} + +qx.Proto.getData = function(sType) { + return qx.event.handler.DragAndDropHandler.getInstance().getData(sType); +} + +qx.Proto.clearData = function() { + qx.event.handler.DragAndDropHandler.getInstance().clearData(); +} + +qx.Proto.getDropDataTypes = function() { + return qx.event.handler.DragAndDropHandler.getInstance().getDropDataTypes(); +} + + + + + + +/* +--------------------------------------------------------------------------- + ACTION SUPPORT +--------------------------------------------------------------------------- +*/ + +qx.Proto.addAction = function(sAction) { + qx.event.handler.DragAndDropHandler.getInstance().addAction(sAction); +} + +qx.Proto.removeAction = function(sAction) { + qx.event.handler.DragAndDropHandler.getInstance().removeAction(sAction); +} + +qx.Proto.getAction = function() { + return qx.event.handler.DragAndDropHandler.getInstance().getCurrentAction(); +} + +qx.Proto.clearActions = function() { + qx.event.handler.DragAndDropHandler.getInstance().clearActions(); +} + + + + + + +/* +--------------------------------------------------------------------------- + USER FEEDBACK SUPPORT +--------------------------------------------------------------------------- +*/ + +/** + * Sets the widget to show as feedback for the user. This widget should + * represent the object(s) the user is dragging. + * + * @param widget {qx.ui.core.Widget} the feedback widget. + * @param deltaX {int ? 10} the number of pixels the top-left corner of the widget + * should be away from the mouse cursor in x direction. + * @param deltaY {int ? 10} the number of pixels the top-left corner of the widget + * should be away from the mouse cursor in y direction. + * @param autoDisposeWidget {boolean} whether the widget should be disposed when + * dragging is finished or cancelled. + */ +qx.Proto.setFeedbackWidget = function(widget, deltaX, deltaY, autoDisposeWidget) { + qx.event.handler.DragAndDropHandler.getInstance().setFeedbackWidget(widget, deltaX, deltaY, autoDisposeWidget); +}; + + + + + + +/* +--------------------------------------------------------------------------- + CURSPOR POSITIONING SUPPORT +--------------------------------------------------------------------------- +*/ + +/** + * Sets the position of the cursor feedback (the icon showing whether dropping + * is allowed at the current position and which action a drop will do). + * + * @param deltaX {int} The number of pixels the top-left corner of the + * cursor feedback should be away from the mouse cursor in x direction. + * @param deltaY {int} The number of pixels the top-left corner of the + * cursor feedback should be away from the mouse cursor in y direction. + */ +qx.Proto.setCursorPosition = function(deltaX, deltaY) { + qx.event.handler.DragAndDropHandler.getInstance().setCursorPosition(deltaX, deltaY); +}; + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return; + } + + this._mouseEvent = null; + + return qx.event.type.MouseEvent.prototype.dispose.call(this); +} diff --git a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/Event.js b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/Event.js new file mode 100644 index 0000000000..82798da893 --- /dev/null +++ b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/Event.js @@ -0,0 +1,90 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2007 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL: http://www.gnu.org/licenses/lgpl.html + EPL: http://www.eclipse.org/org/documents/epl-v10.php + See the LICENSE file in the project's top-level directory for details. + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(core) + +************************************************************************ */ + +/*! + The qooxdoo core event object. Each event object for qx.core.Targets should extend this class. +*/ +qx.OO.defineClass("qx.event.type.Event", qx.core.Object, +function(vType) +{ + qx.core.Object.call(this, false); + + this.setType(vType); +}); + +qx.OO.addFastProperty({ name : "type", setOnlyOnce : true }); + +qx.OO.addFastProperty({ name : "originalTarget", setOnlyOnce : true }); +qx.OO.addFastProperty({ name : "target", setOnlyOnce : true }); +qx.OO.addFastProperty({ name : "relatedTarget", setOnlyOnce : true }); +qx.OO.addFastProperty({ name : "currentTarget" }); + +qx.OO.addFastProperty({ name : "bubbles", defaultValue : false, noCompute : true }); +qx.OO.addFastProperty({ name : "propagationStopped", defaultValue : true, noCompute : true }); +qx.OO.addFastProperty({ name : "defaultPrevented", defaultValue : false, noCompute : true }); + +/** If the event object should automatically be disposed by the dispatcher */ +qx.OO.addFastProperty({ name : "autoDispose", defaultValue : false }); + + + + +/* +--------------------------------------------------------------------------- + SHORTCUTS +--------------------------------------------------------------------------- +*/ + +qx.Proto.preventDefault = function() { + this.setDefaultPrevented(true); +} + +qx.Proto.stopPropagation = function() { + this.setPropagationStopped(true); +} + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if(this.getDisposed()) { + return; + } + + this._valueOriginalTarget = null; + this._valueTarget = null; + this._valueRelatedTarget = null; + this._valueCurrentTarget = null; + + return qx.core.Object.prototype.dispose.call(this); +} diff --git a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/FocusEvent.js b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/FocusEvent.js new file mode 100644 index 0000000000..d8b327cb78 --- /dev/null +++ b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/FocusEvent.js @@ -0,0 +1,48 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2007 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL: http://www.gnu.org/licenses/lgpl.html + EPL: http://www.eclipse.org/org/documents/epl-v10.php + See the LICENSE file in the project's top-level directory for details. + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_core) + +************************************************************************ */ + +/*! + This event handles all focus events. + + The four supported types are: + 1+2: focus and blur also propagate the target object + 3+4: focusout and focusin are bubbling to the parent objects +*/ +qx.OO.defineClass("qx.event.type.FocusEvent", qx.event.type.Event, +function(vType, vTarget) +{ + qx.event.type.Event.call(this, vType); + + this.setTarget(vTarget); + + switch(vType) + { + case "focusin": + case "focusout": + this.setBubbles(true); + this.setPropagationStopped(false); + } +}); diff --git a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/KeyEvent.js b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/KeyEvent.js new file mode 100644 index 0000000000..eb69c51242 --- /dev/null +++ b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/KeyEvent.js @@ -0,0 +1,200 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2007 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL: http://www.gnu.org/licenses/lgpl.html + EPL: http://www.eclipse.org/org/documents/epl-v10.php + See the LICENSE file in the project's top-level directory for details. + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + * Fabian Jakobs (fjakobs) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_core) + +************************************************************************ */ + +/** + * A key event instance contains all data for each occured key event + * + * @param vType {String} event type (keydown, keypress, keyinput, keyup) + * @param vDomEvent {Element} DOM event object + * @param vDomTarget {Element} target element of the DOM event + * @param vTarget + * @param vOriginalTarget + * @param vKeyCode {Integer} emulated key code for compatibility with older qoodoo applications + * @param vCharCode {Integer} char code from the "keypress" event + * @param vKeyIdentifier {String} the key identifier + */ +qx.OO.defineClass("qx.event.type.KeyEvent", qx.event.type.DomEvent, +function(vType, vDomEvent, vDomTarget, vTarget, vOriginalTarget, vKeyCode, vCharCode, vKeyIdentifier) +{ + qx.event.type.DomEvent.call(this, vType, vDomEvent, vDomTarget, vTarget, vOriginalTarget); + + this.setKeyCode(vKeyCode); + this.setCharCode(vCharCode); + this.setKeyIdentifier(vKeyIdentifier); +}); + +/** + * Legacy keycode + * @deprecated Will be removed with qooxdoo 0.7 + */ +qx.OO.addFastProperty({ name : "keyCode", setOnlyOnce : true, noCompute : true }); + +/** + * Unicode number of the pressed character. + * Only valid in "keyinput" events + */ +qx.OO.addFastProperty({ name : "charCode", setOnlyOnce : true, noCompute : true }); + +/** + * Identifier of the pressed key. This property is modeled after the <em>KeyboardEvent.keyIdentifier</em> property + * of the W3C DOM 3 event specification (http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/events.html#Events-KeyboardEvent-keyIdentifier). + * + * It is not valid in "keyinput" events" + * + * Printable keys are represented by a unicode string, non-printable keys have one of the following + * values: + * <br> + * <table> + * <tr><th>Backspace</th><td>The Backspace (Back) key.</td></tr> + * <tr><th>Tab</th><td>The Horizontal Tabulation (Tab) key.</td></tr> + * <tr><th>Space</th><td>The Space (Spacebar) key.</td></tr> + * <tr><th>Enter</th><td>The Enter key. Note: This key identifier is also used for the Return (Macintosh numpad) key.</td></tr> + * <tr><th>Shift</th><td>The Shift key.</td></tr> + * <tr><th>Control</th><td>The Control (Ctrl) key.</td></tr> + * <tr><th>Alt</th><td>The Alt (Menu) key.</td></tr> + * <tr><th>CapsLock</th><td>The CapsLock key</td></tr> + * <tr><th>Meta</th><td>The Meta key. (Apple Meta and Windows key)</td></tr> + * <tr><th>Escape</th><td>The Escape (Esc) key.</td></tr> + * <tr><th>Left</th><td>The Left Arrow key.</td></tr> + * <tr><th>Up</th><td>The Up Arrow key.</td></tr> + * <tr><th>Right</th><td>The Right Arrow key.</td></tr> + * <tr><th>Down</th><td>The Down Arrow key.</td></tr> + * <tr><th>PageUp</th><td>The Page Up key.</td></tr> + * <tr><th>PageDown</th><td>The Page Down (Next) key.</td></tr> + * <tr><th>End</th><td>The End key.</td></tr> + * <tr><th>Home</th><td>The Home key.</td></tr> + * <tr><th>Insert</th><td>The Insert (Ins) key. (Does not fire in Opera/Win)</td></tr> + * <tr><th>Delete</th><td>The Delete (Del) Key.</td></tr> + * <tr><th>F1</th><td>The F1 key.</td></tr> + * <tr><th>F2</th><td>The F2 key.</td></tr> + * <tr><th>F3</th><td>The F3 key.</td></tr> + * <tr><th>F4</th><td>The F4 key.</td></tr> + * <tr><th>F5</th><td>The F5 key.</td></tr> + * <tr><th>F6</th><td>The F6 key.</td></tr> + * <tr><th>F7</th><td>The F7 key.</td></tr> + * <tr><th>F8</th><td>The F8 key.</td></tr> + * <tr><th>F9</th><td>The F9 key.</td></tr> + * <tr><th>F10</th><td>The F10 key.</td></tr> + * <tr><th>F11</th><td>The F11 key.</td></tr> + * <tr><th>F12</th><td>The F12 key.</td></tr> + * <tr><th>NumLock</th><td>The Num Lock key.</td></tr> + * <tr><th>PrintScreen</th><td>The Print Screen (PrintScrn, SnapShot) key.</td></tr> + * <tr><th>Scroll</th><td>The scroll lock key</td></tr> + * <tr><th>Pause</th><td>The pause/break key</td></tr> + * <tr><th>Win</th><td>The Windows Logo key</td></tr> + * <tr><th>Apps</th><td>The Application key (Windows Context Menu)</td></tr> + * </table> + */ +qx.OO.addFastProperty({ name : "keyIdentifier", setOnlyOnce : true, noCompute : true }); + + + + + + + + +/* ************************************************************************ + Class data, properties and methods +************************************************************************ */ + +/* +--------------------------------------------------------------------------- + CLASS PROPERTIES AND METHODS +--------------------------------------------------------------------------- +*/ + +/** + * Mapping of the old key identifiers to the key codes + * @deprecated + */ +qx.event.type.KeyEvent.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, + + print : 124, + + 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 +}; + +// create dynamic codes copy +(function() { + qx.event.type.KeyEvent.codes = {}; + for (var i in qx.event.type.KeyEvent.keys) { + qx.event.type.KeyEvent.codes[qx.event.type.KeyEvent.keys[i]] = i; + } +})(); diff --git a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/MouseEvent.js b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/MouseEvent.js new file mode 100644 index 0000000000..053037b281 --- /dev/null +++ b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/event/type/MouseEvent.js @@ -0,0 +1,311 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2007 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL: http://www.gnu.org/licenses/lgpl.html + EPL: http://www.eclipse.org/org/documents/epl-v10.php + See the LICENSE file in the project's top-level directory for details. + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_core) + +************************************************************************ */ + +/*! + A mouse event instance contains all data for each occured mouse event +*/ +qx.OO.defineClass("qx.event.type.MouseEvent", qx.event.type.DomEvent, +function(vType, vDomEvent, vDomTarget, vTarget, vOriginalTarget, vRelatedTarget) +{ + qx.event.type.DomEvent.call(this, vType, vDomEvent, vDomTarget, vTarget, vOriginalTarget); + + if (vRelatedTarget) { + this.setRelatedTarget(vRelatedTarget); + } +}); + +qx.Class.C_BUTTON_LEFT = "left"; +qx.Class.C_BUTTON_MIDDLE = "middle"; +qx.Class.C_BUTTON_RIGHT = "right"; +qx.Class.C_BUTTON_NONE = "none"; + + + +/* ************************************************************************ + Class data, properties and methods +************************************************************************ */ + +/* +--------------------------------------------------------------------------- + CLASS PROPERTIES AND METHODS +--------------------------------------------------------------------------- +*/ + +qx.event.type.MouseEvent._screenX = qx.event.type.MouseEvent._screenY = qx.event.type.MouseEvent._clientX = qx.event.type.MouseEvent._clientY = qx.event.type.MouseEvent._pageX = qx.event.type.MouseEvent._pageY = 0; +qx.event.type.MouseEvent._button = null; + +qx.event.type.MouseEvent._storeEventState = function(e) +{ + qx.event.type.MouseEvent._screenX = e.getScreenX(); + qx.event.type.MouseEvent._screenY = e.getScreenY(); + qx.event.type.MouseEvent._clientX = e.getClientX(); + qx.event.type.MouseEvent._clientY = e.getClientY(); + qx.event.type.MouseEvent._pageX = e.getPageX(); + qx.event.type.MouseEvent._pageY = e.getPageY(); + qx.event.type.MouseEvent._button = e.getButton(); +} + +qx.event.type.MouseEvent.getScreenX = function() { return qx.event.type.MouseEvent._screenX; } +qx.event.type.MouseEvent.getScreenY = function() { return qx.event.type.MouseEvent._screenY; } +qx.event.type.MouseEvent.getClientX = function() { return qx.event.type.MouseEvent._clientX; } +qx.event.type.MouseEvent.getClientY = function() { return qx.event.type.MouseEvent._clientY; } +qx.event.type.MouseEvent.getPageX = function() { return qx.event.type.MouseEvent._pageX; } +qx.event.type.MouseEvent.getPageY = function() { return qx.event.type.MouseEvent._pageY; } +qx.event.type.MouseEvent.getButton = function() { return qx.event.type.MouseEvent._button; } + +if (qx.core.Client.getInstance().isMshtml()) +{ + qx.event.type.MouseEvent.buttons = { left : 1, right : 2, middle : 4 } +} +else +{ + qx.event.type.MouseEvent.buttons = { left : 0, right : 2, middle : 1 } +} + + + + + + +/* ************************************************************************ + Instance data, properties and methods +************************************************************************ */ + +/* +--------------------------------------------------------------------------- + SCREEN COORDINATES SUPPORT +--------------------------------------------------------------------------- +*/ + +qx.Proto.getScreenX = function() { + return this.getDomEvent().screenX; +} + +qx.Proto.getScreenY = function() { + return this.getDomEvent().screenY; +} + + + + + + + + +/* +--------------------------------------------------------------------------- + PAGE COORDINATES SUPPORT +--------------------------------------------------------------------------- +*/ + +if (qx.core.Client.getInstance().isMshtml()) +{ +qx.OO.addFastProperty({ name : "pageX", readOnly : true }); +qx.OO.addFastProperty({ name : "pageY", readOnly : true }); + + if (qx.core.Client.getInstance().isInQuirksMode()) + { + qx.Proto._computePageX = function() { + return this.getDomEvent().clientX + document.documentElement.scrollLeft; + } + + qx.Proto._computePageY = function() { + return this.getDomEvent().clientY + document.documentElement.scrollTop; + } + } + else + { + qx.Proto._computePageX = function() { + return this.getDomEvent().clientX + document.body.scrollLeft; + } + + qx.Proto._computePageY = function() { + return this.getDomEvent().clientY + document.body.scrollTop; + } + } +} +else if (qx.core.Client.getInstance().isGecko()) +{ + qx.Proto.getPageX = function() { + return this.getDomEvent().pageX; + } + + qx.Proto.getPageY = function() { + return this.getDomEvent().pageY; + } +} +else +{ + qx.Proto.getPageX = function() { + return this.getDomEvent().clientX; + } + + qx.Proto.getPageY = function() { + return this.getDomEvent().clientY; + } +} + + + + + + + +/* +--------------------------------------------------------------------------- + CLIENT COORDINATES SUPPORT +--------------------------------------------------------------------------- +*/ + +if (qx.core.Client.getInstance().isMshtml() || qx.core.Client.getInstance().isGecko()) +{ + qx.Proto.getClientX = function() { + return this.getDomEvent().clientX; + } + + qx.Proto.getClientY = function() { + return this.getDomEvent().clientY; + } +} +else +{ +qx.OO.addFastProperty({ name : "clientX", readOnly : true }); +qx.OO.addFastProperty({ name : "clientY", readOnly : true }); + + qx.Proto._computeClientX = function() { + return this.getDomEvent().clientX + (document.body && document.body.scrollLeft != null ? document.body.scrollLeft : 0); + } + + qx.Proto._computeClientY = function() { + return this.getDomEvent().clientY + (document.body && document.body.scrollTop != null ? document.body.scrollTop : 0); + } +} + + + + + + + +/* +--------------------------------------------------------------------------- + BUTTON SUPPORT +--------------------------------------------------------------------------- +*/ + +qx.OO.addFastProperty({ name : "button", readOnly : true }); + +// IE does not set e.button in click events +if (qx.core.Client.getInstance().isMshtml()) +{ + qx.Proto.isLeftButtonPressed = function() { + if (this.getType() == "click") { + return true; + } else { + return this.getButton() === qx.event.type.MouseEvent.C_BUTTON_LEFT; + } + } +} +else +{ + qx.Proto.isLeftButtonPressed = function() { + return this.getButton() === qx.event.type.MouseEvent.C_BUTTON_LEFT; + } +} + +qx.Proto.isMiddleButtonPressed = function() { + return this.getButton() === qx.event.type.MouseEvent.C_BUTTON_MIDDLE; +} + +qx.Proto.isRightButtonPressed = function() { + return this.getButton() === qx.event.type.MouseEvent.C_BUTTON_RIGHT; +} + +qx.Proto._computeButton = function() { + var e = this.getDomEvent(); + if (e.which) { + switch (e.which) { + case 1: + return qx.event.type.MouseEvent.C_BUTTON_LEFT; + + case 3: + return qx.event.type.MouseEvent.C_BUTTON_RIGHT; + + case 2: + return qx.event.type.MouseEvent.C_BUTTON_MIDDLE; + + default: + return qx.event.type.MouseEvent.C_BUTTON_NONE; + + } + } else { + switch(e.button) { + case 1: + return qx.event.type.MouseEvent.C_BUTTON_LEFT; + + case 2: + return qx.event.type.MouseEvent.C_BUTTON_RIGHT; + + case 4: + return qx.event.type.MouseEvent.C_BUTTON_MIDDLE; + + default: + return qx.event.type.MouseEvent.C_BUTTON_NONE; + } + } +} + + + + +/* +--------------------------------------------------------------------------- + WHEEL SUPPORT +--------------------------------------------------------------------------- +*/ + +// Implementation differences: http://ajaxian.com/archives/javascript-and-mouse-wheels + +qx.OO.addFastProperty({ name : "wheelDelta", readOnly : true }); + +if(qx.core.Client.getInstance().isMshtml()) +{ + qx.Proto._computeWheelDelta = function() { + return this.getDomEvent().wheelDelta / 120; + } +} +else if(qx.core.Client.getInstance().isOpera()) +{ + qx.Proto._computeWheelDelta = function() { + return -this.getDomEvent().wheelDelta / 120; + } +} +else +{ + qx.Proto._computeWheelDelta = function() { + return -this.getDomEvent().detail / 3; + } +} |