3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.2.0
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
15 <div id="cls-Ext.ButtonGroup"></div>/**
16 * @class Ext.ButtonGroup
18 * Container for a group of buttons. Example usage:
20 var p = new Ext.Panel({
21 title: 'Panel with Button Group',
24 renderTo: document.body,
33 rowspan: 3, iconCls: 'add',
44 menu: [{text: 'Menu Item 1'}]
46 xtype:'splitbutton', text: 'Cut', iconCls: 'add16', menu: [{text: 'Cut Menu Item'}]
48 text: 'Copy', iconCls: 'add16'
50 text: 'Format', iconCls: 'add16'
56 * Create a new ButtonGroup.
57 * @param {Object} config The config object
60 Ext.ButtonGroup = Ext.extend(Ext.Panel, {
61 <div id="cfg-Ext.ButtonGroup-columns"></div>/**
62 * @cfg {Number} columns The <tt>columns</tt> configuration property passed to the
63 * {@link #layout configured layout manager}. See {@link Ext.layout.TableLayout#columns}.
65 <div id="cfg-Ext.ButtonGroup-baseCls"></div>/**
66 * @cfg {String} baseCls Defaults to <tt>'x-btn-group'</tt>. See {@link Ext.Panel#baseCls}.
68 baseCls: 'x-btn-group',
69 <div id="cfg-Ext.ButtonGroup-layout"></div>/**
70 * @cfg {String} layout Defaults to <tt>'table'</tt>. See {@link Ext.Container#layout}.
73 defaultType: 'button',
74 <div id="cfg-Ext.ButtonGroup-frame"></div>/**
75 * @cfg {Boolean} frame Defaults to <tt>true</tt>. See {@link Ext.Panel#frame}.
78 internalDefaults: {removeMode: 'container', hideParent: true},
80 initComponent : function(){
81 this.layoutConfig = this.layoutConfig || {};
82 Ext.applyIf(this.layoutConfig, {
83 columns : this.columns
86 this.addClass('x-btn-group-notitle');
88 this.on('afterlayout', this.onAfterLayout, this);
89 Ext.ButtonGroup.superclass.initComponent.call(this);
92 applyDefaults : function(c){
93 c = Ext.ButtonGroup.superclass.applyDefaults.call(this, c);
94 var d = this.internalDefaults;
96 Ext.applyIf(c.initialConfig, d);
104 onAfterLayout : function(){
105 var bodyWidth = this.body.getFrameWidth('lr') + this.body.dom.firstChild.offsetWidth;
106 this.body.setWidth(bodyWidth);
107 this.el.setWidth(bodyWidth + this.getFrameWidth());
109 <div id="cfg-Ext.ButtonGroup-tools"></div>/**
110 * @cfg {Array} tools @hide
114 Ext.reg('buttongroup', Ext.ButtonGroup);