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 width : [ '100%', 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 height : [ 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 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
11 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
12 gapY : [ 0, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH ]
\r
15 overrideAttrsForChild : {
\r
22 calculate : function( data, isNeedsDetection, x, y, w, h ){
\r
23 var ret = isNeedsDetection,
\r
24 attrs = data.attrObject || data.attrClass.prototype,
\r
25 uinodes = data.uinodes,
\r
26 l = uinodes && uinodes.length,
\r
28 childW, childH, gapY,
\r
29 i, _x, _y, _w, node,
\r
30 contentW, contentH, autoW, autoH, detectionPhase;
\r
32 data.preMesure( w, h );
\r
34 contentW = data.contentWidth;
\r
35 contentH = data.contentHeight;
\r
36 autoW = contentW === X.UI.Attr.AUTO;
\r
37 autoH = contentH === X.UI.Attr.AUTO;
\r
38 detectionPhase = autoW || autoH;
\r
39 gapY = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.gapY.No ], contentH );
\r
40 childW = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.childWidth.No ], contentW );
\r
41 childH = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.childHeight.No ], contentH );
\r
45 if( !detectionPhase ) ret = false;
\r
49 for( i = 0; i < l; ++i ){
\r
50 node = uinodes[ i ];
\r
51 node.calculate( detectionPhase, _x, _y, contentW, childH );
\r
52 _y += node.boxHeight + gapY;
\r
55 if( node.boxWidth !== X.UI.Attr.AUTO ){
\r
58 if( node.minBoxWidth !== X.UI.Attr.AUTO ){
\r
59 w = node.minBoxWidth;
\r
64 if( _w < w ) _w = w;
\r
69 _y = data.minContentHeight !== X.UI.Attr.AUTO ? data.minContentHeight : 0;
\r
72 if( detectionPhase ){
\r
73 if( autoW ) data.contentWidth = _w;
\r
74 if( autoH ) data.contentHeight = _y;
\r
76 for( i = 0; i < l; ++i ){
\r
77 node = uinodes[ i ];
\r
78 node.calculate( false, _x, _y, data.contentWidth, data.contentHeight );
\r
79 _y += node.boxHeight + gapY;
\r
84 !isNeedsDetection && data.updateLayout( x + data.boxX, y + data.boxY );
\r
90 X.UI.VBox = X.UI.Box.presets(
\r
91 X.UI.Layout.Vertical,
\r