provide installation instructions
[extjs.git] / source / widgets / menu / TextItem.js
1 /*\r
2  * Ext JS Library 2.2.1\r
3  * Copyright(c) 2006-2009, Ext JS, LLC.\r
4  * licensing@extjs.com\r
5  * \r
6  * http://extjs.com/license\r
7  */\r
8 \r
9 /**\r
10  * @class Ext.menu.TextItem\r
11  * @extends Ext.menu.BaseItem\r
12  * Adds a static text string to a menu, usually used as either a heading or group separator.\r
13  * @constructor\r
14  * Creates a new TextItem\r
15  * @param {Object/String} config If config is a string, it is used as the text to display, otherwise it\r
16  * is applied as a config object (and should contain a <tt>text</tt> property).\r
17  */\r
18 Ext.menu.TextItem = function(cfg){\r
19     if(typeof cfg == 'string'){\r
20         cfg = {text: cfg}\r
21     }\r
22     Ext.menu.TextItem.superclass.constructor.call(this, cfg);\r
23 };\r
24 \r
25 Ext.extend(Ext.menu.TextItem, Ext.menu.BaseItem, {\r
26     /**\r
27      * @cfg {String} text The text to display for this item (defaults to '')\r
28      */\r
29     /**\r
30      * @cfg {Boolean} hideOnClick True to hide the containing menu after this item is clicked (defaults to false)\r
31      */\r
32     hideOnClick : false,\r
33     /**\r
34      * @cfg {String} itemCls The default CSS class to use for text items (defaults to "x-menu-text")\r
35      */\r
36     itemCls : "x-menu-text",\r
37 \r
38     // private\r
39     onRender : function(){\r
40         var s = document.createElement("span");\r
41         s.className = this.itemCls;\r
42         s.innerHTML = this.text;\r
43         this.el = s;\r
44         Ext.menu.TextItem.superclass.onRender.apply(this, arguments);\r
45     }\r
46 });