-<html>\r
-<head>\r
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> \r
- <title>The source code</title>\r
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body onload="prettyPrint();">\r
- <pre class="prettyprint lang-js">/**\r
- * @class Ext.Element\r
- */\r
-Ext.Element.addMethods({\r
- <div id="method-Ext.Element-setBox"></div>/**\r
- * Sets the element's box. Use getBox() on another element to get a box obj. If animate is true then width, height, x and y will be animated concurrently.\r
- * @param {Object} box The box to fill {x, y, width, height}\r
- * @param {Boolean} adjust (optional) Whether to adjust for box-model issues automatically\r
- * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object\r
- * @return {Ext.Element} this\r
- */\r
- setBox : function(box, adjust, animate){\r
- var me = this,\r
- w = box.width, \r
- h = box.height;\r
- if((adjust && !me.autoBoxAdjust) && !me.isBorderBox()){\r
- w -= (me.getBorderWidth("lr") + me.getPadding("lr"));\r
- h -= (me.getBorderWidth("tb") + me.getPadding("tb"));\r
- }\r
- me.setBounds(box.x, box.y, w, h, me.animTest.call(me, arguments, animate, 2));\r
- return me;\r
- },\r
-\r
- <div id="method-Ext.Element-getBox"></div>/**\r
- * Return an object defining the area of this Element which can be passed to {@link #setBox} to\r
- * set another Element's size/location to match this element.\r
- * @param {Boolean} contentBox (optional) If true a box for the content of the element is returned.\r
- * @param {Boolean} local (optional) If true the element's left and top are returned instead of page x/y.\r
- * @return {Object} box An object in the format<pre><code>\r
-{\r
- x: <Element's X position>,\r
- y: <Element's Y position>,\r
- width: <Element's width>,\r
- height: <Element's height>,\r
- bottom: <Element's lower bound>,\r
- right: <Element's rightmost bound>\r
-}\r
-</code></pre>\r
- * The returned object may also be addressed as an Array where index 0 contains the X position\r
- * and index 1 contains the Y position. So the result may also be used for {@link #setXY}\r
- */\r
- getBox : function(contentBox, local) { \r
- var me = this,\r
- xy,\r
- left,\r
- top,\r
- getBorderWidth = me.getBorderWidth,\r
- getPadding = me.getPadding, \r
- l,\r
- r,\r
- t,\r
- b;\r
- if(!local){\r
- xy = me.getXY();\r
- }else{\r
- left = parseInt(me.getStyle("left"), 10) || 0;\r
- top = parseInt(me.getStyle("top"), 10) || 0;\r
- xy = [left, top];\r
- }\r
- var el = me.dom, w = el.offsetWidth, h = el.offsetHeight, bx;\r
- if(!contentBox){\r
- bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h};\r
- }else{\r
- l = getBorderWidth.call(me, "l") + getPadding.call(me, "l");\r
- r = getBorderWidth.call(me, "r") + getPadding.call(me, "r");\r
- t = getBorderWidth.call(me, "t") + getPadding.call(me, "t");\r
- b = getBorderWidth.call(me, "b") + getPadding.call(me, "b");\r
- bx = {x: xy[0]+l, y: xy[1]+t, 0: xy[0]+l, 1: xy[1]+t, width: w-(l+r), height: h-(t+b)};\r
- }\r
- bx.right = bx.x + bx.width;\r
- bx.bottom = bx.y + bx.height;\r
- return bx;\r
- },\r
- \r
- <div id="method-Ext.Element-move"></div>/**\r
- * Move this element relative to its current position.\r
- * @param {String} direction Possible values are: "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").\r
- * @param {Number} distance How far to move the element in pixels\r
- * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object\r
- * @return {Ext.Element} this\r
- */\r
- move : function(direction, distance, animate){\r
- var me = this, \r
- xy = me.getXY(),\r
- x = xy[0],\r
- y = xy[1], \r
- left = [x - distance, y],\r
- right = [x + distance, y],\r
- top = [x, y - distance],\r
- bottom = [x, y + distance],\r
- hash = {\r
- l : left,\r
- left : left,\r
- r : right,\r
- right : right,\r
- t : top,\r
- top : top,\r
- up : top,\r
- b : bottom, \r
- bottom : bottom,\r
- down : bottom \r
- };\r
- \r
- direction = direction.toLowerCase(); \r
- me.moveTo(hash[direction][0], hash[direction][1], me.animTest.call(me, arguments, animate, 2));\r
- },\r
- \r
- <div id="method-Ext.Element-setLeftTop"></div>/**\r
- * Quick set left and top adding default units\r
- * @param {String} left The left CSS property value\r
- * @param {String} top The top CSS property value\r
- * @return {Ext.Element} this\r
- */\r
- setLeftTop : function(left, top){\r
- var me = this,\r
- style = me.dom.style;\r
- style.left = me.addUnits(left);\r
- style.top = me.addUnits(top);\r
- return me;\r
- },\r
- \r
- <div id="method-Ext.Element-getRegion"></div>/**\r
- * Returns the region of the given element.\r
- * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).\r
- * @return {Region} A Ext.lib.Region containing "top, left, bottom, right" member data.\r
- */\r
- getRegion : function(){\r
- return Ext.lib.Dom.getRegion(this.dom);\r
- },\r
- \r
- <div id="method-Ext.Element-setBounds"></div>/**\r
- * Sets the element's position and size in one shot. If animation is true then width, height, x and y will be animated concurrently.\r
- * @param {Number} x X value for new position (coordinates are page-based)\r
- * @param {Number} y Y value for new position (coordinates are page-based)\r
- * @param {Mixed} width The new width. This may be one of:<div class="mdetail-params"><ul>\r
- * <li>A Number specifying the new width in this Element's {@link #defaultUnit}s (by default, pixels)</li>\r
- * <li>A String used to set the CSS width style. Animation may <b>not</b> be used.\r
- * </ul></div>\r
- * @param {Mixed} height The new height. This may be one of:<div class="mdetail-params"><ul>\r
- * <li>A Number specifying the new height in this Element's {@link #defaultUnit}s (by default, pixels)</li>\r
- * <li>A String used to set the CSS height style. Animation may <b>not</b> be used.</li>\r
- * </ul></div>\r
- * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object\r
- * @return {Ext.Element} this\r
- */\r
- setBounds : function(x, y, width, height, animate){\r
- var me = this;\r
- if (!animate || !me.anim) {\r
- me.setSize(width, height);\r
- me.setLocation(x, y);\r
- } else {\r
- me.anim({points: {to: [x, y]}, \r
- width: {to: me.adjustWidth(width)}, \r
- height: {to: me.adjustHeight(height)}},\r
- me.preanim(arguments, 4), \r
- 'motion');\r
- }\r
- return me;\r
- },\r
-\r
- <div id="method-Ext.Element-setRegion"></div>/**\r
- * Sets the element's position and size the specified region. If animation is true then width, height, x and y will be animated concurrently.\r
- * @param {Ext.lib.Region} region The region to fill\r
- * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object\r
- * @return {Ext.Element} this\r
- */\r
- setRegion : function(region, animate) {\r
- return this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.animTest.call(this, arguments, animate, 1));\r
- }\r
-});</pre> \r
-</body>\r
+<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>
+</head>
+<body onload="prettyPrint();">
+ <pre class="prettyprint lang-js">/*!
+ * Ext JS Library 3.2.0
+ * Copyright(c) 2006-2010 Ext JS, Inc.
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+/**
+ * @class Ext.Element
+ */
+Ext.Element.addMethods({
+ <div id="method-Ext.Element-setBox"></div>/**
+ * Sets the element's box. Use getBox() on another element to get a box obj. If animate is true then width, height, x and y will be animated concurrently.
+ * @param {Object} box The box to fill {x, y, width, height}
+ * @param {Boolean} adjust (optional) Whether to adjust for box-model issues automatically
+ * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+ * @return {Ext.Element} this
+ */
+ setBox : function(box, adjust, animate){
+ var me = this,
+ w = box.width,
+ h = box.height;
+ if((adjust && !me.autoBoxAdjust) && !me.isBorderBox()){
+ w -= (me.getBorderWidth("lr") + me.getPadding("lr"));
+ h -= (me.getBorderWidth("tb") + me.getPadding("tb"));
+ }
+ me.setBounds(box.x, box.y, w, h, me.animTest.call(me, arguments, animate, 2));
+ return me;
+ },
+
+ <div id="method-Ext.Element-getBox"></div>/**
+ * Return an object defining the area of this Element which can be passed to {@link #setBox} to
+ * set another Element's size/location to match this element.
+ * @param {Boolean} contentBox (optional) If true a box for the content of the element is returned.
+ * @param {Boolean} local (optional) If true the element's left and top are returned instead of page x/y.
+ * @return {Object} box An object in the format<pre><code>
+{
+ x: <Element's X position>,
+ y: <Element's Y position>,
+ width: <Element's width>,
+ height: <Element's height>,
+ bottom: <Element's lower bound>,
+ right: <Element's rightmost bound>
+}
+</code></pre>
+ * The returned object may also be addressed as an Array where index 0 contains the X position
+ * and index 1 contains the Y position. So the result may also be used for {@link #setXY}
+ */
+ getBox : function(contentBox, local) {
+ var me = this,
+ xy,
+ left,
+ top,
+ getBorderWidth = me.getBorderWidth,
+ getPadding = me.getPadding,
+ l,
+ r,
+ t,
+ b;
+ if(!local){
+ xy = me.getXY();
+ }else{
+ left = parseInt(me.getStyle("left"), 10) || 0;
+ top = parseInt(me.getStyle("top"), 10) || 0;
+ xy = [left, top];
+ }
+ var el = me.dom, w = el.offsetWidth, h = el.offsetHeight, bx;
+ if(!contentBox){
+ bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h};
+ }else{
+ l = getBorderWidth.call(me, "l") + getPadding.call(me, "l");
+ r = getBorderWidth.call(me, "r") + getPadding.call(me, "r");
+ t = getBorderWidth.call(me, "t") + getPadding.call(me, "t");
+ b = getBorderWidth.call(me, "b") + getPadding.call(me, "b");
+ bx = {x: xy[0]+l, y: xy[1]+t, 0: xy[0]+l, 1: xy[1]+t, width: w-(l+r), height: h-(t+b)};
+ }
+ bx.right = bx.x + bx.width;
+ bx.bottom = bx.y + bx.height;
+ return bx;
+ },
+
+ <div id="method-Ext.Element-move"></div>/**
+ * Move this element relative to its current position.
+ * @param {String} direction Possible values are: "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").
+ * @param {Number} distance How far to move the element in pixels
+ * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+ * @return {Ext.Element} this
+ */
+ move : function(direction, distance, animate){
+ var me = this,
+ xy = me.getXY(),
+ x = xy[0],
+ y = xy[1],
+ left = [x - distance, y],
+ right = [x + distance, y],
+ top = [x, y - distance],
+ bottom = [x, y + distance],
+ hash = {
+ l : left,
+ left : left,
+ r : right,
+ right : right,
+ t : top,
+ top : top,
+ up : top,
+ b : bottom,
+ bottom : bottom,
+ down : bottom
+ };
+
+ direction = direction.toLowerCase();
+ me.moveTo(hash[direction][0], hash[direction][1], me.animTest.call(me, arguments, animate, 2));
+ },
+
+ <div id="method-Ext.Element-setLeftTop"></div>/**
+ * Quick set left and top adding default units
+ * @param {String} left The left CSS property value
+ * @param {String} top The top CSS property value
+ * @return {Ext.Element} this
+ */
+ setLeftTop : function(left, top){
+ var me = this,
+ style = me.dom.style;
+ style.left = me.addUnits(left);
+ style.top = me.addUnits(top);
+ return me;
+ },
+
+ <div id="method-Ext.Element-getRegion"></div>/**
+ * Returns the region of the given element.
+ * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
+ * @return {Region} A Ext.lib.Region containing "top, left, bottom, right" member data.
+ */
+ getRegion : function(){
+ return Ext.lib.Dom.getRegion(this.dom);
+ },
+
+ <div id="method-Ext.Element-setBounds"></div>/**
+ * Sets the element's position and size in one shot. If animation is true then width, height, x and y will be animated concurrently.
+ * @param {Number} x X value for new position (coordinates are page-based)
+ * @param {Number} y Y value for new position (coordinates are page-based)
+ * @param {Mixed} width The new width. This may be one of:<div class="mdetail-params"><ul>
+ * <li>A Number specifying the new width in this Element's {@link #defaultUnit}s (by default, pixels)</li>
+ * <li>A String used to set the CSS width style. Animation may <b>not</b> be used.
+ * </ul></div>
+ * @param {Mixed} height The new height. This may be one of:<div class="mdetail-params"><ul>
+ * <li>A Number specifying the new height in this Element's {@link #defaultUnit}s (by default, pixels)</li>
+ * <li>A String used to set the CSS height style. Animation may <b>not</b> be used.</li>
+ * </ul></div>
+ * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+ * @return {Ext.Element} this
+ */
+ setBounds : function(x, y, width, height, animate){
+ var me = this;
+ if (!animate || !me.anim) {
+ me.setSize(width, height);
+ me.setLocation(x, y);
+ } else {
+ me.anim({points: {to: [x, y]},
+ width: {to: me.adjustWidth(width)},
+ height: {to: me.adjustHeight(height)}},
+ me.preanim(arguments, 4),
+ 'motion');
+ }
+ return me;
+ },
+
+ <div id="method-Ext.Element-setRegion"></div>/**
+ * Sets the element's position and size the specified region. If animation is true then width, height, x and y will be animated concurrently.
+ * @param {Ext.lib.Region} region The region to fill
+ * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+ * @return {Ext.Element} this
+ */
+ setRegion : function(region, animate) {
+ return this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.animTest.call(this, arguments, animate, 1));
+ }
+});</pre>
+</body>
</html>
\ No newline at end of file