Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / ColorMenu.html
1 <html>\r
2 <head>\r
3   <title>The source code</title>\r
4     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
5     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
6 </head>\r
7 <body  onload="prettyPrint();">\r
8     <pre class="prettyprint lang-js"><div id="cls-Ext.menu.ColorMenu"></div>/**\r
9  * @class Ext.menu.ColorMenu\r
10  * @extends Ext.menu.Menu\r
11  * <p>A menu containing a {@link Ext.ColorPalette} Component.</p>\r
12  * <p>Notes:</p><div class="mdetail-params"><ul>\r
13  * <li>Although not listed here, the <b>constructor</b> for this class\r
14  * accepts all of the configuration options of <b>{@link Ext.ColorPalette}</b>.</li>\r
15  * <li>If subclassing ColorMenu, any configuration options for the ColorPalette must be\r
16  * applied to the <tt><b>initialConfig</b></tt> property of the ColorMenu.\r
17  * Applying {@link Ext.ColorPalette ColorPalette} configuration settings to\r
18  * <b><tt>this</tt></b> will <b>not</b> affect the ColorPalette's configuration.</li>\r
19  * </ul></div> * \r
20  * @xtype colormenu\r
21  */\r
22  Ext.menu.ColorMenu = Ext.extend(Ext.menu.Menu, {\r
23     <div id="cfg-Ext.menu.ColorMenu-enableScrolling"></div>/** \r
24      * @cfg {Boolean} enableScrolling\r
25      * @hide \r
26      */\r
27     enableScrolling : false,\r
28     <div id="cfg-Ext.menu.ColorMenu-handler"></div>/**\r
29      * @cfg {Function} handler\r
30      * Optional. A function that will handle the select event of this menu.\r
31      * The handler is passed the following parameters:<div class="mdetail-params"><ul>\r
32      * <li><code>palette</code> : ColorPalette<div class="sub-desc">The {@link #palette Ext.ColorPalette}.</div></li>\r
33      * <li><code>color</code> : String<div class="sub-desc">The 6-digit color hex code (without the # symbol).</div></li>\r
34      * </ul></div>\r
35      */\r
36     <div id="cfg-Ext.menu.ColorMenu-scope"></div>/**\r
37      * @cfg {Object} scope\r
38      * The scope (<tt><b>this</b></tt> reference) in which the <code>{@link #handler}</code>\r
39      * function will be called.  Defaults to this ColorMenu instance.\r
40      */    \r
41     \r
42     <div id="cfg-Ext.menu.ColorMenu-hideOnClick"></div>/** \r
43      * @cfg {Boolean} hideOnClick\r
44      * False to continue showing the menu after a color is selected, defaults to true.\r
45      */\r
46     hideOnClick : true,\r
47     \r
48     <div id="cfg-Ext.menu.ColorMenu-maxHeight"></div>/** \r
49      * @cfg {Number} maxHeight\r
50      * @hide \r
51      */\r
52     <div id="cfg-Ext.menu.ColorMenu-scrollIncrement"></div>/** \r
53      * @cfg {Number} scrollIncrement\r
54      * @hide \r
55      */\r
56     <div id="prop-Ext.menu.ColorMenu-palette"></div>/**\r
57      * @property palette\r
58      * @type ColorPalette\r
59      * The {@link Ext.ColorPalette} instance for this ColorMenu\r
60      */\r
61     \r
62     \r
63     <div id="event-Ext.menu.ColorMenu-click"></div>/**\r
64      * @event click\r
65      * @hide\r
66      */\r
67     \r
68     <div id="event-Ext.menu.ColorMenu-itemclick"></div>/**\r
69      * @event itemclick\r
70      * @hide\r
71      */\r
72     \r
73     initComponent : function(){\r
74         Ext.apply(this, {\r
75             plain: true,\r
76             showSeparator: false,\r
77             items: this.palette = new Ext.ColorPalette(this.initialConfig)\r
78         });\r
79         this.palette.purgeListeners();\r
80         Ext.menu.ColorMenu.superclass.initComponent.call(this);\r
81         <div id="event-Ext.menu.ColorMenu-select"></div>/**\r
82          * @event select\r
83          * Fires when a color is selected from the {@link #palette Ext.ColorPalette}\r
84          * @param {Ext.ColorPalette} palette The {@link #palette Ext.ColorPalette}\r
85              * @param {String} color The 6-digit color hex code (without the # symbol)\r
86          */\r
87         this.relayEvents(this.palette, ['select']);\r
88         this.on('select', this.menuHide, this);\r
89         if(this.handler){\r
90             this.on('select', this.handler, this.scope || this);\r
91         }\r
92     },\r
93 \r
94     menuHide : function(){\r
95         if(this.hideOnClick){\r
96             this.hide(true);\r
97         }\r
98     }\r
99 });\r
100 Ext.reg('colormenu', Ext.menu.ColorMenu);\r
101 </pre>    \r
102 </body>\r
103 </html>