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 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
8 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
9 gapX : [ 0, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH ]
\r
12 overrideAttrsForChild : {
\r
19 calculate : function( data, isNeedsDetection, x, y, w, h ){
\r
20 var attrs = data.attrObject || data.attrClass.prototype,
\r
21 uinodes = data.uinodes,
\r
22 l = uinodes && uinodes.length,
\r
23 childW, childH, gapX,
\r
24 i, _x, _y, _h, node;
\r
26 data.preMesure( w, h );
\r
28 contentW = data.contentWidth;
\r
29 contentH = data.contentHeight;
\r
30 autoW = contentW === X.UI.Attr.AUTO;
\r
31 autoH = contentH === X.UI.Attr.AUTO;
\r
32 detectionPhase = autoW || autoH;
\r
35 childW = _AbstractUINode.calcValue( attrs[ data.supportAttrs.childWidth.No ], contentW );
\r
36 childH = _AbstractUINode.calcValue( attrs[ data.supportAttrs.childHeight.No ], contentH );
\r
37 gapX = _AbstractUINode.calcValue( attrs[ data.supportAttrs.gapX.No ], contentW );
\r
41 for( i = 0; i < l; ++i ){
\r
42 node = uinodes[ i ];
\r
43 node.calculate( detectionPhase, _x, _y, childW, childH );
\r
44 _x += node.boxWidth + gapX;
\r
46 h = node.boxHeight !== X.UI.Attr.AUTO ?
\r
48 node.minBoxHeight !== X.UI.Attr.AUTO ?
\r
49 node.minBoxHeight : 0;
\r
50 if( _h < h ) _h = h;
\r
55 _h = data.minContentHeight !== X.UI.Attr.AUTO ? data.minContentHeight : 0;
\r
58 if( detectionPhase ){
\r
59 if( autoW ) data.contentWidth = _x;
\r
60 if( autoH ) data.contentHeight = _h;
\r
63 //data.postMesure();
\r
66 !isNeedsDetection && data.updateLayout( x, y );
\r
70 var HBox = Box.presets(
\r
71 X.UI.Layout.Horizontal,
\r