+++ /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.QuickTip\r
- * @extends Ext.ToolTip\r
- * A specialized tooltip class for tooltips that can be specified in markup and automatically managed by the global\r
- * {@link Ext.QuickTips} instance. See the QuickTips class header for additional usage details and examples.\r
- * @constructor\r
- * Create a new Tip\r
- * @param {Object} config The configuration options\r
- */\r
-Ext.QuickTip = Ext.extend(Ext.ToolTip, {\r
- /**\r
- * @cfg {Mixed} target The target HTMLElement, Ext.Element or id to associate with this quicktip (defaults to the document).\r
- */\r
- /**\r
- * @cfg {Boolean} interceptTitles True to automatically use the element's DOM title value if available (defaults to false).\r
- */\r
- interceptTitles : false,\r
-\r
- // private\r
- tagConfig : {\r
- namespace : "ext",\r
- attribute : "qtip",\r
- width : "qwidth",\r
- target : "target",\r
- title : "qtitle",\r
- hide : "hide",\r
- cls : "qclass",\r
- align : "qalign"\r
- },\r
-\r
- // private\r
- initComponent : function(){\r
- this.target = this.target || Ext.getDoc();\r
- this.targets = this.targets || {};\r
- Ext.QuickTip.superclass.initComponent.call(this);\r
- },\r
-\r
- /**\r
- * Configures a new quick tip instance and assigns it to a target element. The following config values are\r
- * supported (for example usage, see the {@link Ext.QuickTips} class header):\r
- * <div class="mdetail-params"><ul>\r
- * <li>autoHide</li>\r
- * <li>cls</li>\r
- * <li>dismissDelay (overrides the singleton value)</li>\r
- * <li>target (required)</li>\r
- * <li>text (required)</li>\r
- * <li>title</li>\r
- * <li>width</li></ul></div>\r
- * @param {Object} config The config object\r
- */\r
- register : function(config){\r
- var cs = Ext.isArray(config) ? config : arguments;\r
- for(var i = 0, len = cs.length; i < len; i++){\r
- var c = cs[i];\r
- var target = c.target;\r
- if(target){\r
- if(Ext.isArray(target)){\r
- for(var j = 0, jlen = target.length; j < jlen; j++){\r
- this.targets[Ext.id(target[j])] = c;\r
- }\r
- } else{\r
- this.targets[Ext.id(target)] = c;\r
- }\r
- }\r
- }\r
- },\r
-\r
- /**\r
- * Removes this quick tip from its element and destroys it.\r
- * @param {String/HTMLElement/Element} el The element from which the quick tip is to be removed.\r
- */\r
- unregister : function(el){\r
- delete this.targets[Ext.id(el)];\r
- },\r
-\r
- // private\r
- onTargetOver : function(e){\r
- if(this.disabled){\r
- return;\r
- }\r
- this.targetXY = e.getXY();\r
- var t = e.getTarget();\r
- if(!t || t.nodeType !== 1 || t == document || t == document.body){\r
- return;\r
- }\r
- if(this.activeTarget && t == this.activeTarget.el){\r
- this.clearTimer('hide');\r
- this.show();\r
- return;\r
- }\r
- if(t && this.targets[t.id]){\r
- this.activeTarget = this.targets[t.id];\r
- this.activeTarget.el = t;\r
- this.delayShow();\r
- return;\r
- }\r
- var ttp, et = Ext.fly(t), cfg = this.tagConfig;\r
- var ns = cfg.namespace;\r
- if(this.interceptTitles && t.title){\r
- ttp = t.title;\r
- t.qtip = ttp;\r
- t.removeAttribute("title");\r
- e.preventDefault();\r
- } else{\r
- ttp = t.qtip || et.getAttributeNS(ns, cfg.attribute);\r
- }\r
- if(ttp){\r
- var autoHide = et.getAttributeNS(ns, cfg.hide);\r
- this.activeTarget = {\r
- el: t,\r
- text: ttp,\r
- width: et.getAttributeNS(ns, cfg.width),\r
- autoHide: autoHide != "user" && autoHide !== 'false',\r
- title: et.getAttributeNS(ns, cfg.title),\r
- cls: et.getAttributeNS(ns, cfg.cls),\r
- align: et.getAttributeNS(ns, cfg.align)\r
- };\r
- this.delayShow();\r
- }\r
- },\r
-\r
- // private\r
- onTargetOut : function(e){\r
- this.clearTimer('show');\r
- if(this.autoHide !== false){\r
- this.delayHide();\r
- }\r
- },\r
-\r
- // inherit docs\r
- showAt : function(xy){\r
- var t = this.activeTarget;\r
- if(t){\r
- if(!this.rendered){\r
- this.render(Ext.getBody());\r
- this.activeTarget = t;\r
- }\r
- if(t.width){\r
- this.setWidth(t.width);\r
- this.body.setWidth(this.adjustBodyWidth(t.width - this.getFrameWidth()));\r
- this.measureWidth = false;\r
- } else{\r
- this.measureWidth = true;\r
- }\r
- this.setTitle(t.title || '');\r
- this.body.update(t.text);\r
- this.autoHide = t.autoHide;\r
- this.dismissDelay = t.dismissDelay || this.dismissDelay;\r
- if(this.lastCls){\r
- this.el.removeClass(this.lastCls);\r
- delete this.lastCls;\r
- }\r
- if(t.cls){\r
- this.el.addClass(t.cls);\r
- this.lastCls = t.cls;\r
- }\r
- if(t.align){ // TODO: this doesn't seem to work consistently\r
- xy = this.el.getAlignToXY(t.el, t.align);\r
- this.constrainPosition = false;\r
- } else{\r
- this.constrainPosition = true;\r
- }\r
- }\r
- Ext.QuickTip.superclass.showAt.call(this, xy);\r
- },\r
-\r
- // inherit docs\r
- hide: function(){\r
- delete this.activeTarget;\r
- Ext.QuickTip.superclass.hide.call(this);\r
- }\r
-});
\ No newline at end of file