cc49811c93307a47deaf55e08b38e67be52536d2.svn-base 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * Ext JS Library 2.0 Copyright(c) 2006-2007, Ext JS, LLC. licensing@extjs.com
  3. *
  4. * http://extjs.com/license
  5. */
  6. /*
  7. * These classes are private internal classes
  8. */
  9. Ext.CenterLayoutRegion = function(mgr, config) {
  10. Ext.CenterLayoutRegion.superclass.constructor.call(this, mgr, config,
  11. "center");
  12. this.visible = true;
  13. this.minWidth = config.minWidth || 20;
  14. this.minHeight = config.minHeight || 20;
  15. };
  16. Ext.extend(Ext.CenterLayoutRegion, Ext.LayoutRegion, {
  17. hide : function() {
  18. // center panel can't be hidden
  19. },
  20. show : function() {
  21. // center panel can't be hidden
  22. },
  23. getMinWidth : function() {
  24. return this.minWidth;
  25. },
  26. getMinHeight : function() {
  27. return this.minHeight;
  28. }
  29. });
  30. Ext.NorthLayoutRegion = function(mgr, config) {
  31. Ext.NorthLayoutRegion.superclass.constructor.call(this, mgr, config,
  32. "north", "n-resize");
  33. if (this.split) {
  34. this.split.placement = Ext.SplitBar.TOP;
  35. this.split.orientation = Ext.SplitBar.VERTICAL;
  36. this.split.el.addClass("x-layout-split-v");
  37. }
  38. var size = config.initialSize || config.height;
  39. if (typeof size != "undefined") {
  40. this.el.setHeight(size);
  41. }
  42. };
  43. Ext.extend(Ext.NorthLayoutRegion, Ext.SplitLayoutRegion, {
  44. orientation : Ext.SplitBar.VERTICAL,
  45. getBox : function() {
  46. if (this.collapsed) {
  47. return this.collapsedEl.getBox();
  48. }
  49. var box = this.el.getBox();
  50. if (this.split) {
  51. box.height += this.split.el.getHeight();
  52. }
  53. return box;
  54. },
  55. updateBox : function(box) {
  56. if (this.split && !this.collapsed) {
  57. box.height -= this.split.el.getHeight();
  58. this.split.el.setLeft(box.x);
  59. this.split.el.setTop(box.y + box.height);
  60. this.split.el.setWidth(box.width);
  61. }
  62. if (this.collapsed) {
  63. this.updateBody(box.width, null);
  64. }
  65. Ext.NorthLayoutRegion.superclass.updateBox.call(this, box);
  66. }
  67. });
  68. Ext.SouthLayoutRegion = function(mgr, config) {
  69. Ext.SouthLayoutRegion.superclass.constructor.call(this, mgr, config,
  70. "south", "s-resize");
  71. if (this.split) {
  72. this.split.placement = Ext.SplitBar.BOTTOM;
  73. this.split.orientation = Ext.SplitBar.VERTICAL;
  74. this.split.el.addClass("x-layout-split-v");
  75. }
  76. var size = config.initialSize || config.height;
  77. if (typeof size != "undefined") {
  78. this.el.setHeight(size);
  79. }
  80. };
  81. Ext.extend(Ext.SouthLayoutRegion, Ext.SplitLayoutRegion, {
  82. orientation : Ext.SplitBar.VERTICAL,
  83. getBox : function() {
  84. if (this.collapsed) {
  85. return this.collapsedEl.getBox();
  86. }
  87. var box = this.el.getBox();
  88. if (this.split) {
  89. var sh = this.split.el.getHeight();
  90. box.height += sh;
  91. box.y -= sh;
  92. }
  93. return box;
  94. },
  95. updateBox : function(box) {
  96. if (this.split && !this.collapsed) {
  97. var sh = this.split.el.getHeight();
  98. box.height -= sh;
  99. box.y += sh;
  100. this.split.el.setLeft(box.x);
  101. this.split.el.setTop(box.y - sh);
  102. this.split.el.setWidth(box.width);
  103. }
  104. if (this.collapsed) {
  105. this.updateBody(box.width, null);
  106. }
  107. Ext.SouthLayoutRegion.superclass.updateBox.call(this, box);
  108. }
  109. });
  110. Ext.EastLayoutRegion = function(mgr, config) {
  111. Ext.EastLayoutRegion.superclass.constructor.call(this, mgr, config, "east",
  112. "e-resize");
  113. if (this.split) {
  114. this.split.placement = Ext.SplitBar.RIGHT;
  115. this.split.orientation = Ext.SplitBar.HORIZONTAL;
  116. this.split.el.addClass("x-layout-split-h");
  117. }
  118. var size = config.initialSize || config.width;
  119. if (typeof size != "undefined") {
  120. this.el.setWidth(size);
  121. }
  122. };
  123. Ext.extend(Ext.EastLayoutRegion, Ext.SplitLayoutRegion, {
  124. orientation : Ext.SplitBar.HORIZONTAL,
  125. getBox : function() {
  126. if (this.collapsed) {
  127. return this.collapsedEl.getBox();
  128. }
  129. var box = this.el.getBox();
  130. if (this.split) {
  131. var sw = this.split.el.getWidth();
  132. box.width += sw;
  133. box.x -= sw;
  134. }
  135. return box;
  136. },
  137. updateBox : function(box) {
  138. if (this.split && !this.collapsed) {
  139. var sw = this.split.el.getWidth();
  140. box.width -= sw;
  141. this.split.el.setLeft(box.x);
  142. this.split.el.setTop(box.y);
  143. this.split.el.setHeight(box.height);
  144. box.x += sw;
  145. }
  146. if (this.collapsed) {
  147. this.updateBody(null, box.height);
  148. }
  149. Ext.EastLayoutRegion.superclass.updateBox.call(this, box);
  150. }
  151. });
  152. Ext.WestLayoutRegion = function(mgr, config) {
  153. Ext.WestLayoutRegion.superclass.constructor.call(this, mgr, config, "west",
  154. "w-resize");
  155. if (this.split) {
  156. this.split.placement = Ext.SplitBar.LEFT;
  157. this.split.orientation = Ext.SplitBar.HORIZONTAL;
  158. this.split.el.addClass("x-layout-split-h");
  159. }
  160. var size = config.initialSize || config.width;
  161. if (typeof size != "undefined") {
  162. this.el.setWidth(size);
  163. }
  164. };
  165. Ext.extend(Ext.WestLayoutRegion, Ext.SplitLayoutRegion, {
  166. orientation : Ext.SplitBar.HORIZONTAL,
  167. getBox : function() {
  168. if (this.collapsed) {
  169. return this.collapsedEl.getBox();
  170. }
  171. var box = this.el.getBox();
  172. if (this.split) {
  173. box.width += this.split.el.getWidth();
  174. }
  175. return box;
  176. },
  177. updateBox : function(box) {
  178. if (this.split && !this.collapsed) {
  179. var sw = this.split.el.getWidth();
  180. box.width -= sw;
  181. this.split.el.setLeft(box.x + box.width);
  182. this.split.el.setTop(box.y);
  183. this.split.el.setHeight(box.height);
  184. }
  185. if (this.collapsed) {
  186. this.updateBody(null, box.height);
  187. }
  188. Ext.WestLayoutRegion.superclass.updateBox.call(this, box);
  189. }
  190. });