LayoutContainer.js.uncompressed.js 3.6 KB

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