X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6a7e4474cba9d8be4b2ec445e10f1691f7277c50..530ef4b6c5b943cfa68b779d11cf7de29aa878bf:/src/widgets/Button.js diff --git a/src/widgets/Button.js b/src/widgets/Button.js index a2e8b868..6f8a4e86 100644 --- a/src/widgets/Button.js +++ b/src/widgets/Button.js @@ -1,5 +1,5 @@ /*! - * Ext JS Library 3.2.0 + * Ext JS Library 3.2.1 * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license @@ -185,6 +185,13 @@ Ext.Button = Ext.extend(Ext.BoxComponent, { * @type Menu * The {@link Ext.menu.Menu Menu} object associated with this Button when configured with the {@link #menu} config option. */ + /** + * @cfg {Boolean} autoWidth + * By default, if a width is not specified the button will attempt to stretch horizontally to fit its content. + * If the button is being managed by a width sizing layout (hbox, fit, anchor), set this to false to prevent + * the button from doing this automatic sizing. + * Defaults to undefined. + */ initComponent : function(){ Ext.Button.superclass.initComponent.call(this); @@ -282,7 +289,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, { if(!Ext.isEmpty(this.oldCls)){ this.el.removeClass([this.oldCls, 'x-btn-pressed']); } - this.oldCls = (this.iconCls || this.icon) ? (this.text ? ' x-btn-text-icon' : ' x-btn-icon') : ' x-btn-noicon'; + this.oldCls = (this.iconCls || this.icon) ? (this.text ? 'x-btn-text-icon' : 'x-btn-icon') : 'x-btn-noicon'; this.el.addClass([this.oldCls, this.pressed ? 'x-btn-pressed' : null]); } }, @@ -456,7 +463,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, { // private doAutoWidth : function(){ - if(this.el && this.text && this.width === undefined){ + if(this.autoWidth !== false && this.el && this.text && this.width === undefined){ this.el.setWidth('auto'); if(Ext.isIE7 && Ext.isStrict){ var ib = this.btnEl;