Print Friendly

# Class YAHOO.widget.ContextMenu

Package: | YAHOO.widget
Class: | ContextMenu
Extends: | Menu
Defined In: | menu.js

Creates a list of options or commands which are made visible in response to an HTML element's "contextmenu" event ("mousedown" for Opera).

## Public Properties

Property | Defined By
--- | ---
| BOTTOM_LEFT<static> : String | Overlay
<static> Constant representing the top bottom left corner of an element, used for configuring the context eleme...
| BOTTOM_RIGHT<static> : String | Overlay
<static> Constant representing the bottom right corner of an element, used for configuring the context element ...
| CSS_BODY<static> : String | Module
<static> Constant representing the module body
| CSS_CLASS_NAME : String | Menu
String representing the CSS class(es) to be applied to the menu's `<div>` element.
| CSS_FOOTER<static> : String | Module
<static> Constant representing the module footer
| CSS_HEADER<static> : String | Module
<static> Constant representing the module header
| CSS_MODULE<static> : String | Module
<static> Constant for the default CSS class name that represents a Module
| CSS_OVERLAY<static> : String | Overlay
<static> Constant representing the default CSS class used for an Overlay
| GROUP_TITLE_TAG_NAME : String | Menu
String representing the tagname of the HTML element used to title the menu's item groups.
| ITEM_TYPE : YAHOO.widget.MenuItem | Menu
Object representing the type of menu item to instantiate and add when parsing the child nodes (either <li> el...
| TOP_LEFT<static> : String | Overlay
<static> Constant representing the top left corner of an element, used for configuring the context element alig...
| TOP_RIGHT<static> : String | Overlay
<static> Constant representing the top right corner of an element, used for configuring the context element ali...
| activeItem : YAHOO.widget.MenuItem | Menu
Object reference to the item in the menu that has focus.
| body : HTMLElement | Module
The body element, denoted with CSS class "bd"
| browser : String | Module
String representing the current user-agent browser
| cfg : YAHOO.util.Config | Module
The Module's Config object used for monitoring configuration properties.
| contextEventTarget : <a | ContextMenu
Object reference for the HTML element that was the target of the "contextmenu" DOM event ("mousedown" for Opera) that...
| contructor : Function | Module
The class's constructor function
| element : HTMLElement | Module
The main module element that contains the header, body, and footer
| footer : HTMLElement | Module
The footer element, denoted with CSS class "ft"
| header : HTMLElement | Module
The header element, denoted with CSS class "hd"
| http : String | Module
<static> Constant representing the prefix path to use for non-secure images
| https : String | Module
<static> Constant representing the prefix path to use for securely served images
| id : String | Module
The id of the element
| imageRoot : String | Module
The String representing the image root
| isSecure : Boolean | Module
Boolean representing whether or not the current browsing context is secure (https)
| itemData : Array | Menu
Array of items to be added to the menu. The array can contain strings representing the text for each item to be crea...
| javascript : String | Module
<static> Constant representing the url for the "src" attribute of the iframe used to monitor changes to the bro...
| lazyLoad : Boolean | Menu
Boolean indicating if the menu's "lazy load" feature is enabled. If set to "true," initialization and rendering of t...
| parent : YAHOO.widget.MenuItem | Menu
Object reference to the menu's parent menu or menu item. This property can be set via the constructor using the confi...
| platform : String | Module
String representing the current user-agent platform
| srcElement : <a | Menu
Object reference to the HTML element (either `<select>` or `<div>`) used to create the menu.

## Public Methods

Method | Defined By
--- | ---
| ContextMenu() | ContextMenu
| _onClick(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`) : void | Menu
"click" event handler for the menu. @protected
| _onKeyDown(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`) : void | Menu
"keydown" event handler for the menu. @protected
| _onMouseOut(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`) : void | Menu
"mouseout" event handler for the menu. @protected
| _onMouseOver(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`) : void | Menu
"mouseover" event handler for the menu. @protected
| addItem(`YAHOO.widget.MenuItem p_oItem`, `String p_oItem`, `Object p_oItem`, `Number p_nGroupIndex`) : YAHOO.widget.MenuItem | Menu
Appends an item to the menu.
| addItems(`Array p_aItems`, `Number p_nGroupIndex`) : Array | Menu
Adds an array of items to the menu.
| align(`String elementAlign`, `String contextAlign`) : void | Overlay
Aligns the Overlay to its context element using the specified corner points (represented by the constants TOP_LEFT, T...
| appendToBody(`HTMLElement element`) : void | Module
Appends the passed element to the body. If no body is present, one will be automatically created.
| appendToFooter(`HTMLElement element`) : void | Module
Appends the passed element to the footer. If no footer is present, one will be automatically created.
| appendToHeader(`HTMLElement element`) : void | Module
Appends the passed element to the header. If no header is present, one will be automatically created.
| center() : void | Overlay
Centers the container in the viewport.
| clearActiveItem(`Boolean p_bBlur`) : void | Menu
Sets the "selected" configuration property of the menu's active item to "false" and hides the item's submenu.
| configConstrainToViewport(`String type`, `Object[] args`, `Object obj`) : void | Overlay
The default event handler fired when the "constraintoviewport" property is changed.
| configContainer(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`) : void | Menu
Event handler for when the "container" configuration property of the menu changes.
| configContext(`String type`, `Object[] args`, `Object obj`) : void | Overlay
The default event handler fired when the "context" property is changed.
| configFixedCenter(`String type`, `Object[] args`, `Object obj`) : void | Overlay
The default event handler fired when the "fixedcenter" property is changed.
| configHeight(`String type`, `Object[] args`, `Object obj`) : void | Overlay
The default event handler fired when the "height" property is changed.
| configHideDelay(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`) : void | Menu
Event handler for when the "hidedelay" configuration property of the menu changes.
| configIframe(`String type`, `Object[] args`, `Object obj`) : void | Overlay
The default event handler fired when the "iframe" property is changed.
| configMonitorResize(`String type`, `Object[] args`, `Object obj`) : void | Module
Default event handler for the "monitorresize" configuration property
| configPosition(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`) : void | Menu
Event handler for when the "position" configuration property of the menu changes.
| configTrigger(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.ContextMenu p_oMenu`) : void | ContextMenu
Event handler for when the value of the "trigger" configuration property changes.
| configVisible(`String type`, `Object[] args`, `Object obj`) : void | Module
Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the...
| configWidth(`String type`, `Object[] args`, `Object obj`) : void | Overlay
The default event handler fired when the "width" property is changed.
| configX(`String type`, `Object[] args`, `Object obj`) : void | Overlay
The default event handler fired when the "x" property is changed.
| configXY(`String type`, `Object[] args`, `Object obj`) : void | Overlay
The default event handler fired when the "xy" property is changed.
| configY(`String type`, `Object[] args`, `Object obj`) : void | Overlay
The default event handler fired when the "y" property is changed.
| configzIndex(`String type`, `Object[] args`, `Object obj`) : void | Overlay
The default event handler fired when the "zIndex" property is changed.
| destroy() : void | ContextMenu
Removes the context menu's `<div>` element (and accompanying child nodes) from the document.
| doCenterOnDOMEvent() : void | Overlay
Center event handler used for centering on scroll/resize, but only if the Overlay is visible
| enforceConstraints(`String type`, `Object[] args`, `Object obj`) : void | Overlay
The default event handler executed when the moveEvent is fired, if the "constraintoviewport" is set to true.
| getItem(`Number p_nItemIndex`, `Number p_nGroupIndex`) : YAHOO.widget.MenuItem | Menu
Returns the item at the specified index.
| getItemGroups() : Array | Menu
Returns a multi-dimensional array of all of the items in the menu.
| getRoot() : void | Menu
Finds the menu's root menu.
| hide() : void | Module
Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEve...
| hideIframe() : void | Overlay
Hides the iframe shim, if it has been enabled
| hideMacGeckoScrollbars() : void | Overlay
Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where scrollbars cannot ...
| init(`String p_oElement`, `String p_oElement`, `, `Object p_oConfig`) : void` | ContextMenu
The ContextMenu class's initialization method. This method is automatically called by the constructor, and sets up al...
| initDefaultConfig() : void | ContextMenu
Initializes the class's configurable properties which can be changed using the context menu's Config object ("cfg").
| initEvents() : void | Module
Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
| initResizeMonitor() : void | Module
Initialized an empty IFRAME that is placed out of the visible area that can be used to detect text resize.
| insertItem(`YAHOO.widget.MenuItem p_oItem`, `String p_oItem`, `Object p_oItem`, `Number p_nItemIndex`, `Number p_nGroupIndex`) : YAHOO.widget.MenuItem | Menu
Inserts an item into the menu at the specified index.
| moveTo(`Number x`, `Number y`) : void | Overlay
Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);
| onDomResize(`DOMEvent e`, `Object obj`) : void | Module
Event handler fired when the resize monitor element is resized.
| removeItem(`YAHOO.widget.MenuItem p_oObject`, `Number p_oObject`, `Number p_nGroupIndex`) : YAHOO.widget.MenuItem | Menu
Removes the specified item from the menu.
| render(`String appendToNode`, `HTMLElement appendToNode`, `HTMLElement moduleElement`) : Boolean | Module
Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optio...
| setBody(`String bodyContent`, `HTMLElement bodyContent`) : void | Module
Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is presen...
| setFooter(`String footerContent`, `HTMLElement footerContent`) : void | Module
Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is ...
| setHeader(`String headerContent`, `HTMLElement headerContent`) : void | Module
Sets the Module's header content to the HTML specified, or appends the passed element to the header. If no header is ...
| setInitialFocus() : void | Menu
Sets focus to the menu's first enabled item.
| setInitialSelection() : void | Menu
Sets the "selected" configuration property of the menu's first enabled item to "true."
| setItemGroupTitle(`String p_sGroupTitle`, `Number p_nGroupIndex`) : void | Menu
Sets the title of a group of menu items.
| show() : void | Module
Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEven...
| showIframe() : void | Overlay
Shows the iframe shim, if it has been enabled
| showMacGeckoScrollbars() : void | Overlay
Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where scrollbars ca...
| syncPosition() : void | Overlay
Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used t...
| toString() : String | ContextMenu
Returns a string representing the context menu.
| windowResizeHandler<static>(`DOMEvent e`) : void | Overlay
<static> The DOM event handler used to fire the CustomEvent for window resize
| windowScrollHandler<static>(`DOMEvent e`) : void | Overlay
<static> The DOM event handler used to fire the CustomEvent for window scroll

## Public Events

Event | Defined By
--- | ---
| YAHOO.widget.Overlay.windowResizeEvent : () | Overlay
A singleton CustomEvent used for reacting to the DOM event for window resize
| YAHOO.widget.Overlay.windowScrollEvent : () | Overlay
A singleton CustomEvent used for reacting to the DOM event for window scroll
| appendEvent : () | Module
CustomEvent fired when the Module is appended to the DOM
| beforeHideEvent : () | Module
CustomEvent fired before the Module is hidden
| beforeInitEvent : (`class classRef`) | Module
CustomEvent fired prior to class initalization.
| beforeMoveEvent : (`Number x`, `Number y`) | Overlay
CustomEvent fired before the Overlay is moved.
| beforeRenderEvent : () | Module
CustomEvent fired before the Module is rendered
| beforeShowEvent : () | Module
CustomEvent fired before the Module is shown
| changeBodyEvent : (`String/HTMLElement content`) | Module
CustomEvent fired when the body content of the Module is modified
| changeContentEvent : () | Module
CustomEvent fired when the content of the Module is modified
| changeFooterEvent : (`String/HTMLElement content`) | Module
CustomEvent fired when the footer content of the Module is modified
| changeHeaderEvent : (`String/HTMLElement content`) | Module
CustomEvent fired when the header content of the Module is modified
| clickEvent : () | Menu
Fires when the user clicks the on the menu. Passes back the DOM Event object as an argument.
| destroyEvent : () | Module
CustomEvent fired when the Module is destroyed
| hideEvent : () | Module
CustomEvent fired after the Module is hidden
| initEvent : (`class classRef`) | Module
CustomEvent fired after class initalization.
| itemAddedEvent : () | Menu
Fires when an item is added to the menu.
| itemRemovedEvent : () | Menu
Fires when an item is removed to the menu.
| keyDownEvent : () | Menu
Fires when the user presses a key when one of the menu's items has focus. Passes back the DOM Event object as an arg...
| keyPressEvent : () | Menu
Fires when the user presses an alphanumeric key when one of the menu's items has focus. Passes back the DOM Event ob...
| keyUpEvent : () | Menu
Fires when the user releases a key when one of the menu's items has focus. Passes back the DOM Event object as an ar...
| mouseDownEvent : () | Menu
Fires when the user mouses down on the menu. Passes back the DOM Event object as an argument.
| mouseOutEvent : () | Menu
Fires when the mouse has left the menu. Passes back the DOM Event object as an argument.
| mouseOverEvent : () | Menu
Fires when the mouse has entered the menu. Passes back the DOM Event object as an argument.
| mouseUpEvent : () | Menu
Fires when the user releases a mouse button while the mouse is over the menu. Passes back the DOM Event object as an...
| moveEvent : (`Number x`, `Number y`) | Overlay
CustomEvent fired after the Overlay is moved.
| renderEvent : () | Module
CustomEvent fired after the Module is rendered
| showEvent : () | Module
CustomEvent fired after the Module is shown

## Property Details

### BOTTOM_LEFT<static>

`public String BOTTOM_LEFT<static>`
<static> Constant representing the top bottom left corner of an element, used for configuring the context element alignment
This property is defined by Overlay.

### BOTTOM_RIGHT<static>

`public String BOTTOM_RIGHT<static>`
<static> Constant representing the bottom right corner of an element, used for configuring the context element alignment
This property is defined by Overlay.

### CSS_BODY<static>

`public String CSS_BODY<static>`
<static> Constant representing the module body
This property is defined by Module.

### CSS_CLASS_NAME

`public String CSS_CLASS_NAME`
String representing the CSS class(es) to be applied to the menu's `<div>` element.
This property is defined by Menu.

### CSS_FOOTER<static>

`public String CSS_FOOTER<static>`
<static> Constant representing the module footer
This property is defined by Module.

### CSS_HEADER<static>

`public String CSS_HEADER<static>`
<static> Constant representing the module header
This property is defined by Module.

### CSS_MODULE<static>

`public String CSS_MODULE<static>`
<static> Constant for the default CSS class name that represents a Module
This property is defined by Module.

### CSS_OVERLAY<static>

`public String CSS_OVERLAY<static>`
<static> Constant representing the default CSS class used for an Overlay
This property is defined by Overlay.

### GROUP_TITLE_TAG_NAME

`public String GROUP_TITLE_TAG_NAME`
String representing the tagname of the HTML element used to title the menu's item groups.
This property is defined by Menu.

### ITEM_TYPE

`public YAHOO.widget.MenuItem ITEM_TYPE`
Object representing the type of menu item to instantiate and add when parsing the child nodes (either `<li>` element, `<optgroup>` element or `<option>`) of the menu's source HTML element.
This property is defined by Menu.

### TOP_LEFT<static>

`public String TOP_LEFT<static>`
<static> Constant representing the top left corner of an element, used for configuring the context element alignment
This property is defined by Overlay.

### TOP_RIGHT<static>

`public String TOP_RIGHT<static>`
<static> Constant representing the top right corner of an element, used for configuring the context element alignment
This property is defined by Overlay.

### activeItem

`public YAHOO.widget.MenuItem activeItem`
Object reference to the item in the menu that has focus.
This property is defined by Menu.

### body

`public HTMLElement body`
The body element, denoted with CSS class "bd"
This property is defined by Module.

### browser

`public String browser`
String representing the current user-agent browser
This property is defined by Module.

### cfg

`public YAHOO.util.Config cfg`
The Module's Config object used for monitoring configuration properties.
This property is defined by Module.

### contextEventTarget

`public <a contextEventTarget`
Object reference for the HTML element that was the target of the "contextmenu" DOM event ("mousedown" for Opera) that triggered the display of the context menu.
This property is defined by ContextMenu.

### contructor

`public Function contructor`
The class's constructor function
This property is defined by Module.

### element

`public HTMLElement element`
The main module element that contains the header, body, and footer
This property is defined by Module.

### footer

`public HTMLElement footer`
The footer element, denoted with CSS class "ft"
This property is defined by Module.

### header

`public HTMLElement header`
The header element, denoted with CSS class "hd"
This property is defined by Module.

### http

`public String http`
<static> Constant representing the prefix path to use for non-secure images
This property is defined by Module.

### https

`public String https`
<static> Constant representing the prefix path to use for securely served images
This property is defined by Module.

### id

`public String id`
The id of the element
This property is defined by Module.

### imageRoot

`public String imageRoot`
The String representing the image root
This property is defined by Module.

### isSecure

`public Boolean isSecure`
Boolean representing whether or not the current browsing context is secure (https)
This property is defined by Module.

### itemData

`public Array itemData`
Array of items to be added to the menu. The array can contain strings representing the text for each item to be created, object literals representing the menu item configuration properties, or MenuItem instances. This property should be set via the constructor using the configuration object literal.
This property is defined by Menu.

### javascript

`public String javascript`
<static> Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size
This property is defined by Module.

### lazyLoad

`public Boolean lazyLoad`
Boolean indicating if the menu's "lazy load" feature is enabled. If set to "true," initialization and rendering of the menu's items will be deferred until the first time it is made visible. This property should be set via the constructor using the configuration object literal.
This property is defined by Menu.

### parent

`public YAHOO.widget.MenuItem parent`
Object reference to the menu's parent menu or menu item. This property can be set via the constructor using the configuration object literal.
This property is defined by Menu.

### platform

`public String platform`
String representing the current user-agent platform
This property is defined by Module.

### srcElement

`public <a srcElement`
Object reference to the HTML element (either `<select>` or `<div>`) used to create the menu.
This property is defined by Menu.

## Constructor Details

### ContextMenu

`public function ContextMenu()`
Parameters:

- None.

## Method Details

### _onClick

`public function _onClick(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`)`
"click" event handler for the menu. @protected
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oMenu` : YAHOO.widget.Menu
  Object representing the menu that fired the event.

Returns:

- `void`

This method is defined by Menu.

### _onKeyDown

`public function _onKeyDown(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`)`
"keydown" event handler for the menu. @protected
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oMenu` : YAHOO.widget.Menu
  Object representing the menu that fired the event.

Returns:

- `void`

This method is defined by Menu.

### _onMouseOut

`public function _onMouseOut(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`)`
"mouseout" event handler for the menu. @protected
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oMenu` : YAHOO.widget.Menu
  Object representing the menu that fired the event.

Returns:

- `void`

This method is defined by Menu.

### _onMouseOver

`public function _onMouseOver(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`)`
"mouseover" event handler for the menu. @protected
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oMenu` : YAHOO.widget.Menu
  Object representing the menu that fired the event.

Returns:

- `void`

This method is defined by Menu.

### addItem

`public function addItem(`YAHOO.widget.MenuItem p_oItem`, `String p_oItem`, `Object p_oItem`, `Number p_nGroupIndex`)`
Appends an item to the menu.
Parameters:

- `p_oItem` : YAHOO.widget.MenuItem
  Object reference for the MenuItem instance to be added to the menu.
- `p_oItem` : String
  String specifying the text of the item to be added to the menu.
- `p_oItem` : Object
  Object literal containing a set of menu item configuration properties.
- `p_nGroupIndex` : Number
  Optional. Number indicating the group to which the item belongs.

Returns:

- `YAHOO.widget.MenuItem`

This method is defined by Menu.

### addItems

`public function addItems(`Array p_aItems`, `Number p_nGroupIndex`)`
Adds an array of items to the menu.
Parameters:

- `p_aItems` : Array
  Array of items to be added to the menu. The array can contain strings specifying the text for each item to be created, object literals specifying each of the menu item configuration properties, or MenuItem instances.
- `p_nGroupIndex` : Number
  Optional. Number specifying the group to which the items belongs.

Returns:

- `Array`

This method is defined by Menu.

### align

`public function align(`String elementAlign`, `String contextAlign`)`
Aligns the Overlay to its context element using the specified corner points (represented by the constants TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, and BOTTOM_RIGHT.
Parameters:

- `elementAlign` : String
  The String representing the corner of the Overlay that should be aligned to the context element
- `contextAlign` : String
  The corner of the context element that the elementAlign corner should stick to.

Returns:

- `void`

This method is defined by Overlay.

### appendToBody

`public function appendToBody(`HTMLElement element`)`
Appends the passed element to the body. If no body is present, one will be automatically created.
Parameters:

- `element` : HTMLElement
  The element to append to the body

Returns:

- `void`

This method is defined by Module.

### appendToFooter

`public function appendToFooter(`HTMLElement element`)`
Appends the passed element to the footer. If no footer is present, one will be automatically created.
Parameters:

- `element` : HTMLElement
  The element to append to the footer

Returns:

- `void`

This method is defined by Module.

### appendToHeader

`public function appendToHeader(`HTMLElement element`)`
Appends the passed element to the header. If no header is present, one will be automatically created.
Parameters:

- `element` : HTMLElement
  The element to append to the header

Returns:

- `void`

This method is defined by Module.

### center

`public function center()`
Centers the container in the viewport.
Parameters:

- None.

Returns:

- `void`

This method is defined by Overlay.

### clearActiveItem

`public function clearActiveItem(`Boolean p_bBlur`)`
Sets the "selected" configuration property of the menu's active item to "false" and hides the item's submenu.
Parameters:

- `p_bBlur` : Boolean
  Boolean indicating if the menu's active item should be blurred.

Returns:

- `void`

This method is defined by Menu.

### configConstrainToViewport

`public function configConstrainToViewport(`String type`, `Object[] args`, `Object obj`)`
The default event handler fired when the "constraintoviewport" property is changed.
Parameters:

- `type` : String
  The CustomEvent type (usually the property name)
- `args` : Object[]
  The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- `obj` : Object
  The scope object. For configuration handlers, this will usually equal the owner.

Returns:

- `void`

This method is defined by Overlay.

### configContainer

`public function configContainer(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`)`
Event handler for when the "container" configuration property of the menu changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oMenu` : YAHOO.widget.Menu
  Object representing the menu that fired the event.

Returns:

- `void`

This method is defined by Menu.

### configContext

`public function configContext(`String type`, `Object[] args`, `Object obj`)`
The default event handler fired when the "context" property is changed.
Parameters:

- `type` : String
  The CustomEvent type (usually the property name)
- `args` : Object[]
  The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- `obj` : Object
  The scope object. For configuration handlers, this will usually equal the owner.

Returns:

- `void`

This method is defined by Overlay.

### configFixedCenter

`public function configFixedCenter(`String type`, `Object[] args`, `Object obj`)`
The default event handler fired when the "fixedcenter" property is changed.
Parameters:

- `type` : String
  The CustomEvent type (usually the property name)
- `args` : Object[]
  The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- `obj` : Object
  The scope object. For configuration handlers, this will usually equal the owner.

Returns:

- `void`

This method is defined by Overlay.

### configHeight

`public function configHeight(`String type`, `Object[] args`, `Object obj`)`
The default event handler fired when the "height" property is changed.
Parameters:

- `type` : String
  The CustomEvent type (usually the property name)
- `args` : Object[]
  The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- `obj` : Object
  The scope object. For configuration handlers, this will usually equal the owner.

Returns:

- `void`

This method is defined by Overlay.

### configHideDelay

`public function configHideDelay(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`)`
Event handler for when the "hidedelay" configuration property of the menu changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oMenu` : YAHOO.widget.Menu
  Object representing the menu that fired the event.

Returns:

- `void`

This method is defined by Menu.

### configIframe

`public function configIframe(`String type`, `Object[] args`, `Object obj`)`
The default event handler fired when the "iframe" property is changed.
Parameters:

- `type` : String
  The CustomEvent type (usually the property name)
- `args` : Object[]
  The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- `obj` : Object
  The scope object. For configuration handlers, this will usually equal the owner.

Returns:

- `void`

This method is defined by Overlay.

### configMonitorResize

`public function configMonitorResize(`String type`, `Object[] args`, `Object obj`)`
Default event handler for the "monitorresize" configuration property
Parameters:

- `type` : String
  The CustomEvent type (usually the property name)
- `args` : Object[]
  The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- `obj` : Object
  The scope object. For configuration handlers, this will usually equal the owner.

Returns:

- `void`

This method is defined by Module.

### configPosition

`public function configPosition(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`)`
Event handler for when the "position" configuration property of the menu changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oMenu` : YAHOO.widget.Menu
  Object representing the menu that fired the event.

Returns:

- `void`

This method is defined by Menu.

### configTrigger

`public function configTrigger(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.ContextMenu p_oMenu`)`
Event handler for when the value of the "trigger" configuration property changes.
Parameters:

- `p_sType` : String
  String representing the name of the event that was fired.
- `p_aArgs` : Array
  Array of arguments sent when the event was fired.
- `p_oMenu` : YAHOO.widget.ContextMenu
  Object representing the context menu that fired the event.

Returns:

- `void`

This method is defined by ContextMenu.

### configVisible

`public function configVisible(`String type`, `Object[] args`, `Object obj`)`
Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none". This method is responsible for firing showEvent and hideEvent.
Parameters:

- `type` : String
  The CustomEvent type (usually the property name)
- `args` : Object[]
  The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- `obj` : Object
  The scope object. For configuration handlers, this will usually equal the owner.

Returns:

- `void`

This method is defined by Module.

### configWidth

`public function configWidth(`String type`, `Object[] args`, `Object obj`)`
The default event handler fired when the "width" property is changed.
Parameters:

- `type` : String
  The CustomEvent type (usually the property name)
- `args` : Object[]
  The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- `obj` : Object
  The scope object. For configuration handlers, this will usually equal the owner.

Returns:

- `void`

This method is defined by Overlay.

### configX

`public function configX(`String type`, `Object[] args`, `Object obj`)`
The default event handler fired when the "x" property is changed.
Parameters:

- `type` : String
  The CustomEvent type (usually the property name)
- `args` : Object[]
  The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- `obj` : Object
  The scope object. For configuration handlers, this will usually equal the owner.

Returns:

- `void`

This method is defined by Overlay.

### configXY

`public function configXY(`String type`, `Object[] args`, `Object obj`)`
The default event handler fired when the "xy" property is changed.
Parameters:

- `type` : String
  The CustomEvent type (usually the property name)
- `args` : Object[]
  The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- `obj` : Object
  The scope object. For configuration handlers, this will usually equal the owner.

Returns:

- `void`

This method is defined by Overlay.

### configY

`public function configY(`String type`, `Object[] args`, `Object obj`)`
The default event handler fired when the "y" property is changed.
Parameters:

- `type` : String
  The CustomEvent type (usually the property name)
- `args` : Object[]
  The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- `obj` : Object
  The scope object. For configuration handlers, this will usually equal the owner.

Returns:

- `void`

This method is defined by Overlay.

### configzIndex

`public function configzIndex(`String type`, `Object[] args`, `Object obj`)`
The default event handler fired when the "zIndex" property is changed.
Parameters:

- `type` : String
  The CustomEvent type (usually the property name)
- `args` : Object[]
  The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- `obj` : Object
  The scope object. For configuration handlers, this will usually equal the owner.

Returns:

- `void`

This method is defined by Overlay.

### destroy

`public function destroy()`
Removes the context menu's `<div>` element (and accompanying child nodes) from the document.
Parameters:

- None.

Returns:

- `void`

This method is defined by ContextMenu.

### doCenterOnDOMEvent

`public function doCenterOnDOMEvent()`
Center event handler used for centering on scroll/resize, but only if the Overlay is visible
Parameters:

- None.

Returns:

- `void`

This method is defined by Overlay.

### enforceConstraints

`public function enforceConstraints(`String type`, `Object[] args`, `Object obj`)`
The default event handler executed when the moveEvent is fired, if the "constraintoviewport" is set to true.
Parameters:

- `type` : String
  The CustomEvent type (usually the property name)
- `args` : Object[]
  The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- `obj` : Object
  The scope object. For configuration handlers, this will usually equal the owner.

Returns:

- `void`

This method is defined by Overlay.

### getItem

`public function getItem(`Number p_nItemIndex`, `Number p_nGroupIndex`)`
Returns the item at the specified index.
Parameters:

- `p_nItemIndex` : Number
  Number indicating the ordinal position of the item to be retrieved.
- `p_nGroupIndex` : Number
  Optional. Number indicating the group to which the item belongs.

Returns:

- `YAHOO.widget.MenuItem`

This method is defined by Menu.

### getItemGroups

`public function getItemGroups()`
Returns a multi-dimensional array of all of the items in the menu.
Parameters:

- None.

Returns:

- `Array`

This method is defined by Menu.

### getRoot

`public function getRoot()`
Finds the menu's root menu.
Parameters:

- None.

Returns:

- `void`

This method is defined by Menu.

### hide

`public function hide()`
Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.
Parameters:

- None.

Returns:

- `void`

This method is defined by Module.

### hideIframe

`public function hideIframe()`
Hides the iframe shim, if it has been enabled
Parameters:

- None.

Returns:

- `void`

This method is defined by Overlay.

### hideMacGeckoScrollbars

`public function hideMacGeckoScrollbars()`
Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
Parameters:

- None.

Returns:

- `void`

This method is defined by Overlay.

### init

`public function init(`String p_oElement`, `String p_oElement`, `, `Object p_oConfig`)`
The ContextMenu class's initialization method. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
Parameters:

- `p_oElement` : String
  String specifying the id attribute of the `<div>` element of the context menu.
- `p_oElement` : String
  String specifying the id attribute of the `<select>` element to be used as the data source for the context menu.
- `href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-` : <a
  html.html#ID-22445964">HTMLDivElement} p_oElement Object specifying the `<div>` element of the context menu.
- `href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-` : <a
  html.html#ID-94282980">HTMLSelectElement} p_oElement Object specifying the `<select>` element to be used as the data source for the context menu.
- `p_oConfig` : Object
  Optional. Object literal specifying the configuration for the context menu. See configuration class documentation for more details.

Returns:

- `void`

This method is defined by ContextMenu.
`

### initDefaultConfig

`public function initDefaultConfig()`
Initializes the class's configurable properties which can be changed using the context menu's Config object ("cfg").
Parameters:

- None.

Returns:

- `void`

This method is defined by ContextMenu.

### initEvents

`public function initEvents()`
Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
Parameters:

- None.

Returns:

- `void`

This method is defined by Module.

### initResizeMonitor

`public function initResizeMonitor()`
Initialized an empty IFRAME that is placed out of the visible area that can be used to detect text resize.
Parameters:

- None.

Returns:

- `void`

This method is defined by Module.

### insertItem

`public function insertItem(`YAHOO.widget.MenuItem p_oItem`, `String p_oItem`, `Object p_oItem`, `Number p_nItemIndex`, `Number p_nGroupIndex`)`
Inserts an item into the menu at the specified index.
Parameters:

- `p_oItem` : YAHOO.widget.MenuItem
  Object reference for the MenuItem instance to be added to the menu.
- `p_oItem` : String
  String specifying the text of the item to be added to the menu.
- `p_oItem` : Object
  Object literal containing a set of menu item configuration properties.
- `p_nItemIndex` : Number
  Number indicating the ordinal position at which the item should be added.
- `p_nGroupIndex` : Number
  Optional. Number indicating the group to which the item belongs.

Returns:

- `YAHOO.widget.MenuItem`

This method is defined by Menu.

### moveTo

`public function moveTo(`Number x`, `Number y`)`
Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);
Parameters:

- `x` : Number
  The Overlay's new x position
- `y` : Number
  The Overlay's new y position

Returns:

- `void`

This method is defined by Overlay.

### onDomResize

`public function onDomResize(`DOMEvent e`, `Object obj`)`
Event handler fired when the resize monitor element is resized.
Parameters:

- `e` : DOMEvent
  The DOM resize event
- `obj` : Object
  The scope object passed to the handler

Returns:

- `void`

This method is defined by Module.

### removeItem

`public function removeItem(`YAHOO.widget.MenuItem p_oObject`, `Number p_oObject`, `Number p_nGroupIndex`)`
Removes the specified item from the menu.
Parameters:

- `p_oObject` : YAHOO.widget.MenuItem
  Object reference for the MenuItem instance to be removed from the menu.
- `p_oObject` : Number
  Number specifying the index of the item to be removed.
- `p_nGroupIndex` : Number
  Optional. Number specifying the group to which the item belongs.

Returns:

- `YAHOO.widget.MenuItem`

This method is defined by Menu.

### render

`public function render(`String appendToNode`, `HTMLElement appendToNode`, `HTMLElement moduleElement`)`
Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.
Parameters:

- `appendToNode` : String
  The element id to which the Module should be appended to prior to rendering OR
- `appendToNode` : HTMLElement
  The element to which the Module should be appended to prior to rendering
- `moduleElement` : HTMLElement
  OPTIONAL. The element that represents the actual Standard Module container.

Returns:

- `Boolean`
  Success or failure of the render

This method is defined by Module.

### setBody

`public function setBody(`String bodyContent`, `HTMLElement bodyContent`)`
Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.
Parameters:

- `bodyContent` : String
  The HTML used to set the body OR
- `bodyContent` : HTMLElement
  The HTMLElement to append to the body

Returns:

- `void`

This method is defined by Module.

### setFooter

`public function setFooter(`String footerContent`, `HTMLElement footerContent`)`
Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.
Parameters:

- `footerContent` : String
  The HTML used to set the footer OR
- `footerContent` : HTMLElement
  The HTMLElement to append to the footer

Returns:

- `void`

This method is defined by Module.

### setHeader

`public function setHeader(`String headerContent`, `HTMLElement headerContent`)`
Sets the Module's header content to the HTML specified, or appends the passed element to the header. If no header is present, one will be automatically created.
Parameters:

- `headerContent` : String
  The HTML used to set the header OR
- `headerContent` : HTMLElement
  The HTMLElement to append to the header

Returns:

- `void`

This method is defined by Module.

### setInitialFocus

`public function setInitialFocus()`
Sets focus to the menu's first enabled item.
Parameters:

- None.

Returns:

- `void`

This method is defined by Menu.

### setInitialSelection

`public function setInitialSelection()`
Sets the "selected" configuration property of the menu's first enabled item to "true."
Parameters:

- None.

Returns:

- `void`

This method is defined by Menu.

### setItemGroupTitle

`public function setItemGroupTitle(`String p_sGroupTitle`, `Number p_nGroupIndex`)`
Sets the title of a group of menu items.
Parameters:

- `p_sGroupTitle` : String
  String specifying the title of the group.
- `p_nGroupIndex` : Number
  Optional. Number specifying the group to which the title belongs.

Returns:

- `void`

This method is defined by Menu.

### show

`public function show()`
Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.
Parameters:

- None.

Returns:

- `void`

This method is defined by Module.

### showIframe

`public function showIframe()`
Shows the iframe shim, if it has been enabled
Parameters:

- None.

Returns:

- `void`

This method is defined by Overlay.

### showMacGeckoScrollbars

`public function showMacGeckoScrollbars()`
Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
Parameters:

- None.

Returns:

- `void`

This method is defined by Overlay.

### syncPosition

`public function syncPosition()`
Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.
Parameters:

- None.

Returns:

- `void`

This method is defined by Overlay.

### toString

`public function toString()`
Returns a string representing the context menu.
Parameters:

- None.

Returns:

- `String`

This method is defined by ContextMenu.

### windowResizeHandler<static>

`public function windowResizeHandler<static>(`DOMEvent e`)`
<static> The DOM event handler used to fire the CustomEvent for window resize
Parameters:

- `e` : DOMEvent
  The DOM resize event

Returns:

- `void`

This method is defined by Overlay.

### windowScrollHandler<static>

`public function windowScrollHandler<static>(`DOMEvent e`)`
<static> The DOM event handler used to fire the CustomEvent for window scroll
Parameters:

- `e` : DOMEvent
  The DOM scroll event

Returns:

- `void`

This method is defined by Overlay.

## Event Details

### YAHOO.widget.Overlay.windowResizeEvent

`public event YAHOO.widget.Overlay.windowResizeEvent`
A singleton CustomEvent used for reacting to the DOM event for window resize
Subscribers will be called with the following parameters:

- None.

This event is defined by Overlay.

### YAHOO.widget.Overlay.windowScrollEvent

`public event YAHOO.widget.Overlay.windowScrollEvent`
A singleton CustomEvent used for reacting to the DOM event for window scroll
Subscribers will be called with the following parameters:

- None.

This event is defined by Overlay.

### appendEvent

`public event appendEvent`
CustomEvent fired when the Module is appended to the DOM
Subscribers will be called with the following parameters:

- None.

This event is defined by Module.

### beforeHideEvent

`public event beforeHideEvent`
CustomEvent fired before the Module is hidden
Subscribers will be called with the following parameters:

- None.

This event is defined by Module.

### beforeInitEvent

`public event beforeInitEvent`
CustomEvent fired prior to class initalization.
Subscribers will be called with the following parameters:

- `classRef` : class
  class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)

This event is defined by Module.

### beforeMoveEvent

`public event beforeMoveEvent`
CustomEvent fired before the Overlay is moved.
Subscribers will be called with the following parameters:

- `x` : Number
  x coordinate
- `y` : Number
  y coordinate

This event is defined by Overlay.

### beforeRenderEvent

`public event beforeRenderEvent`
CustomEvent fired before the Module is rendered
Subscribers will be called with the following parameters:

- None.

This event is defined by Module.

### beforeShowEvent

`public event beforeShowEvent`
CustomEvent fired before the Module is shown
Subscribers will be called with the following parameters:

- None.

This event is defined by Module.

### changeBodyEvent

`public event changeBodyEvent`
CustomEvent fired when the body content of the Module is modified
Subscribers will be called with the following parameters:

- `content` : String/HTMLElement
  String/element representing the new body content

This event is defined by Module.

### changeContentEvent

`public event changeContentEvent`
CustomEvent fired when the content of the Module is modified
Subscribers will be called with the following parameters:

- None.

This event is defined by Module.

### changeFooterEvent

`public event changeFooterEvent`
CustomEvent fired when the footer content of the Module is modified
Subscribers will be called with the following parameters:

- `content` : String/HTMLElement
  String/element representing the new footer content

This event is defined by Module.

### changeHeaderEvent

`public event changeHeaderEvent`
CustomEvent fired when the header content of the Module is modified
Subscribers will be called with the following parameters:

- `content` : String/HTMLElement
  String/element representing the new header content

This event is defined by Module.

### clickEvent

`public event clickEvent`
Fires when the user clicks the on the menu. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by Menu.

### destroyEvent

`public event destroyEvent`
CustomEvent fired when the Module is destroyed
Subscribers will be called with the following parameters:

- None.

This event is defined by Module.

### hideEvent

`public event hideEvent`
CustomEvent fired after the Module is hidden
Subscribers will be called with the following parameters:

- None.

This event is defined by Module.

### initEvent

`public event initEvent`
CustomEvent fired after class initalization.
Subscribers will be called with the following parameters:

- `classRef` : class
  class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)

This event is defined by Module.

### itemAddedEvent

`public event itemAddedEvent`
Fires when an item is added to the menu.
Subscribers will be called with the following parameters:

- None.

This event is defined by Menu.

### itemRemovedEvent

`public event itemRemovedEvent`
Fires when an item is removed to the menu.
Subscribers will be called with the following parameters:

- None.

This event is defined by Menu.

### keyDownEvent

`public event keyDownEvent`
Fires when the user presses a key when one of the menu's items has focus. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by Menu.

### keyPressEvent

`public event keyPressEvent`
Fires when the user presses an alphanumeric key when one of the menu's items has focus. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by Menu.

### keyUpEvent

`public event keyUpEvent`
Fires when the user releases a key when one of the menu's items has focus. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by Menu.

### mouseDownEvent

`public event mouseDownEvent`
Fires when the user mouses down on the menu. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by Menu.

### mouseOutEvent

`public event mouseOutEvent`
Fires when the mouse has left the menu. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by Menu.

### mouseOverEvent

`public event mouseOverEvent`
Fires when the mouse has entered the menu. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by Menu.

### mouseUpEvent

`public event mouseUpEvent`
Fires when the user releases a mouse button while the mouse is over the menu. Passes back the DOM Event object as an argument.
Subscribers will be called with the following parameters:

- None.

This event is defined by Menu.

### moveEvent

`public event moveEvent`
CustomEvent fired after the Overlay is moved.
Subscribers will be called with the following parameters:

- `x` : Number
  x coordinate
- `y` : Number
  y coordinate

This event is defined by Overlay.

### renderEvent

`public event renderEvent`
CustomEvent fired after the Module is rendered
Subscribers will be called with the following parameters:

- None.

This event is defined by Module.

### showEvent

`public event showEvent`
CustomEvent fired after the Module is shown
Subscribers will be called with the following parameters:

- None.

This event is defined by Module.

yui-ext - Copyright © 2006 Jack Slocum. | Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.