X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6:/docs/source/ClickRepeater.html diff --git a/docs/source/ClickRepeater.html b/docs/source/ClickRepeater.html index c96196fd..947f8ba7 100644 --- a/docs/source/ClickRepeater.html +++ b/docs/source/ClickRepeater.html @@ -1,12 +1,18 @@ - - - - The source code - - - - -
/** + + + + The source code + + + + +
/*!
+ * Ext JS Library 3.3.1
+ * Copyright(c) 2006-2010 Sencha Inc.
+ * licensing@sencha.com
+ * http://www.sencha.com/license
+ */
+
/** @class Ext.util.ClickRepeater @extends Ext.util.Observable @@ -35,48 +41,51 @@ @param {Mixed} el The element to listen on @param {Object} config */ -Ext.util.ClickRepeater = function(el, config) -{ - this.el = Ext.get(el); - this.el.unselectable(); - - Ext.apply(this, config); - - this.addEvents( - /** - * @event mousedown - * Fires when the mouse button is depressed. - * @param {Ext.util.ClickRepeater} this - */ +Ext.util.ClickRepeater = Ext.extend(Ext.util.Observable, { + + constructor : function(el, config){ + this.el = Ext.get(el); + this.el.unselectable(); + + Ext.apply(this, config); + + this.addEvents( + /** + * @event mousedown + * Fires when the mouse button is depressed. + * @param {Ext.util.ClickRepeater} this + * @param {Ext.EventObject} e + */ "mousedown", - /** - * @event click - * Fires on a specified interval during the time the element is pressed. - * @param {Ext.util.ClickRepeater} this - */ + /** + * @event click + * Fires on a specified interval during the time the element is pressed. + * @param {Ext.util.ClickRepeater} this + * @param {Ext.EventObject} e + */ "click", - /** - * @event mouseup - * Fires when the mouse key is released. - * @param {Ext.util.ClickRepeater} this - */ + /** + * @event mouseup + * Fires when the mouse key is released. + * @param {Ext.util.ClickRepeater} this + * @param {Ext.EventObject} e + */ "mouseup" - ); + ); - if(!this.disabled){ - this.disabled = true; - this.enable(); - } - - // allow inline handler - if(this.handler){ - this.on("click", this.handler, this.scope || this); - } + if(!this.disabled){ + this.disabled = true; + this.enable(); + } - Ext.util.ClickRepeater.superclass.constructor.call(this); -}; + // allow inline handler + if(this.handler){ + this.on("click", this.handler, this.scope || this); + } -Ext.extend(Ext.util.ClickRepeater, Ext.util.Observable, { + Ext.util.ClickRepeater.superclass.constructor.call(this); + }, + interval : 20, delay: 250, preventDefault : true, @@ -89,13 +98,16 @@ Ext.extend(Ext.util.ClickRepeater, Ext.util.Observable, { enable: function(){ if(this.disabled){ this.el.on('mousedown', this.handleMouseDown, this); + if (Ext.isIE){ + this.el.on('dblclick', this.handleDblClick, this); + } if(this.preventDefault || this.stopDefault){ this.el.on('click', this.eventOptions, this); } } this.disabled = false; }, - + /** * Disables the repeater and stops events from firing. */ @@ -110,33 +122,41 @@ Ext.extend(Ext.util.ClickRepeater, Ext.util.Observable, { } this.disabled = true; }, - + /** * Convenience function for setting disabled/enabled by boolean. * @param {Boolean} disabled */ setDisabled: function(disabled){ - this[disabled ? 'disable' : 'enable'](); + this[disabled ? 'disable' : 'enable'](); }, - + eventOptions: function(e){ if(this.preventDefault){ e.preventDefault(); } if(this.stopDefault){ e.stopEvent(); - } + } }, - + // private destroy : function() { this.disable(true); Ext.destroy(this.el); this.purgeListeners(); }, - + + handleDblClick : function(e){ + clearTimeout(this.timer); + this.el.blur(); + + this.fireEvent("mousedown", this, e); + this.fireEvent("click", this, e); + }, + // private - handleMouseDown : function(){ + handleMouseDown : function(e){ clearTimeout(this.timer); this.el.blur(); if(this.pressClass){ @@ -147,25 +167,25 @@ Ext.extend(Ext.util.ClickRepeater, Ext.util.Observable, { Ext.getDoc().on("mouseup", this.handleMouseUp, this); this.el.on("mouseout", this.handleMouseOut, this); - this.fireEvent("mousedown", this); - this.fireEvent("click", this); + this.fireEvent("mousedown", this, e); + this.fireEvent("click", this, e); -// Do not honor delay or interval if acceleration wanted. + // Do not honor delay or interval if acceleration wanted. if (this.accelerate) { this.delay = 400; - } - this.timer = this.click.defer(this.delay || this.interval, this); + } + this.timer = this.click.defer(this.delay || this.interval, this, [e]); }, // private - click : function(){ - this.fireEvent("click", this); + click : function(e){ + this.fireEvent("click", this, e); this.timer = this.click.defer(this.accelerate ? this.easeOutExpo(this.mousedownTime.getElapsed(), 400, -390, 12000) : - this.interval, this); + this.interval, this, [e]); }, easeOutExpo : function (t, b, c, d) { @@ -191,14 +211,14 @@ Ext.extend(Ext.util.ClickRepeater, Ext.util.Observable, { }, // private - handleMouseUp : function(){ + handleMouseUp : function(e){ clearTimeout(this.timer); this.el.un("mouseover", this.handleMouseReturn, this); this.el.un("mouseout", this.handleMouseOut, this); Ext.getDoc().un("mouseup", this.handleMouseUp, this); this.el.removeClass(this.pressClass); - this.fireEvent("mouseup", this); + this.fireEvent("mouseup", this, e); } -});
- +});
+ \ No newline at end of file