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 ret = isNeedsDetection,
\r
22 attrs = data.attrObject || data.attrClass.prototype,
\r
23 uinodes = data.uinodes,
\r
24 l = uinodes && uinodes.length,
\r
26 childW, childH, gapY,
\r
27 i, _x, _y, _w, node,
\r
28 contentW, contentH, autoW, autoH, detectionPhase;
\r
30 data.preMesure( w, h );
\r
32 contentW = data.contentWidth;
\r
33 contentH = data.contentHeight;
\r
34 autoW = contentW === X.UI.Attr.AUTO;
\r
35 autoH = contentH === X.UI.Attr.AUTO;
\r
36 detectionPhase = autoW || autoH;
\r
37 gapY = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.gapY.No ], contentH );
\r
38 childW = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.childWidth.No ], contentW );
\r
39 childH = X.UI._AbstractUINode.calcValue( attrs[ data.supportAttrs.childHeight.No ], contentH );
\r
43 if( !detectionPhase ) ret = false;
\r
47 for( i = 0; i < l; ++i ){
\r
48 node = uinodes[ i ];
\r
49 node.calculate( detectionPhase, _x, _y, contentW, childH );
\r
50 _y += node.boxHeight + gapY;
\r
53 if( node.boxWidth !== X.UI.Attr.AUTO ){
\r
56 if( node.minBoxWidth !== X.UI.Attr.AUTO ){
\r
57 w = node.minBoxWidth;
\r
62 if( _w < w ) _w = w;
\r
67 _y = data.minContentHeight !== X.UI.Attr.AUTO ? data.minContentHeight : 0;
\r
70 if( detectionPhase ){
\r
71 if( autoW ) data.contentWidth = _w;
\r
72 if( autoH ) data.contentHeight = _y;
\r
74 for( i = 0; i < l; ++i ){
\r
75 node = uinodes[ i ];
\r
76 node.calculate( false, _x, _y, data.contentWidth, data.contentHeight );
\r
77 _y += node.boxHeight + gapY;
\r
82 !isNeedsDetection && data.updateLayout( x + data.boxX, y + data.boxY );
\r
88 X.UI.VBox = X.UI.Box.presets(
\r
89 X.UI.Layout.Vertical,
\r