Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / source / widgets / SplitButton.js
diff --git a/source/widgets/SplitButton.js b/source/widgets/SplitButton.js
deleted file mode 100644 (file)
index ed33c35..0000000
+++ /dev/null
@@ -1,198 +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.SplitButton\r
- * @extends Ext.Button\r
- * A split button that provides a built-in dropdown arrow that can fire an event separately from the default\r
- * click event of the button.  Typically this would be used to display a dropdown menu that provides additional\r
- * options to the primary button action, but any custom handler can provide the arrowclick implementation.  Example usage:\r
- * <pre><code>\r
-// display a dropdown menu:\r
-new Ext.SplitButton({\r
-       renderTo: 'button-ct', // the container id\r
-       text: 'Options',\r
-       handler: optionsHandler, // handle a click on the button itself\r
-       menu: new Ext.menu.Menu({\r
-        items: [\r
-               // these items will render as dropdown menu items when the arrow is clicked:\r
-               {text: 'Item 1', handler: item1Handler},\r
-               {text: 'Item 2', handler: item2Handler}\r
-        ]\r
-       })\r
-});\r
-\r
-// Instead of showing a menu, you provide any type of custom\r
-// functionality you want when the dropdown arrow is clicked:\r
-new Ext.SplitButton({\r
-       renderTo: 'button-ct',\r
-       text: 'Options',\r
-       handler: optionsHandler,\r
-       arrowHandler: myCustomHandler\r
-});\r
-</code></pre>\r
- * @cfg {Function} arrowHandler A function called when the arrow button is clicked (can be used instead of click event)\r
- * @cfg {String} arrowTooltip The title attribute of the arrow\r
- * @constructor\r
- * Create a new menu button\r
- * @param {Object} config The config object\r
- */\r
-Ext.SplitButton = Ext.extend(Ext.Button, {\r
-       // private\r
-    arrowSelector : 'button:last',\r
-\r
-    // private\r
-    initComponent : function(){\r
-        Ext.SplitButton.superclass.initComponent.call(this);\r
-        /**\r
-         * @event arrowclick\r
-         * Fires when this button's arrow is clicked\r
-         * @param {MenuButton} this\r
-         * @param {EventObject} e The click event\r
-         */\r
-        this.addEvents("arrowclick");\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        // this is one sweet looking template!\r
-        var tpl = new Ext.Template(\r
-            '<table cellspacing="0" class="x-btn-menu-wrap x-btn"><tr><td>',\r
-            '<table cellspacing="0" class="x-btn-wrap x-btn-menu-text-wrap"><tbody>',\r
-            '<tr><td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><button class="x-btn-text" type="{1}">{0}</button></td></tr>',\r
-            "</tbody></table></td><td>",\r
-            '<table cellspacing="0" class="x-btn-wrap x-btn-menu-arrow-wrap"><tbody>',\r
-            '<tr><td class="x-btn-center"><button class="x-btn-menu-arrow-el" type="button">&#160;</button></td><td class="x-btn-right"><i>&#160;</i></td></tr>',\r
-            "</tbody></table></td></tr></table>"\r
-        );\r
-        var btn, targs = [this.text || '&#160;', this.type];\r
-        if(position){\r
-            btn = tpl.insertBefore(position, targs, true);\r
-        }else{\r
-            btn = tpl.append(ct, targs, true);\r
-        }\r
-        var btnEl = btn.child(this.buttonSelector);\r
-\r
-        this.initButtonEl(btn, btnEl);\r
-        this.arrowBtnTable = btn.child("table:last");\r
-        if(this.arrowTooltip){\r
-            btn.child(this.arrowSelector).dom[this.tooltipType] = this.arrowTooltip;\r
-        }\r
-    },\r
-\r
-    // private\r
-    autoWidth : function(){\r
-        if(this.el){\r
-            var tbl = this.el.child("table:first");\r
-            var tbl2 = this.el.child("table:last");\r
-            this.el.setWidth("auto");\r
-            tbl.setWidth("auto");\r
-            if(Ext.isIE7 && Ext.isStrict){\r
-                var ib = this.el.child(this.buttonSelector);\r
-                if(ib && ib.getWidth() > 20){\r
-                    ib.clip();\r
-                    ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr'));\r
-                }\r
-            }\r
-            if(this.minWidth){\r
-                if((tbl.getWidth()+tbl2.getWidth()) < this.minWidth){\r
-                    tbl.setWidth(this.minWidth-tbl2.getWidth());\r
-                }\r
-            }\r
-            this.el.setWidth(tbl.getWidth()+tbl2.getWidth());\r
-        } \r
-    },\r
-\r
-    /**\r
-     * Sets this button's arrow click handler.\r
-     * @param {Function} handler The function to call when the arrow is clicked\r
-     * @param {Object} scope (optional) Scope for the function passed above\r
-     */\r
-    setArrowHandler : function(handler, scope){\r
-        this.arrowHandler = handler;\r
-        this.scope = scope;  \r
-    },\r
-\r
-    // private\r
-    onClick : function(e){\r
-        e.preventDefault();\r
-        if(!this.disabled){\r
-            if(e.getTarget(".x-btn-menu-arrow-wrap")){\r
-                if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){\r
-                    this.showMenu();\r
-                }\r
-                this.fireEvent("arrowclick", this, e);\r
-                if(this.arrowHandler){\r
-                    this.arrowHandler.call(this.scope || this, this, e);\r
-                }\r
-            }else{\r
-                if(this.enableToggle){\r
-                    this.toggle();\r
-                }\r
-                this.fireEvent("click", this, e);\r
-                if(this.handler){\r
-                    this.handler.call(this.scope || this, this, e);\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    getClickEl : function(e, isUp){\r
-        if(!isUp){\r
-            return (this.lastClickEl = e.getTarget("table", 10, true));\r
-        }\r
-        return this.lastClickEl;\r
-    },\r
-\r
-    // private\r
-    onDisable : function(){\r
-        if(this.el){\r
-            if(!Ext.isIE6){\r
-                this.el.addClass("x-item-disabled");\r
-            }\r
-            this.el.child(this.buttonSelector).dom.disabled = true;\r
-            this.el.child(this.arrowSelector).dom.disabled = true;\r
-        }\r
-        this.disabled = true;\r
-    },\r
-\r
-    // private\r
-    onEnable : function(){\r
-        if(this.el){\r
-            if(!Ext.isIE6){\r
-                this.el.removeClass("x-item-disabled");\r
-            }\r
-            this.el.child(this.buttonSelector).dom.disabled = false;\r
-            this.el.child(this.arrowSelector).dom.disabled = false;\r
-        }\r
-        this.disabled = false;\r
-    },\r
-\r
-    // private\r
-    isMenuTriggerOver : function(e){\r
-        return this.menu && e.within(this.arrowBtnTable) && !e.within(this.arrowBtnTable, true);\r
-    },\r
-\r
-    // private\r
-    isMenuTriggerOut : function(e, internal){\r
-        return this.menu && !e.within(this.arrowBtnTable);\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        Ext.destroy(this.arrowBtnTable);\r
-        Ext.SplitButton.superclass.onDestroy.call(this);\r
-    }\r
-});\r
-\r
-// backwards compat\r
-Ext.MenuButton = Ext.SplitButton;\r
-\r
-\r
-Ext.reg('splitbutton', Ext.SplitButton);
\ No newline at end of file