2 * Component layout for components which maintain an inner body element which must be resized to synchronize with the
4 * @class Ext.layout.component.Body
5 * @extends Ext.layout.component.Component
9 Ext.define('Ext.layout.component.Body', {
11 /* Begin Definitions */
13 alias: ['layout.body'],
15 extend: 'Ext.layout.component.Component',
17 uses: ['Ext.layout.container.Container'],
23 onLayout: function(width, height) {
27 // Size the Component's encapsulating element according to the dimensions
28 me.setTargetSize(width, height);
30 // Size the Component's body element according to the content box of the encapsulating element
31 me.setBodySize.apply(me, arguments);
33 // We need to bind to the owner whenever we do not have a user set height or width.
34 if (owner && owner.layout && owner.layout.isLayout) {
35 if (!Ext.isNumber(owner.height) || !Ext.isNumber(owner.width)) {
36 owner.layout.bindToOwnerCtComponent = true;
39 owner.layout.bindToOwnerCtComponent = false;
43 me.callParent(arguments);
48 * <p>Sizes the Component's body element to fit exactly within the content box of the Component's encapsulating element.<p>
50 setBodySize: function(width, height) {
53 frameSize = owner.frameSize,
54 isNumber = Ext.isNumber;
56 if (isNumber(width)) {
57 width -= owner.el.getFrameWidth('lr') - frameSize.left - frameSize.right;
59 if (isNumber(height)) {
60 height -= owner.el.getFrameWidth('tb') - frameSize.top - frameSize.bottom;
63 me.setElementSize(owner.body, width, height);