+++ /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.Tip\r
- * @extends Ext.Panel\r
- * This is the base class for {@link Ext.QuickTip} and {@link Ext.Tooltip} that provides the basic layout and\r
- * positioning that all tip-based classes require. This class can be used directly for simple, statically-positioned\r
- * tips that are displayed programmatically, or it can be extended to provide custom tip implementations.\r
- * @constructor\r
- * Create a new Tip\r
- * @param {Object} config The configuration options\r
- */\r
-Ext.Tip = Ext.extend(Ext.Panel, {\r
- /**\r
- * @cfg {Boolean} closable True to render a close tool button into the tooltip header (defaults to false).\r
- */\r
- /**\r
- * @cfg {Number} width\r
- * Width in pixels of the tip (defaults to auto). Width will be ignored if it exceeds the bounds of\r
- * {@link #minWidth} or {@link #maxWidth}. The maximum supported value is 500.\r
- */\r
- /**\r
- * @cfg {Number} minWidth The minimum width of the tip in pixels (defaults to 40).\r
- */\r
- minWidth : 40,\r
- /**\r
- * @cfg {Number} maxWidth The maximum width of the tip in pixels (defaults to 300). The maximum supported value is 500.\r
- */\r
- maxWidth : 300,\r
- /**\r
- * @cfg {Boolean/String} shadow True or "sides" for the default effect, "frame" for 4-way shadow, and "drop"\r
- * for bottom-right shadow (defaults to "sides").\r
- */\r
- shadow : "sides",\r
- /**\r
- * @cfg {String} defaultAlign <b>Experimental</b>. The default {@link Ext.Element#alignTo} anchor position value\r
- * for this tip relative to its element of origin (defaults to "tl-bl?").\r
- */\r
- defaultAlign : "tl-bl?",\r
- autoRender: true,\r
- quickShowInterval : 250,\r
-\r
- // private panel overrides\r
- frame:true,\r
- hidden:true,\r
- baseCls: 'x-tip',\r
- floating:{shadow:true,shim:true,useDisplay:true,constrain:false},\r
- autoHeight:true,\r
-\r
- // private\r
- initComponent : function(){\r
- Ext.Tip.superclass.initComponent.call(this);\r
- if(this.closable && !this.title){\r
- this.elements += ',header';\r
- }\r
- },\r
-\r
- // private\r
- afterRender : function(){\r
- Ext.Tip.superclass.afterRender.call(this);\r
- if(this.closable){\r
- this.addTool({\r
- id: 'close',\r
- handler: this.hide,\r
- scope: this\r
- });\r
- }\r
- },\r
-\r
- /**\r
- * Shows this tip at the specified XY position. Example usage:\r
- * <pre><code>\r
-// Show the tip at x:50 and y:100\r
-tip.showAt([50,100]);\r
-</code></pre>\r
- * @param {Array} xy An array containing the x and y coordinates\r
- */\r
- showAt : function(xy){\r
- Ext.Tip.superclass.show.call(this);\r
- if(this.measureWidth !== false && (!this.initialConfig || typeof this.initialConfig.width != 'number')){\r
- this.doAutoWidth();\r
- }\r
- if(this.constrainPosition){\r
- xy = this.el.adjustForConstraints(xy);\r
- }\r
- this.setPagePosition(xy[0], xy[1]);\r
- },\r
-\r
- // protected\r
- doAutoWidth : function(){\r
- var bw = this.body.getTextWidth();\r
- if(this.title){\r
- bw = Math.max(bw, this.header.child('span').getTextWidth(this.title));\r
- }\r
- bw += this.getFrameWidth() + (this.closable ? 20 : 0) + this.body.getPadding("lr");\r
- this.setWidth(bw.constrain(this.minWidth, this.maxWidth));\r
- \r
- // IE7 repaint bug on initial show\r
- if(Ext.isIE7 && !this.repainted){\r
- this.el.repaint();\r
- this.repainted = true;\r
- }\r
- },\r
-\r
- /**\r
- * <b>Experimental</b>. Shows this tip at a position relative to another element using a standard {@link Ext.Element#alignTo}\r
- * anchor position value. Example usage:\r
- * <pre><code>\r
-// Show the tip at the default position ('tl-br?')\r
-tip.showBy('my-el');\r
-\r
-// Show the tip's top-left corner anchored to the element's top-right corner\r
-tip.showBy('my-el', 'tl-tr');\r
-</code></pre>\r
- * @param {Mixed} el An HTMLElement, Ext.Element or string id of the target element to align to\r
- * @param {String} position (optional) A valid {@link Ext.Element#alignTo} anchor position (defaults to 'tl-br?' or\r
- * {@link #defaultAlign} if specified).\r
- */\r
- showBy : function(el, pos){\r
- if(!this.rendered){\r
- this.render(Ext.getBody());\r
- }\r
- this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign));\r
- },\r
-\r
- initDraggable : function(){\r
- this.dd = new Ext.Tip.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable);\r
- this.header.addClass('x-tip-draggable');\r
- }\r
-});\r
-\r
-// private - custom Tip DD implementation\r
-Ext.Tip.DD = function(tip, config){\r
- Ext.apply(this, config);\r
- this.tip = tip;\r
- Ext.Tip.DD.superclass.constructor.call(this, tip.el.id, 'WindowDD-'+tip.id);\r
- this.setHandleElId(tip.header.id);\r
- this.scroll = false;\r
-};\r
-\r
-Ext.extend(Ext.Tip.DD, Ext.dd.DD, {\r
- moveOnly:true,\r
- scroll:false,\r
- headerOffsets:[100, 25],\r
- startDrag : function(){\r
- this.tip.el.disableShadow();\r
- },\r
- endDrag : function(e){\r
- this.tip.el.enableShadow(true);\r
- }\r
-});
\ No newline at end of file