1 <!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-menu.ColorPicker'>/**
2 </span> * @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>
12 * </ul></div>
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',
47 <span id='Ext-menu.ColorPicker-cfg-hideOnClick'> /**
48 </span> * @cfg {Boolean} hideOnClick
49 * False to continue showing the menu after a date is selected, defaults to true.
53 <span id='Ext-menu.ColorPicker-cfg-pickerId'> /**
54 </span> * @cfg {String} pickerId
55 * An id to assign to the underlying color picker. Defaults to <tt>null</tt>.
59 <span id='Ext-menu.ColorPicker-cfg-maxHeight'> /**
60 </span> * @cfg {Number} maxHeight
64 <span id='Ext-menu.ColorPicker-property-picker'> /**
65 </span> * The {@link Ext.picker.Color} instance for this ColorMenu
70 <span id='Ext-menu.ColorPicker-event-click'> /**
71 </span> * @event click
75 <span id='Ext-menu.ColorPicker-event-itemclick'> /**
76 </span> * @event itemclick
80 initComponent : function(){
87 cls: Ext.baseCSSPrefix + 'menu-color-item',
93 me.callParent(arguments);
95 me.picker = me.down('colorpicker');
97 <span id='Ext-menu.ColorPicker-event-select'> /**
98 </span> * @event select
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);
110 <span id='Ext-menu.ColorPicker-method-hidePickerOnSelect'> /**
111 </span> * Hides picker on select if hideOnClick is true
114 hidePickerOnSelect: function() {
115 Ext.menu.Manager.hideAll();
117 });</pre></pre></body></html>