1 X.UI.Layout.Horizontal = X.UI.Layout.create( {
\r
2 name : 'HorizontalLayout',
\r
4 overrideAttrsForSelf : {
\r
6 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
7 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
8 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
9 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
10 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
11 gapX : [ 0, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH ]
\r
14 overrideAttrsForChild : {
\r
21 calculate : function( data, isNeedsDetection, x, y, w, h ){
\r
22 var ret = isNeedsDetection,
\r
23 attrs = data.attrObject || data.attrClass.prototype,
\r
24 uinodes = data.uinodes,
\r
25 l = uinodes && uinodes.length,
\r
27 contentW, contentH, autoW, autoH, detectionPhase, gapX,
\r
28 childW, childH, _x, _y, _h, node, minFlag;
\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 gapX = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.gapX.No ], contentW );
\r
38 childW = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.childWidth.No ], contentW );
\r
39 childH = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.childHeight.No ], contentH );
\r
41 _y = data.contentT;
\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, childW, childH );
\r
50 _x += node.boxWidth + gapX;
\r
52 if( node.boxHeight !== X.UI.Attr.AUTO ){
\r
55 if( node.minBoxHeight !== X.UI.Attr.AUTO ){
\r
56 h = node.minBoxHeight;
\r
61 if( _h < h ) _h = h;
\r
66 _h = data.minContentHeight !== X.UI.Attr.AUTO ? data.minContentHeight : 0;
\r
69 if( detectionPhase ){
\r
70 if( autoW ) data.contentWidth = _x;
\r
71 if( autoH ) data.contentHeight = _h;
\r
73 for( i = 0; i < l; ++i ){
\r
74 node = uinodes[ i ];
\r
75 node.calculate( false, _x, _y, data.contentWidth, data.contentHeight );
\r
76 _x += node.boxWidth + gapX;
\r
81 !isNeedsDetection && data.updateLayout( x + data.boxX, y + data.boxY );
\r
87 X.UI.HBox = X.UI.Box.presets(
\r
88 X.UI.Layout.Horizontal,
\r