source: Dev/branches/rest-dojo-ui/client/dijit/layout/LayoutContainer.js @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 3.4 KB
Line 
1define([
2        "dojo/_base/kernel", // kernel.deprecated
3        "dojo/_base/lang",
4        "dojo/_base/declare", // declare
5        "../_WidgetBase",
6        "./_LayoutWidget",
7        "./utils"               // layoutUtils.layoutChildren
8], function(kernel, lang, declare, _WidgetBase, _LayoutWidget, layoutUtils){
9
10/*=====
11        var _WidgetBase = dijit._WidgetBase;
12        var _LayoutWidget = dijit.layout._LayoutWidget;
13=====*/
14
15// module:
16//              dijit/layout/LayoutContainer
17// summary:
18//              Deprecated.  Use `dijit.layout.BorderContainer` instead.
19
20
21// This argument can be specified for the children of a LayoutContainer.
22// Since any widget can be specified as a LayoutContainer child, mix it
23// into the base widget class.  (This is a hack, but it's effective.)
24lang.extend(_WidgetBase, {
25        // layoutAlign: String
26        //              "none", "left", "right", "bottom", "top", and "client".
27        //              See the LayoutContainer description for details on this parameter.
28        layoutAlign: 'none'
29});
30
31return declare("dijit.layout.LayoutContainer", _LayoutWidget, {
32        // summary:
33        //              Deprecated.  Use `dijit.layout.BorderContainer` instead.
34        //
35        // description:
36        //              Provides Delphi-style panel layout semantics.
37        //
38        //              A LayoutContainer is a box with a specified size (like style="width: 500px; height: 500px;"),
39        //              that contains children widgets marked with "layoutAlign" of "left", "right", "bottom", "top", and "client".
40        //              It takes it's children marked as left/top/bottom/right, and lays them out along the edges of the box,
41        //              and then it takes the child marked "client" and puts it into the remaining space in the middle.
42        //
43        //              Left/right positioning is similar to CSS's "float: left" and "float: right",
44        //              and top/bottom positioning would be similar to "float: top" and "float: bottom", if there were such
45        //              CSS.
46        //
47        //              Note that there can only be one client element, but there can be multiple left, right, top,
48        //              or bottom elements.
49        //
50        // example:
51        // |    <style>
52        // |            html, body{ height: 100%; width: 100%; }
53        // |    </style>
54        // |    <div data-dojo-type="dijit.layout.LayoutContainer" style="width: 100%; height: 100%">
55        // |            <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="layoutAlign: 'top'">header text</div>
56        // |            <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="layoutAlign: 'left'" style="width: 200px;">table of contents</div>
57        // |            <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="layoutAlign: 'client'">client area</div>
58        // |    </div>
59        //
60        //              Lays out each child in the natural order the children occur in.
61        //              Basically each child is laid out into the "remaining space", where "remaining space" is initially
62        //              the content area of this widget, but is reduced to a smaller rectangle each time a child is added.
63        // tags:
64        //              deprecated
65
66        baseClass: "dijitLayoutContainer",
67
68        constructor: function(){
69                kernel.deprecated("dijit.layout.LayoutContainer is deprecated", "use BorderContainer instead", 2.0);
70        },
71
72        layout: function(){
73                layoutUtils.layoutChildren(this.domNode, this._contentBox, this.getChildren());
74        },
75
76        addChild: function(/*dijit._Widget*/ child, /*Integer?*/ insertIndex){
77                this.inherited(arguments);
78                if(this._started){
79                        layoutUtils.layoutChildren(this.domNode, this._contentBox, this.getChildren());
80                }
81        },
82
83        removeChild: function(/*dijit._Widget*/ widget){
84                this.inherited(arguments);
85                if(this._started){
86                        layoutUtils.layoutChildren(this.domNode, this._contentBox, this.getChildren());
87                }
88        }
89});
90
91});
Note: See TracBrowser for help on using the repository browser.