--- /dev/null
+<html>\r
+<head>\r
+ <title>The source code</title>\r
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body onload="prettyPrint();">\r
+ <pre class="prettyprint lang-js">/**\r
+ * @class Ext.EventManager\r
+ */\r
+Ext.apply(Ext.EventManager, function(){\r
+ var resizeEvent, \r
+ resizeTask, \r
+ textEvent, \r
+ textSize,\r
+ D = Ext.lib.Dom,\r
+ E = Ext.lib.Event,\r
+ propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,\r
+ curWidth = 0,\r
+ curHeight = 0,\r
+ // note 1: IE fires ONLY the keydown event on specialkey autorepeat\r
+ // note 2: Safari < 3.1, Gecko (Mac/Linux) & Opera fire only the keypress event on specialkey autorepeat\r
+ // (research done by @Jan Wolter at http://unixpapa.com/js/key.html)\r
+ useKeydown = Ext.isSafari ? \r
+ Ext.num(navigator.userAgent.toLowerCase().match(/version\/(\d+\.\d)/)[1] || 2) >= 3.1 :\r
+ !((Ext.isGecko && !Ext.isWindows) || Ext.isOpera);\r
+ \r
+ return { \r
+ // private\r
+ doResizeEvent: function(){\r
+ var h = D.getViewHeight(),\r
+ w = D.getViewWidth();\r
+ \r
+ //whacky problem in IE where the resize event will fire even though the w/h are the same.\r
+ if(curHeight != h || curWidth != w){\r
+ resizeEvent.fire(curWidth = w, curHeight = h);\r
+ }\r
+ },\r
+ \r
+ <div id="method-Ext.EventManager-onWindowResize"></div>/**\r
+ * Fires when the window is resized and provides resize event buffering (50 milliseconds), passes new viewport width and height to handlers.\r
+ * @param {Function} fn The method the event invokes\r
+ * @param {Object} scope An object that becomes the scope of the handler\r
+ * @param {boolean} options\r
+ */\r
+ onWindowResize : function(fn, scope, options){\r
+ if(!resizeEvent){\r
+ resizeEvent = new Ext.util.Event();\r
+ resizeTask = new Ext.util.DelayedTask(this.doResizeEvent);\r
+ E.on(window, "resize", this.fireWindowResize, this);\r
+ }\r
+ resizeEvent.addListener(fn, scope, options);\r
+ },\r
+ \r
+ // exposed only to allow manual firing\r
+ fireWindowResize : function(){\r
+ if(resizeEvent){\r
+ if((Ext.isIE||Ext.isAir) && resizeTask){\r
+ resizeTask.delay(50);\r
+ }else{\r
+ resizeEvent.fire(D.getViewWidth(), D.getViewHeight());\r
+ }\r
+ }\r
+ },\r
+ \r
+ <div id="method-Ext.EventManager-onTextResize"></div>/**\r
+ * Fires when the user changes the active text size. Handler gets called with 2 params, the old size and the new size.\r
+ * @param {Function} fn The method the event invokes\r
+ * @param {Object} scope An object that becomes the scope of the handler\r
+ * @param {boolean} options\r
+ */\r
+ onTextResize : function(fn, scope, options){\r
+ if(!textEvent){\r
+ textEvent = new Ext.util.Event();\r
+ var textEl = new Ext.Element(document.createElement('div'));\r
+ textEl.dom.className = 'x-text-resize';\r
+ textEl.dom.innerHTML = 'X';\r
+ textEl.appendTo(document.body);\r
+ textSize = textEl.dom.offsetHeight;\r
+ setInterval(function(){\r
+ if(textEl.dom.offsetHeight != textSize){\r
+ textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);\r
+ }\r
+ }, this.textResizeInterval);\r
+ }\r
+ textEvent.addListener(fn, scope, options);\r
+ },\r
+ \r
+ <div id="method-Ext.EventManager-removeResizeListener"></div>/**\r
+ * Removes the passed window resize listener.\r
+ * @param {Function} fn The method the event invokes\r
+ * @param {Object} scope The scope of handler\r
+ */\r
+ removeResizeListener : function(fn, scope){\r
+ if(resizeEvent){\r
+ resizeEvent.removeListener(fn, scope);\r
+ }\r
+ },\r
+ \r
+ // private\r
+ fireResize : function(){\r
+ if(resizeEvent){\r
+ resizeEvent.fire(D.getViewWidth(), D.getViewHeight());\r
+ }\r
+ },\r
+ \r
+ <div id="prop-Ext.EventManager-textResizeInterval"></div>/**\r
+ * The frequency, in milliseconds, to check for text resize events (defaults to 50)\r
+ */\r
+ textResizeInterval : 50,\r
+ \r
+ <div id="prop-Ext.EventManager-ieDeferSrc"></div>/**\r
+ * Url used for onDocumentReady with using SSL (defaults to Ext.SSL_SECURE_URL)\r
+ */\r
+ ieDeferSrc : false,\r
+ \r
+ // protected for use inside the framework\r
+ // detects whether we should use keydown or keypress based on the browser.\r
+ useKeydown: useKeydown\r
+ };\r
+}());\r
+\r
+Ext.EventManager.on = Ext.EventManager.addListener;\r
+\r
+\r
+Ext.apply(Ext.EventObjectImpl.prototype, {\r
+ <div id="prop-Ext.EventManager-BACKSPACE"></div>/** Key constant @type Number */\r
+ BACKSPACE: 8,\r
+ <div id="prop-Ext.EventManager-TAB"></div>/** Key constant @type Number */\r
+ TAB: 9,\r
+ <div id="prop-Ext.EventManager-NUM_CENTER"></div>/** Key constant @type Number */\r
+ NUM_CENTER: 12,\r
+ <div id="prop-Ext.EventManager-ENTER"></div>/** Key constant @type Number */\r
+ ENTER: 13,\r
+ <div id="prop-Ext.EventManager-RETURN"></div>/** Key constant @type Number */\r
+ RETURN: 13,\r
+ <div id="prop-Ext.EventManager-SHIFT"></div>/** Key constant @type Number */\r
+ SHIFT: 16,\r
+ <div id="prop-Ext.EventManager-CTRL"></div>/** Key constant @type Number */\r
+ CTRL: 17,\r
+ CONTROL : 17, // legacy\r
+ <div id="prop-Ext.EventManager-ALT"></div>/** Key constant @type Number */\r
+ ALT: 18,\r
+ <div id="prop-Ext.EventManager-PAUSE"></div>/** Key constant @type Number */\r
+ PAUSE: 19,\r
+ <div id="prop-Ext.EventManager-CAPS_LOCK"></div>/** Key constant @type Number */\r
+ CAPS_LOCK: 20,\r
+ <div id="prop-Ext.EventManager-ESC"></div>/** Key constant @type Number */\r
+ ESC: 27,\r
+ <div id="prop-Ext.EventManager-SPACE"></div>/** Key constant @type Number */\r
+ SPACE: 32,\r
+ <div id="prop-Ext.EventManager-PAGE_UP"></div>/** Key constant @type Number */\r
+ PAGE_UP: 33,\r
+ PAGEUP : 33, // legacy\r
+ <div id="prop-Ext.EventManager-PAGE_DOWN"></div>/** Key constant @type Number */\r
+ PAGE_DOWN: 34,\r
+ PAGEDOWN : 34, // legacy\r
+ <div id="prop-Ext.EventManager-END"></div>/** Key constant @type Number */\r
+ END: 35,\r
+ <div id="prop-Ext.EventManager-HOME"></div>/** Key constant @type Number */\r
+ HOME: 36,\r
+ <div id="prop-Ext.EventManager-LEFT"></div>/** Key constant @type Number */\r
+ LEFT: 37,\r
+ <div id="prop-Ext.EventManager-UP"></div>/** Key constant @type Number */\r
+ UP: 38,\r
+ <div id="prop-Ext.EventManager-RIGHT"></div>/** Key constant @type Number */\r
+ RIGHT: 39,\r
+ <div id="prop-Ext.EventManager-DOWN"></div>/** Key constant @type Number */\r
+ DOWN: 40,\r
+ <div id="prop-Ext.EventManager-PRINT_SCREEN"></div>/** Key constant @type Number */\r
+ PRINT_SCREEN: 44,\r
+ <div id="prop-Ext.EventManager-INSERT"></div>/** Key constant @type Number */\r
+ INSERT: 45,\r
+ <div id="prop-Ext.EventManager-DELETE"></div>/** Key constant @type Number */\r
+ DELETE: 46,\r
+ <div id="prop-Ext.EventManager-ZERO"></div>/** Key constant @type Number */\r
+ ZERO: 48,\r
+ <div id="prop-Ext.EventManager-ONE"></div>/** Key constant @type Number */\r
+ ONE: 49,\r
+ <div id="prop-Ext.EventManager-TWO"></div>/** Key constant @type Number */\r
+ TWO: 50,\r
+ <div id="prop-Ext.EventManager-THREE"></div>/** Key constant @type Number */\r
+ THREE: 51,\r
+ <div id="prop-Ext.EventManager-FOUR"></div>/** Key constant @type Number */\r
+ FOUR: 52,\r
+ <div id="prop-Ext.EventManager-FIVE"></div>/** Key constant @type Number */\r
+ FIVE: 53,\r
+ <div id="prop-Ext.EventManager-SIX"></div>/** Key constant @type Number */\r
+ SIX: 54,\r
+ <div id="prop-Ext.EventManager-SEVEN"></div>/** Key constant @type Number */\r
+ SEVEN: 55,\r
+ <div id="prop-Ext.EventManager-EIGHT"></div>/** Key constant @type Number */\r
+ EIGHT: 56,\r
+ <div id="prop-Ext.EventManager-NINE"></div>/** Key constant @type Number */\r
+ NINE: 57,\r
+ <div id="prop-Ext.EventManager-A"></div>/** Key constant @type Number */\r
+ A: 65,\r
+ <div id="prop-Ext.EventManager-B"></div>/** Key constant @type Number */\r
+ B: 66,\r
+ <div id="prop-Ext.EventManager-C"></div>/** Key constant @type Number */\r
+ C: 67,\r
+ <div id="prop-Ext.EventManager-D"></div>/** Key constant @type Number */\r
+ D: 68,\r
+ <div id="prop-Ext.EventManager-E"></div>/** Key constant @type Number */\r
+ E: 69,\r
+ <div id="prop-Ext.EventManager-F"></div>/** Key constant @type Number */\r
+ F: 70,\r
+ <div id="prop-Ext.EventManager-G"></div>/** Key constant @type Number */\r
+ G: 71,\r
+ <div id="prop-Ext.EventManager-H"></div>/** Key constant @type Number */\r
+ H: 72,\r
+ <div id="prop-Ext.EventManager-I"></div>/** Key constant @type Number */\r
+ I: 73,\r
+ <div id="prop-Ext.EventManager-J"></div>/** Key constant @type Number */\r
+ J: 74,\r
+ <div id="prop-Ext.EventManager-K"></div>/** Key constant @type Number */\r
+ K: 75,\r
+ <div id="prop-Ext.EventManager-L"></div>/** Key constant @type Number */\r
+ L: 76,\r
+ <div id="prop-Ext.EventManager-M"></div>/** Key constant @type Number */\r
+ M: 77,\r
+ <div id="prop-Ext.EventManager-N"></div>/** Key constant @type Number */\r
+ N: 78,\r
+ <div id="prop-Ext.EventManager-O"></div>/** Key constant @type Number */\r
+ O: 79,\r
+ <div id="prop-Ext.EventManager-P"></div>/** Key constant @type Number */\r
+ P: 80,\r
+ <div id="prop-Ext.EventManager-Q"></div>/** Key constant @type Number */\r
+ Q: 81,\r
+ <div id="prop-Ext.EventManager-R"></div>/** Key constant @type Number */\r
+ R: 82,\r
+ <div id="prop-Ext.EventManager-S"></div>/** Key constant @type Number */\r
+ S: 83,\r
+ <div id="prop-Ext.EventManager-T"></div>/** Key constant @type Number */\r
+ T: 84,\r
+ <div id="prop-Ext.EventManager-U"></div>/** Key constant @type Number */\r
+ U: 85,\r
+ <div id="prop-Ext.EventManager-V"></div>/** Key constant @type Number */\r
+ V: 86,\r
+ <div id="prop-Ext.EventManager-W"></div>/** Key constant @type Number */\r
+ W: 87,\r
+ <div id="prop-Ext.EventManager-X"></div>/** Key constant @type Number */\r
+ X: 88,\r
+ <div id="prop-Ext.EventManager-Y"></div>/** Key constant @type Number */\r
+ Y: 89,\r
+ <div id="prop-Ext.EventManager-Z"></div>/** Key constant @type Number */\r
+ Z: 90,\r
+ <div id="prop-Ext.EventManager-CONTEXT_MENU"></div>/** Key constant @type Number */\r
+ CONTEXT_MENU: 93,\r
+ <div id="prop-Ext.EventManager-NUM_ZERO"></div>/** Key constant @type Number */\r
+ NUM_ZERO: 96,\r
+ <div id="prop-Ext.EventManager-NUM_ONE"></div>/** Key constant @type Number */\r
+ NUM_ONE: 97,\r
+ <div id="prop-Ext.EventManager-NUM_TWO"></div>/** Key constant @type Number */\r
+ NUM_TWO: 98,\r
+ <div id="prop-Ext.EventManager-NUM_THREE"></div>/** Key constant @type Number */\r
+ NUM_THREE: 99,\r
+ <div id="prop-Ext.EventManager-NUM_FOUR"></div>/** Key constant @type Number */\r
+ NUM_FOUR: 100,\r
+ <div id="prop-Ext.EventManager-NUM_FIVE"></div>/** Key constant @type Number */\r
+ NUM_FIVE: 101,\r
+ <div id="prop-Ext.EventManager-NUM_SIX"></div>/** Key constant @type Number */\r
+ NUM_SIX: 102,\r
+ <div id="prop-Ext.EventManager-NUM_SEVEN"></div>/** Key constant @type Number */\r
+ NUM_SEVEN: 103,\r
+ <div id="prop-Ext.EventManager-NUM_EIGHT"></div>/** Key constant @type Number */\r
+ NUM_EIGHT: 104,\r
+ <div id="prop-Ext.EventManager-NUM_NINE"></div>/** Key constant @type Number */\r
+ NUM_NINE: 105,\r
+ <div id="prop-Ext.EventManager-NUM_MULTIPLY"></div>/** Key constant @type Number */\r
+ NUM_MULTIPLY: 106,\r
+ <div id="prop-Ext.EventManager-NUM_PLUS"></div>/** Key constant @type Number */\r
+ NUM_PLUS: 107,\r
+ <div id="prop-Ext.EventManager-NUM_MINUS"></div>/** Key constant @type Number */\r
+ NUM_MINUS: 109,\r
+ <div id="prop-Ext.EventManager-NUM_PERIOD"></div>/** Key constant @type Number */\r
+ NUM_PERIOD: 110,\r
+ <div id="prop-Ext.EventManager-NUM_DIVISION"></div>/** Key constant @type Number */\r
+ NUM_DIVISION: 111,\r
+ <div id="prop-Ext.EventManager-F1"></div>/** Key constant @type Number */\r
+ F1: 112,\r
+ <div id="prop-Ext.EventManager-F2"></div>/** Key constant @type Number */\r
+ F2: 113,\r
+ <div id="prop-Ext.EventManager-F3"></div>/** Key constant @type Number */\r
+ F3: 114,\r
+ <div id="prop-Ext.EventManager-F4"></div>/** Key constant @type Number */\r
+ F4: 115,\r
+ <div id="prop-Ext.EventManager-F5"></div>/** Key constant @type Number */\r
+ F5: 116,\r
+ <div id="prop-Ext.EventManager-F6"></div>/** Key constant @type Number */\r
+ F6: 117,\r
+ <div id="prop-Ext.EventManager-F7"></div>/** Key constant @type Number */\r
+ F7: 118,\r
+ <div id="prop-Ext.EventManager-F8"></div>/** Key constant @type Number */\r
+ F8: 119,\r
+ <div id="prop-Ext.EventManager-F9"></div>/** Key constant @type Number */\r
+ F9: 120,\r
+ <div id="prop-Ext.EventManager-F10"></div>/** Key constant @type Number */\r
+ F10: 121,\r
+ <div id="prop-Ext.EventManager-F11"></div>/** Key constant @type Number */\r
+ F11: 122,\r
+ <div id="prop-Ext.EventManager-F12"></div>/** Key constant @type Number */\r
+ F12: 123, \r
+ \r
+ /** @private */\r
+ isNavKeyPress : function(){\r
+ var me = this,\r
+ k = this.normalizeKey(me.keyCode); \r
+ return (k >= 33 && k <= 40) || // Page Up/Down, End, Home, Left, Up, Right, Down\r
+ k == me.RETURN ||\r
+ k == me.TAB ||\r
+ k == me.ESC;\r
+ },\r
+\r
+ isSpecialKey : function(){\r
+ var k = this.normalizeKey(this.keyCode);\r
+ return (this.type == 'keypress' && this.ctrlKey) ||\r
+ this.isNavKeyPress() ||\r
+ (k == this.BACKSPACE) || // Backspace\r
+ (k >= 16 && k <= 20) || // Shift, Ctrl, Alt, Pause, Caps Lock\r
+ (k >= 44 && k <= 45); // Print Screen, Insert\r
+ },\r
+ \r
+ getPoint : function(){\r
+ return new Ext.lib.Point(this.xy[0], this.xy[1]);\r
+ },\r
+\r
+ <div id="method-Ext.EventManager-hasModifier"></div>/**\r
+ * Returns true if the control, meta, shift or alt key was pressed during this event.\r
+ * @return {Boolean}\r
+ */\r
+ hasModifier : function(){\r
+ return ((this.ctrlKey || this.altKey) || this.shiftKey);\r
+ }\r
+});</pre> \r
+</body>\r
+</html>
\ No newline at end of file