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