3 <title>The source code</title>
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 <body onload="prettyPrint();">
8 <pre class="prettyprint lang-js">/*!
10 * Copyright(c) 2006-2009 Ext JS, LLC
12 * http://www.extjs.com/license
14 <div id="cls-Ext.ButtonGroup"></div>/**
\r
15 * @class Ext.ButtonGroup
\r
16 * @extends Ext.Panel
\r
17 * Container for a group of buttons. Example usage:
\r
19 var p = new Ext.Panel({
\r
20 title: 'Panel with Button Group',
\r
23 renderTo: document.body,
\r
26 xtype: 'buttongroup',
\r
27 {@link #columns}: 3,
\r
32 rowspan: 3, iconCls: 'add',
\r
34 cls: 'x-btn-as-arrow'
\r
36 xtype:'splitbutton',
\r
37 text: 'Menu Button',
\r
42 arrowAlign:'bottom',
\r
43 menu: [{text: 'Menu Item 1'}]
\r
45 xtype:'splitbutton', text: 'Cut', iconCls: 'add16', menu: [{text: 'Cut Menu Item'}]
\r
47 text: 'Copy', iconCls: 'add16'
\r
49 text: 'Format', iconCls: 'add16'
\r
54 * @xtype buttongroup
\r
56 Ext.ButtonGroup = Ext.extend(Ext.Panel, {
\r
57 <div id="cfg-Ext.ButtonGroup-columns"></div>/**
\r
58 * @cfg {Number} columns The <tt>columns</tt> configuration property passed to the
\r
59 * {@link #layout configured layout manager}. See {@link Ext.layout.TableLayout#columns}.
\r
61 <div id="cfg-Ext.ButtonGroup-baseCls"></div>/**
\r
62 * @cfg {String} baseCls Defaults to <tt>'x-btn-group'</tt>. See {@link Ext.Panel#baseCls}.
\r
64 baseCls: 'x-btn-group',
\r
65 <div id="cfg-Ext.ButtonGroup-layout"></div>/**
\r
66 * @cfg {String} layout Defaults to <tt>'table'</tt>. See {@link Ext.Container#layout}.
\r
69 defaultType: 'button',
\r
70 <div id="cfg-Ext.ButtonGroup-frame"></div>/**
\r
71 * @cfg {Boolean} frame Defaults to <tt>true</tt>. See {@link Ext.Panel#frame}.
\r
74 internalDefaults: {removeMode: 'container', hideParent: true},
\r
76 initComponent : function(){
\r
77 this.layoutConfig = this.layoutConfig || {};
\r
78 Ext.applyIf(this.layoutConfig, {
\r
79 columns : this.columns
\r
82 this.addClass('x-btn-group-notitle');
\r
84 this.on('afterlayout', this.onAfterLayout, this);
\r
85 Ext.ButtonGroup.superclass.initComponent.call(this);
\r
88 applyDefaults : function(c){
\r
89 c = Ext.ButtonGroup.superclass.applyDefaults.call(this, c);
\r
90 var d = this.internalDefaults;
\r
92 Ext.applyIf(c.initialConfig, d);
\r
100 onAfterLayout : function(){
\r
101 var bodyWidth = this.body.getFrameWidth('lr') + this.body.dom.firstChild.offsetWidth;
\r
102 this.body.setWidth(bodyWidth);
\r
103 this.el.setWidth(bodyWidth + this.getFrameWidth());
\r
105 <div id="cfg-Ext.ButtonGroup-tools"></div>/**
\r
106 * @cfg {Array} tools @hide
\r
110 Ext.reg('buttongroup', Ext.ButtonGroup);
\r