5 Ext.toolbar.Toolbar.Button = Ext.extend(Ext.button.Button, {});
6 Ext.toolbar.Toolbar.SplitButton = Ext.extend(Ext.button.Split, {});
7 Ext.reg('tbbutton', Ext.toolbar.Toolbar.Button);
8 Ext.reg('tbsplit', Ext.toolbar.Toolbar.SplitButton);
13 Ext.toolbar.Toolbar.override({
15 * Adds text to the toolbar
16 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
17 * @param {String} text The text to add
18 * @return {Ext.Toolbar.Item} The element's item
20 addText : function(text){
21 return this.addItem(new Ext.Toolbar.TextItem(text));
25 * Adds a new element to the toolbar from the passed {@link Ext.core.DomHelper} config
26 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
27 * @param {Object} config
28 * @return {Ext.Toolbar.Item} The element's item
30 addDom : function(config){
31 return this.add(new Ext.Toolbar.Item({autoEl: config}));
35 * Adds a dynamically rendered Ext.form field (Text, ComboBox, etc). Note: the field should not have
36 * been rendered yet. For a field that has already been rendered, use {@link #addElement}.
37 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
38 * @param {Ext.form.field.Field} field
39 * @return {Ext.Toolbar.Item}
41 addField : function(field){
42 return this.add(field);
46 * Inserts any {@link Ext.toolbar.Item}/{@link Ext.button.Button} at the specified index.
47 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
48 * @param {Number} index The index where the item is to be inserted
49 * @param {Object/Ext.Toolbar.Item/Ext.button.Button/Array} item The button, or button config object to be
50 * inserted, or an array of buttons/configs.
51 * @return {Ext.button.Button/Item}
53 insertButton : function(index, item){
54 if(Ext.isArray(item)){
56 for(var i = 0, len = item.length; i < len; i++) {
57 buttons.push(this.insertButton(index + i, item[i]));
61 return Ext.toolbar.Toolbar.superclass.insert.call(this, index, item);
66 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
67 * @return {Ext.toolbar.Item} The separator {@link Ext.toolbar.Item item}
69 addSeparator : function(){
70 return this.add(new Ext.toolbar.Separator());
74 * Adds a spacer element
75 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
76 * @return {Ext.Toolbar.Spacer} The spacer item
78 addSpacer : function(){
79 return this.add(new Ext.Toolbar.Spacer());
83 * Forces subsequent additions into the float:right toolbar
84 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
87 this.add(new Ext.Toolbar.Fill());
91 * Adds any standard HTML element to the toolbar
92 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
93 * @param {Mixed} el The element or id of the element to add
94 * @return {Ext.Toolbar.Item} The element's item
96 addElement : function(el){
97 return this.addItem(new Ext.Toolbar.Item({el:el}));
101 * Adds any Toolbar.Item or subclass
102 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
103 * @param {Ext.Toolbar.Item} item
104 * @return {Ext.Toolbar.Item} The item
106 addItem : function(item){
107 return this.add.apply(this, arguments);
111 * Adds a button (or buttons). See {@link Ext.button.Button} for more info on the config.
112 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
113 * @param {Object/Array} config A button config or array of configs
114 * @return {Ext.button.Button/Array}
116 addButton : function(config){
117 if(Ext.isArray(config)){
119 for(var i = 0, len = config.length; i < len; i++) {
120 buttons.push(this.addButton(config[i]));
124 return this.add(this.constructButton(config));