3 * Copyright(c) 2006-2010 Ext JS, Inc.
5 * http://www.extjs.com/license
8 * @class Ext.ButtonGroup
10 * Container for a group of buttons. Example usage:
12 var p = new Ext.Panel({
13 title: 'Panel with Button Group',
16 renderTo: document.body,
25 rowspan: 3, iconCls: 'add',
36 menu: [{text: 'Menu Item 1'}]
38 xtype:'splitbutton', text: 'Cut', iconCls: 'add16', menu: [{text: 'Cut Menu Item'}]
40 text: 'Copy', iconCls: 'add16'
42 text: 'Format', iconCls: 'add16'
48 * Create a new ButtonGroup.
49 * @param {Object} config The config object
52 Ext.ButtonGroup = Ext.extend(Ext.Panel, {
54 * @cfg {Number} columns The <tt>columns</tt> configuration property passed to the
55 * {@link #layout configured layout manager}. See {@link Ext.layout.TableLayout#columns}.
58 * @cfg {String} baseCls Defaults to <tt>'x-btn-group'</tt>. See {@link Ext.Panel#baseCls}.
60 baseCls: 'x-btn-group',
62 * @cfg {String} layout Defaults to <tt>'table'</tt>. See {@link Ext.Container#layout}.
65 defaultType: 'button',
67 * @cfg {Boolean} frame Defaults to <tt>true</tt>. See {@link Ext.Panel#frame}.
70 internalDefaults: {removeMode: 'container', hideParent: true},
72 initComponent : function(){
73 this.layoutConfig = this.layoutConfig || {};
74 Ext.applyIf(this.layoutConfig, {
75 columns : this.columns
78 this.addClass('x-btn-group-notitle');
80 this.on('afterlayout', this.onAfterLayout, this);
81 Ext.ButtonGroup.superclass.initComponent.call(this);
84 applyDefaults : function(c){
85 c = Ext.ButtonGroup.superclass.applyDefaults.call(this, c);
86 var d = this.internalDefaults;
88 Ext.applyIf(c.initialConfig, d);
96 onAfterLayout : function(){
97 var bodyWidth = this.body.getFrameWidth('lr') + this.body.dom.firstChild.offsetWidth;
98 this.body.setWidth(bodyWidth);
99 this.el.setWidth(bodyWidth + this.getFrameWidth());
102 * @cfg {Array} tools @hide
106 Ext.reg('buttongroup', Ext.ButtonGroup);