3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js"><div id="cls-Ext.ButtonGroup"></div>/**
\r
9 * @class Ext.ButtonGroup
\r
10 * @extends Ext.Panel
\r
11 * Container for a group of buttons. Example usage:
\r
13 var p = new Ext.Panel({
\r
14 title: 'Panel with Button Group',
\r
17 renderTo: document.body,
\r
20 xtype: 'buttongroup',
\r
21 {@link #columns}: 3,
\r
26 rowspan: 3, iconCls: 'add',
\r
28 cls: 'x-btn-as-arrow'
\r
30 xtype:'splitbutton',
\r
31 text: 'Menu Button',
\r
36 arrowAlign:'bottom',
\r
37 menu: [{text: 'Menu Item 1'}]
\r
39 xtype:'splitbutton', text: 'Cut', iconCls: 'add16', menu: [{text: 'Cut Menu Item'}]
\r
41 text: 'Copy', iconCls: 'add16'
\r
43 text: 'Format', iconCls: 'add16'
\r
48 * @xtype buttongroup
\r
50 Ext.ButtonGroup = Ext.extend(Ext.Panel, {
\r
51 <div id="cfg-Ext.ButtonGroup-columns"></div>/**
\r
52 * @cfg {Number} columns The <tt>columns</tt> configuration property passed to the
\r
53 * {@link #layout configured layout manager}. See {@link Ext.layout.TableLayout#columns}.
\r
55 <div id="cfg-Ext.ButtonGroup-baseCls"></div>/**
\r
56 * @cfg {String} baseCls Defaults to <tt>'x-btn-group'</tt>. See {@link Ext.Panel#baseCls}.
\r
58 baseCls: 'x-btn-group',
\r
59 <div id="cfg-Ext.ButtonGroup-layout"></div>/**
\r
60 * @cfg {String} layout Defaults to <tt>'table'</tt>. See {@link Ext.Container#layout}.
\r
63 defaultType: 'button',
\r
64 <div id="cfg-Ext.ButtonGroup-frame"></div>/**
\r
65 * @cfg {Boolean} frame Defaults to <tt>true</tt>. See {@link Ext.Panel#frame}.
\r
68 internalDefaults: {removeMode: 'container', hideParent: true},
\r
70 initComponent : function(){
\r
71 this.layoutConfig = this.layoutConfig || {};
\r
72 Ext.applyIf(this.layoutConfig, {
\r
73 columns : this.columns
\r
76 this.addClass('x-btn-group-notitle');
\r
78 this.on('afterlayout', this.onAfterLayout, this);
\r
79 Ext.ButtonGroup.superclass.initComponent.call(this);
\r
82 applyDefaults : function(c){
\r
83 c = Ext.ButtonGroup.superclass.applyDefaults.call(this, c);
\r
84 var d = this.internalDefaults;
\r
86 Ext.applyIf(c.initialConfig, d);
\r
94 onAfterLayout : function(){
\r
95 var bodyWidth = this.body.getFrameWidth('lr') + this.body.dom.firstChild.offsetWidth;
\r
96 this.body.setWidth(bodyWidth);
\r
97 this.el.setWidth(bodyWidth + this.getFrameWidth());
\r
99 <div id="cfg-Ext.ButtonGroup-tools"></div>/**
\r
100 * @cfg {Array} tools @hide
\r
104 Ext.reg('buttongroup', Ext.ButtonGroup);
\r