Toolbar-legacy.js
4.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// backwards compat
Ext.toolbar.Toolbar.Button = Ext.extend(Ext.button.Button, {});
Ext.toolbar.Toolbar.SplitButton = Ext.extend(Ext.button.Split, {});
Ext.reg('tbbutton', Ext.toolbar.Toolbar.Button);
Ext.reg('tbsplit', Ext.toolbar.Toolbar.SplitButton);
// Exclude from documentation
Ext.toolbar.Toolbar.override({
/*
* Adds text to the toolbar
* <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
* @param {String} text The text to add
* @return {Ext.toolbar.Item} The element's item
*/
addText : function(text){
return this.addItem(new Ext.Toolbar.TextItem(text));
},
/*
* Adds a new element to the toolbar from the passed {@link Ext.DomHelper} config
* <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
* @param {Object} config
* @return {Ext.toolbar.Item} The element's item
*/
addDom : function(config){
return this.add(new Ext.Toolbar.Item({autoEl: config}));
},
/*
* Adds a dynamically rendered Ext.form field (Text, ComboBox, etc). Note: the field should not have
* been rendered yet. For a field that has already been rendered, use {@link #addElement}.
* <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
* @param {Ext.form.field.Field} field
* @return {Ext.toolbar.Item}
*/
addField : function(field){
return this.add(field);
},
/*
* Inserts any {@link Ext.toolbar.Item}/{@link Ext.button.Button} at the specified index.
* <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
* @param {Number} index The index where the item is to be inserted
* @param {Object/Ext.toolbar.Item/Ext.button.Button/Object[]} item The button, or button config object to be
* inserted, or an array of buttons/configs.
* @return {Ext.button.Button/Ext.toolbar.Item}
*/
insertButton : function(index, item){
if(Ext.isArray(item)){
var buttons = [],
i, len;
for(i = 0, len = item.length; i < len; i++) {
buttons.push(this.insertButton(index + i, item[i]));
}
return buttons;
}
return Ext.toolbar.Toolbar.superclass.insert.call(this, index, item);
},
/*
* Adds a separator
* <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
* @return {Ext.toolbar.Item} The separator {@link Ext.toolbar.Item item}
*/
addSeparator : function(){
return this.add(new Ext.toolbar.Separator());
},
/*
* Adds a spacer element
* <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
* @return {Ext.toolbar.Spacer} The spacer item
*/
addSpacer : function(){
return this.add(new Ext.Toolbar.Spacer());
},
/*
* Forces subsequent additions into the float:right toolbar
* <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
*/
addFill : function(){
this.add(new Ext.Toolbar.Fill());
},
/*
* Adds any standard HTML element to the toolbar
* <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
* @param {String/HTMLElement/Ext.Element} el The element or id of the element to add
* @return {Ext.toolbar.Item} The element's item
*/
addElement : function(el){
return this.addItem(new Ext.Toolbar.Item({el:el}));
},
/*
* Adds any Toolbar.Item or subclass
* <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
* @param {Ext.toolbar.Item} item
* @return {Ext.toolbar.Item} The item
*/
addItem : function(item){
return this.add.apply(this, arguments);
},
/*
* Adds a button (or buttons). See {@link Ext.button.Button} for more info on the config.
* <br><p><b>Note</b>: See the notes within {@link Ext.container.Container#add}.</p>
* @param {Object/Object[]} config A button config or array of configs
* @return {Ext.button.Button/Ext.button.Button[]}
*/
addButton : function(config){
if(Ext.isArray(config)){
var buttons = [],
i, len;
for(i = 0, len = config.length; i < len; i++) {
buttons.push(this.addButton(config[i]));
}
return buttons;
}
return this.add(this.constructButton(config));
}
});