+++ /dev/null
-/*\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.ToolTip\r
- * @extends Ext.Tip\r
- * A standard tooltip implementation for providing additional information when hovering over a target element.\r
- * @constructor\r
- * Create a new Tooltip\r
- * @param {Object} config The configuration options\r
- */\r
-Ext.ToolTip = Ext.extend(Ext.Tip, {\r
- /**\r
- * @cfg {Mixed} target The target HTMLElement, Ext.Element or id to associate with this tooltip.\r
- */\r
- /**\r
- * @cfg {Boolean} autoHide True to automatically hide the tooltip after the mouse exits the target element\r
- * or after the {@link #dismissDelay} has expired if set (defaults to true). If {@link closable} = true a close\r
- * tool button will be rendered into the tooltip header.\r
- */\r
- /**\r
- * @cfg {Number} showDelay Delay in milliseconds before the tooltip displays after the mouse enters the\r
- * target element (defaults to 500)\r
- */\r
- showDelay: 500,\r
- /**\r
- * @cfg {Number} hideDelay Delay in milliseconds after the mouse exits the target element but before the\r
- * tooltip actually hides (defaults to 200). Set to 0 for the tooltip to hide immediately.\r
- */\r
- hideDelay: 200,\r
- /**\r
- * @cfg {Number} dismissDelay Delay in milliseconds before the tooltip automatically hides (defaults to 5000).\r
- * To disable automatic hiding, set dismissDelay = 0.\r
- */\r
- dismissDelay: 5000,\r
- /**\r
- * @cfg {Array} mouseOffset An XY offset from the mouse position where the tooltip should be shown (defaults to [15,18]).\r
- */\r
- mouseOffset: [15,18],\r
- /**\r
- * @cfg {Boolean} trackMouse True to have the tooltip follow the mouse as it moves over the target element (defaults to false).\r
- */\r
- trackMouse : false,\r
- constrainPosition: true,\r
-\r
- // private\r
- initComponent: function(){\r
- Ext.ToolTip.superclass.initComponent.call(this);\r
- this.lastActive = new Date();\r
- this.initTarget();\r
- },\r
-\r
- // private\r
- initTarget : function(){\r
- if(this.target){\r
- this.target = Ext.get(this.target);\r
- this.target.on('mouseover', this.onTargetOver, this);\r
- this.target.on('mouseout', this.onTargetOut, this);\r
- this.target.on('mousemove', this.onMouseMove, this);\r
- }\r
- },\r
-\r
- // private\r
- onMouseMove : function(e){\r
- this.targetXY = e.getXY();\r
- if(!this.hidden && this.trackMouse){\r
- this.setPagePosition(this.getTargetXY());\r
- }\r
- },\r
-\r
- // private\r
- getTargetXY : function(){\r
- return [this.targetXY[0]+this.mouseOffset[0], this.targetXY[1]+this.mouseOffset[1]];\r
- },\r
-\r
- // private\r
- onTargetOver : function(e){\r
- if(this.disabled || e.within(this.target.dom, true)){\r
- return;\r
- }\r
- this.clearTimer('hide');\r
- this.targetXY = e.getXY();\r
- this.delayShow();\r
- },\r
-\r
- // private\r
- delayShow : function(){\r
- if(this.hidden && !this.showTimer){\r
- if(this.lastActive.getElapsed() < this.quickShowInterval){\r
- this.show();\r
- }else{\r
- this.showTimer = this.show.defer(this.showDelay, this);\r
- }\r
- }else if(!this.hidden && this.autoHide !== false){\r
- this.show();\r
- }\r
- },\r
-\r
- // private\r
- onTargetOut : function(e){\r
- if(this.disabled || e.within(this.target.dom, true)){\r
- return;\r
- }\r
- this.clearTimer('show');\r
- if(this.autoHide !== false){\r
- this.delayHide();\r
- }\r
- },\r
-\r
- // private\r
- delayHide : function(){\r
- if(!this.hidden && !this.hideTimer){\r
- this.hideTimer = this.hide.defer(this.hideDelay, this);\r
- }\r
- },\r
-\r
- /**\r
- * Hides this tooltip if visible.\r
- */\r
- hide: function(){\r
- this.clearTimer('dismiss');\r
- this.lastActive = new Date();\r
- Ext.ToolTip.superclass.hide.call(this);\r
- },\r
-\r
- /**\r
- * Shows this tooltip at the current event target XY position.\r
- */\r
- show : function(){\r
- this.showAt(this.getTargetXY());\r
- },\r
-\r
- // inherit docs\r
- showAt : function(xy){\r
- this.lastActive = new Date();\r
- this.clearTimers();\r
- Ext.ToolTip.superclass.showAt.call(this, xy);\r
- if(this.dismissDelay && this.autoHide !== false){\r
- this.dismissTimer = this.hide.defer(this.dismissDelay, this);\r
- }\r
- },\r
-\r
- // private\r
- clearTimer : function(name){\r
- name = name + 'Timer';\r
- clearTimeout(this[name]);\r
- delete this[name];\r
- },\r
-\r
- // private\r
- clearTimers : function(){\r
- this.clearTimer('show');\r
- this.clearTimer('dismiss');\r
- this.clearTimer('hide');\r
- },\r
-\r
- // private\r
- onShow : function(){\r
- Ext.ToolTip.superclass.onShow.call(this);\r
- Ext.getDoc().on('mousedown', this.onDocMouseDown, this);\r
- },\r
-\r
- // private\r
- onHide : function(){\r
- Ext.ToolTip.superclass.onHide.call(this);\r
- Ext.getDoc().un('mousedown', this.onDocMouseDown, this);\r
- },\r
-\r
- // private\r
- onDocMouseDown : function(e){\r
- if(this.autoHide !== false && !e.within(this.el.dom)){\r
- this.disable();\r
- this.enable.defer(100, this);\r
- }\r
- },\r
-\r
- // private\r
- onDisable : function(){\r
- this.clearTimers();\r
- this.hide();\r
- },\r
-\r
- // private\r
- adjustPosition : function(x, y){\r
- // keep the position from being under the mouse\r
- var ay = this.targetXY[1], h = this.getSize().height;\r
- if(this.constrainPosition && y <= ay && (y+h) >= ay){\r
- y = ay-h-5;\r
- }\r
- return {x : x, y: y};\r
- },\r
-\r
- // private\r
- onDestroy : function(){\r
- Ext.ToolTip.superclass.onDestroy.call(this);\r
- if(this.target){\r
- this.target.un('mouseover', this.onTargetOver, this);\r
- this.target.un('mouseout', this.onTargetOut, this);\r
- this.target.un('mousemove', this.onMouseMove, this);\r
- }\r
- }\r
-});
\ No newline at end of file