Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / pkgs / pkg-buttons-debug.js
index e222695..b20da17 100644 (file)
@@ -1,6 +1,6 @@
 /*!
- * Ext JS Library 3.1.0
- * Copyright(c) 2006-2009 Ext JS, LLC
+ * Ext JS Library 3.1.1
+ * Copyright(c) 2006-2010 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
  */
@@ -436,7 +436,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
         if(this.rendered){\r
             this.clearTip();\r
         }\r
-        if(this.menu && this.menu.autoDestroy) {\r
+        if(this.menu && this.destroyMenu !== false) {\r
             Ext.destroy(this.menu);\r
         }\r
         Ext.destroy(this.repeater);\r
@@ -451,6 +451,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
             delete this.btnEl;\r
             Ext.ButtonToggleMgr.unregister(this);\r
         }\r
+        Ext.Button.superclass.onDestroy.call(this);\r
     },\r
 \r
     // private\r
@@ -581,6 +582,10 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
             if(this.tooltip){\r
                 Ext.QuickTips.getQuickTip().cancelShow(this.btnEl);\r
             }\r
+            if(this.menu.isVisible()){\r
+                this.menu.hide();\r
+            }\r
+            this.menu.ownerCt = this;\r
             this.menu.show(this.el, this.menuAlign);\r
         }\r
         return this;\r
@@ -590,7 +595,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
      * Hide this button's menu (if it has one)\r
      */\r
     hideMenu : function(){\r
-        if(this.menu){\r
+        if(this.hasVisibleMenu()){\r
             this.menu.hide();\r
         }\r
         return this;\r
@@ -601,7 +606,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
      * @return {Boolean}\r
      */\r
     hasVisibleMenu : function(){\r
-        return this.menu && this.menu.isVisible();\r
+        return this.menu && this.menu.ownerCt == this && this.menu.isVisible();\r
     },\r
 \r
     // private\r
@@ -616,7 +621,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
             if(this.enableToggle && (this.allowDepress !== false || !this.pressed)){\r
                 this.toggle();\r
             }\r
-            if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){\r
+            if(this.menu && !this.hasVisibleMenu() && !this.ignoreNextClick){\r
                 this.showMenu();\r
             }\r
             this.fireEvent('click', this, e);\r
@@ -716,17 +721,21 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
     },\r
     // private\r
     onMenuShow : function(e){\r
-        this.menu.ownerCt = this;\r
-        this.ignoreNextClick = 0;\r
-        this.el.addClass('x-btn-menu-active');\r
-        this.fireEvent('menushow', this, this.menu);\r
+        if(this.menu.ownerCt == this){\r
+            this.menu.ownerCt = this;\r
+            this.ignoreNextClick = 0;\r
+            this.el.addClass('x-btn-menu-active');\r
+            this.fireEvent('menushow', this, this.menu);\r
+        }\r
     },\r
     // private\r
     onMenuHide : function(e){\r
-        this.el.removeClass('x-btn-menu-active');\r
-        this.ignoreNextClick = this.restoreClick.defer(250, this);\r
-        this.fireEvent('menuhide', this, this.menu);\r
-        delete this.menu.ownerCt;\r
+        if(this.menu.ownerCt == this){\r
+            this.el.removeClass('x-btn-menu-active');\r
+            this.ignoreNextClick = this.restoreClick.defer(250, this);\r
+            this.fireEvent('menuhide', this, this.menu);\r
+            delete this.menu.ownerCt;\r
+        }\r
     },\r
 \r
     // private\r
@@ -737,6 +746,21 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
     /**\r
      * @cfg {String} autoEl @hide\r
      */\r
+    /**\r
+     * @cfg {String/Object} html @hide\r
+     */\r
+    /**\r
+     * @cfg {String} contentEl  @hide\r
+     */\r
+    /**\r
+     * @cfg {Mixed} data  @hide\r
+     */\r
+    /**\r
+     * @cfg {Mixed} tpl  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} tplWriteMode  @hide\r
+     */\r
 });\r
 Ext.reg('button', Ext.Button);\r
 \r
@@ -1011,7 +1035,7 @@ Ext.CycleButton = Ext.extend(Ext.SplitButton, {
             }\r
             this.activeItem = item;\r
             if(!item.checked){\r
-                item.setChecked(true, true);\r
+                item.setChecked(true, false);\r
             }\r
             if(this.forceIcon){\r
                 this.setIconClass(this.forceIcon);\r
@@ -1052,7 +1076,7 @@ Ext.CycleButton = Ext.extend(Ext.SplitButton, {
         this.itemCount = this.items.length;\r
 \r
         this.menu = {cls:'x-cycle-menu', items:[]};\r
-        var checked;\r
+        var checked = 0;\r
         Ext.each(this.items, function(item, i){\r
             Ext.apply(item, {\r
                 group: item.group || this.id,\r
@@ -1063,13 +1087,12 @@ Ext.CycleButton = Ext.extend(Ext.SplitButton, {
             });\r
             this.menu.items.push(item);\r
             if(item.checked){\r
-                checked = item;\r
+                checked = i;\r
             }\r
         }, this);\r
-        this.setActiveItem(checked, true);\r
         Ext.CycleButton.superclass.initComponent.call(this);\r
-\r
         this.on('click', this.toggleSelected, this);\r
+        this.setActiveItem(checked, true);\r
     },\r
 \r
     // private\r