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 * A menu containing a Ext.picker.Color Component.
20 * - Although not listed here, the **constructor** for this class accepts all of the
21 * configuration options of {@link Ext.picker.Color}.
22 * - If subclassing ColorMenu, any configuration options for the ColorPicker must be
23 * applied to the **initialConfig** property of the ColorMenu. Applying
24 * {@link Ext.picker.Color ColorPicker} configuration settings to `this` will **not**
25 * affect the ColorPicker's configuration.
30 * var colorPicker = Ext.create('Ext.menu.ColorPicker', {
34 * Ext.create('Ext.menu.Menu', {
37 * floating: false, // usually you want this set to True (default)
38 * renderTo: Ext.getBody(), // usually rendered by it's containing component
40 * text: 'choose a color',
46 * text: 'regular item'
50 Ext.define('Ext.menu.ColorPicker', {
51 extend: 'Ext.menu.Menu',
53 alias: 'widget.colormenu',
60 * @cfg {Boolean} hideOnClick
61 * False to continue showing the menu after a date is selected.
66 * @cfg {String} pickerId
67 * An id to assign to the underlying color picker.
72 * @cfg {Number} maxHeight
77 * @property {Ext.picker.Color} picker
78 * The {@link Ext.picker.Color} instance for this ColorMenu
91 initComponent : function(){
93 cfg = Ext.apply({}, me.initialConfig);
95 // Ensure we don't get duplicate listeners
101 cls: Ext.baseCSSPrefix + 'menu-color-item',
107 me.callParent(arguments);
109 me.picker = me.down('colorpicker');
113 * @alias Ext.picker.Color#select
115 me.relayEvents(me.picker, ['select']);
117 if (me.hideOnClick) {
118 me.on('select', me.hidePickerOnSelect, me);
123 * Hides picker on select if hideOnClick is true
126 hidePickerOnSelect: function() {
127 Ext.menu.Manager.hideAll();