1 var XUI_Layout_Horizontal = X[ 'UI' ][ 'Layout' ][ 'Horizontal' ] = XUI_createLayout( {
\r
2 name : 'HorizontalLayout',
\r
4 overrideAttrsForSelf : {
\r
6 role : [ 0, XUI_Dirty.CLEAN, XUI_Attr_USER.UINODE, XUI_Attr_Type.INIT_ONLY | XUI_Attr_Type.LIST, 'none,chrome,container' ],
\r
7 width : [ '100%', XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT | XUI_Attr_Type.AUTO ],
\r
8 height : [ XUI_Attr_AUTO, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT | XUI_Attr_Type.AUTO ],
\r
9 childWidth : [ XUI_Attr_AUTO, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT | XUI_Attr_Type.AUTO ],
\r
10 childHeight : [ XUI_Attr_AUTO, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT | XUI_Attr_Type.AUTO ],
\r
11 gapX : [ 0, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_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 === XUI_Attr_AUTO;
\r
35 autoH = contentH === XUI_Attr_AUTO;
\r
36 detectionPhase = autoW || autoH;
\r
37 gapX = XUI_AbstractUINode_calcValue( attrs[ data.usableAttrs.gapX.No ], contentW );
\r
38 childW = XUI_AbstractUINode_calcValue( attrs[ data.usableAttrs.childWidth.No ], contentW );
\r
39 childH = XUI_AbstractUINode_calcValue( attrs[ data.usableAttrs.childHeight.No ], contentH );
\r
40 _x = 0; //data.contentL;
\r
41 _y = 0; //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, 0, childW, childH );
\r
50 _x += node.boxWidth + gapX;
\r
52 if( node.boxHeight !== XUI_Attr_AUTO ){
\r
55 if( node.boxHeightMin !== XUI_Attr_AUTO ){
\r
56 h = node.boxHeightMin;
\r
61 if( _h < h ) _h = h;
\r
66 _h = data.contentHeightMin !== XUI_Attr_AUTO ? data.contentHeightMin : 0;
\r
69 if( detectionPhase ){
\r
70 if( autoW ) data.contentWidth = _x;
\r
71 if( autoH ) data.contentHeight = _h;
\r
72 _x = 0; //data.contentL;
\r
73 for( i = 0; i < l; ++i ){
\r
74 node = uinodes[ i ];
\r
75 node.calculate( false, _x, 0, data.contentWidth, data.contentHeight );
\r
76 _x += node.boxWidth + gapX;
\r
81 if( !isNeedsDetection ){
\r
90 X.UI.HBox = X.UI.Box.presets(
\r
91 XUI_Layout_Horizontal,
\r
100 X.UI.HBox = X.UI.Box.inherits(
\r
104 Constructor : function(){
\r
108 supports = XUI_Attr_createAttrDef( XUI_Box.prototype.usableAttrs, XUI_Layout_Horizontal.overrideAttrsForSelf );
\r
110 XUI_HBox = XUI_Box.inherits(
\r
112 layout : XUI_Layout_Horizontal,
\r
113 usableAttrs : supports,
\r
114 attrClass : XUI_Attr_preset( XUI_Box.prototype.attrClass, supports, {
\r
120 X_Pair_create( this, XUI_HBox( this, XUI_Layout_Horizontal, arguments ) );
\r