4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-menu-ColorPicker'>/**
19 </span> * @class Ext.menu.ColorPicker
20 * @extends Ext.menu.Menu
21 * <p>A menu containing a {@link Ext.picker.Color} Component.</p>
22 * <p>Notes:</p><div class="mdetail-params"><ul>
23 * <li>Although not listed here, the <b>constructor</b> for this class
24 * accepts all of the configuration options of <b>{@link Ext.picker.Color}</b>.</li>
25 * <li>If subclassing ColorMenu, any configuration options for the ColorPicker must be
26 * applied to the <tt><b>initialConfig</b></tt> property of the ColorMenu.
27 * Applying {@link Ext.picker.Color ColorPicker} configuration settings to
28 * <b><tt>this</tt></b> will <b>not</b> affect the ColorPicker's configuration.</li>
29 * </ul></div>
31 * {@img Ext.menu.ColorPicker/Ext.menu.ColorPicker.png Ext.menu.ColorPicker component}
35 * var colorPicker = Ext.create('Ext.menu.ColorPicker', {
39 * Ext.create('Ext.menu.Menu', {
42 * floating: false, // usually you want this set to True (default)
43 * renderTo: Ext.getBody(), // usually rendered by it's containing component
45 * text: 'choose a color',
51 * text: 'regular item'
55 * @author Nicolas Ferrero
57 Ext.define('Ext.menu.ColorPicker', {
58 extend: 'Ext.menu.Menu',
60 alias: 'widget.colormenu',
66 <span id='Ext-menu-ColorPicker-cfg-hideOnClick'> /**
67 </span> * @cfg {Boolean} hideOnClick
68 * False to continue showing the menu after a date is selected, defaults to true.
72 <span id='Ext-menu-ColorPicker-cfg-pickerId'> /**
73 </span> * @cfg {String} pickerId
74 * An id to assign to the underlying color picker. Defaults to <tt>null</tt>.
78 <span id='Ext-menu-ColorPicker-cfg-maxHeight'> /**
79 </span> * @cfg {Number} maxHeight
83 <span id='Ext-menu-ColorPicker-property-picker'> /**
84 </span> * The {@link Ext.picker.Color} instance for this ColorMenu
89 <span id='Ext-menu-ColorPicker-event-click'> /**
90 </span> * @event click
94 <span id='Ext-menu-ColorPicker-event-itemclick'> /**
95 </span> * @event itemclick
99 initComponent : function(){
104 showSeparator: false,
106 cls: Ext.baseCSSPrefix + 'menu-color-item',
112 me.callParent(arguments);
114 me.picker = me.down('colorpicker');
116 <span id='Ext-menu-ColorPicker-event-select'> /**
117 </span> * @event select
118 * Fires when a date is selected from the {@link #picker Ext.picker.Color}
119 * @param {Ext.picker.Color} picker The {@link #picker Ext.picker.Color}
120 * @param {String} color The 6-digit color hex code (without the # symbol)
122 me.relayEvents(me.picker, ['select']);
124 if (me.hideOnClick) {
125 me.on('select', me.hidePickerOnSelect, me);
129 <span id='Ext-menu-ColorPicker-method-hidePickerOnSelect'> /**
130 </span> * Hides picker on select if hideOnClick is true
133 hidePickerOnSelect: function() {
134 Ext.menu.Manager.hideAll();