3 <title>The source code</title>
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 <body onload="prettyPrint();">
8 <pre class="prettyprint lang-js">/*!
10 * Copyright(c) 2006-2009 Ext JS, LLC
12 * http://www.extjs.com/license
14 <div id="cls-Ext.layout.ToolbarLayout"></div>/**
\r
15 * @class Ext.layout.ToolbarLayout
\r
16 * @extends Ext.layout.ContainerLayout
\r
17 * Layout manager implicitly used by Ext.Toolbar.
\r
19 Ext.layout.ToolbarLayout = Ext.extend(Ext.layout.ContainerLayout, {
\r
20 monitorResize : true,
\r
22 lastOverflow : false,
\r
24 noItemsMenuText : '<div class="x-toolbar-no-items">(None)</div>',
\r
26 onLayout : function(ct, target){
\r
28 target.addClass('x-toolbar-layout-ct');
\r
29 target.insertHtml('beforeEnd',
\r
30 '<table cellspacing="0" class="x-toolbar-ct"><tbody><tr><td class="x-toolbar-left" align="left"><table cellspacing="0"><tbody><tr class="x-toolbar-left-row"></tr></tbody></table></td><td class="x-toolbar-right" align="right"><table cellspacing="0" class="x-toolbar-right-ct"><tbody><tr><td><table cellspacing="0"><tbody><tr class="x-toolbar-right-row"></tr></tbody></table></td><td><table cellspacing="0"><tbody><tr class="x-toolbar-extras-row"></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table>');
\r
31 this.leftTr = target.child('tr.x-toolbar-left-row', true);
\r
32 this.rightTr = target.child('tr.x-toolbar-right-row', true);
\r
33 this.extrasTr = target.child('tr.x-toolbar-extras-row', true);
\r
35 var side = this.leftTr;
\r
38 var items = ct.items.items;
\r
39 for(var i = 0, len = items.length, c; i < len; i++, pos++) {
\r
42 side = this.rightTr;
\r
44 }else if(!c.rendered){
\r
45 c.render(this.insertCell(c, side, pos));
\r
47 if(!c.xtbHidden && !this.isValidParent(c, side.childNodes[pos])){
\r
48 var td = this.insertCell(c, side, pos);
\r
49 td.appendChild(c.getDomPositionEl().dom);
\r
50 c.container = Ext.get(td);
\r
54 //strip extra empty cells
\r
55 this.cleanup(this.leftTr);
\r
56 this.cleanup(this.rightTr);
\r
57 this.cleanup(this.extrasTr);
\r
58 this.fitToSize(target);
\r
61 cleanup : function(row){
\r
62 var cn = row.childNodes;
\r
63 for(var i = cn.length-1, c; i >= 0 && (c = cn[i]); i--){
\r
70 insertCell : function(c, side, pos){
\r
71 var td = document.createElement('td');
\r
72 td.className='x-toolbar-cell';
\r
73 side.insertBefore(td, side.childNodes[pos]||null);
\r
77 hideItem : function(item){
\r
78 var h = (this.hiddens = this.hiddens || []);
\r
80 item.xtbHidden = true;
\r
81 item.xtbWidth = item.getDomPositionEl().dom.parentNode.offsetWidth;
\r
85 unhideItem : function(item){
\r
87 item.xtbHidden = false;
\r
88 this.hiddens.remove(item);
\r
89 if(this.hiddens.length < 1){
\r
90 delete this.hiddens;
\r
94 getItemWidth : function(c){
\r
95 return c.hidden ? (c.xtbWidth || 0) : c.getDomPositionEl().dom.parentNode.offsetWidth;
\r
98 fitToSize : function(t){
\r
99 if(this.container.enableOverflow === false){
\r
102 var w = t.dom.clientWidth;
\r
103 var lw = this.lastWidth || 0;
\r
104 this.lastWidth = w;
\r
105 var iw = t.dom.firstChild.offsetWidth;
\r
107 var clipWidth = w - this.triggerWidth;
\r
108 var hideIndex = -1;
\r
110 if(iw > w || (this.hiddens && w >= lw)){
\r
111 var i, items = this.container.items.items, len = items.length, c;
\r
113 for(i = 0; i < len; i++) {
\r
116 loopWidth += this.getItemWidth(c);
\r
117 if(loopWidth > clipWidth){
\r
123 this.unhideItem(c);
\r
131 if(!this.lastOverflow){
\r
132 this.container.fireEvent('overflowchange', this.container, true);
\r
133 this.lastOverflow = true;
\r
135 }else if(this.more){
\r
137 this.more.destroy();
\r
139 if(this.lastOverflow){
\r
140 this.container.fireEvent('overflowchange', this.container, false);
\r
141 this.lastOverflow = false;
\r
146 createMenuConfig : function(c, hideOnClick){
\r
147 var cfg = Ext.apply({}, c.initialConfig),
\r
148 group = c.toggleGroup;
\r
151 text: c.overflowText || c.text,
\r
152 iconCls: c.iconCls,
\r
155 disabled: c.disabled,
\r
156 handler: c.handler,
\r
159 hideOnClick: hideOnClick
\r
161 if(group || c.enableToggle){
\r
164 checked: c.pressed,
\r
166 checkchange: function(item, checked){
\r
178 addComponentToMenu : function(m, c){
\r
179 if(c instanceof Ext.Toolbar.Separator){
\r
181 }else if(Ext.isFunction(c.isXType)){
\r
182 if(c.isXType('splitbutton')){
\r
183 m.add(this.createMenuConfig(c, true));
\r
184 }else if(c.isXType('button')){
\r
185 m.add(this.createMenuConfig(c, !c.menu));
\r
186 }else if(c.isXType('buttongroup')){
\r
187 c.items.each(function(item){
\r
188 this.addComponentToMenu(m, item);
\r
194 clearMenu : function(){
\r
195 var m = this.moreMenu;
\r
197 m.items.each(function(item){
\r
204 beforeMoreShow : function(m){
\r
205 var h = this.container.items.items,
\r
209 needsSep = function(group, item){
\r
210 return group.isXType('buttongroup') && !(item instanceof Ext.Toolbar.Separator);
\r
215 for(var i = 0; i < len; i++){
\r
218 if(prev && (needsSep(c, prev) || needsSep(prev, c))){
\r
221 this.addComponentToMenu(m, c);
\r
225 // put something so the menu isn't empty
\r
226 // if no compatible items found
\r
227 if(m.items.length < 1){
\r
228 m.add(this.noItemsMenuText);
\r
232 initMore : function(){
\r
234 this.moreMenu = new Ext.menu.Menu({
\r
236 beforeshow: this.beforeMoreShow,
\r
240 this.moreMenu.ownerCt = this.container;
\r
241 this.more = new Ext.Button({
\r
242 iconCls: 'x-toolbar-more-icon',
\r
243 cls: 'x-toolbar-more',
\r
244 menu: this.moreMenu
\r
246 var td = this.insertCell(this.more, this.extrasTr, 100);
\r
247 this.more.render(td);
\r
251 destroy : function(){
\r
252 Ext.destroy(this.more, this.moreMenu);
\r
253 Ext.layout.ToolbarLayout.superclass.destroy.call(this);
\r
255 <div id="prop-Ext.layout.ToolbarLayout-activeItem"></div>/**
\r
256 * @property activeItem
\r
261 Ext.Container.LAYOUTS.toolbar = Ext.layout.ToolbarLayout;
\r
263 <div id="cls-Ext.Toolbar"></div>/**
\r
264 * @class Ext.Toolbar
\r
265 * @extends Ext.Container
\r
266 * <p>Basic Toolbar class. Although the <tt>{@link Ext.Container#defaultType defaultType}</tt> for Toolbar
\r
267 * is <tt>{@link Ext.Button button}</tt>, Toolbar elements (child items for the Toolbar container) may
\r
268 * be virtually any type of Component. Toolbar elements can be created explicitly via their constructors,
\r
269 * or implicitly via their xtypes, and can be <tt>{@link #add}</tt>ed dynamically.</p>
\r
270 * <p>Some items have shortcut strings for creation:</p>
\r
272 <u>Shortcut</u> <u>xtype</u> <u>Class</u> <u>Description</u>
\r
273 '->' 'tbfill' {@link Ext.Toolbar.Fill} begin using the right-justified button container
\r
274 '-' 'tbseparator' {@link Ext.Toolbar.Separator} add a vertical separator bar between toolbar items
\r
275 ' ' 'tbspacer' {@link Ext.Toolbar.Spacer} add horiztonal space between elements
\r
278 * Example usage of various elements:
\r
280 var tb = new Ext.Toolbar({
\r
281 renderTo: document.body,
\r
286 // xtype: 'button', // default for Toolbars, same as 'tbbutton'
\r
290 xtype: 'splitbutton', // same as 'tbsplitbutton'
\r
291 text: 'Split Button'
\r
293 // begin using the right-justified button container
\r
294 '->', // same as {xtype: 'tbfill'}, // Ext.Toolbar.Fill
\r
296 xtype: 'textfield',
\r
298 emptyText: 'enter search term'
\r
300 // add a vertical separator bar between toolbar items
\r
301 '-', // same as {xtype: 'tbseparator'} to create Ext.Toolbar.Separator
\r
302 'text 1', // same as {xtype: 'tbtext', text: 'text1'} to create Ext.Toolbar.TextItem
\r
303 {xtype: 'tbspacer'},// same as ' ' to create Ext.Toolbar.Spacer
\r
305 {xtype: 'tbspacer', width: 50}, // add a 50px space
\r
310 * Example adding a ComboBox within a menu of a button:
\r
312 // ComboBox creation
\r
313 var combo = new Ext.form.ComboBox({
\r
314 store: new Ext.data.ArrayStore({
\r
316 fields: ['initials', 'fullname'],
\r
318 ['FF', 'Fred Flintstone'],
\r
319 ['BR', 'Barney Rubble']
\r
322 displayField: 'fullname',
\r
325 forceSelection: true,
\r
326 triggerAction: 'all',
\r
327 emptyText: 'Select a name...',
\r
328 selectOnFocus: true,
\r
330 getListParent: function() {
\r
331 return this.el.up('.x-menu');
\r
333 iconCls: 'no-icon' //use iconCls if placing within menu to shift to right side of menu
\r
336 // put ComboBox in a Menu
\r
337 var menu = new Ext.menu.Menu({
\r
340 combo // A Field in a Menu
\r
344 // add a Button with the menu
\r
346 text:'Button w/ Menu',
\r
347 menu: menu // assign menu by instance
\r
352 * Creates a new Toolbar
\r
353 * @param {Object/Array} config A config object or an array of buttons to <tt>{@link #add}</tt>
\r
356 Ext.Toolbar = function(config){
\r
357 if(Ext.isArray(config)){
\r
358 config = {items: config, layout: 'toolbar'};
\r
360 config = Ext.apply({
\r
363 if(config.buttons) {
\r
364 config.items = config.buttons;
\r
367 Ext.Toolbar.superclass.constructor.call(this, config);
\r
372 var T = Ext.Toolbar;
\r
374 Ext.extend(T, Ext.Container, {
\r
376 defaultType: 'button',
\r
378 <div id="cfg-Ext.Toolbar-layout"></div>/**
\r
379 * @cfg {String/Object} layout
\r
380 * This class assigns a default layout (<code>layout:'<b>toolbar</b>'</code>).
\r
381 * Developers <i>may</i> override this configuration option if another layout
\r
382 * is required (the constructor must be passed a configuration object in this
\r
383 * case instead of an array).
\r
384 * See {@link Ext.Container#layout} for additional information.
\r
388 internalDefaults: {removeMode: 'container', hideParent: true},
\r
389 toolbarCls: 'x-toolbar',
\r
391 initComponent : function(){
\r
392 T.superclass.initComponent.call(this);
\r
394 <div id="event-Ext.Toolbar-overflowchange"></div>/**
\r
395 * @event overflowchange
\r
396 * Fires after the overflow state has changed.
\r
397 * @param {Object} c The Container
\r
398 * @param {Boolean} lastOverflow overflow state
\r
400 this.addEvents('overflowchange');
\r
404 onRender : function(ct, position){
\r
406 if(!this.autoCreate){
\r
407 this.autoCreate = {
\r
408 cls: this.toolbarCls + ' x-small-editor'
\r
411 this.el = ct.createChild(Ext.apply({ id: this.id },this.autoCreate), position);
\r
412 Ext.Toolbar.superclass.onRender.apply(this, arguments);
\r
416 <div id="method-Ext.Toolbar-add"></div>/**
\r
417 * <p>Adds element(s) to the toolbar -- this function takes a variable number of
\r
418 * arguments of mixed type and adds them to the toolbar.</p>
\r
419 * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
\r
420 * @param {Mixed} arg1 The following types of arguments are all valid:<br />
\r
422 * <li>{@link Ext.Button} config: A valid button config object (equivalent to {@link #addButton})</li>
\r
423 * <li>HtmlElement: Any standard HTML element (equivalent to {@link #addElement})</li>
\r
424 * <li>Field: Any form field (equivalent to {@link #addField})</li>
\r
425 * <li>Item: Any subclass of {@link Ext.Toolbar.Item} (equivalent to {@link #addItem})</li>
\r
426 * <li>String: Any generic string (gets wrapped in a {@link Ext.Toolbar.TextItem}, equivalent to {@link #addText}).
\r
427 * Note that there are a few special strings that are treated differently as explained next.</li>
\r
428 * <li>'-': Creates a separator element (equivalent to {@link #addSeparator})</li>
\r
429 * <li>' ': Creates a spacer element (equivalent to {@link #addSpacer})</li>
\r
430 * <li>'->': Creates a fill element (equivalent to {@link #addFill})</li>
\r
432 * @param {Mixed} arg2
\r
433 * @param {Mixed} etc.
\r
438 lookupComponent : function(c){
\r
439 if(Ext.isString(c)){
\r
441 c = new T.Separator();
\r
442 }else if(c == ' '){
\r
443 c = new T.Spacer();
\r
444 }else if(c == '->'){
\r
447 c = new T.TextItem(c);
\r
449 this.applyDefaults(c);
\r
451 if(c.isFormField || c.render){ // some kind of form field, some kind of Toolbar.Item
\r
452 c = this.constructItem(c);
\r
453 }else if(c.tag){ // DomHelper spec
\r
454 c = new T.Item({autoEl: c});
\r
455 }else if(c.tagName){ // element
\r
456 c = new T.Item({el:c});
\r
457 }else if(Ext.isObject(c)){ // must be button config?
\r
458 c = c.xtype ? this.constructItem(c) : this.constructButton(c);
\r
465 applyDefaults : function(c){
\r
466 if(!Ext.isString(c)){
\r
467 c = Ext.Toolbar.superclass.applyDefaults.call(this, c);
\r
468 var d = this.internalDefaults;
\r
470 Ext.applyIf(c.initialConfig, d);
\r
480 constructItem : function(item, type){
\r
481 return Ext.create(item, type || this.defaultType);
\r
484 <div id="method-Ext.Toolbar-addSeparator"></div>/**
\r
486 * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
\r
487 * @return {Ext.Toolbar.Item} The separator {@link Ext.Toolbar.Item item}
\r
489 addSeparator : function(){
\r
490 return this.add(new T.Separator());
\r
493 <div id="method-Ext.Toolbar-addSpacer"></div>/**
\r
494 * Adds a spacer element
\r
495 * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
\r
496 * @return {Ext.Toolbar.Spacer} The spacer item
\r
498 addSpacer : function(){
\r
499 return this.add(new T.Spacer());
\r
502 <div id="method-Ext.Toolbar-addFill"></div>/**
\r
503 * Forces subsequent additions into the float:right toolbar
\r
504 * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
\r
506 addFill : function(){
\r
507 this.add(new T.Fill());
\r
510 <div id="method-Ext.Toolbar-addElement"></div>/**
\r
511 * Adds any standard HTML element to the toolbar
\r
512 * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
\r
513 * @param {Mixed} el The element or id of the element to add
\r
514 * @return {Ext.Toolbar.Item} The element's item
\r
516 addElement : function(el){
\r
517 return this.addItem(new T.Item({el:el}));
\r
520 <div id="method-Ext.Toolbar-addItem"></div>/**
\r
521 * Adds any Toolbar.Item or subclass
\r
522 * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
\r
523 * @param {Ext.Toolbar.Item} item
\r
524 * @return {Ext.Toolbar.Item} The item
\r
526 addItem : function(item){
\r
527 return this.add.apply(this, arguments);
\r
530 <div id="method-Ext.Toolbar-addButton"></div>/**
\r
531 * Adds a button (or buttons). See {@link Ext.Button} for more info on the config.
\r
532 * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
\r
533 * @param {Object/Array} config A button config or array of configs
\r
534 * @return {Ext.Button/Array}
\r
536 addButton : function(config){
\r
537 if(Ext.isArray(config)){
\r
539 for(var i = 0, len = config.length; i < len; i++) {
\r
540 buttons.push(this.addButton(config[i]));
\r
544 return this.add(this.constructButton(config));
\r
547 <div id="method-Ext.Toolbar-addText"></div>/**
\r
548 * Adds text to the toolbar
\r
549 * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
\r
550 * @param {String} text The text to add
\r
551 * @return {Ext.Toolbar.Item} The element's item
\r
553 addText : function(text){
\r
554 return this.addItem(new T.TextItem(text));
\r
557 <div id="method-Ext.Toolbar-addDom"></div>/**
\r
558 * Adds a new element to the toolbar from the passed {@link Ext.DomHelper} config
\r
559 * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
\r
560 * @param {Object} config
\r
561 * @return {Ext.Toolbar.Item} The element's item
\r
563 addDom : function(config){
\r
564 return this.add(new T.Item({autoEl: config}));
\r
567 <div id="method-Ext.Toolbar-addField"></div>/**
\r
568 * Adds a dynamically rendered Ext.form field (TextField, ComboBox, etc). Note: the field should not have
\r
569 * been rendered yet. For a field that has already been rendered, use {@link #addElement}.
\r
570 * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
\r
571 * @param {Ext.form.Field} field
\r
572 * @return {Ext.Toolbar.Item}
\r
574 addField : function(field){
\r
575 return this.add(field);
\r
578 <div id="method-Ext.Toolbar-insertButton"></div>/**
\r
579 * Inserts any {@link Ext.Toolbar.Item}/{@link Ext.Button} at the specified index.
\r
580 * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
\r
581 * @param {Number} index The index where the item is to be inserted
\r
582 * @param {Object/Ext.Toolbar.Item/Ext.Button/Array} item The button, or button config object to be
\r
583 * inserted, or an array of buttons/configs.
\r
584 * @return {Ext.Button/Item}
\r
586 insertButton : function(index, item){
\r
587 if(Ext.isArray(item)){
\r
589 for(var i = 0, len = item.length; i < len; i++) {
\r
590 buttons.push(this.insertButton(index + i, item[i]));
\r
594 return Ext.Toolbar.superclass.insert.call(this, index, item);
\r
598 initMenuTracking : function(item){
\r
599 if(this.trackMenus && item.menu){
\r
601 'menutriggerover' : this.onButtonTriggerOver,
\r
602 'menushow' : this.onButtonMenuShow,
\r
603 'menuhide' : this.onButtonMenuHide,
\r
610 constructButton : function(item){
\r
611 var b = item.events ? item : this.constructItem(item, item.split ? 'splitbutton' : this.defaultType);
\r
612 this.initMenuTracking(b);
\r
617 onDisable : function(){
\r
618 this.items.each(function(item){
\r
626 onEnable : function(){
\r
627 this.items.each(function(item){
\r
635 onButtonTriggerOver : function(btn){
\r
636 if(this.activeMenuBtn && this.activeMenuBtn != btn){
\r
637 this.activeMenuBtn.hideMenu();
\r
639 this.activeMenuBtn = btn;
\r
644 onButtonMenuShow : function(btn){
\r
645 this.activeMenuBtn = btn;
\r
649 onButtonMenuHide : function(btn){
\r
650 delete this.activeMenuBtn;
\r
653 Ext.reg('toolbar', Ext.Toolbar);
\r
655 <div id="cls-Ext.Toolbar.Item"></div>/**
\r
656 * @class Ext.Toolbar.Item
\r
657 * @extends Ext.BoxComponent
\r
658 * The base class that other non-interacting Toolbar Item classes should extend in order to
\r
659 * get some basic common toolbar item functionality.
\r
661 * Creates a new Item
\r
662 * @param {HTMLElement} el
\r
665 T.Item = Ext.extend(Ext.BoxComponent, {
\r
666 hideParent: true, // Hiding a Toolbar.Item hides its containing TD
\r
667 enable:Ext.emptyFn,
\r
668 disable:Ext.emptyFn,
\r
670 <div id="cfg-Ext.Toolbar.Item-overflowText"></div>/**
\r
671 * @cfg {String} overflowText Text to be used for the menu if the item is overflowed.
\r
674 Ext.reg('tbitem', T.Item);
\r
676 <div id="cls-Ext.Toolbar.Separator"></div>/**
\r
677 * @class Ext.Toolbar.Separator
\r
678 * @extends Ext.Toolbar.Item
\r
679 * A simple class that adds a vertical separator bar between toolbar items
\r
680 * (css class:<tt>'xtb-sep'</tt>). Example usage:
\r
685 {xtype: 'tbseparator'}, // or '-'
\r
691 * Creates a new Separator
\r
692 * @xtype tbseparator
\r
694 T.Separator = Ext.extend(T.Item, {
\r
695 onRender : function(ct, position){
\r
696 this.el = ct.createChild({tag:'span', cls:'xtb-sep'}, position);
\r
699 Ext.reg('tbseparator', T.Separator);
\r
701 <div id="cls-Ext.Toolbar.Spacer"></div>/**
\r
702 * @class Ext.Toolbar.Spacer
\r
703 * @extends Ext.Toolbar.Item
\r
704 * A simple element that adds extra horizontal space between items in a toolbar.
\r
705 * By default a 2px wide space is added via css specification:<pre><code>
\r
706 .x-toolbar .xtb-spacer {
\r
710 * <p>Example usage:</p>
\r
715 {xtype: 'tbspacer'}, // or ' '
\r
717 // space width is also configurable via javascript
\r
718 {xtype: 'tbspacer', width: 50}, // add a 50px space
\r
724 * Creates a new Spacer
\r
727 T.Spacer = Ext.extend(T.Item, {
\r
728 <div id="cfg-Ext.Toolbar.Spacer-width"></div>/**
\r
729 * @cfg {Number} width
\r
730 * The width of the spacer in pixels (defaults to 2px via css style <tt>.x-toolbar .xtb-spacer</tt>).
\r
733 onRender : function(ct, position){
\r
734 this.el = ct.createChild({tag:'div', cls:'xtb-spacer', style: this.width?'width:'+this.width+'px':''}, position);
\r
737 Ext.reg('tbspacer', T.Spacer);
\r
739 <div id="cls-Ext.Toolbar.Fill"></div>/**
\r
740 * @class Ext.Toolbar.Fill
\r
741 * @extends Ext.Toolbar.Spacer
\r
742 * A non-rendering placeholder item which instructs the Toolbar's Layout to begin using
\r
743 * the right-justified button container.
\r
748 {xtype: 'tbfill'}, // or '->'
\r
754 * Creates a new Fill
\r
757 T.Fill = Ext.extend(T.Item, {
\r
759 render : Ext.emptyFn,
\r
762 Ext.reg('tbfill', T.Fill);
\r
764 <div id="cls-Ext.Toolbar.TextItem"></div>/**
\r
765 * @class Ext.Toolbar.TextItem
\r
766 * @extends Ext.Toolbar.Item
\r
767 * A simple class that renders text directly into a toolbar
\r
768 * (with css class:<tt>'xtb-text'</tt>). Example usage:
\r
772 {xtype: 'tbtext', text: 'Item 1'} // or simply 'Item 1'
\r
777 * Creates a new TextItem
\r
778 * @param {String/Object} text A text string, or a config object containing a <tt>text</tt> property
\r
781 T.TextItem = Ext.extend(T.Item, {
\r
782 <div id="cfg-Ext.Toolbar.TextItem-text"></div>/**
\r
783 * @cfg {String} text The text to be used as innerHTML (html tags are accepted)
\r
786 constructor: function(config){
\r
787 T.TextItem.superclass.constructor.call(this, Ext.isString(config) ? {text: config} : config);
\r
791 onRender : function(ct, position) {
\r
792 this.autoEl = {cls: 'xtb-text', html: this.text || ''};
\r
793 T.TextItem.superclass.onRender.call(this, ct, position);
\r
796 <div id="method-Ext.Toolbar.TextItem-setText"></div>/**
\r
797 * Updates this item's text, setting the text to be used as innerHTML.
\r
798 * @param {String} t The text to display (html accepted).
\r
800 setText : function(t) {
\r
808 Ext.reg('tbtext', T.TextItem);
\r
810 // backwards compat
\r
811 T.Button = Ext.extend(Ext.Button, {});
\r
812 T.SplitButton = Ext.extend(Ext.SplitButton, {});
\r
813 Ext.reg('tbbutton', T.Button);
\r
814 Ext.reg('tbsplit', T.SplitButton);
\r