X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F20_ui%2F12_HBox.js;h=6639a7c40908e00ae6eb0373d1b2addbb509388b;hb=3d352d8bf476ab57cc333e8d02d0e6ea5efa69b7;hp=52b9bdf2936c0411592db9d7c5221de83c2da3bc;hpb=eedd028ba64be2ea0828cf686f1d0ec3bb4010d5;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/20_ui/12_HBox.js b/0.6.x/js/20_ui/12_HBox.js index 52b9bdf..6639a7c 100644 --- a/0.6.x/js/20_ui/12_HBox.js +++ b/0.6.x/js/20_ui/12_HBox.js @@ -1,14 +1,14 @@ -X.UI.Layout.Horizontal = X.UI.Layout.create( { +var XUI_Layout_Horizontal = X[ 'UI' ][ 'Layout' ][ 'Horizontal' ] = XUI_createLayout( { name : 'HorizontalLayout', overrideAttrsForSelf : { selectable : false, - 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' ], - 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 ], - 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 ], - 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 ], - 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 ], - gapX : [ 0, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH ] + role : [ 0, XUI_Dirty.CLEAN, XUI_Attr_USER.UINODE, XUI_Attr_Type.INIT_ONLY | XUI_Attr_Type.LIST, 'none,chrome,container' ], + width : [ '100%', XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT | XUI_Attr_Type.AUTO ], + height : [ XUI_Attr_AUTO, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT | XUI_Attr_Type.AUTO ], + childWidth : [ XUI_Attr_AUTO, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT | XUI_Attr_Type.AUTO ], + childHeight : [ XUI_Attr_AUTO, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT | XUI_Attr_Type.AUTO ], + gapX : [ 0, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH ] }, overrideAttrsForChild : { @@ -31,14 +31,14 @@ X.UI.Layout.Horizontal = X.UI.Layout.create( { contentW = data.contentWidth; contentH = data.contentHeight; - autoW = contentW === X.UI.Attr.AUTO; - autoH = contentH === X.UI.Attr.AUTO; + autoW = contentW === XUI_Attr_AUTO; + autoH = contentH === XUI_Attr_AUTO; detectionPhase = autoW || autoH; - gapX = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.gapX.No ], contentW ); - childW = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.childWidth.No ], contentW ); - childH = XUI_AbstractUINode_calcValue( attrs[ data.supportAttrs.childHeight.No ], contentH ); - _x = data.contentL; - _y = data.contentT; + gapX = XUI_AbstractUINode_calcValue( attrs[ data.usableAttrs.gapX.No ], contentW ); + childW = XUI_AbstractUINode_calcValue( attrs[ data.usableAttrs.childWidth.No ], contentW ); + childH = XUI_AbstractUINode_calcValue( attrs[ data.usableAttrs.childHeight.No ], contentH ); + _x = 0; //data.contentL; + _y = 0; //data.contentT; if( !detectionPhase ) ret = false; @@ -46,14 +46,14 @@ X.UI.Layout.Horizontal = X.UI.Layout.create( { _h = 0; for( i = 0; i < l; ++i ){ node = uinodes[ i ]; - node.calculate( detectionPhase, _x, _y, childW, childH ); + node.calculate( detectionPhase, _x, 0, childW, childH ); _x += node.boxWidth + gapX; if( autoH ){ - if( node.boxHeight !== X.UI.Attr.AUTO ){ + if( node.boxHeight !== XUI_Attr_AUTO ){ h = node.boxHeight; } else - if( node.minBoxHeight !== X.UI.Attr.AUTO ){ - h = node.minBoxHeight; + if( node.boxHeightMin !== XUI_Attr_AUTO ){ + h = node.boxHeightMin; minFlag = true; } else { h = 0; @@ -63,31 +63,60 @@ X.UI.Layout.Horizontal = X.UI.Layout.create( { }; _x -= gapX; } else { - _h = data.minContentHeight !== X.UI.Attr.AUTO ? data.minContentHeight : 0; + _h = data.contentHeightMin !== XUI_Attr_AUTO ? data.contentHeightMin : 0; }; if( detectionPhase ){ if( autoW ) data.contentWidth = _x; if( autoH ) data.contentHeight = _h; - _x = data.contentL; + _x = 0; //data.contentL; for( i = 0; i < l; ++i ){ node = uinodes[ i ]; - node.calculate( false, _x, _y, data.contentWidth, data.contentHeight ); + node.calculate( false, _x, 0, data.contentWidth, data.contentHeight ); _x += node.boxWidth + gapX; }; data.postMesure(); }; - !isNeedsDetection && data.updateLayout( x + data.boxX, y + data.boxY ); - + if( !isNeedsDetection ){ + data.boxX += x; + data.boxY += y; + }; return !ret; } }); +/* X.UI.HBox = X.UI.Box.presets( - X.UI.Layout.Horizontal, + XUI_Layout_Horizontal, 'HBox', { gapX : '0.2em' } -); +);*/ + +var XUI_HBox; + +X.UI.HBox = X.UI.Box.inherits( + 'HBox', + X_Class.NONE, + { + Constructor : function(){ + var supports; + + if( !XUI_HBox ){ + supports = XUI_Attr_createAttrDef( XUI_Box.prototype.usableAttrs, XUI_Layout_Horizontal.overrideAttrsForSelf ); + + XUI_HBox = XUI_Box.inherits( + { + layout : XUI_Layout_Horizontal, + usableAttrs : supports, + attrClass : XUI_Attr_preset( XUI_Box.prototype.attrClass, supports, { + gapX : '0.2em' + } ) + } + ); + }; + X_Pair_create( this, XUI_HBox( this, XUI_Layout_Horizontal, arguments ) ); + } + }); \ No newline at end of file