X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..e9397f91ede62d446aed37d23256e8938fc4c335:/docs/source/BaseItem.html diff --git a/docs/source/BaseItem.html b/docs/source/BaseItem.html index 266b2f56..3d4b159b 100644 --- a/docs/source/BaseItem.html +++ b/docs/source/BaseItem.html @@ -1,11 +1,18 @@ - - - The source code - - - - -
/** + + + + The source code + + + + +
/*!
+ * Ext JS Library 3.3.1
+ * Copyright(c) 2006-2010 Sencha Inc.
+ * licensing@sencha.com
+ * http://www.sencha.com/license
+ */
+
/** * @class Ext.menu.BaseItem * @extends Ext.Component * The base class for all items that render into menus. BaseItem provides default rendering, activated state @@ -15,37 +22,7 @@ * @param {Object} config Configuration options * @xtype menubaseitem */ -Ext.menu.BaseItem = function(config){ - Ext.menu.BaseItem.superclass.constructor.call(this, config); - - this.addEvents( -
/** - * @event click - * Fires when this item is clicked - * @param {Ext.menu.BaseItem} this - * @param {Ext.EventObject} e - */ - 'click', -
/** - * @event activate - * Fires when this item is activated - * @param {Ext.menu.BaseItem} this - */ - 'activate', -
/** - * @event deactivate - * Fires when this item is deactivated - * @param {Ext.menu.BaseItem} this - */ - 'deactivate' - ); - - if(this.handler){ - this.on("click", this.handler, this.scope); - } -}; - -Ext.extend(Ext.menu.BaseItem, Ext.Component, { +Ext.menu.BaseItem = Ext.extend(Ext.Component, {
/** * @property parentMenu * @type Ext.menu.Menu @@ -76,7 +53,7 @@ Ext.extend(Ext.menu.BaseItem, Ext.Component, { */ hideOnClick : true,
/** - * @cfg {Number} clickHideDelay Length of time in milliseconds to wait before hiding after a click (defaults to 100) + * @cfg {Number} clickHideDelay Length of time in milliseconds to wait before hiding after a click (defaults to 1) */ clickHideDelay : 1, @@ -86,6 +63,34 @@ Ext.extend(Ext.menu.BaseItem, Ext.Component, { // private actionMode : "container", + initComponent : function(){ + Ext.menu.BaseItem.superclass.initComponent.call(this); + this.addEvents( +
/** + * @event click + * Fires when this item is clicked + * @param {Ext.menu.BaseItem} this + * @param {Ext.EventObject} e + */ + 'click', +
/** + * @event activate + * Fires when this item is activated + * @param {Ext.menu.BaseItem} this + */ + 'activate', +
/** + * @event deactivate + * Fires when this item is deactivated + * @param {Ext.menu.BaseItem} this + */ + 'deactivate' + ); + if(this.handler){ + this.on("click", this.handler, this.scope); + } + }, + // private onRender : function(container, position){ Ext.menu.BaseItem.superclass.onRender.apply(this, arguments); @@ -93,9 +98,12 @@ Ext.extend(Ext.menu.BaseItem, Ext.Component, { this.parentMenu = this.ownerCt; }else{ this.container.addClass('x-menu-list-item'); - this.mon(this.el, 'click', this.onClick, this); - this.mon(this.el, 'mouseenter', this.activate, this); - this.mon(this.el, 'mouseleave', this.deactivate, this); + this.mon(this.el, { + scope: this, + click: this.onClick, + mouseenter: this.activate, + mouseleave: this.deactivate + }); } }, @@ -103,7 +111,7 @@ Ext.extend(Ext.menu.BaseItem, Ext.Component, { * Sets the function that will handle click events for this item (equivalent to passing in the {@link #handler} * config property). If an existing handler is already registered, it will be unregistered for you. * @param {Function} handler The function that should be called on click - * @param {Object} scope The scope that should be passed to the handler + * @param {Object} scope The scope (this reference) in which the handler function is executed. Defaults to this menu item. */ setHandler : function(handler, scope){ if(this.handler){ @@ -147,8 +155,13 @@ Ext.extend(Ext.menu.BaseItem, Ext.Component, { // private handleClick : function(e){ + var pm = this.parentMenu; if(this.hideOnClick){ - this.parentMenu.hide.defer(this.clickHideDelay, this.parentMenu, [true]); + if(pm.floating){ + pm.hide.defer(this.clickHideDelay, pm, [true]); + }else{ + pm.deactivateActive(); + } } }, @@ -158,6 +171,6 @@ Ext.extend(Ext.menu.BaseItem, Ext.Component, { // private. Do nothing hideMenu : Ext.emptyFn }); -Ext.reg('menubaseitem', Ext.menu.BaseItem);
- +Ext.reg('menubaseitem', Ext.menu.BaseItem);
+ \ No newline at end of file