--- /dev/null
+/*\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
+For licensing, see LICENSE.html or http://ckeditor.com/license\r
+*/\r
+\r
+/**\r
+ * @fileOverview Defines the {@link CKEDITOR.dom.event} class, which\r
+ * represents the a native DOM event object.\r
+ */\r
+\r
+/**\r
+ * Represents a native DOM event object.\r
+ * @constructor\r
+ * @param {Object} domEvent A native DOM event object.\r
+ * @example\r
+ */\r
+CKEDITOR.dom.event = function( domEvent )\r
+{\r
+ /**\r
+ * The native DOM event object represented by this class instance.\r
+ * @type Object\r
+ * @example\r
+ */\r
+ this.$ = domEvent;\r
+};\r
+\r
+CKEDITOR.dom.event.prototype =\r
+{\r
+ /**\r
+ * Gets the key code associated to the event.\r
+ * @returns {Number} The key code.\r
+ * @example\r
+ * alert( event.getKey() ); "65" is "a" has been pressed\r
+ */\r
+ getKey : function()\r
+ {\r
+ return this.$.keyCode || this.$.which;\r
+ },\r
+\r
+ /**\r
+ * Gets a number represeting the combination of the keys pressed during the\r
+ * event. It is the sum with the current key code and the {@link CKEDITOR.CTRL},\r
+ * {@link CKEDITOR.SHIFT} and {@link CKEDITOR.ALT} constants.\r
+ * @returns {Number} The number representing the keys combination.\r
+ * @example\r
+ * alert( event.getKeystroke() == 65 ); // "a" key\r
+ * alert( event.getKeystroke() == CKEDITOR.CTRL + 65 ); // CTRL + "a" key\r
+ * alert( event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65 ); // CTRL + SHIFT + "a" key\r
+ */\r
+ getKeystroke : function()\r
+ {\r
+ var keystroke = this.getKey();\r
+\r
+ if ( this.$.ctrlKey || this.$.metaKey )\r
+ keystroke += CKEDITOR.CTRL;\r
+\r
+ if ( this.$.shiftKey )\r
+ keystroke += CKEDITOR.SHIFT;\r
+\r
+ if ( this.$.altKey )\r
+ keystroke += CKEDITOR.ALT;\r
+\r
+ return keystroke;\r
+ },\r
+\r
+ /**\r
+ * Prevents the original behavior of the event to happen. It can optionally\r
+ * stop propagating the event in the event chain.\r
+ * @param {Boolean} [stopPropagation] Stop propagating this event in the\r
+ * event chain.\r
+ * @example\r
+ * var element = CKEDITOR.document.getById( 'myElement' );\r
+ * element.on( 'click', function( ev )\r
+ * {\r
+ * // The DOM event object is passed by the "data" property.\r
+ * var domEvent = ev.data;\r
+ * // Prevent the click to chave any effect in the element.\r
+ * domEvent.preventDefault();\r
+ * });\r
+ */\r
+ preventDefault : function( stopPropagation )\r
+ {\r
+ var $ = this.$;\r
+ if ( $.preventDefault )\r
+ $.preventDefault();\r
+ else\r
+ $.returnValue = false;\r
+\r
+ if ( stopPropagation )\r
+ this.stopPropagation();\r
+ },\r
+\r
+ stopPropagation : function()\r
+ {\r
+ var $ = this.$;\r
+ if ( $.stopPropagation )\r
+ $.stopPropagation();\r
+ else\r
+ $.cancelBubble = true;\r
+ },\r
+\r
+ /**\r
+ * Returns the DOM node where the event was targeted to.\r
+ * @returns {CKEDITOR.dom.node} The target DOM node.\r
+ * @example\r
+ * var element = CKEDITOR.document.getById( 'myElement' );\r
+ * element.on( 'click', function( ev )\r
+ * {\r
+ * // The DOM event object is passed by the "data" property.\r
+ * var domEvent = ev.data;\r
+ * // Add a CSS class to the event target.\r
+ * domEvent.getTarget().addClass( 'clicked' );\r
+ * });\r
+ */\r
+\r
+ getTarget : function()\r
+ {\r
+ var rawNode = this.$.target || this.$.srcElement;\r
+ return rawNode ? new CKEDITOR.dom.node( rawNode ) : null;\r
+ }\r
+};\r
+\r
+/**\r
+ * CTRL key (1000).\r
+ * @constant\r
+ * @example\r
+ */\r
+CKEDITOR.CTRL = 1000;\r
+\r
+/**\r
+ * SHIFT key (2000).\r
+ * @constant\r
+ * @example\r
+ */\r
+CKEDITOR.SHIFT = 2000;\r
+\r
+/**\r
+ * ALT key (4000).\r
+ * @constant\r
+ * @example\r
+ */\r
+CKEDITOR.ALT = 4000;\r