+++ /dev/null
-/*\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.menu.BaseItem\r
- * @extends Ext.Component\r
- * The base class for all items that render into menus. BaseItem provides default rendering, activated state\r
- * management and base configuration options shared by all menu components.\r
- * @constructor\r
- * Creates a new BaseItem\r
- * @param {Object} config Configuration options\r
- */\r
-Ext.menu.BaseItem = function(config){\r
- Ext.menu.BaseItem.superclass.constructor.call(this, config);\r
-\r
- this.addEvents(\r
- /**\r
- * @event click\r
- * Fires when this item is clicked\r
- * @param {Ext.menu.BaseItem} this\r
- * @param {Ext.EventObject} e\r
- */\r
- 'click',\r
- /**\r
- * @event activate\r
- * Fires when this item is activated\r
- * @param {Ext.menu.BaseItem} this\r
- */\r
- 'activate',\r
- /**\r
- * @event deactivate\r
- * Fires when this item is deactivated\r
- * @param {Ext.menu.BaseItem} this\r
- */\r
- 'deactivate'\r
- );\r
-\r
- if(this.handler){\r
- this.on("click", this.handler, this.scope);\r
- }\r
-};\r
-\r
-Ext.extend(Ext.menu.BaseItem, Ext.Component, {\r
- /**\r
- * @cfg {Function} handler\r
- * A function that will handle the click event of this menu item (defaults to undefined)\r
- */\r
- /**\r
- * @cfg {Object} scope\r
- * The scope in which the handler function will be called.\r
- */\r
- /**\r
- * @cfg {Boolean} canActivate True if this item can be visually activated (defaults to false)\r
- */\r
- canActivate : false,\r
- /**\r
- * @cfg {String} activeClass The CSS class to use when the item becomes activated (defaults to "x-menu-item-active")\r
- */\r
- activeClass : "x-menu-item-active",\r
- /**\r
- * @cfg {Boolean} hideOnClick True to hide the containing menu after this item is clicked (defaults to true)\r
- */\r
- hideOnClick : true,\r
- /**\r
- * @cfg {Number} hideDelay Length of time in milliseconds to wait before hiding after a click (defaults to 100)\r
- */\r
- hideDelay : 100,\r
-\r
- // private\r
- ctype: "Ext.menu.BaseItem",\r
-\r
- // private\r
- actionMode : "container",\r
-\r
- // private\r
- render : function(container, parentMenu){\r
- /**\r
- * The parent Menu of this Item.\r
- * @property parentMenu\r
- * @type Ext.menu.Menu\r
- */\r
- this.parentMenu = parentMenu;\r
- Ext.menu.BaseItem.superclass.render.call(this, container);\r
- this.container.menuItemId = this.id;\r
- },\r
-\r
- // private\r
- onRender : function(container, position){\r
- this.el = Ext.get(this.el);\r
- if(this.id){\r
- this.el.id = this.id;\r
- }\r
- container.dom.appendChild(this.el.dom);\r
- },\r
-\r
- /**\r
- * Sets the function that will handle click events for this item (equivalent to passing in the {@link #handler}\r
- * config property). If an existing handler is already registered, it will be unregistered for you.\r
- * @param {Function} handler The function that should be called on click\r
- * @param {Object} scope The scope that should be passed to the handler\r
- */\r
- setHandler : function(handler, scope){\r
- if(this.handler){\r
- this.un("click", this.handler, this.scope);\r
- }\r
- this.on("click", this.handler = handler, this.scope = scope);\r
- },\r
-\r
- // private\r
- onClick : function(e){\r
- if(!this.disabled && this.fireEvent("click", this, e) !== false\r
- && this.parentMenu.fireEvent("itemclick", this, e) !== false){\r
- this.handleClick(e);\r
- }else{\r
- e.stopEvent();\r
- }\r
- },\r
-\r
- // private\r
- activate : function(){\r
- if(this.disabled){\r
- return false;\r
- }\r
- var li = this.container;\r
- li.addClass(this.activeClass);\r
- this.region = li.getRegion().adjust(2, 2, -2, -2);\r
- this.fireEvent("activate", this);\r
- return true;\r
- },\r
-\r
- // private\r
- deactivate : function(){\r
- this.container.removeClass(this.activeClass);\r
- this.fireEvent("deactivate", this);\r
- },\r
-\r
- // private\r
- shouldDeactivate : function(e){\r
- return !this.region || !this.region.contains(e.getPoint());\r
- },\r
-\r
- // private\r
- handleClick : function(e){\r
- if(this.hideOnClick){\r
- this.parentMenu.hide.defer(this.hideDelay, this.parentMenu, [true]);\r
- }\r
- },\r
-\r
- // private\r
- expandMenu : function(autoActivate){\r
- // do nothing\r
- },\r
-\r
- // private\r
- hideMenu : function(){\r
- // do nothing\r
- }\r
-});
\ No newline at end of file