3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js"><div id="cls-Ext.menu.ColorMenu"></div>/**
\r
10 * @class Ext.menu.ColorMenu
\r
11 * @extends Ext.menu.Menu
\r
12 * <p>A menu containing a {@link Ext.ColorPalette} Component.</p>
\r
13 * <p>Notes:</p><div class="mdetail-params"><ul>
\r
14 * <li>Although not listed here, the <b>constructor</b> for this class
\r
15 * accepts all of the configuration options of <b>{@link Ext.ColorPalette}</b>.</li>
\r
16 * <li>If subclassing ColorMenu, any configuration options for the ColorPalette must be
\r
17 * applied to the <tt><b>initialConfig</b></tt> property of the ColorMenu.
\r
18 * Applying {@link Ext.ColorPalette ColorPalette} configuration settings to
\r
19 * <b><tt>this</tt></b> will <b>not</b> affect the ColorPalette's configuration.</li>
\r
23 Ext.menu.ColorMenu = Ext.extend(Ext.menu.Menu, {
\r
24 <div id="cfg-Ext.menu.ColorMenu-enableScrolling"></div>/**
\r
25 * @cfg {Boolean} enableScrolling
\r
28 enableScrolling : false,
\r
29 <div id="cfg-Ext.menu.ColorMenu-handler"></div>/**
\r
30 * @cfg {Function} handler
\r
31 * Optional. A function that will handle the select event of this menu.
\r
32 * The handler is passed the following parameters:<div class="mdetail-params"><ul>
\r
33 * <li><code>palette</code> : ColorPalette<div class="sub-desc">The {@link #palette Ext.ColorPalette}.</div></li>
\r
34 * <li><code>color</code> : String<div class="sub-desc">The 6-digit color hex code (without the # symbol).</div></li>
\r
37 <div id="cfg-Ext.menu.ColorMenu-scope"></div>/**
\r
38 * @cfg {Object} scope
\r
39 * The scope (<tt><b>this</b></tt> reference) in which the <code>{@link #handler}</code>
\r
40 * function will be called. Defaults to this ColorMenu instance.
\r
43 <div id="cfg-Ext.menu.ColorMenu-hideOnClick"></div>/**
\r
44 * @cfg {Boolean} hideOnClick
\r
45 * False to continue showing the menu after a color is selected, defaults to true.
\r
49 cls : 'x-color-menu',
\r
51 <div id="cfg-Ext.menu.ColorMenu-paletteId"></div>/**
\r
52 * @cfg {String} paletteId
\r
53 * An id to assign to the underlying color palette. Defaults to <tt>null</tt>.
\r
57 <div id="cfg-Ext.menu.ColorMenu-maxHeight"></div>/**
\r
58 * @cfg {Number} maxHeight
\r
61 <div id="cfg-Ext.menu.ColorMenu-scrollIncrement"></div>/**
\r
62 * @cfg {Number} scrollIncrement
\r
65 <div id="prop-Ext.menu.ColorMenu-palette"></div>/**
\r
67 * @type ColorPalette
\r
68 * The {@link Ext.ColorPalette} instance for this ColorMenu
\r
72 <div id="event-Ext.menu.ColorMenu-click"></div>/**
\r
77 <div id="event-Ext.menu.ColorMenu-itemclick"></div>/**
\r
82 initComponent : function(){
\r
85 showSeparator: false,
\r
86 items: this.palette = new Ext.ColorPalette(Ext.applyIf({
\r
88 }, this.initialConfig))
\r
90 this.palette.purgeListeners();
\r
91 Ext.menu.ColorMenu.superclass.initComponent.call(this);
\r
92 <div id="event-Ext.menu.ColorMenu-select"></div>/**
\r
94 * Fires when a color is selected from the {@link #palette Ext.ColorPalette}
\r
95 * @param {Ext.ColorPalette} palette The {@link #palette Ext.ColorPalette}
\r
96 * @param {String} color The 6-digit color hex code (without the # symbol)
\r
98 this.relayEvents(this.palette, ['select']);
\r
99 this.on('select', this.menuHide, this);
\r
101 this.on('select', this.handler, this.scope || this);
\r
105 menuHide : function(){
\r
106 if(this.hideOnClick){
\r
111 Ext.reg('colormenu', Ext.menu.ColorMenu);
\r