3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js"><div id="cls-Ext.menu.ColorMenu"></div>/**
\r
9 * @class Ext.menu.ColorMenu
\r
10 * @extends Ext.menu.Menu
\r
11 * <p>A menu containing a {@link Ext.ColorPalette} Component.</p>
\r
12 * <p>Notes:</p><div class="mdetail-params"><ul>
\r
13 * <li>Although not listed here, the <b>constructor</b> for this class
\r
14 * accepts all of the configuration options of <b>{@link Ext.ColorPalette}</b>.</li>
\r
15 * <li>If subclassing ColorMenu, any configuration options for the ColorPalette must be
\r
16 * applied to the <tt><b>initialConfig</b></tt> property of the ColorMenu.
\r
17 * Applying {@link Ext.ColorPalette ColorPalette} configuration settings to
\r
18 * <b><tt>this</tt></b> will <b>not</b> affect the ColorPalette's configuration.</li>
\r
22 Ext.menu.ColorMenu = Ext.extend(Ext.menu.Menu, {
\r
23 <div id="cfg-Ext.menu.ColorMenu-enableScrolling"></div>/**
\r
24 * @cfg {Boolean} enableScrolling
\r
27 enableScrolling : false,
\r
28 <div id="cfg-Ext.menu.ColorMenu-handler"></div>/**
\r
29 * @cfg {Function} handler
\r
30 * Optional. A function that will handle the select event of this menu.
\r
31 * The handler is passed the following parameters:<div class="mdetail-params"><ul>
\r
32 * <li><code>palette</code> : ColorPalette<div class="sub-desc">The {@link #palette Ext.ColorPalette}.</div></li>
\r
33 * <li><code>color</code> : String<div class="sub-desc">The 6-digit color hex code (without the # symbol).</div></li>
\r
36 <div id="cfg-Ext.menu.ColorMenu-scope"></div>/**
\r
37 * @cfg {Object} scope
\r
38 * The scope (<tt><b>this</b></tt> reference) in which the <code>{@link #handler}</code>
\r
39 * function will be called. Defaults to this ColorMenu instance.
\r
42 <div id="cfg-Ext.menu.ColorMenu-hideOnClick"></div>/**
\r
43 * @cfg {Boolean} hideOnClick
\r
44 * False to continue showing the menu after a color is selected, defaults to true.
\r
48 <div id="cfg-Ext.menu.ColorMenu-maxHeight"></div>/**
\r
49 * @cfg {Number} maxHeight
\r
52 <div id="cfg-Ext.menu.ColorMenu-scrollIncrement"></div>/**
\r
53 * @cfg {Number} scrollIncrement
\r
56 <div id="prop-Ext.menu.ColorMenu-palette"></div>/**
\r
58 * @type ColorPalette
\r
59 * The {@link Ext.ColorPalette} instance for this ColorMenu
\r
63 <div id="event-Ext.menu.ColorMenu-click"></div>/**
\r
68 <div id="event-Ext.menu.ColorMenu-itemclick"></div>/**
\r
73 initComponent : function(){
\r
76 showSeparator: false,
\r
77 items: this.palette = new Ext.ColorPalette(this.initialConfig)
\r
79 this.palette.purgeListeners();
\r
80 Ext.menu.ColorMenu.superclass.initComponent.call(this);
\r
81 <div id="event-Ext.menu.ColorMenu-select"></div>/**
\r
83 * Fires when a color is selected from the {@link #palette Ext.ColorPalette}
\r
84 * @param {Ext.ColorPalette} palette The {@link #palette Ext.ColorPalette}
\r
85 * @param {String} color The 6-digit color hex code (without the # symbol)
\r
87 this.relayEvents(this.palette, ['select']);
\r
88 this.on('select', this.menuHide, this);
\r
90 this.on('select', this.handler, this.scope || this);
\r
94 menuHide : function(){
\r
95 if(this.hideOnClick){
\r
100 Ext.reg('colormenu', Ext.menu.ColorMenu);
\r