4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-layout-component-Body'>/**
19 </span> * Component layout for components which maintain an inner body element which must be resized to synchronize with the
21 * @class Ext.layout.component.Body
22 * @extends Ext.layout.component.Component
26 Ext.define('Ext.layout.component.Body', {
28 /* Begin Definitions */
30 alias: ['layout.body'],
32 extend: 'Ext.layout.component.Component',
34 uses: ['Ext.layout.container.Container'],
40 onLayout: function(width, height) {
44 // Size the Component's encapsulating element according to the dimensions
45 me.setTargetSize(width, height);
47 // Size the Component's body element according to the content box of the encapsulating element
48 me.setBodySize.apply(me, arguments);
50 // We need to bind to the owner whenever we do not have a user set height or width.
51 if (owner && owner.layout && owner.layout.isLayout) {
52 if (!Ext.isNumber(owner.height) || !Ext.isNumber(owner.width)) {
53 owner.layout.bindToOwnerCtComponent = true;
56 owner.layout.bindToOwnerCtComponent = false;
60 me.callParent(arguments);
63 <span id='Ext-layout-component-Body-method-setBodySize'> /**
65 * <p>Sizes the Component's body element to fit exactly within the content box of the Component's encapsulating element.<p>
67 setBodySize: function(width, height) {
70 frameSize = owner.frameSize,
71 isNumber = Ext.isNumber;
73 if (isNumber(width)) {
74 width -= owner.el.getFrameWidth('lr') - frameSize.left - frameSize.right;
76 if (isNumber(height)) {
77 height -= owner.el.getFrameWidth('tb') - frameSize.top - frameSize.bottom;
80 me.setElementSize(owner.body, width, height);