<html>
<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
</head>
<body onload="prettyPrint();">
<pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
+ * Ext JS Library 3.2.2
+ * Copyright(c) 2006-2010 Ext JS, Inc.
* licensing@extjs.com
* http://www.extjs.com/license
*/
@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,
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.
*/
}
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){
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) {
},
// 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);
}
-});</pre>
+});</pre>
</body>
</html>
\ No newline at end of file