4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js">// backwards compat
19 Ext.toolbar.Toolbar.Button = Ext.extend(Ext.button.Button, {});
20 Ext.toolbar.Toolbar.SplitButton = Ext.extend(Ext.button.Split, {});
21 Ext.reg('tbbutton', Ext.toolbar.Toolbar.Button);
22 Ext.reg('tbsplit', Ext.toolbar.Toolbar.SplitButton);
27 Ext.toolbar.Toolbar.override({
29 * Adds text to the toolbar
30 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
31 * @param {String} text The text to add
32 * @return {Ext.toolbar.Item} The element's item
34 addText : function(text){
35 return this.addItem(new Ext.Toolbar.TextItem(text));
39 * Adds a new element to the toolbar from the passed {@link Ext.DomHelper} config
40 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
41 * @param {Object} config
42 * @return {Ext.toolbar.Item} The element's item
44 addDom : function(config){
45 return this.add(new Ext.Toolbar.Item({autoEl: config}));
49 * Adds a dynamically rendered Ext.form field (Text, ComboBox, etc). Note: the field should not have
50 * been rendered yet. For a field that has already been rendered, use {@link #addElement}.
51 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
52 * @param {Ext.form.field.Field} field
53 * @return {Ext.toolbar.Item}
55 addField : function(field){
56 return this.add(field);
60 * Inserts any {@link Ext.toolbar.Item}/{@link Ext.button.Button} at the specified index.
61 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
62 * @param {Number} index The index where the item is to be inserted
63 * @param {Object/Ext.toolbar.Item/Ext.button.Button/Object[]} item The button, or button config object to be
64 * inserted, or an array of buttons/configs.
65 * @return {Ext.button.Button/Ext.toolbar.Item}
67 insertButton : function(index, item){
68 if(Ext.isArray(item)){
70 for(var i = 0, len = item.length; i < len; i++) {
71 buttons.push(this.insertButton(index + i, item[i]));
75 return Ext.toolbar.Toolbar.superclass.insert.call(this, index, item);
80 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
81 * @return {Ext.toolbar.Item} The separator {@link Ext.toolbar.Item item}
83 addSeparator : function(){
84 return this.add(new Ext.toolbar.Separator());
88 * Adds a spacer element
89 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
90 * @return {Ext.toolbar.Spacer} The spacer item
92 addSpacer : function(){
93 return this.add(new Ext.Toolbar.Spacer());
97 * Forces subsequent additions into the float:right toolbar
98 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
100 addFill : function(){
101 this.add(new Ext.Toolbar.Fill());
105 * Adds any standard HTML element to the toolbar
106 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
107 * @param {String/HTMLElement/Ext.Element} el The element or id of the element to add
108 * @return {Ext.toolbar.Item} The element's item
110 addElement : function(el){
111 return this.addItem(new Ext.Toolbar.Item({el:el}));
115 * Adds any Toolbar.Item or subclass
116 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
117 * @param {Ext.toolbar.Item} item
118 * @return {Ext.toolbar.Item} The item
120 addItem : function(item){
121 return this.add.apply(this, arguments);
125 * Adds a button (or buttons). See {@link Ext.button.Button} for more info on the config.
126 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
127 * @param {Object/Object[]} config A button config or array of configs
128 * @return {Ext.button.Button/Ext.button.Button[]}
130 addButton : function(config){
131 if(Ext.isArray(config)){
133 for(var i = 0, len = config.length; i < len; i++) {
134 buttons.push(this.addButton(config[i]));
138 return this.add(this.constructButton(config));