LayoutContainer.js 3.3 KB

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