Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / source / widgets / ColorPalette.js
diff --git a/source/widgets/ColorPalette.js b/source/widgets/ColorPalette.js
deleted file mode 100644 (file)
index 000381f..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/*\r
- * Ext JS Library 2.2.1\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
- */\r
-\r
-/**\r
- * @class Ext.ColorPalette\r
- * @extends Ext.Component\r
- * Simple color palette class for choosing colors.  The palette can be rendered to any container.<br />\r
- * Here's an example of typical usage:\r
- * <pre><code>\r
-var cp = new Ext.ColorPalette({value:'993300'});  // initial selected color\r
-cp.render('my-div');\r
-\r
-cp.on('select', function(palette, selColor){\r
-    // do something with selColor\r
-});\r
-</code></pre>\r
- * @constructor\r
- * Create a new ColorPalette\r
- * @param {Object} config The config object\r
- */\r
-Ext.ColorPalette = function(config){\r
-    Ext.ColorPalette.superclass.constructor.call(this, config);\r
-    this.addEvents(\r
-        /**\r
-            * @event select\r
-            * Fires when a color is selected\r
-            * @param {ColorPalette} this\r
-            * @param {String} color The 6-digit color hex code (without the # symbol)\r
-            */\r
-        'select'\r
-    );\r
-\r
-    if(this.handler){\r
-        this.on("select", this.handler, this.scope, true);\r
-    }\r
-};\r
-Ext.extend(Ext.ColorPalette, Ext.Component, {\r
-       /**\r
-        * @cfg {String} tpl An existing XTemplate instance to be used in place of the default template for rendering the component.\r
-        */\r
-    /**\r
-     * @cfg {String} itemCls\r
-     * The CSS class to apply to the containing element (defaults to "x-color-palette")\r
-     */\r
-    itemCls : "x-color-palette",\r
-    /**\r
-     * @cfg {String} value\r
-     * The initial color to highlight (should be a valid 6-digit color hex code without the # symbol).  Note that\r
-     * the hex codes are case-sensitive.\r
-     */\r
-    value : null,\r
-    clickEvent:'click',\r
-    // private\r
-    ctype: "Ext.ColorPalette",\r
-\r
-    /**\r
-     * @cfg {Boolean} allowReselect If set to true then reselecting a color that is already selected fires the {@link #select} event\r
-     */\r
-    allowReselect : false,\r
-\r
-    /**\r
-     * <p>An array of 6-digit color hex code strings (without the # symbol).  This array can contain any number\r
-     * of colors, and each hex code should be unique.  The width of the palette is controlled via CSS by adjusting\r
-     * the width property of the 'x-color-palette' class (or assigning a custom class), so you can balance the number\r
-     * of colors with the width setting until the box is symmetrical.</p>\r
-     * <p>You can override individual colors if needed:</p>\r
-     * <pre><code>\r
-var cp = new Ext.ColorPalette();\r
-cp.colors[0] = "FF0000";  // change the first box to red\r
-</code></pre>\r
-\r
-Or you can provide a custom array of your own for complete control:\r
-<pre><code>\r
-var cp = new Ext.ColorPalette();\r
-cp.colors = ["000000", "993300", "333300"];\r
-</code></pre>\r
-     * @type Array\r
-     */\r
-    colors : [\r
-        "000000", "993300", "333300", "003300", "003366", "000080", "333399", "333333",\r
-        "800000", "FF6600", "808000", "008000", "008080", "0000FF", "666699", "808080",\r
-        "FF0000", "FF9900", "99CC00", "339966", "33CCCC", "3366FF", "800080", "969696",\r
-        "FF00FF", "FFCC00", "FFFF00", "00FF00", "00FFFF", "00CCFF", "993366", "C0C0C0",\r
-        "FF99CC", "FFCC99", "FFFF99", "CCFFCC", "CCFFFF", "99CCFF", "CC99FF", "FFFFFF"\r
-    ],\r
-\r
-    // private\r
-    onRender : function(container, position){\r
-        var t = this.tpl || new Ext.XTemplate(\r
-            '<tpl for="."><a href="#" class="color-{.}" hidefocus="on"><em><span style="background:#{.}" unselectable="on">&#160;</span></em></a></tpl>'\r
-        );\r
-        var el = document.createElement("div");\r
-        el.id = this.getId();\r
-        el.className = this.itemCls;\r
-        t.overwrite(el, this.colors);\r
-        container.dom.insertBefore(el, position);\r
-        this.el = Ext.get(el);\r
-        this.el.on(this.clickEvent, this.handleClick,  this, {delegate: "a"});\r
-        if(this.clickEvent != 'click'){\r
-            this.el.on('click', Ext.emptyFn,  this, {delegate: "a", preventDefault:true});\r
-        }\r
-    },\r
-\r
-    // private\r
-    afterRender : function(){\r
-        Ext.ColorPalette.superclass.afterRender.call(this);\r
-        if(this.value){\r
-            var s = this.value;\r
-            this.value = null;\r
-            this.select(s);\r
-        }\r
-    },\r
-\r
-    // private\r
-    handleClick : function(e, t){\r
-        e.preventDefault();\r
-        if(!this.disabled){\r
-            var c = t.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1];\r
-            this.select(c.toUpperCase());\r
-        }\r
-    },\r
-\r
-    /**\r
-     * Selects the specified color in the palette (fires the {@link #select} event)\r
-     * @param {String} color A valid 6-digit color hex code (# will be stripped if included)\r
-     */\r
-    select : function(color){\r
-        color = color.replace("#", "");\r
-        if(color != this.value || this.allowReselect){\r
-            var el = this.el;\r
-            if(this.value){\r
-                el.child("a.color-"+this.value).removeClass("x-color-palette-sel");\r
-            }\r
-            el.child("a.color-"+color).addClass("x-color-palette-sel");\r
-            this.value = color;\r
-            this.fireEvent("select", this, color);\r
-        }\r
-    }\r
-\r
-    /**\r
-     * @cfg {String} autoEl @hide\r
-     */\r
-});\r
-Ext.reg('colorpalette', Ext.ColorPalette);
\ No newline at end of file