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