X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/src/widgets/layout/BoxLayout.js diff --git a/src/widgets/layout/BoxLayout.js b/src/widgets/layout/BoxLayout.js index 75d0526f..400f86f4 100644 --- a/src/widgets/layout/BoxLayout.js +++ b/src/widgets/layout/BoxLayout.js @@ -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}, /** * @cfg {String} padding - * Defaults to '0'. Sets the padding to be applied to all child items managed by this - * container's layout. + *

Sets the padding to be applied to all child items managed by this layout.

+ *

This property must be specified as a string containing + * space-separated, numeric padding values. The order of the sides associated + * with each value matches the way CSS processes padding values:

+ *
+ *

Defaults to: "0"

*/ padding : '0', // documented in subclasses @@ -55,6 +67,13 @@ Ext.layout.BoxLayout = Ext.extend(Ext.layout.ContainerLayout, { extraCls : 'x-box-item', ctCls : 'x-box-layout-ct', innerCls : 'x-box-inner', + + constructor : function(config){ + Ext.layout.BoxLayout.superclass.constructor.call(this, config); + if(Ext.isString(this.defaultMargins)){ + this.defaultMargins = this.parseMargins(this.defaultMargins); + } + }, // private isValidParent : function(c, target){ @@ -78,7 +97,7 @@ Ext.layout.BoxLayout = Ext.extend(Ext.layout.ContainerLayout, { // private renderItem : function(c){ - if(typeof c.margins == 'string'){ + if(Ext.isString(c.margins)){ c.margins = this.parseMargins(c.margins); }else if(!c.margins){ c.margins = this.defaultMargins; @@ -109,7 +128,9 @@ Ext.layout.BoxLayout = Ext.extend(Ext.layout.ContainerLayout, { /** * @class Ext.layout.VBoxLayout * @extends Ext.layout.BoxLayout - * A layout that arranges items vertically + *

A layout that arranges items vertically down a Container. This layout optionally divides available vertical + * space between child items containing a numeric flex configuration.

+ * This layout may also be used to set the widths of child items by configuring it with the {@link #align} option. */ Ext.layout.VBoxLayout = Ext.extend(Ext.layout.BoxLayout, { /** @@ -157,8 +178,8 @@ Ext.layout.VBoxLayout = Ext.extend(Ext.layout.BoxLayout, { var cs = this.getItems(ct), cm, ch, margin, size = this.getTargetSize(target), - w = size.width - target.getPadding('lr') - this.scrollOffset, - h = size.height - target.getPadding('tb'), + w = size.width - target.getPadding('lr'), + h = size.height - target.getPadding('tb') - this.scrollOffset, l = this.padding.left, t = this.padding.top, isStart = this.pack == 'start', isRestore = ['stretch', 'stretchmax'].indexOf(this.align) == -1, @@ -264,7 +285,9 @@ Ext.Container.LAYOUTS.vbox = Ext.layout.VBoxLayout; /** * @class Ext.layout.HBoxLayout * @extends Ext.layout.BoxLayout - * A layout that arranges items horizontally + *

A layout that arranges items horizontally across a Container. This layout optionally divides available horizontal + * space between child items containing a numeric flex configuration.

+ * This layout may also be used to set the heights of child items by configuring it with the {@link #align} option. */ Ext.layout.HBoxLayout = Ext.extend(Ext.layout.BoxLayout, { /**