--- /dev/null
+/*!
+ * Ext JS Library 3.0.0
+ * Copyright(c) 2006-2009 Ext JS, LLC
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+/**\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
+ /**\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
+ /**\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
+ /**\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
+ /**\r
+ * The frequency, in milliseconds, to check for text resize events (defaults to 50)\r
+ */\r
+ textResizeInterval : 50,\r
+ \r
+ /**\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
+ /** Key constant @type Number */\r
+ BACKSPACE: 8,\r
+ /** Key constant @type Number */\r
+ TAB: 9,\r
+ /** Key constant @type Number */\r
+ NUM_CENTER: 12,\r
+ /** Key constant @type Number */\r
+ ENTER: 13,\r
+ /** Key constant @type Number */\r
+ RETURN: 13,\r
+ /** Key constant @type Number */\r
+ SHIFT: 16,\r
+ /** Key constant @type Number */\r
+ CTRL: 17,\r
+ CONTROL : 17, // legacy\r
+ /** Key constant @type Number */\r
+ ALT: 18,\r
+ /** Key constant @type Number */\r
+ PAUSE: 19,\r
+ /** Key constant @type Number */\r
+ CAPS_LOCK: 20,\r
+ /** Key constant @type Number */\r
+ ESC: 27,\r
+ /** Key constant @type Number */\r
+ SPACE: 32,\r
+ /** Key constant @type Number */\r
+ PAGE_UP: 33,\r
+ PAGEUP : 33, // legacy\r
+ /** Key constant @type Number */\r
+ PAGE_DOWN: 34,\r
+ PAGEDOWN : 34, // legacy\r
+ /** Key constant @type Number */\r
+ END: 35,\r
+ /** Key constant @type Number */\r
+ HOME: 36,\r
+ /** Key constant @type Number */\r
+ LEFT: 37,\r
+ /** Key constant @type Number */\r
+ UP: 38,\r
+ /** Key constant @type Number */\r
+ RIGHT: 39,\r
+ /** Key constant @type Number */\r
+ DOWN: 40,\r
+ /** Key constant @type Number */\r
+ PRINT_SCREEN: 44,\r
+ /** Key constant @type Number */\r
+ INSERT: 45,\r
+ /** Key constant @type Number */\r
+ DELETE: 46,\r
+ /** Key constant @type Number */\r
+ ZERO: 48,\r
+ /** Key constant @type Number */\r
+ ONE: 49,\r
+ /** Key constant @type Number */\r
+ TWO: 50,\r
+ /** Key constant @type Number */\r
+ THREE: 51,\r
+ /** Key constant @type Number */\r
+ FOUR: 52,\r
+ /** Key constant @type Number */\r
+ FIVE: 53,\r
+ /** Key constant @type Number */\r
+ SIX: 54,\r
+ /** Key constant @type Number */\r
+ SEVEN: 55,\r
+ /** Key constant @type Number */\r
+ EIGHT: 56,\r
+ /** Key constant @type Number */\r
+ NINE: 57,\r
+ /** Key constant @type Number */\r
+ A: 65,\r
+ /** Key constant @type Number */\r
+ B: 66,\r
+ /** Key constant @type Number */\r
+ C: 67,\r
+ /** Key constant @type Number */\r
+ D: 68,\r
+ /** Key constant @type Number */\r
+ E: 69,\r
+ /** Key constant @type Number */\r
+ F: 70,\r
+ /** Key constant @type Number */\r
+ G: 71,\r
+ /** Key constant @type Number */\r
+ H: 72,\r
+ /** Key constant @type Number */\r
+ I: 73,\r
+ /** Key constant @type Number */\r
+ J: 74,\r
+ /** Key constant @type Number */\r
+ K: 75,\r
+ /** Key constant @type Number */\r
+ L: 76,\r
+ /** Key constant @type Number */\r
+ M: 77,\r
+ /** Key constant @type Number */\r
+ N: 78,\r
+ /** Key constant @type Number */\r
+ O: 79,\r
+ /** Key constant @type Number */\r
+ P: 80,\r
+ /** Key constant @type Number */\r
+ Q: 81,\r
+ /** Key constant @type Number */\r
+ R: 82,\r
+ /** Key constant @type Number */\r
+ S: 83,\r
+ /** Key constant @type Number */\r
+ T: 84,\r
+ /** Key constant @type Number */\r
+ U: 85,\r
+ /** Key constant @type Number */\r
+ V: 86,\r
+ /** Key constant @type Number */\r
+ W: 87,\r
+ /** Key constant @type Number */\r
+ X: 88,\r
+ /** Key constant @type Number */\r
+ Y: 89,\r
+ /** Key constant @type Number */\r
+ Z: 90,\r
+ /** Key constant @type Number */\r
+ CONTEXT_MENU: 93,\r
+ /** Key constant @type Number */\r
+ NUM_ZERO: 96,\r
+ /** Key constant @type Number */\r
+ NUM_ONE: 97,\r
+ /** Key constant @type Number */\r
+ NUM_TWO: 98,\r
+ /** Key constant @type Number */\r
+ NUM_THREE: 99,\r
+ /** Key constant @type Number */\r
+ NUM_FOUR: 100,\r
+ /** Key constant @type Number */\r
+ NUM_FIVE: 101,\r
+ /** Key constant @type Number */\r
+ NUM_SIX: 102,\r
+ /** Key constant @type Number */\r
+ NUM_SEVEN: 103,\r
+ /** Key constant @type Number */\r
+ NUM_EIGHT: 104,\r
+ /** Key constant @type Number */\r
+ NUM_NINE: 105,\r
+ /** Key constant @type Number */\r
+ NUM_MULTIPLY: 106,\r
+ /** Key constant @type Number */\r
+ NUM_PLUS: 107,\r
+ /** Key constant @type Number */\r
+ NUM_MINUS: 109,\r
+ /** Key constant @type Number */\r
+ NUM_PERIOD: 110,\r
+ /** Key constant @type Number */\r
+ NUM_DIVISION: 111,\r
+ /** Key constant @type Number */\r
+ F1: 112,\r
+ /** Key constant @type Number */\r
+ F2: 113,\r
+ /** Key constant @type Number */\r
+ F3: 114,\r
+ /** Key constant @type Number */\r
+ F4: 115,\r
+ /** Key constant @type Number */\r
+ F5: 116,\r
+ /** Key constant @type Number */\r
+ F6: 117,\r
+ /** Key constant @type Number */\r
+ F7: 118,\r
+ /** Key constant @type Number */\r
+ F8: 119,\r
+ /** Key constant @type Number */\r
+ F9: 120,\r
+ /** Key constant @type Number */\r
+ F10: 121,\r
+ /** Key constant @type Number */\r
+ F11: 122,\r
+ /** 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
+ /**\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
+});
\ No newline at end of file