3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
8 * @class Ext.layout.FitLayout
\r
9 * @extends Ext.layout.ContainerLayout
\r
10 * <p>This is a base class for layouts that contain <b>a single item</b> that automatically expands to fill the layout's
\r
11 * container. This class is intended to be extended or created via the <tt>layout:'fit'</tt> {@link Ext.Container#layout}
\r
12 * config, and should generally not need to be created directly via the new keyword.</p>
\r
13 * <p>FitLayout does not have any direct config options (other than inherited ones). To fit a panel to a container
\r
14 * using FitLayout, simply set layout:'fit' on the container and add a single panel to it. If the container has
\r
15 * multiple panels, only the first one will be displayed. Example usage:</p>
\r
17 var p = new Ext.Panel({
\r
18 title: 'Fit Layout',
\r
21 title: 'Inner Panel',
\r
22 html: '<p>This is the inner panel content</p>',
\r
28 Ext.layout.FitLayout = Ext.extend(Ext.layout.ContainerLayout, {
\r
33 onLayout : function(ct, target){
\r
34 Ext.layout.FitLayout.superclass.onLayout.call(this, ct, target);
\r
35 if(!this.container.collapsed){
\r
36 var sz = (Ext.isIE6 && Ext.isStrict && target.dom == document.body) ? target.getViewSize() : target.getStyleSize();
\r
37 this.setItemSize(this.activeItem || ct.items.itemAt(0), sz);
\r
42 setItemSize : function(item, size){
\r
43 if(item && size.height > 0){ // display none?
\r
48 Ext.Container.LAYOUTS['fit'] = Ext.layout.FitLayout;