X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/b37ceabb82336ee82757cd32efe353cfab8ec267..f5240829880f87e0cf581c6a296e436fdef0ef80:/pkgs/pkg-menu-debug.js diff --git a/pkgs/pkg-menu-debug.js b/pkgs/pkg-menu-debug.js index e21f0f48..15350607 100644 --- a/pkgs/pkg-menu-debug.js +++ b/pkgs/pkg-menu-debug.js @@ -1,5 +1,5 @@ /*! - * Ext JS Library 3.2.2 + * Ext JS Library 3.3.0 * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license @@ -294,7 +294,7 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { var items = this.items; for(var i = start, len = items.length; i >= 0 && i < len; i+= step){ var item = items.get(i); - if(!item.disabled && (item.canActivate || item.isFormField)){ + if(item.isVisible() && !item.disabled && (item.canActivate || item.isFormField)){ this.setActiveItem(item, false); return item; } @@ -549,8 +549,8 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { return c; }, - applyDefaults : function(c){ - if(!Ext.isString(c)){ + applyDefaults : function(c) { + if (!Ext.isString(c)) { c = Ext.menu.Menu.superclass.applyDefaults.call(this, c); var d = this.internalDefaults; if(d){ @@ -566,10 +566,10 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { }, // private - getMenuItem : function(config){ - if(!config.isXType){ - if(!config.xtype && Ext.isBoolean(config.checked)){ - return new Ext.menu.CheckItem(config) + getMenuItem : function(config) { + if (!config.isXType) { + if (!config.xtype && Ext.isBoolean(config.checked)) { + return new Ext.menu.CheckItem(config); } return Ext.create(config, this.defaultType); } @@ -580,7 +580,7 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { * Adds a separator bar to the menu * @return {Ext.menu.Item} The menu item that was added */ - addSeparator : function(){ + addSeparator : function() { return this.add(new Ext.menu.Separator()); }, @@ -589,7 +589,7 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { * @param {Mixed} el The element or DOM node to add, or its id * @return {Ext.menu.Item} The menu item that was added */ - addElement : function(el){ + addElement : function(el) { return this.add(new Ext.menu.BaseItem({ el: el })); @@ -600,7 +600,7 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { * @param {Ext.menu.Item} item The menu item to add * @return {Ext.menu.Item} The menu item that was added */ - addItem : function(item){ + addItem : function(item) { return this.add(item); }, @@ -609,7 +609,7 @@ Ext.menu.Menu = Ext.extend(Ext.Container, { * @param {Object} config A MenuItem config object * @return {Ext.menu.Item} The menu item that was added */ - addMenuItem : function(config){ + addMenuItem : function(config) { return this.add(this.getMenuItem(config)); }, @@ -801,18 +801,6 @@ Ext.menu.MenuMgr = function(){ } } - // private - function onBeforeCheck(mi, state){ - if(state){ - var g = groups[mi.group]; - for(var i = 0, l = g.length; i < l; i++){ - if(g[i] != mi){ - g[i].setChecked(false); - } - } - } - } - return { /** @@ -875,7 +863,6 @@ Ext.menu.MenuMgr = function(){ groups[g] = []; } groups[g].push(menuItem); - menuItem.on("beforecheckchange", onBeforeCheck); } }, @@ -884,7 +871,23 @@ Ext.menu.MenuMgr = function(){ var g = menuItem.group; if(g){ groups[g].remove(menuItem); - menuItem.un("beforecheckchange", onBeforeCheck); + } + }, + + // private + onCheckChange: function(item, state){ + if(item.group && state){ + var group = groups[item.group], + i = 0, + len = group.length, + current; + + for(; i < len; i++){ + current = group[i]; + if(current != item){ + current.setChecked(false); + } + } } }, @@ -1095,15 +1098,17 @@ Ext.menu.TextItem = Ext.extend(Ext.menu.BaseItem, { */ itemCls : "x-menu-text", - constructor : function(config){ - if(typeof config == 'string'){ - config = {text: config} + constructor : function(config) { + if (typeof config == 'string') { + config = { + text: config + }; } Ext.menu.TextItem.superclass.constructor.call(this, config); }, // private - onRender : function(){ + onRender : function() { var s = document.createElement("span"); s.className = this.itemCls; s.innerHTML = this.text; @@ -1196,6 +1201,12 @@ Ext.menu.Item = Ext.extend(Ext.menu.BaseItem, { * @cfg {Number} showDelay Length of time in milliseconds to wait before showing this item (defaults to 200) */ showDelay: 200, + + /** + * @cfg {String} altText The altText to use for the icon, if it exists. Defaults to ''. + */ + altText: '', + // doc'd in BaseItem hideDelay: 200, @@ -1219,7 +1230,7 @@ Ext.menu.Item = Ext.extend(Ext.menu.BaseItem, { ' target="{hrefTarget}"', '', '>', - '', + '{altText}', '{text}', '' ); @@ -1242,7 +1253,8 @@ Ext.menu.Item = Ext.extend(Ext.menu.BaseItem, { hrefTarget: this.hrefTarget, icon: this.icon || Ext.BLANK_IMAGE_URL, iconCls: this.iconCls || '', - text: this.itemText||this.text||' ' + text: this.itemText||this.text||' ', + altText: this.altText || '' }; }, @@ -1382,7 +1394,7 @@ Ext.menu.CheckItem = Ext.extend(Ext.menu.Item, { /** * @cfg {Boolean} checked True to initialize this checkbox as checked (defaults to false). Note that - * if this checkbox is part of a radio group (group = true) only the last item in the group that is + * if this checkbox is part of a radio group (group = true) only the first item in the group that is * initialized with checked = true will be rendered as checked. */ checked: false, @@ -1447,6 +1459,7 @@ Ext.menu.CheckItem = Ext.extend(Ext.menu.Item, { setChecked : function(state, suppressEvent){ var suppress = suppressEvent === true; if(this.checked != state && (suppress || this.fireEvent("beforecheckchange", this, state) !== false)){ + Ext.menu.MenuMgr.onCheckChange(this, state); if(this.container){ this.container[state ? "addClass" : "removeClass"]("x-menu-item-checked"); }