X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F20_ui%2F08_Box.js;h=0a3ad335c8d27138f6c1416c21ef14cba5176920;hb=f01f21c6d473692d016cb2b286a61d55380be3b3;hp=dfe2e15b32cbea6853670bb61b9aba2064ad9fe9;hpb=d836e6243878426d4cfd7a14ceb9b77db9f92b57;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/20_ui/08_Box.js b/0.6.x/js/20_ui/08_Box.js index dfe2e15..0a3ad33 100644 --- a/0.6.x/js/20_ui/08_Box.js +++ b/0.6.x/js/20_ui/08_Box.js @@ -1,15 +1,15 @@ -X.UI.Layout.Canvas = X.UI.Layout.create( { +var XUI_Layout_Canvas = X[ 'UI' ][ 'Layout' ][ 'Canvas' ] = XUI_createLayout( { name : 'CanvasLayout', 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' ], + role : [ 0, XUI_Dirty.CLEAN, XUI_Attr_USER.UINODE, XUI_Attr_Type.INIT_ONLY | XUI_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 ], - maxWidth : [ X.UI.Attr.AUTO, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT ], - height : [ 0, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT ], - maxHeight : [ X.UI.Attr.AUTO, X.UI.Dirty.LAYOUT, X.UI.Attr.USER.LAYOUT, X.UI.Attr.Type.LENGTH | X.UI.Attr.Type.PERCENT ] + width : [ '100%', XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT ], + maxWidth : [ XUI_Attr_AUTO, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT ], + height : [ 0, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT ], + maxHeight : [ XUI_Attr_AUTO, XUI_Dirty.LAYOUT, XUI_Attr_USER.LAYOUT, XUI_Attr_Type.LENGTH | XUI_Attr_Type.PERCENT ] }, overrideAttrsForChild : { @@ -24,7 +24,7 @@ X.UI.Layout.Canvas = X.UI.Layout.create( { data.preMesure( w, h ); - if( isNeedsDetection && ( data.boxWidth === X.UI.Attr.AUTO || data.boxHeight === X.UI.Attr.AUTO ) ) return false; + if( isNeedsDetection && ( data.boxWidth === XUI_Attr_AUTO || data.boxHeight === XUI_Attr_AUTO ) ) return false; _x = data.contentL; _y = data.contentT; @@ -37,23 +37,26 @@ X.UI.Layout.Canvas = X.UI.Layout.create( { node.calculate( false, _x, _y, _w, _h ); }; } else - if( data.contentHeight === X.UI.Attr.AUTO ){ - data.contentHeight = data.minContentHeight !== X.UI.Attr.AUTO ? data.minContentHeight : 0; + if( data.contentHeight === XUI_Attr_AUTO ){ + data.contentHeight = data.minContentHeight !== XUI_Attr_AUTO ? data.minContentHeight : 0; }; data.postMesure(); - data.updateLayout( x + data.boxX, y + data.boxY ); - + + if( !isNeedsDetection ){ + data.boxX += x; + data.boxY += y; + }; return true; } }); -X.UI._Box = X.UI._AbstractUINode.inherits( +var XUI_Box = XUI_AbstractUINode.inherits( 'X.UI._Box', - X_Class.PRIVATE_DATA | X_Class.SUPER_ACCESS, // 現状 super 指定がないとconstructor未定擬時に親のconstructor が使われない + X_Class.PRIVATE_DATA, // 現状 super 指定がないとconstructor未定擬時に親のconstructor が使われない { - supportAttrs : XUI_Attr_createAttrDef( X.UI._AbstractUINode.prototype.supportAttrs, X.UI.Layout.Canvas.overrideAttrsForSelf ), + supportAttrs : XUI_Attr_createAttrDef( XUI_AbstractUINode.prototype.supportAttrs, XUI_Layout_Canvas.overrideAttrsForSelf ), layout : null, uinodes : null, @@ -63,8 +66,8 @@ X.UI._Box = X.UI._AbstractUINode.inherits( pointerChildren : true, through : false, - scrollingX : 0, - scrollingY : 0, + scrollingX : 0, // TODO 現在のスクロール位置 + scrollingY : 0, // TODO Constructor : function( layout, args ){ var i = 0, @@ -97,7 +100,7 @@ X.UI._Box = X.UI._AbstractUINode.inherits( if( arg[ 'instanceOf' ] && arg[ 'instanceOf' ]( Node ) ){ //this.layout = arg; } else - if( arg[ 'instanceOf' ] && arg[ 'instanceOf' ]( X.UI.Layout.Base ) ){ + if( arg[ 'instanceOf' ] && arg[ 'instanceOf' ]( XUI_LayoutBase ) ){ //this.layout = arg; } else if( X_Type_isObject( arg ) ){ @@ -133,7 +136,7 @@ X.UI._Box = X.UI._AbstractUINode.inherits( }; this.phase = 1; - this.User[ 'dispatch' ]( { type : X.UI.Event.INIT } ); + this.User[ 'dispatch' ]( { type : XUI_Event.INIT } ); }, addToParent : function( parentXNode ){ @@ -150,7 +153,7 @@ X.UI._Box = X.UI._AbstractUINode.inherits( }; this.phase = 2; - this.User[ 'dispatch' ]( { type : X.UI.Event.ADDED } ); + this.User[ 'dispatch' ]( { type : XUI_Event.ADDED } ); }, /* Rellay */ @@ -163,7 +166,7 @@ X.UI._Box = X.UI._AbstractUINode.inherits( }; }; - X.UI._AbstractUINode.prototype.creationComplete.apply( this, arguments ); + XUI_AbstractUINode.prototype.creationComplete.apply( this, arguments ); }, calculate : function( isNeedsDetection, x, y, w, h ){ @@ -171,6 +174,17 @@ X.UI._Box = X.UI._AbstractUINode.inherits( this.phase = 4; return ret; }, + + updateLayout : function(){ + var uinodes = this.uinodes, i, l; + + if( uinodes && ( l = uinodes.length ) ){ + for( i = 0; i < l; ++i ){ + uinodes[ i ].updateLayout(); + }; + }; + XUI_AbstractUINode.prototype.updateLayout.call( this ); + }, capcher : function( x, y ){ var uinodes, child, _x, _y, hit, i; @@ -287,11 +301,11 @@ X.UI._Box = X.UI._AbstractUINode.inherits( X.UI.Box = X.UI.AbstractUINode.inherits( 'Box', - X_Class.SUPER_ACCESS, - X.UI._Box, + X_Class.NONE, + XUI_Box, { Constructor : function(){ - X_Class_newPrivate( this, X.UI.Layout.Canvas, arguments ); + X_Class_newPrivate( this, XUI_Layout_Canvas, arguments ); }, add : function( node /* , node, node ... */ ){ @@ -357,7 +371,7 @@ X.UI.Box.presets = function(){ arg = args[ i ]; if( !arg ) continue; // レイアウトの preset ができるのは layout が未定義な Box だけ - if( !shadow.prototype.layout && arg[ 'instanceOf' ] && arg[ 'instanceOf' ]( X.UI.Layout.Base ) ){ + if( !shadow.prototype.layout && arg[ 'instanceOf' ] && arg[ 'instanceOf' ]( XUI_LayoutBase ) ){ layout = arg; } else if( ( klassDef = X_Class_getClassDef( arg ) ) && klassDef.isPrivate ){ @@ -381,7 +395,7 @@ X.UI.Box.presets = function(){ klass = this.inherits( privateKlass ); privateKlass.prototype.supportAttrs = supports, - privateKlass.prototype.attrClass = X.UI.Attr.preset( privateKlass.prototype.attrClass, supports, attrs ); + privateKlass.prototype.attrClass = XUI_Attr_preset( privateKlass.prototype.attrClass, supports, attrs ); } else { supports = XUI_Attr_createAttrDef( shadow.prototype.supportAttrs, layout.overrideAttrsForSelf ); @@ -391,7 +405,7 @@ X.UI.Box.presets = function(){ { layout : layout, supportAttrs : supports, - attrClass : X.UI.Attr.preset( shadow.prototype.attrClass, supports, attrs ) + attrClass : XUI_Attr_preset( shadow.prototype.attrClass, supports, attrs ) } ) );