Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / src / widgets / layout / BoxLayout.js
index 75d0526..400f86f 100644 (file)
@@ -1,5 +1,5 @@
 /*!
- * Ext JS Library 3.0.0
+ * Ext JS Library 3.0.3
  * Copyright(c) 2006-2009 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
@@ -42,8 +42,20 @@ Ext.layout.BoxLayout = Ext.extend(Ext.layout.ContainerLayout, {
     defaultMargins : {left:0,top:0,right:0,bottom:0},\r
     /**\r
      * @cfg {String} padding\r
-     * Defaults to <tt>'0'</tt>. Sets the padding to be applied to all child items managed by this\r
-     * container's layout. \r
+     * <p>Sets the padding to be applied to all child items managed by this layout.</p> \r
+     * <p>This property must be specified as a string containing\r
+     * space-separated, numeric padding values. The order of the sides associated\r
+     * with each value matches the way CSS processes padding values:</p>\r
+     * <div class="mdetail-params"><ul>\r
+     * <li>If there is only one value, it applies to all sides.</li>\r
+     * <li>If there are two values, the top and bottom borders are set to the\r
+     * first value and the right and left are set to the second.</li>\r
+     * <li>If there are three values, the top is set to the first value, the left\r
+     * and right are set to the second, and the bottom is set to the third.</li>\r
+     * <li>If there are four values, they apply to the top, right, bottom, and\r
+     * left, respectively.</li>\r
+     * </ul></div>\r
+     * <p>Defaults to: <code>"0"</code></p>\r
      */\r
     padding : '0',\r
     // documented in subclasses\r
@@ -55,6 +67,13 @@ Ext.layout.BoxLayout = Ext.extend(Ext.layout.ContainerLayout, {
     extraCls : 'x-box-item',\r
     ctCls : 'x-box-layout-ct',\r
     innerCls : 'x-box-inner',\r
+    \r
+    constructor : function(config){\r
+        Ext.layout.BoxLayout.superclass.constructor.call(this, config);\r
+        if(Ext.isString(this.defaultMargins)){\r
+            this.defaultMargins = this.parseMargins(this.defaultMargins);\r
+        }\r
+    },\r
 \r
     // private\r
     isValidParent : function(c, target){\r
@@ -78,7 +97,7 @@ Ext.layout.BoxLayout = Ext.extend(Ext.layout.ContainerLayout, {
 \r
     // private\r
     renderItem : function(c){\r
-        if(typeof c.margins == 'string'){\r
+        if(Ext.isString(c.margins)){\r
             c.margins = this.parseMargins(c.margins);\r
         }else if(!c.margins){\r
             c.margins = this.defaultMargins;\r
@@ -109,7 +128,9 @@ Ext.layout.BoxLayout = Ext.extend(Ext.layout.ContainerLayout, {
 /**\r
  * @class Ext.layout.VBoxLayout\r
  * @extends Ext.layout.BoxLayout\r
- * A layout that arranges items vertically\r
+ * <p>A layout that arranges items vertically down a Container. This layout optionally divides available vertical\r
+ * space between child items containing a numeric <code>flex</code> configuration.</p>\r
+ * This layout may also be used to set the widths of child items by configuring it with the {@link #align} option.\r
  */\r
 Ext.layout.VBoxLayout = Ext.extend(Ext.layout.BoxLayout, {\r
     /**\r
@@ -157,8 +178,8 @@ Ext.layout.VBoxLayout = Ext.extend(Ext.layout.BoxLayout, {
         \r
         var cs = this.getItems(ct), cm, ch, margin,\r
             size = this.getTargetSize(target),\r
-            w = size.width - target.getPadding('lr') - this.scrollOffset,\r
-            h = size.height - target.getPadding('tb'),\r
+            w = size.width - target.getPadding('lr'),\r
+            h = size.height - target.getPadding('tb') - this.scrollOffset,\r
             l = this.padding.left, t = this.padding.top,\r
             isStart = this.pack == 'start',\r
             isRestore = ['stretch', 'stretchmax'].indexOf(this.align) == -1,\r
@@ -264,7 +285,9 @@ Ext.Container.LAYOUTS.vbox = Ext.layout.VBoxLayout;
 /**\r
  * @class Ext.layout.HBoxLayout\r
  * @extends Ext.layout.BoxLayout\r
- * A layout that arranges items horizontally\r
+ * <p>A layout that arranges items horizontally across a Container. This layout optionally divides available horizontal\r
+ * space between child items containing a numeric <code>flex</code> configuration.</p>\r
+ * This layout may also be used to set the heights of child items by configuring it with the {@link #align} option.\r
  */\r
 Ext.layout.HBoxLayout = Ext.extend(Ext.layout.BoxLayout, {\r
     /**\r