Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / src / layout / component / field / File.js
1 /**
2  * @private
3  * @class Ext.layout.component.field.File
4  * @extends Ext.layout.component.field.Field
5  * Layout class for {@link Ext.form.field.File} fields. Adjusts the input field size to accommodate
6  * the file picker trigger button.
7  * @private
8  */
9
10 Ext.define('Ext.layout.component.field.File', {
11     alias: ['layout.filefield'],
12     extend: 'Ext.layout.component.field.Field',
13
14     type: 'filefield',
15
16     sizeBodyContents: function(width, height) {
17         var me = this,
18             owner = me.owner;
19
20         if (!owner.buttonOnly) {
21             // Decrease the field's width by the width of the button and the configured buttonMargin.
22             // Both the text field and the button are floated left in CSS so they'll stack up side by side.
23             me.setElementSize(owner.inputEl, Ext.isNumber(width) ? width - owner.button.getWidth() - owner.buttonMargin : width);
24         }
25     }
26 });