4 * Copyright(c) 2006-2007, Ext JS, LLC.
6 * Originally Released Under LGPL - original licence link has changed is not relivant.
9 * <script type="text/javascript">
13 * @class Roo.LayoutManager
14 * @extends Roo.util.Observable
15 * Base class for layout managers.
17 Roo.LayoutManager = function(container, config){
18 Roo.LayoutManager.superclass.constructor.call(this);
19 this.el = Roo.get(container);
20 Roo.log('height!!!!!!!!!!!!!!!!!??');
21 Roo.log(this.el.getStyles('width', 'height'));
24 if(this.el.dom == document.body && Roo.isIE && !config.allowScroll){
25 document.body.scroll = "no";
26 }else if(this.el.dom != document.body && this.el.getStyle('position') == 'static'){
27 this.el.position('relative');
30 this.el.addClass("x-layout-container");
31 /** false to disable window resize monitoring @type Boolean */
32 this.monitorWindowResize = true;
37 * Fires when a layout is performed.
38 * @param {Roo.LayoutManager} this
42 * @event regionresized
43 * Fires when the user resizes a region.
44 * @param {Roo.LayoutRegion} region The resized region
45 * @param {Number} newSize The new size (width for east/west, height for north/south)
47 "regionresized" : true,
49 * @event regioncollapsed
50 * Fires when a region is collapsed.
51 * @param {Roo.LayoutRegion} region The collapsed region
53 "regioncollapsed" : true,
55 * @event regionexpanded
56 * Fires when a region is expanded.
57 * @param {Roo.LayoutRegion} region The expanded region
59 "regionexpanded" : true
61 this.updating = false;
62 Roo.EventManager.onWindowResize(this.onWindowResize, this, true);
65 Roo.extend(Roo.LayoutManager, Roo.util.Observable, {
67 * Returns true if this layout is currently being updated
70 isUpdating : function(){
75 * Suspend the LayoutManager from doing auto-layouts while
76 * making multiple add or remove calls
78 beginUpdate : function(){
83 * Restore auto-layouts and optionally disable the manager from performing a layout
84 * @param {Boolean} noLayout true to disable a layout update
86 endUpdate : function(noLayout){
87 this.updating = false;
97 onRegionResized : function(region, newSize){
98 this.fireEvent("regionresized", region, newSize);
102 onRegionCollapsed : function(region){
103 this.fireEvent("regioncollapsed", region);
106 onRegionExpanded : function(region){
107 this.fireEvent("regionexpanded", region);
111 * Returns the size of the current view. This method normalizes document.body and element embedded layouts and
112 * performs box-model adjustments.
113 * @return {Object} The size as an object {width: (the width), height: (the height)}
115 getViewSize : function(){
117 if(this.el.dom != document.body){
118 size = this.el.getSize();
120 size = {width: Roo.lib.Dom.getViewWidth(), height: Roo.lib.Dom.getViewHeight()};
122 size.width -= this.el.getBorderWidth("lr")-this.el.getPadding("lr");
123 size.height -= this.el.getBorderWidth("tb")-this.el.getPadding("tb");
128 * Returns the Element this layout is bound to.
129 * @return {Roo.Element}
136 * Returns the specified region.
137 * @param {String} target The region key ('center', 'north', 'south', 'east' or 'west')
138 * @return {Roo.LayoutRegion}
140 getRegion : function(target){
141 return this.regions[target.toLowerCase()];
144 onWindowResize : function(){
145 if(this.monitorWindowResize){