+++ /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.Shadow\r
- * Simple class that can provide a shadow effect for any element. Note that the element MUST be absolutely positioned,\r
- * and the shadow does not provide any shimming. This should be used only in simple cases -- for more advanced\r
- * functionality that can also provide the same shadow effect, see the {@link Ext.Layer} class.\r
- * @constructor\r
- * Create a new Shadow\r
- * @param {Object} config The config object\r
- */\r
-Ext.Shadow = function(config){\r
- Ext.apply(this, config);\r
- if(typeof this.mode != "string"){\r
- this.mode = this.defaultMode;\r
- }\r
- var o = this.offset, a = {h: 0};\r
- var rad = Math.floor(this.offset/2);\r
- switch(this.mode.toLowerCase()){ // all this hideous nonsense calculates the various offsets for shadows\r
- case "drop":\r
- a.w = 0;\r
- a.l = a.t = o;\r
- a.t -= 1;\r
- if(Ext.isIE){\r
- a.l -= this.offset + rad;\r
- a.t -= this.offset + rad;\r
- a.w -= rad;\r
- a.h -= rad;\r
- a.t += 1;\r
- }\r
- break;\r
- case "sides":\r
- a.w = (o*2);\r
- a.l = -o;\r
- a.t = o-1;\r
- if(Ext.isIE){\r
- a.l -= (this.offset - rad);\r
- a.t -= this.offset + rad;\r
- a.l += 1;\r
- a.w -= (this.offset - rad)*2;\r
- a.w -= rad + 1;\r
- a.h -= 1;\r
- }\r
- break;\r
- case "frame":\r
- a.w = a.h = (o*2);\r
- a.l = a.t = -o;\r
- a.t += 1;\r
- a.h -= 2;\r
- if(Ext.isIE){\r
- a.l -= (this.offset - rad);\r
- a.t -= (this.offset - rad);\r
- a.l += 1;\r
- a.w -= (this.offset + rad + 1);\r
- a.h -= (this.offset + rad);\r
- a.h += 1;\r
- }\r
- break;\r
- };\r
-\r
- this.adjusts = a;\r
-};\r
-\r
-Ext.Shadow.prototype = {\r
- /**\r
- * @cfg {String} mode\r
- * The shadow display mode. Supports the following options:<br />\r
- * sides: Shadow displays on both sides and bottom only<br />\r
- * frame: Shadow displays equally on all four sides<br />\r
- * drop: Traditional bottom-right drop shadow (default)\r
- */\r
- /**\r
- * @cfg {String} offset\r
- * The number of pixels to offset the shadow from the element (defaults to 4)\r
- */\r
- offset: 4,\r
-\r
- // private\r
- defaultMode: "drop",\r
-\r
- /**\r
- * Displays the shadow under the target element\r
- * @param {Mixed} targetEl The id or element under which the shadow should display\r
- */\r
- show : function(target){\r
- target = Ext.get(target);\r
- if(!this.el){\r
- this.el = Ext.Shadow.Pool.pull();\r
- if(this.el.dom.nextSibling != target.dom){\r
- this.el.insertBefore(target);\r
- }\r
- }\r
- this.el.setStyle("z-index", this.zIndex || parseInt(target.getStyle("z-index"), 10)-1);\r
- if(Ext.isIE){\r
- this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")";\r
- }\r
- this.realign(\r
- target.getLeft(true),\r
- target.getTop(true),\r
- target.getWidth(),\r
- target.getHeight()\r
- );\r
- this.el.dom.style.display = "block";\r
- },\r
-\r
- /**\r
- * Returns true if the shadow is visible, else false\r
- */\r
- isVisible : function(){\r
- return this.el ? true : false; \r
- },\r
-\r
- /**\r
- * Direct alignment when values are already available. Show must be called at least once before\r
- * calling this method to ensure it is initialized.\r
- * @param {Number} left The target element left position\r
- * @param {Number} top The target element top position\r
- * @param {Number} width The target element width\r
- * @param {Number} height The target element height\r
- */\r
- realign : function(l, t, w, h){\r
- if(!this.el){\r
- return;\r
- }\r
- var a = this.adjusts, d = this.el.dom, s = d.style;\r
- var iea = 0;\r
- s.left = (l+a.l)+"px";\r
- s.top = (t+a.t)+"px";\r
- var sw = (w+a.w), sh = (h+a.h), sws = sw +"px", shs = sh + "px";\r
- if(s.width != sws || s.height != shs){\r
- s.width = sws;\r
- s.height = shs;\r
- if(!Ext.isIE){\r
- var cn = d.childNodes;\r
- var sww = Math.max(0, (sw-12))+"px";\r
- cn[0].childNodes[1].style.width = sww;\r
- cn[1].childNodes[1].style.width = sww;\r
- cn[2].childNodes[1].style.width = sww;\r
- cn[1].style.height = Math.max(0, (sh-12))+"px";\r
- }\r
- }\r
- },\r
-\r
- /**\r
- * Hides this shadow\r
- */\r
- hide : function(){\r
- if(this.el){\r
- this.el.dom.style.display = "none";\r
- Ext.Shadow.Pool.push(this.el);\r
- delete this.el;\r
- }\r
- },\r
-\r
- /**\r
- * Adjust the z-index of this shadow\r
- * @param {Number} zindex The new z-index\r
- */\r
- setZIndex : function(z){\r
- this.zIndex = z;\r
- if(this.el){\r
- this.el.setStyle("z-index", z);\r
- }\r
- }\r
-};\r
-\r
-// Private utility class that manages the internal Shadow cache\r
-Ext.Shadow.Pool = function(){\r
- var p = [];\r
- var markup = Ext.isIE ?\r
- '<div class="x-ie-shadow"></div>' :\r
- '<div class="x-shadow"><div class="xst"><div class="xstl"></div><div class="xstc"></div><div class="xstr"></div></div><div class="xsc"><div class="xsml"></div><div class="xsmc"></div><div class="xsmr"></div></div><div class="xsb"><div class="xsbl"></div><div class="xsbc"></div><div class="xsbr"></div></div></div>';\r
- return {\r
- pull : function(){\r
- var sh = p.shift();\r
- if(!sh){\r
- sh = Ext.get(Ext.DomHelper.insertHtml("beforeBegin", document.body.firstChild, markup));\r
- sh.autoBoxAdjust = false;\r
- }\r
- return sh;\r
- },\r
-\r
- push : function(sh){\r
- p.push(sh);\r
- }\r
- };\r
-}();
\ No newline at end of file