3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.3.1
11 * Copyright(c) 2006-2010 Sencha Inc.
12 * licensing@sencha.com
13 * http://www.sencha.com/license
15 <div id="cls-Ext.Shadow"></div>/**
17 * Simple class that can provide a shadow effect for any element. Note that the element MUST be absolutely positioned,
18 * and the shadow does not provide any shimming. This should be used only in simple cases -- for more advanced
19 * functionality that can also provide the same shadow effect, see the {@link Ext.Layer} class.
22 * @param {Object} config The config object
24 Ext.Shadow = function(config) {
25 Ext.apply(this, config);
26 if (typeof this.mode != "string") {
27 this.mode = this.defaultMode;
33 rad = Math.floor(this.offset / 2);
34 switch (this.mode.toLowerCase()) {
35 // all this hideous nonsense calculates the various offsets for shadows
41 a.l -= this.offset + rad;
42 a.t -= this.offset + rad;
53 a.l -= (this.offset - rad);
54 a.t -= this.offset + rad;
56 a.w -= (this.offset - rad) * 2;
67 a.l -= (this.offset - rad);
68 a.t -= (this.offset - rad);
70 a.w -= (this.offset + rad + 1);
71 a.h -= (this.offset + rad);
80 Ext.Shadow.prototype = {
81 <div id="cfg-Ext.Shadow-mode"></div>/**
83 * The shadow display mode. Supports the following options:<div class="mdetail-params"><ul>
84 * <li><b><tt>sides</tt></b> : Shadow displays on both sides and bottom only</li>
85 * <li><b><tt>frame</tt></b> : Shadow displays equally on all four sides</li>
86 * <li><b><tt>drop</tt></b> : Traditional bottom-right drop shadow</li>
89 <div id="cfg-Ext.Shadow-offset"></div>/**
90 * @cfg {String} offset
91 * The number of pixels to offset the shadow from the element (defaults to <tt>4</tt>)
98 <div id="method-Ext.Shadow-show"></div>/**
99 * Displays the shadow under the target element
100 * @param {Mixed} targetEl The id or element under which the shadow should display
102 show: function(target) {
103 target = Ext.get(target);
105 this.el = Ext.Shadow.Pool.pull();
106 if (this.el.dom.nextSibling != target.dom) {
107 this.el.insertBefore(target);
110 this.el.setStyle("z-index", this.zIndex || parseInt(target.getStyle("z-index"), 10) - 1);
112 this.el.dom.style.filter = "progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius=" + (this.offset) + ")";
115 target.getLeft(true),
120 this.el.dom.style.display = "block";
123 <div id="method-Ext.Shadow-isVisible"></div>/**
124 * Returns true if the shadow is visible, else false
126 isVisible: function() {
127 return this.el ? true: false;
130 <div id="method-Ext.Shadow-realign"></div>/**
131 * Direct alignment when values are already available. Show must be called at least once before
132 * calling this method to ensure it is initialized.
133 * @param {Number} left The target element left position
134 * @param {Number} top The target element top position
135 * @param {Number} width The target element width
136 * @param {Number} height The target element height
138 realign: function(l, t, w, h) {
142 var a = this.adjusts,
152 s.left = (l + a.l) + "px";
153 s.top = (t + a.t) + "px";
154 if (s.width != sws || s.height != shs) {
159 sww = Math.max(0, (sw - 12)) + "px";
160 cn[0].childNodes[1].style.width = sww;
161 cn[1].childNodes[1].style.width = sww;
162 cn[2].childNodes[1].style.width = sww;
163 cn[1].style.height = Math.max(0, (sh - 12)) + "px";
168 <div id="method-Ext.Shadow-hide"></div>/**
173 this.el.dom.style.display = "none";
174 Ext.Shadow.Pool.push(this.el);
179 <div id="method-Ext.Shadow-setZIndex"></div>/**
180 * Adjust the z-index of this shadow
181 * @param {Number} zindex The new z-index
183 setZIndex: function(z) {
186 this.el.setStyle("z-index", z);
191 // Private utility class that manages the internal Shadow cache
192 Ext.Shadow.Pool = function() {
195 '<div class="x-ie-shadow"></div>':
196 '<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>';
201 sh = Ext.get(Ext.DomHelper.insertHtml("beforeBegin", document.body.firstChild, markup));
202 sh.autoBoxAdjust = false;