X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F20_ui%2F11_VBox.js;h=9c81e5adf976d8a4c1583052398520e741f154bb;hb=6002fdac540134f01738f95246c0ea66302bd702;hp=d9becca173d4021a59cc0a836f082b271466ce7d;hpb=f01f21c6d473692d016cb2b286a61d55380be3b3;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/20_ui/11_VBox.js b/0.6.x/js/20_ui/11_VBox.js index d9becca..9c81e5a 100644 --- a/0.6.x/js/20_ui/11_VBox.js +++ b/0.6.x/js/20_ui/11_VBox.js @@ -2,14 +2,17 @@ var XUI_Layout_Vertical = X[ 'UI' ][ 'Layout' ][ 'Vertical' ] = XUI_createLayout name : 'VerticalLayout', + /* + * + */ overrideAttrsForSelf : { selectable : false, - 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 ], + 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 ], - gapY : [ 0, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH ] + gapY : [ 0, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH ] }, overrideAttrsForChild : { @@ -40,7 +43,7 @@ var XUI_Layout_Vertical = X[ 'UI' ][ 'Layout' ][ 'Vertical' ] = XUI_createLayout 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; + _y = 0; //data.contentT; if( !detectionPhase ) ret = false; @@ -48,8 +51,9 @@ var XUI_Layout_Vertical = X[ 'UI' ][ 'Layout' ][ 'Vertical' ] = XUI_createLayout _w = 0; for( i = 0; i < l; ++i ){ node = uinodes[ i ]; - node.calculate( detectionPhase, _x, _y, contentW, childH ); + node.calculate( detectionPhase, 0, _y, contentW, childH ); _y += node.boxHeight + gapY; + //console.dir( node ); // 概算のみ if( autoW ){ if( node.boxWidth !== XUI_Attr_AUTO ){ @@ -61,8 +65,8 @@ var XUI_Layout_Vertical = X[ 'UI' ][ 'Layout' ][ 'Vertical' ] = XUI_createLayout } else { w = 0; }; - if( _w < w ) _w = w; - }; + if( _w < w ) _w = w; + }; }; _y -= gapY; } else { @@ -71,11 +75,11 @@ var XUI_Layout_Vertical = X[ 'UI' ][ 'Layout' ][ 'Vertical' ] = XUI_createLayout if( detectionPhase ){ if( autoW ) data.contentWidth = _w; - if( autoH ) data.contentHeight = _y; - _y = data.contentT; + if( autoH ) data.contentHeight = _y;// - data.contentT; + _y = 0;//data.contentT; for( i = 0; i < l; ++i ){ node = uinodes[ i ]; - node.calculate( false, _x, _y, data.contentWidth, data.contentHeight ); + node.calculate( false, 0, _y, data.contentWidth, data.contentHeight ); _y += node.boxHeight + gapY; }; data.postMesure(); @@ -83,17 +87,36 @@ var XUI_Layout_Vertical = X[ 'UI' ][ 'Layout' ][ 'Vertical' ] = XUI_createLayout if( !isNeedsDetection ){ data.boxX += x; - data.boxY += y; + data.boxY += y; }; return !ret; } }); -X.UI.VBox = X.UI.Box.presets( - XUI_Layout_Vertical, +var XUI_VBox; + +X.UI.VBox = X.UI.Box.inherits( 'VBox', + X_Class.NONE, { - gapY : '0.2em', - childWidth : '100%' - } -); + Constructor : function(){ + var supports; + + if( !XUI_VBox ){ + supports = XUI_Attr_createAttrDef( XUI_Box.prototype.supportAttrs, XUI_Layout_Vertical.overrideAttrsForSelf ); + + XUI_VBox = XUI_Box.inherits( + { + layout : XUI_Layout_Vertical, + supportAttrs : supports, + attrClass : XUI_Attr_preset( XUI_Box.prototype.attrClass, supports, { + gapY : '0.2em', + childWidth : '100%' + } ) + } + ); + }; + X_Pair_create( this, XUI_VBox( this, XUI_Layout_Vertical, arguments ) ); + } + }); +