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
15 * Base class for layout managers.
17 Roo.bootstrap.layout.Manager = function(config)
19 Roo.bootstrap.layout.Manager.superclass.constructor.call(this,config);
25 /** false to disable window resize monitoring @type Boolean */
26 this.monitorWindowResize = true;
31 * Fires when a layout is performed.
32 * @param {Roo.LayoutManager} this
36 * @event regionresized
37 * Fires when the user resizes a region.
38 * @param {Roo.LayoutRegion} region The resized region
39 * @param {Number} newSize The new size (width for east/west, height for north/south)
41 "regionresized" : true,
43 * @event regioncollapsed
44 * Fires when a region is collapsed.
45 * @param {Roo.LayoutRegion} region The collapsed region
47 "regioncollapsed" : true,
49 * @event regionexpanded
50 * Fires when a region is expanded.
51 * @param {Roo.LayoutRegion} region The expanded region
53 "regionexpanded" : true
55 this.updating = false;
58 this.el = Roo.get(config.el);
64 Roo.extend(Roo.bootstrap.layout.Manager, Roo.bootstrap.Component, {
69 monitorWindowResize : true,
75 onRender : function(ct, position)
78 this.el = Roo.get(ct);
81 //this.fireEvent('render',this);
85 initEvents: function()
90 if(this.el.dom == document.body && Roo.isIE && !config.allowScroll){
91 document.body.scroll = "no";
92 }else if(this.el.dom != document.body && this.el.getStyle('position') == 'static'){
93 this.el.position('relative');
96 this.el.addClass("roo-layout-container");
97 Roo.EventManager.onWindowResize(this.onWindowResize, this, true);
98 if(this.el.dom != document.body ) {
99 this.el.on('resize', this.layout,this);
100 this.el.on('show', this.layout,this);
106 * Returns true if this layout is currently being updated
109 isUpdating : function(){
110 return this.updating;
114 * Suspend the LayoutManager from doing auto-layouts while
115 * making multiple add or remove calls
117 beginUpdate : function(){
118 this.updating = true;
122 * Restore auto-layouts and optionally disable the manager from performing a layout
123 * @param {Boolean} noLayout true to disable a layout update
125 endUpdate : function(noLayout){
126 this.updating = false;
136 onRegionResized : function(region, newSize){
137 this.fireEvent("regionresized", region, newSize);
141 onRegionCollapsed : function(region){
142 this.fireEvent("regioncollapsed", region);
145 onRegionExpanded : function(region){
146 this.fireEvent("regionexpanded", region);
150 * Returns the size of the current view. This method normalizes document.body and element embedded layouts and
151 * performs box-model adjustments.
152 * @return {Object} The size as an object {width: (the width), height: (the height)}
154 getViewSize : function()
157 if(this.el.dom != document.body){
158 size = this.el.getSize();
160 size = {width: Roo.lib.Dom.getViewWidth(), height: Roo.lib.Dom.getViewHeight()};
162 size.width -= this.el.getBorderWidth("lr")-this.el.getPadding("lr");
163 size.height -= this.el.getBorderWidth("tb")-this.el.getPadding("tb");
168 * Returns the Element this layout is bound to.
169 * @return {Roo.Element}
176 * Returns the specified region.
177 * @param {String} target The region key ('center', 'north', 'south', 'east' or 'west')
178 * @return {Roo.LayoutRegion}
180 getRegion : function(target){
181 return this.regions[target.toLowerCase()];
184 onWindowResize : function(){
185 if(this.monitorWindowResize){