3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 * @class Ext.toolbar.TextItem
17 * @extends Ext.toolbar.Item
19 * A simple class that renders text directly into a toolbar.
23 * {@img Ext.toolbar.TextItem/Ext.toolbar.TextItem.png TextItem component}
25 * Ext.create('Ext.panel.Panel', {
26 * title: 'Panel with TextItem',
30 * {xtype: 'tbtext', text: 'Sample TextItem'}
32 * renderTo: Ext.getBody()
36 * Creates a new TextItem
37 * @param {Object} text A text string, or a config object containing a <tt>text</tt> property
39 Ext.define('Ext.toolbar.TextItem', {
40 extend: 'Ext.toolbar.Item',
41 requires: ['Ext.XTemplate'],
42 alias: 'widget.tbtext',
43 alternateClassName: 'Ext.Toolbar.TextItem',
46 * @cfg {String} text The text to be used as innerHTML (html tags are accepted)
52 baseCls: Ext.baseCSSPrefix + 'toolbar-text',
54 onRender : function() {
55 Ext.apply(this.renderData, {
58 this.callParent(arguments);
62 * Updates this item's text, setting the text to be used as innerHTML.
63 * @param {String} t The text to display (html accepted).
65 setText : function(t) {
68 this.ownerCt.doLayout(); // In case an empty text item (centered at zero height) receives new text.