2 * @class Ext.menu.ColorPicker
3 * @extends Ext.menu.Menu
4 * <p>A menu containing a {@link Ext.picker.Color} Component.</p>
5 * <p>Notes:</p><div class="mdetail-params"><ul>
6 * <li>Although not listed here, the <b>constructor</b> for this class
7 * accepts all of the configuration options of <b>{@link Ext.picker.Color}</b>.</li>
8 * <li>If subclassing ColorMenu, any configuration options for the ColorPicker must be
9 * applied to the <tt><b>initialConfig</b></tt> property of the ColorMenu.
10 * Applying {@link Ext.picker.Color ColorPicker} configuration settings to
11 * <b><tt>this</tt></b> will <b>not</b> affect the ColorPicker's configuration.</li>
13 * {@img Ext.menu.ColorPicker/Ext.menu.ColorPicker.png Ext.menu.ColorPicker component}
15 var colorPicker = Ext.create('Ext.menu.ColorPicker', {
19 Ext.create('Ext.menu.Menu', {
22 floating: false, // usually you want this set to True (default)
23 renderTo: Ext.getBody(), // usually rendered by it's containing component
25 text: 'choose a color',
36 * @author Nicolas Ferrero
38 Ext.define('Ext.menu.ColorPicker', {
39 extend: 'Ext.menu.Menu',
41 alias: 'widget.colormenu',
48 * @cfg {Boolean} hideOnClick
49 * False to continue showing the menu after a date is selected, defaults to true.
54 * @cfg {String} pickerId
55 * An id to assign to the underlying color picker. Defaults to <tt>null</tt>.
60 * @cfg {Number} maxHeight
65 * The {@link Ext.picker.Color} instance for this ColorMenu
80 initComponent : function(){
87 cls: Ext.baseCSSPrefix + 'menu-color-item',
93 me.callParent(arguments);
95 me.picker = me.down('colorpicker');
99 * Fires when a date is selected from the {@link #picker Ext.picker.Color}
100 * @param {Ext.picker.Color} picker The {@link #picker Ext.picker.Color}
101 * @param {String} color The 6-digit color hex code (without the # symbol)
103 me.relayEvents(me.picker, ['select']);
105 if (me.hideOnClick) {
106 me.on('select', me.hidePickerOnSelect, me);
111 * Hides picker on select if hideOnClick is true
114 hidePickerOnSelect: function() {
115 Ext.menu.Manager.hideAll();