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.menu.ColorPicker
17 * @extends Ext.menu.Menu
18 * <p>A menu containing a {@link Ext.picker.Color} Component.</p>
19 * <p>Notes:</p><div class="mdetail-params"><ul>
20 * <li>Although not listed here, the <b>constructor</b> for this class
21 * accepts all of the configuration options of <b>{@link Ext.picker.Color}</b>.</li>
22 * <li>If subclassing ColorMenu, any configuration options for the ColorPicker must be
23 * applied to the <tt><b>initialConfig</b></tt> property of the ColorMenu.
24 * Applying {@link Ext.picker.Color ColorPicker} configuration settings to
25 * <b><tt>this</tt></b> will <b>not</b> affect the ColorPicker's configuration.</li>
28 * {@img Ext.menu.ColorPicker/Ext.menu.ColorPicker.png Ext.menu.ColorPicker component}
32 * var colorPicker = Ext.create('Ext.menu.ColorPicker', {
36 * Ext.create('Ext.menu.Menu', {
39 * floating: false, // usually you want this set to True (default)
40 * renderTo: Ext.getBody(), // usually rendered by it's containing component
42 * text: 'choose a color',
48 * text: 'regular item'
52 * @author Nicolas Ferrero
54 Ext.define('Ext.menu.ColorPicker', {
55 extend: 'Ext.menu.Menu',
57 alias: 'widget.colormenu',
64 * @cfg {Boolean} hideOnClick
65 * False to continue showing the menu after a date is selected, defaults to true.
70 * @cfg {String} pickerId
71 * An id to assign to the underlying color picker. Defaults to <tt>null</tt>.
76 * @cfg {Number} maxHeight
81 * The {@link Ext.picker.Color} instance for this ColorMenu
96 initComponent : function(){
101 showSeparator: false,
103 cls: Ext.baseCSSPrefix + 'menu-color-item',
109 me.callParent(arguments);
111 me.picker = me.down('colorpicker');
115 * Fires when a date is selected from the {@link #picker Ext.picker.Color}
116 * @param {Ext.picker.Color} picker The {@link #picker Ext.picker.Color}
117 * @param {String} color The 6-digit color hex code (without the # symbol)
119 me.relayEvents(me.picker, ['select']);
121 if (me.hideOnClick) {
122 me.on('select', me.hidePickerOnSelect, me);
127 * Hides picker on select if hideOnClick is true
130 hidePickerOnSelect: function() {
131 Ext.menu.Manager.hideAll();