tvheadend/vendor/ext-3.4.1/docs/source/Shadow.html
Adam Sutton bafcfff42d webui: restructure webui/extjs source files
I want to keep the 3rd-party packages away from the main source
where possible.
2013-06-03 17:11:01 +01:00

216 lines
7.8 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
<script type="text/javascript">
function highlight() {
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
}
</script>
</head>
<body onload="prettyPrint(); highlight();">
<pre class="prettyprint lang-js"><span id='Ext-Shadow-method-constructor'><span id='Ext-Shadow'>/**
</span></span> * @class Ext.Shadow
* Simple class that can provide a shadow effect for any element. Note that the element MUST be absolutely positioned,
* and the shadow does not provide any shimming. This should be used only in simple cases -- for more advanced
* functionality that can also provide the same shadow effect, see the {@link Ext.Layer} class.
* @constructor
* Create a new Shadow
* @param {Object} config The config object
*/
Ext.Shadow = function(config) {
Ext.apply(this, config);
if (typeof this.mode != &quot;string&quot;) {
this.mode = this.defaultMode;
}
var o = this.offset,
a = {
h: 0
},
rad = Math.floor(this.offset / 2);
switch (this.mode.toLowerCase()) {
// all this hideous nonsense calculates the various offsets for shadows
case &quot;drop&quot;:
a.w = 0;
a.l = a.t = o;
a.t -= 1;
if (Ext.isIE9m) {
a.l -= this.offset + rad;
a.t -= this.offset + rad;
a.w -= rad;
a.h -= rad;
a.t += 1;
}
break;
case &quot;sides&quot;:
a.w = (o * 2);
a.l = -o;
a.t = o - 1;
if (Ext.isIE9m) {
a.l -= (this.offset - rad);
a.t -= this.offset + rad;
a.l += 1;
a.w -= (this.offset - rad) * 2;
a.w -= rad + 1;
a.h -= 1;
}
break;
case &quot;frame&quot;:
a.w = a.h = (o * 2);
a.l = a.t = -o;
a.t += 1;
a.h -= 2;
if (Ext.isIE9m) {
a.l -= (this.offset - rad);
a.t -= (this.offset - rad);
a.l += 1;
a.w -= (this.offset + rad + 1);
a.h -= (this.offset + rad);
a.h += 1;
}
break;
};
this.adjusts = a;
};
Ext.Shadow.prototype = {
<span id='Ext-Shadow-cfg-mode'> /**
</span> * @cfg {String} mode
* The shadow display mode. Supports the following options:&lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
* &lt;li&gt;&lt;b&gt;&lt;tt&gt;sides&lt;/tt&gt;&lt;/b&gt; : Shadow displays on both sides and bottom only&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;&lt;tt&gt;frame&lt;/tt&gt;&lt;/b&gt; : Shadow displays equally on all four sides&lt;/li&gt;
* &lt;li&gt;&lt;b&gt;&lt;tt&gt;drop&lt;/tt&gt;&lt;/b&gt; : Traditional bottom-right drop shadow&lt;/li&gt;
* &lt;/ul&gt;&lt;/div&gt;
*/
<span id='Ext-Shadow-cfg-offset'> /**
</span> * @cfg {String} offset
* The number of pixels to offset the shadow from the element (defaults to &lt;tt&gt;4&lt;/tt&gt;)
*/
offset: 4,
// private
defaultMode: &quot;drop&quot;,
<span id='Ext-Shadow-method-show'> /**
</span> * Displays the shadow under the target element
* @param {Mixed} targetEl The id or element under which the shadow should display
*/
show: function(target) {
target = Ext.get(target);
if (!this.el) {
this.el = Ext.Shadow.Pool.pull();
if (this.el.dom.nextSibling != target.dom) {
this.el.insertBefore(target);
}
}
this.el.setStyle(&quot;z-index&quot;, this.zIndex || parseInt(target.getStyle(&quot;z-index&quot;), 10) - 1);
if (Ext.isIE9m) {
this.el.dom.style.filter = &quot;progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius=&quot; + (this.offset) + &quot;)&quot;;
}
this.realign(
target.getLeft(true),
target.getTop(true),
target.getWidth(),
target.getHeight()
);
this.el.dom.style.display = &quot;block&quot;;
},
<span id='Ext-Shadow-method-isVisible'> /**
</span> * Returns true if the shadow is visible, else false
*/
isVisible: function() {
return this.el ? true: false;
},
<span id='Ext-Shadow-method-realign'> /**
</span> * Direct alignment when values are already available. Show must be called at least once before
* calling this method to ensure it is initialized.
* @param {Number} left The target element left position
* @param {Number} top The target element top position
* @param {Number} width The target element width
* @param {Number} height The target element height
*/
realign: function(l, t, w, h) {
if (!this.el) {
return;
}
var a = this.adjusts,
d = this.el.dom,
s = d.style,
iea = 0,
sw = (w + a.w),
sh = (h + a.h),
sws = sw + &quot;px&quot;,
shs = sh + &quot;px&quot;,
cn,
sww;
s.left = (l + a.l) + &quot;px&quot;;
s.top = (t + a.t) + &quot;px&quot;;
if (s.width != sws || s.height != shs) {
s.width = sws;
s.height = shs;
if (!Ext.isIE9m) {
cn = d.childNodes;
sww = Math.max(0, (sw - 12)) + &quot;px&quot;;
cn[0].childNodes[1].style.width = sww;
cn[1].childNodes[1].style.width = sww;
cn[2].childNodes[1].style.width = sww;
cn[1].style.height = Math.max(0, (sh - 12)) + &quot;px&quot;;
}
}
},
<span id='Ext-Shadow-method-hide'> /**
</span> * Hides this shadow
*/
hide: function() {
if (this.el) {
this.el.dom.style.display = &quot;none&quot;;
Ext.Shadow.Pool.push(this.el);
delete this.el;
}
},
<span id='Ext-Shadow-method-setZIndex'> /**
</span> * Adjust the z-index of this shadow
* @param {Number} zindex The new z-index
*/
setZIndex: function(z) {
this.zIndex = z;
if (this.el) {
this.el.setStyle(&quot;z-index&quot;, z);
}
}
};
// Private utility class that manages the internal Shadow cache
Ext.Shadow.Pool = function() {
var p = [],
markup = Ext.isIE9m ?
'&lt;div class=&quot;x-ie-shadow&quot;&gt;&lt;/div&gt;':
'&lt;div class=&quot;x-shadow&quot;&gt;&lt;div class=&quot;xst&quot;&gt;&lt;div class=&quot;xstl&quot;&gt;&lt;/div&gt;&lt;div class=&quot;xstc&quot;&gt;&lt;/div&gt;&lt;div class=&quot;xstr&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;xsc&quot;&gt;&lt;div class=&quot;xsml&quot;&gt;&lt;/div&gt;&lt;div class=&quot;xsmc&quot;&gt;&lt;/div&gt;&lt;div class=&quot;xsmr&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;xsb&quot;&gt;&lt;div class=&quot;xsbl&quot;&gt;&lt;/div&gt;&lt;div class=&quot;xsbc&quot;&gt;&lt;/div&gt;&lt;div class=&quot;xsbr&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;';
return {
pull: function() {
var sh = p.shift();
if (!sh) {
sh = Ext.get(Ext.DomHelper.insertHtml(&quot;beforeBegin&quot;, document.body.firstChild, markup));
sh.autoBoxAdjust = false;
}
return sh;
},
push: function(sh) {
p.push(sh);
}
};
}();</pre>
</body>
</html>