3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.3.1
11 * Copyright(c) 2006-2010 Sencha Inc.
12 * licensing@sencha.com
13 * http://www.sencha.com/license
15 <div id="cls-Ext.layout.FitLayout"></div>/**
16 * @class Ext.layout.FitLayout
17 * @extends Ext.layout.ContainerLayout
18 * <p>This is a base class for layouts that contain <b>a single item</b> that automatically expands to fill the layout's
19 * container. This class is intended to be extended or created via the <tt>layout:'fit'</tt> {@link Ext.Container#layout}
20 * config, and should generally not need to be created directly via the new keyword.</p>
21 * <p>FitLayout does not have any direct config options (other than inherited ones). To fit a panel to a container
22 * using FitLayout, simply set layout:'fit' on the container and add a single panel to it. If the container has
23 * multiple panels, only the first one will be displayed. Example usage:</p>
25 var p = new Ext.Panel({
30 html: '<p>This is the inner panel content</p>',
36 Ext.layout.FitLayout = Ext.extend(Ext.layout.ContainerLayout, {
42 getLayoutTargetSize : function() {
43 var target = this.container.getLayoutTarget();
47 // Style Sized (scrollbars not included)
48 return target.getStyleSize();
52 onLayout : function(ct, target){
53 Ext.layout.FitLayout.superclass.onLayout.call(this, ct, target);
55 this.setItemSize(this.activeItem || ct.items.itemAt(0), this.getLayoutTargetSize());
60 setItemSize : function(item, size){
61 if(item && size.height > 0){ // display none?
66 Ext.Container.LAYOUTS['fit'] = Ext.layout.FitLayout;</pre>