]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/layout/_LayoutWidget.js
2 Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
8 if(!dojo
._hasResource
["dijit.layout._LayoutWidget"]){
9 dojo
._hasResource
["dijit.layout._LayoutWidget"]=true;
10 dojo
.provide("dijit.layout._LayoutWidget");
11 dojo
.require("dijit._Widget");
12 dojo
.require("dijit._Container");
13 dojo
.require("dijit._Contained");
14 dojo
.declare("dijit.layout._LayoutWidget",[dijit
._Widget
,dijit
._Container
,dijit
._Contained
],{baseClass
:"dijitLayoutContainer",isLayoutContainer
:true,postCreate:function(){
15 dojo
.addClass(this.domNode
,"dijitContainer");
16 this.inherited(arguments
);
21 this.inherited(arguments
);
22 var _1
=this.getParent
&&this.getParent();
23 if(!(_1
&&_1
.isLayoutContainer
)){
25 this.connect(dojo
.isIE
?this.domNode
:dojo
.global
,"onresize",function(){
29 },resize:function(_2
,_3
){
32 dojo
.marginBox(_4
,_2
);
34 _4
.style
.top
=_2
.t
+"px";
37 _4
.style
.left
=_2
.l
+"px";
41 dojo
.mixin(mb
,_2
||{});
42 if(!("h" in mb
)||!("w" in mb
)){
43 mb
=dojo
.mixin(dojo
.marginBox(_4
),mb
);
45 var cs
=dojo
.getComputedStyle(_4
);
46 var me
=dojo
._getMarginExtents(_4
,cs
);
47 var be
=dojo
._getBorderExtents(_4
,cs
);
48 var bb
=(this._borderBox
={w
:mb
.w
-(me
.w
+be
.w
),h
:mb
.h
-(me
.h
+be
.h
)});
49 var pe
=dojo
._getPadExtents(_4
,cs
);
50 this._contentBox
={l
:dojo
._toPixelValue(_4
,cs
.paddingLeft
),t
:dojo
._toPixelValue(_4
,cs
.paddingTop
),w
:bb
.w
-pe
.w
,h
:bb
.h
-pe
.h
};
53 },_setupChild:function(_5
){
54 dojo
.addClass(_5
.domNode
,this.baseClass
+"-child");
56 dojo
.addClass(_5
.domNode
,this.baseClass
+"-"+_5
.baseClass
);
58 },addChild:function(_6
,_7
){
59 this.inherited(arguments
);
63 },removeChild:function(_8
){
64 dojo
.removeClass(_8
.domNode
,this.baseClass
+"-child");
66 dojo
.removeClass(_8
.domNode
,this.baseClass
+"-"+_8
.baseClass
);
68 this.inherited(arguments
);
70 dijit
.layout
.marginBox2contentBox=function(_9
,mb
){
71 var cs
=dojo
.getComputedStyle(_9
);
72 var me
=dojo
._getMarginExtents(_9
,cs
);
73 var pb
=dojo
._getPadBorderExtents(_9
,cs
);
74 return {l
:dojo
._toPixelValue(_9
,cs
.paddingLeft
),t
:dojo
._toPixelValue(_9
,cs
.paddingTop
),w
:mb
.w
-(me
.w
+pb
.w
),h
:mb
.h
-(me
.h
+pb
.h
)};
78 return _b
.substring(0,1).toUpperCase()+_b
.substring(1);
80 var _c=function(_d
,_e
){
81 _d
.resize
?_d
.resize(_e
):dojo
.marginBox(_d
.domNode
,_e
);
82 dojo
.mixin(_d
,dojo
.marginBox(_d
.domNode
));
85 dijit
.layout
.layoutChildren=function(_f
,dim
,_10
){
86 dim
=dojo
.mixin({},dim
);
87 dojo
.addClass(_f
,"dijitLayoutContainer");
88 _10
=dojo
.filter(_10
,function(_11
){
89 return _11
.layoutAlign
!="client";
90 }).concat(dojo
.filter(_10
,function(_12
){
91 return _12
.layoutAlign
=="client";
93 dojo
.forEach(_10
,function(_13
){
94 var elm
=_13
.domNode
,pos
=_13
.layoutAlign
;
98 _14
.bottom
=_14
.right
="auto";
99 dojo
.addClass(elm
,"dijitAlign"+_a(pos
));
100 if(pos
=="top"||pos
=="bottom"){
106 _14
.top
=dim
.t
+dim
.h
+"px";
109 if(pos
=="left"||pos
=="right"){
115 _14
.left
=dim
.l
+dim
.w
+"px";