Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / src / widgets / menu / ColorMenu.js
diff --git a/src/widgets/menu/ColorMenu.js b/src/widgets/menu/ColorMenu.js
new file mode 100644 (file)
index 0000000..6e20cd1
--- /dev/null
@@ -0,0 +1,72 @@
+/*!
+ * Ext JS Library 3.0.0
+ * Copyright(c) 2006-2009 Ext JS, LLC
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+/**\r
+ * @class Ext.menu.ColorMenu\r
+ * @extends Ext.menu.Menu\r
+ * A menu containing a {@link Ext.ColorPalette} Component.\r
+ * @xtype colormenu\r
+ */\r
+ Ext.menu.ColorMenu = Ext.extend(Ext.menu.Menu, {\r
+    /** \r
+     * @cfg {Boolean} enableScrolling\r
+     * @hide \r
+     */\r
+    enableScrolling: false,\r
+    \r
+    /** \r
+     * @cfg {Boolean} hideOnClick\r
+     * False to continue showing the menu after a color is selected, defaults to true.\r
+     */\r
+    hideOnClick: true,\r
+    \r
+    /** \r
+     * @cfg {Number} maxHeight\r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {Number} scrollIncrement\r
+     * @hide \r
+     */\r
+    /**\r
+     * @property palette\r
+     * @type ColorPalette\r
+     * The {@link Ext.ColorPalette} instance for this ColorMenu\r
+     */\r
+    \r
+    \r
+    /**\r
+     * @event click\r
+     * @hide\r
+     */\r
+    \r
+    /**\r
+     * @event itemclick\r
+     * @hide\r
+     */\r
+    \r
+    initComponent: function(){\r
+        Ext.apply(this, {\r
+            plain: true,\r
+            showSeparator: false,\r
+            items: this.palette = new Ext.ColorPalette(this.initialConfig)\r
+        });\r
+        this.palette.purgeListeners();\r
+        Ext.menu.ColorMenu.superclass.initComponent.call(this);\r
+        this.relayEvents(this.palette, ['select']);\r
+        this.on('select', this.menuHide, this);\r
+        if(this.handler){\r
+            this.on('select', this.handler, this.scope || this)\r
+        }\r
+    },\r
+\r
+    menuHide: function(){\r
+        if(this.hideOnClick){\r
+            this.hide(true);\r
+        }\r
+    }\r
+});\r
+Ext.reg('colormenu', Ext.menu.ColorMenu);
\ No newline at end of file