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