X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..10a866c12701c0a0afd0ac85dcdcf32a421514ac:/src/widgets/menu/ColorMenu.js diff --git a/src/widgets/menu/ColorMenu.js b/src/widgets/menu/ColorMenu.js index 6e20cd1c..15aa4020 100644 --- a/src/widgets/menu/ColorMenu.js +++ b/src/widgets/menu/ColorMenu.js @@ -1,5 +1,5 @@ /*! - * Ext JS Library 3.0.0 + * Ext JS Library 3.1.0 * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license @@ -7,7 +7,15 @@ /** * @class Ext.menu.ColorMenu * @extends Ext.menu.Menu - * A menu containing a {@link Ext.ColorPalette} Component. + *
A menu containing a {@link Ext.ColorPalette} Component.
+ *Notes:
palette
: ColorPalettecolor
: String{@link #handler}
+ * function will be called. Defaults to this ColorMenu instance.
+ */
/**
* @cfg {Boolean} hideOnClick
* False to continue showing the menu after a color is selected, defaults to true.
*/
- hideOnClick: true,
+ hideOnClick : true,
+
+ cls : 'x-color-menu',
+
+ /**
+ * @cfg {String} paletteId
+ * An id to assign to the underlying color palette. Defaults to null.
+ */
+ paletteId : null,
/**
* @cfg {Number} maxHeight
@@ -48,25 +77,33 @@
* @hide
*/
- initComponent: function(){
+ initComponent : function(){
Ext.apply(this, {
plain: true,
showSeparator: false,
- items: this.palette = new Ext.ColorPalette(this.initialConfig)
+ items: this.palette = new Ext.ColorPalette(Ext.applyIf({
+ id: this.paletteId
+ }, this.initialConfig))
});
this.palette.purgeListeners();
Ext.menu.ColorMenu.superclass.initComponent.call(this);
+ /**
+ * @event select
+ * Fires when a color is selected from the {@link #palette Ext.ColorPalette}
+ * @param {Ext.ColorPalette} palette The {@link #palette Ext.ColorPalette}
+ * @param {String} color The 6-digit color hex code (without the # symbol)
+ */
this.relayEvents(this.palette, ['select']);
this.on('select', this.menuHide, this);
if(this.handler){
- this.on('select', this.handler, this.scope || this)
+ this.on('select', this.handler, this.scope || this);
}
},
- menuHide: function(){
+ menuHide : function(){
if(this.hideOnClick){
this.hide(true);
}
}
});
-Ext.reg('colormenu', Ext.menu.ColorMenu);
\ No newline at end of file
+Ext.reg('colormenu', Ext.menu.ColorMenu);