3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 * Component layout for components which maintain an inner body element which must be resized to synchronize with the
18 * @class Ext.layout.component.Body
19 * @extends Ext.layout.component.Component
23 Ext.define('Ext.layout.component.Body', {
25 /* Begin Definitions */
27 alias: ['layout.body'],
29 extend: 'Ext.layout.component.Component',
31 uses: ['Ext.layout.container.Container'],
37 onLayout: function(width, height) {
41 // Size the Component's encapsulating element according to the dimensions
42 me.setTargetSize(width, height);
44 // Size the Component's body element according to the content box of the encapsulating element
45 me.setBodySize.apply(me, arguments);
47 // We need to bind to the owner whenever we do not have a user set height or width.
48 if (owner && owner.layout && owner.layout.isLayout) {
49 if (!Ext.isNumber(owner.height) || !Ext.isNumber(owner.width)) {
50 owner.layout.bindToOwnerCtComponent = true;
53 owner.layout.bindToOwnerCtComponent = false;
57 me.callParent(arguments);
62 * <p>Sizes the Component's body element to fit exactly within the content box of the Component's encapsulating element.<p>
64 setBodySize: function(width, height) {
67 frameSize = owner.frameSize,
68 isNumber = Ext.isNumber;
70 if (isNumber(width)) {
71 width -= owner.el.getFrameWidth('lr') - frameSize.left - frameSize.right;
73 if (isNumber(height)) {
74 height -= owner.el.getFrameWidth('tb') - frameSize.top - frameSize.bottom;
77 me.setElementSize(owner.body, width, height);