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.bootstrap.layout.Manager
14 * @extends Roo.bootstrap.Component
16 * Base class for layout managers.
18 Roo.bootstrap.layout.Manager = function(config)
20 Roo.bootstrap.layout.Manager.superclass.constructor.call(this,config);
26 /** false to disable window resize monitoring @type Boolean */
27 this.monitorWindowResize = true;
32 * Fires when a layout is performed.
33 * @param {Roo.LayoutManager} this
37 * @event regionresized
38 * Fires when the user resizes a region.
39 * @param {Roo.LayoutRegion} region The resized region
40 * @param {Number} newSize The new size (width for east/west, height for north/south)
42 "regionresized" : true,
44 * @event regioncollapsed
45 * Fires when a region is collapsed.
46 * @param {Roo.LayoutRegion} region The collapsed region
48 "regioncollapsed" : true,
50 * @event regionexpanded
51 * Fires when a region is expanded.
52 * @param {Roo.LayoutRegion} region The expanded region
54 "regionexpanded" : true
56 this.updating = false;
59 this.el = Roo.get(config.el);
65 Roo.extend(Roo.bootstrap.layout.Manager, Roo.bootstrap.Component, {
70 monitorWindowResize : true,
76 onRender : function(ct, position)
79 this.el = Roo.get(ct);
82 //this.fireEvent('render',this);
86 initEvents: function()
91 if(this.el.dom == document.body && Roo.isIE && !config.allowScroll){
92 document.body.scroll = "no";
93 }else if(this.el.dom != document.body && this.el.getStyle('position') == 'static'){
94 this.el.position('relative');
97 this.el.addClass("roo-layout-container");
98 Roo.EventManager.onWindowResize(this.onWindowResize, this, true);
99 if(this.el.dom != document.body ) {
100 this.el.on('resize', this.layout,this);
101 this.el.on('show', this.layout,this);
107 * Returns true if this layout is currently being updated
110 isUpdating : function(){
111 return this.updating;
115 * Suspend the LayoutManager from doing auto-layouts while
116 * making multiple add or remove calls
118 beginUpdate : function(){
119 this.updating = true;
123 * Restore auto-layouts and optionally disable the manager from performing a layout
124 * @param {Boolean} noLayout true to disable a layout update
126 endUpdate : function(noLayout){
127 this.updating = false;
137 onRegionResized : function(region, newSize){
138 this.fireEvent("regionresized", region, newSize);
142 onRegionCollapsed : function(region){
143 this.fireEvent("regioncollapsed", region);
146 onRegionExpanded : function(region){
147 this.fireEvent("regionexpanded", region);
151 * Returns the size of the current view. This method normalizes document.body and element embedded layouts and
152 * performs box-model adjustments.
153 * @return {Object} The size as an object {width: (the width), height: (the height)}
155 getViewSize : function()
158 if(this.el.dom != document.body){
159 size = this.el.getSize();
161 size = {width: Roo.lib.Dom.getViewWidth(), height: Roo.lib.Dom.getViewHeight()};
163 size.width -= this.el.getBorderWidth("lr")-this.el.getPadding("lr");
164 size.height -= this.el.getBorderWidth("tb")-this.el.getPadding("tb");
169 * Returns the Element this layout is bound to.
170 * @return {Roo.Element}
177 * Returns the specified region.
178 * @param {String} target The region key ('center', 'north', 'south', 'east' or 'west')
179 * @return {Roo.LayoutRegion}
181 getRegion : function(target){
182 return this.regions[target.toLowerCase()];
185 onWindowResize : function(){
186 if(this.monitorWindowResize){