]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dijit/layout/LayoutContainer.js
Comment class stub
[eow] / static / dojo-release-1.1.1 / dijit / layout / LayoutContainer.js
1 if(!dojo._hasResource["dijit.layout.LayoutContainer"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dijit.layout.LayoutContainer"] = true;
3 dojo.provide("dijit.layout.LayoutContainer");
4
5 dojo.require("dijit.layout._LayoutWidget");
6
7 dojo.declare("dijit.layout.LayoutContainer",
8         dijit.layout._LayoutWidget,
9         {
10         // summary:
11         //      Provides Delphi-style panel layout semantics.
12         //
13         // description:
14         //      A LayoutContainer is a box with a specified size (like style="width: 500px; height: 500px;"),
15         //      that contains children widgets marked with "layoutAlign" of "left", "right", "bottom", "top", and "client".
16         //      It takes it's children marked as left/top/bottom/right, and lays them out along the edges of the box,
17         //      and then it takes the child marked "client" and puts it into the remaining space in the middle.
18         //
19         //  Left/right positioning is similar to CSS's "float: left" and "float: right",
20         //      and top/bottom positioning would be similar to "float: top" and "float: bottom", if there were such
21         //      CSS.
22         //
23         //      Note that there can only be one client element, but there can be multiple left, right, top,
24         //      or bottom elements.
25         //
26         // example:
27         // |    <style>
28         // |            html, body{ height: 100%; width: 100%; }
29         // |    </style>
30         // |    <div dojoType="dijit.layout.LayoutContainer" style="width: 100%; height: 100%">
31         // |            <div dojoType="dijit.layout.ContentPane" layoutAlign="top">header text</div>
32         // |            <div dojoType="dijit.layout.ContentPane" layoutAlign="left" style="width: 200px;">table of contents</div>
33         // |            <div dojoType="dijit.layout.ContentPane" layoutAlign="client">client area</div>
34         // |    </div>
35         // |
36         // |    Lays out each child in the natural order the children occur in.
37         // |    Basically each child is laid out into the "remaining space", where "remaining space" is initially
38         // |    the content area of this widget, but is reduced to a smaller rectangle each time a child is added.
39         //      
40
41         constructor: function(){
42                 dojo.deprecated("dijit.layout.LayoutContainer is deprecated", "use BorderContainer instead", 2.0);
43         },
44
45         layout: function(){
46                 dijit.layout.layoutChildren(this.domNode, this._contentBox, this.getChildren());
47         },
48
49         addChild: function(/*Widget*/ child, /*Integer?*/ insertIndex){
50                 dijit._Container.prototype.addChild.apply(this, arguments);
51                 if(this._started){
52                         dijit.layout.layoutChildren(this.domNode, this._contentBox, this.getChildren());
53                 }
54         },
55
56         removeChild: function(/*Widget*/ widget){
57                 dijit._Container.prototype.removeChild.apply(this, arguments);
58                 if(this._started){
59                         dijit.layout.layoutChildren(this.domNode, this._contentBox, this.getChildren());
60                 }
61         }
62 });
63
64 // This argument can be specified for the children of a LayoutContainer.
65 // Since any widget can be specified as a LayoutContainer child, mix it
66 // into the base widget class.  (This is a hack, but it's effective.)
67 dojo.extend(dijit._Widget, {
68         // layoutAlign: String
69         //              "none", "left", "right", "bottom", "top", and "client".
70         //              See the LayoutContainer description for details on this parameter.
71         layoutAlign: 'none'
72 });
73
74 }