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);
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;
57 this.el = Roo.get(config.el);
63 Roo.extend(Roo.bootstrap.layout.Manager, Roo.bootstrap.Component, {
68 monitorWindowResize : true,
74 initEvents: function()
79 if(this.el.dom == document.body && Roo.isIE && !config.allowScroll){
80 document.body.scroll = "no";
81 }else if(this.el.dom != document.body && this.el.getStyle('position') == 'static'){
82 this.el.position('relative');
85 this.el.addClass("roo-layout-container");
86 Roo.EventManager.onWindowResize(this.onWindowResize, this, true);
91 * Returns true if this layout is currently being updated
94 isUpdating : function(){
99 * Suspend the LayoutManager from doing auto-layouts while
100 * making multiple add or remove calls
102 beginUpdate : function(){
103 this.updating = true;
107 * Restore auto-layouts and optionally disable the manager from performing a layout
108 * @param {Boolean} noLayout true to disable a layout update
110 endUpdate : function(noLayout){
111 this.updating = false;
121 onRegionResized : function(region, newSize){
122 this.fireEvent("regionresized", region, newSize);
126 onRegionCollapsed : function(region){
127 this.fireEvent("regioncollapsed", region);
130 onRegionExpanded : function(region){
131 this.fireEvent("regionexpanded", region);
135 * Returns the size of the current view. This method normalizes document.body and element embedded layouts and
136 * performs box-model adjustments.
137 * @return {Object} The size as an object {width: (the width), height: (the height)}
139 getViewSize : function()
142 if(this.el.dom != document.body){
143 size = this.el.getSize();
145 size = {width: Roo.lib.Dom.getViewWidth(), height: Roo.lib.Dom.getViewHeight()};
147 size.width -= this.el.getBorderWidth("lr")-this.el.getPadding("lr");
148 size.height -= this.el.getBorderWidth("tb")-this.el.getPadding("tb");
153 * Returns the Element this layout is bound to.
154 * @return {Roo.Element}
161 * Returns the specified region.
162 * @param {String} target The region key ('center', 'north', 'south', 'east' or 'west')
163 * @return {Roo.LayoutRegion}
165 getRegion : function(target){
166 return this.regions[target.toLowerCase()];
169 onWindowResize : function(){
170 if(this.monitorWindowResize){