1 X.UI.Layout.Vertical = X.UI.Layout.create( {
\r
3 name : 'VerticalLayout',
\r
5 overrideAttrsForSelf : {
\r
7 role : [ 0, X.UI.Dirty.CLEAN, X.UI.Attr.USER.UINODE, X.UI.Attr.Type.INIT_ONLY | X.UI.Attr.Type.LIST, 'none,chrome,container' ],
\r
8 childWidth : [ X.UI.Attr.AUTO, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.AUTO ],
\r
9 childHeight : [ X.UI.Attr.AUTO, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT | X.UI.Attr.Type.AUTO ],
\r
10 gapY : [ 0, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH ]
\r
13 overrideAttrsForChild : {
\r
20 calculate : function( data, isNeedsDetection, x, y, w, h ){
\r
21 var attrs = data.attrObject || data.attrClass.prototype,
\r
22 uinodes = data.uinodes,
\r
23 l = uinodes && uinodes.length,
\r
24 childW, childH, gapY,
\r
25 i, _x, _y, _w, node,
\r
26 contentW, contentH, autoW, autoH, detectionPhase;
\r
28 data.preMesure( w, h );
\r
30 contentW = data.contentWidth;
\r
31 contentH = data.contentHeight;
\r
32 autoW = contentW === X.UI.Attr.AUTO;
\r
33 autoH = contentH === X.UI.Attr.AUTO;
\r
34 detectionPhase = autoW || autoH;
\r
35 gapY = _AbstractUINode.calcValue( attrs[ data.supportAttrs.gapY.No ], contentH );
\r
36 childW = _AbstractUINode.calcValue( attrs[ data.supportAttrs.childWidth.No ], contentW );
\r
37 childH = _AbstractUINode.calcValue( attrs[ data.supportAttrs.childHeight.No ], contentH );
\r
43 for( i = 0; i < l; ++i ){
\r
44 node = uinodes[ i ];
\r
45 node.calculate( detectionPhase, _x, _y, contentW, childH );
\r
46 _y += node.boxHeight + gapY;
\r
49 w = node.boxWidth !== X.UI.Attr.AUTO ?
\r
51 node.minBoxWidth !== X.UI.Attr.AUTO ?
\r
52 node.minBoxWidth : 0;
\r
53 if( _w < w ) _w = w;
\r
58 _y = data.minContentHeight !== X.UI.Attr.AUTO ? data.minContentHeight : 0;
\r
61 if( detectionPhase ){
\r
62 if( autoW ) data.contentWidth = _w;
\r
63 if( autoH ) data.contentHeight = _y;
\r
66 //data.postMesure();
\r
69 !isNeedsDetection && data.updateLayout( x, y );
\r
73 var VBox = Box.presets(
\r
74 X.UI.Layout.Vertical,
\r