4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/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> * A menu containing a Ext.picker.Color Component.
23 * - Although not listed here, the **constructor** for this class accepts all of the
24 * configuration options of {@link Ext.picker.Color}.
25 * - If subclassing ColorMenu, any configuration options for the ColorPicker must be
26 * applied to the **initialConfig** property of the ColorMenu. Applying
27 * {@link Ext.picker.Color ColorPicker} configuration settings to `this` will **not**
28 * affect the ColorPicker's configuration.
33 * var colorPicker = Ext.create('Ext.menu.ColorPicker', {
37 * Ext.create('Ext.menu.Menu', {
40 * floating: false, // usually you want this set to True (default)
41 * renderTo: Ext.getBody(), // usually rendered by it's containing component
43 * text: 'choose a color',
49 * text: 'regular item'
53 Ext.define('Ext.menu.ColorPicker', {
54 extend: 'Ext.menu.Menu',
56 alias: 'widget.colormenu',
62 <span id='Ext-menu-ColorPicker-cfg-hideOnClick'> /**
63 </span> * @cfg {Boolean} hideOnClick
64 * False to continue showing the menu after a date is selected.
68 <span id='Ext-menu-ColorPicker-cfg-pickerId'> /**
69 </span> * @cfg {String} pickerId
70 * An id to assign to the underlying color picker.
74 <span id='Ext-menu-ColorPicker-cfg-maxHeight'> /**
75 </span> * @cfg {Number} maxHeight
79 <span id='Ext-menu-ColorPicker-property-picker'> /**
80 </span> * @property {Ext.picker.Color} picker
81 * The {@link Ext.picker.Color} instance for this ColorMenu
84 <span id='Ext-menu-ColorPicker-event-click'> /**
85 </span> * @event click
89 <span id='Ext-menu-ColorPicker-event-itemclick'> /**
90 </span> * @event itemclick
94 initComponent : function(){
96 cfg = Ext.apply({}, me.initialConfig);
98 // Ensure we don't get duplicate listeners
102 showSeparator: false,
104 cls: Ext.baseCSSPrefix + 'menu-color-item',
110 me.callParent(arguments);
112 me.picker = me.down('colorpicker');
114 <span id='Ext-menu-ColorPicker-event-select'> /**
115 </span> * @event select
116 * @alias Ext.picker.Color#select
118 me.relayEvents(me.picker, ['select']);
120 if (me.hideOnClick) {
121 me.on('select', me.hidePickerOnSelect, me);
125 <span id='Ext-menu-ColorPicker-method-hidePickerOnSelect'> /**
126 </span> * Hides picker on select if hideOnClick is true
129 hidePickerOnSelect: function() {
130 Ext.menu.Manager.hideAll();