Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / source / util / ClickRepeater.js
diff --git a/source/util/ClickRepeater.js b/source/util/ClickRepeater.js
deleted file mode 100644 (file)
index 4565aab..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*\r
- * Ext JS Library 2.2.1\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
- */\r
-\r
-/**\r
- @class Ext.util.ClickRepeater\r
- @extends Ext.util.Observable\r
-\r
- A wrapper class which can be applied to any element. Fires a "click" event while the\r
- mouse is pressed. The interval between firings may be specified in the config but\r
- defaults to 20 milliseconds.\r
-\r
- Optionally, a CSS class may be applied to the element during the time it is pressed.\r
-\r
- @cfg {Mixed} el The element to act as a button.\r
- @cfg {Number} delay The initial delay before the repeating event begins firing.\r
- Similar to an autorepeat key delay.\r
- @cfg {Number} interval The interval between firings of the "click" event. Default 20 ms.\r
- @cfg {String} pressClass A CSS class name to be applied to the element while pressed.\r
- @cfg {Boolean} accelerate True if autorepeating should start slowly and accelerate.\r
-           "interval" and "delay" are ignored.\r
- @cfg {Boolean} preventDefault True to prevent the default click event\r
- @cfg {Boolean} stopDefault True to stop the default click event\r
-\r
- @history\r
-    2007-02-02 jvs Original code contributed by Nige "Animal" White\r
-    2007-02-02 jvs Renamed to ClickRepeater\r
-    2007-02-03 jvs Modifications for FF Mac and Safari\r
-\r
- @constructor\r
- @param {Mixed} el The element to listen on\r
- @param {Object} config\r
- */\r
-Ext.util.ClickRepeater = function(el, config)\r
-{\r
-    this.el = Ext.get(el);\r
-    this.el.unselectable();\r
-\r
-    Ext.apply(this, config);\r
-\r
-    this.addEvents(\r
-    /**\r
-     * @event mousedown\r
-     * Fires when the mouse button is depressed.\r
-     * @param {Ext.util.ClickRepeater} this\r
-     */\r
-        "mousedown",\r
-    /**\r
-     * @event click\r
-     * Fires on a specified interval during the time the element is pressed.\r
-     * @param {Ext.util.ClickRepeater} this\r
-     */\r
-        "click",\r
-    /**\r
-     * @event mouseup\r
-     * Fires when the mouse key is released.\r
-     * @param {Ext.util.ClickRepeater} this\r
-     */\r
-        "mouseup"\r
-    );\r
-\r
-    this.el.on("mousedown", this.handleMouseDown, this);\r
-    if(this.preventDefault || this.stopDefault){\r
-        this.el.on("click", function(e){\r
-            if(this.preventDefault){\r
-                e.preventDefault();\r
-            }\r
-            if(this.stopDefault){\r
-                e.stopEvent();\r
-            }\r
-        }, this);\r
-    }\r
-\r
-    // allow inline handler\r
-    if(this.handler){\r
-        this.on("click", this.handler,  this.scope || this);\r
-    }\r
-\r
-    Ext.util.ClickRepeater.superclass.constructor.call(this);\r
-};\r
-\r
-Ext.extend(Ext.util.ClickRepeater, Ext.util.Observable, {\r
-    interval : 20,\r
-    delay: 250,\r
-    preventDefault : true,\r
-    stopDefault : false,\r
-    timer : 0,\r
-\r
-    // private\r
-    destroy : function() {\r
-        Ext.destroy(this.el);\r
-        this.purgeListeners();\r
-    },\r
-    \r
-    // private\r
-    handleMouseDown : function(){\r
-        clearTimeout(this.timer);\r
-        this.el.blur();\r
-        if(this.pressClass){\r
-            this.el.addClass(this.pressClass);\r
-        }\r
-        this.mousedownTime = new Date();\r
-\r
-        Ext.getDoc().on("mouseup", this.handleMouseUp, this);\r
-        this.el.on("mouseout", this.handleMouseOut, this);\r
-\r
-        this.fireEvent("mousedown", this);\r
-        this.fireEvent("click", this);\r
-\r
-//      Do not honor delay or interval if acceleration wanted.\r
-        if (this.accelerate) {\r
-            this.delay = 400;\r
-           }\r
-        this.timer = this.click.defer(this.delay || this.interval, this);\r
-    },\r
-\r
-    // private\r
-    click : function(){\r
-        this.fireEvent("click", this);\r
-        this.timer = this.click.defer(this.accelerate ?\r
-            this.easeOutExpo(this.mousedownTime.getElapsed(),\r
-                400,\r
-                -390,\r
-                12000) :\r
-            this.interval, this);\r
-    },\r
-\r
-    easeOutExpo : function (t, b, c, d) {\r
-        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;\r
-    },\r
-\r
-    // private\r
-    handleMouseOut : function(){\r
-        clearTimeout(this.timer);\r
-        if(this.pressClass){\r
-            this.el.removeClass(this.pressClass);\r
-        }\r
-        this.el.on("mouseover", this.handleMouseReturn, this);\r
-    },\r
-\r
-    // private\r
-    handleMouseReturn : function(){\r
-        this.el.un("mouseover", this.handleMouseReturn, this);\r
-        if(this.pressClass){\r
-            this.el.addClass(this.pressClass);\r
-        }\r
-        this.click();\r
-    },\r
-\r
-    // private\r
-    handleMouseUp : function(){\r
-        clearTimeout(this.timer);\r
-        this.el.un("mouseover", this.handleMouseReturn, this);\r
-        this.el.un("mouseout", this.handleMouseOut, this);\r
-        Ext.getDoc().un("mouseup", this.handleMouseUp, this);\r
-        this.el.removeClass(this.pressClass);\r
-        this.fireEvent("mouseup", this);\r
-    }\r
-});
\ No newline at end of file