4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../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"><span id='Ext-toolbar-Toolbar-Button'>/**
22 Ext.toolbar.Toolbar.Button = Ext.extend(Ext.button.Button, {});
23 Ext.toolbar.Toolbar.SplitButton = Ext.extend(Ext.button.Split, {});
24 Ext.reg('tbbutton', Ext.toolbar.Toolbar.Button);
25 Ext.reg('tbsplit', Ext.toolbar.Toolbar.SplitButton);
27 <span id='Ext-toolbar-Toolbar-Button-property-override'>/**
30 Ext.toolbar.Toolbar.override({
31 <span id='Ext-toolbar-Toolbar-Button-method-addText'> /**
32 </span> * Adds text to the toolbar
33 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
34 * @param {String} text The text to add
35 * @return {Ext.Toolbar.Item} The element's item
37 addText : function(text){
38 return this.addItem(new Ext.Toolbar.TextItem(text));
41 <span id='Ext-toolbar-Toolbar-Button-method-addDom'> /**
42 </span> * Adds a new element to the toolbar from the passed {@link Ext.core.DomHelper} config
43 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
44 * @param {Object} config
45 * @return {Ext.Toolbar.Item} The element's item
47 addDom : function(config){
48 return this.add(new Ext.Toolbar.Item({autoEl: config}));
51 <span id='Ext-toolbar-Toolbar-Button-method-addField'> /**
52 </span> * Adds a dynamically rendered Ext.form field (Text, ComboBox, etc). Note: the field should not have
53 * been rendered yet. For a field that has already been rendered, use {@link #addElement}.
54 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
55 * @param {Ext.form.field.Field} field
56 * @return {Ext.Toolbar.Item}
58 addField : function(field){
59 return this.add(field);
62 <span id='Ext-toolbar-Toolbar-Button-method-insertButton'> /**
63 </span> * Inserts any {@link Ext.toolbar.Item}/{@link Ext.button.Button} at the specified index.
64 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
65 * @param {Number} index The index where the item is to be inserted
66 * @param {Object/Ext.Toolbar.Item/Ext.button.Button/Array} item The button, or button config object to be
67 * inserted, or an array of buttons/configs.
68 * @return {Ext.button.Button/Item}
70 insertButton : function(index, item){
71 if(Ext.isArray(item)){
73 for(var i = 0, len = item.length; i < len; i++) {
74 buttons.push(this.insertButton(index + i, item[i]));
78 return Ext.toolbar.Toolbar.superclass.insert.call(this, index, item);
81 <span id='Ext-toolbar-Toolbar-Button-method-addSeparator'> /**
82 </span> * Adds a separator
83 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
84 * @return {Ext.toolbar.Item} The separator {@link Ext.toolbar.Item item}
86 addSeparator : function(){
87 return this.add(new Ext.toolbar.Separator());
90 <span id='Ext-toolbar-Toolbar-Button-method-addSpacer'> /**
91 </span> * Adds a spacer element
92 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
93 * @return {Ext.Toolbar.Spacer} The spacer item
95 addSpacer : function(){
96 return this.add(new Ext.Toolbar.Spacer());
99 <span id='Ext-toolbar-Toolbar-Button-method-addFill'> /**
100 </span> * Forces subsequent additions into the float:right toolbar
101 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
103 addFill : function(){
104 this.add(new Ext.Toolbar.Fill());
107 <span id='Ext-toolbar-Toolbar-Button-method-addElement'> /**
108 </span> * Adds any standard HTML element to the toolbar
109 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
110 * @param {Mixed} el The element or id of the element to add
111 * @return {Ext.Toolbar.Item} The element's item
113 addElement : function(el){
114 return this.addItem(new Ext.Toolbar.Item({el:el}));
117 <span id='Ext-toolbar-Toolbar-Button-method-addItem'> /**
118 </span> * Adds any Toolbar.Item or subclass
119 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
120 * @param {Ext.Toolbar.Item} item
121 * @return {Ext.Toolbar.Item} The item
123 addItem : function(item){
124 return this.add.apply(this, arguments);
127 <span id='Ext-toolbar-Toolbar-Button-method-addButton'> /**
128 </span> * Adds a button (or buttons). See {@link Ext.button.Button} for more info on the config.
129 * <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
130 * @param {Object/Array} config A button config or array of configs
131 * @return {Ext.button.Button/Array}
133 addButton : function(config){
134 if(Ext.isArray(config)){
136 for(var i = 0, len = config.length; i < len; i++) {
137 buttons.push(this.addButton(config[i]));
141 return this.add(this.constructButton(config));