API: menu YAHOO.widget.MenuManager (YUI Library)

# Yahoo! UI Library

### Menu 2.2.2

Yahoo! UI Library > menu > YAHOO.widget.MenuManager

## `static` Class YAHOO.widget.MenuManager

Singleton that manages a collection of all menus and menu items. Listens for DOM events at the document level and dispatches the events to the corresponding menu or menu item.

### Methods

#### addItem

`private void addItem ( p_oItem )`
Adds an item to the collection of known menu items.

Parameters:
  `p_oItem <YAHOO.widget.MenuItem>` Object specifying the MenuItem instance to be added.

Returns: `void`

#### addMenu

`void addMenu ( p_oMenu )`
Adds a menu to the collection of known menus.

Parameters:
  `p_oMenu <YAHOO.widget.Menu>` Object specifying the Menu instance to be added.

Returns: `void`

#### getFocusedMenu

`YAHOO.widget.Menu getFocusedMenu ( )`
Returns a reference to the menu that currently has focus.

Returns: `YAHOO.widget.Menu`

#### getFocusedMenuItem

`YAHOO.widget.MenuItem getFocusedMenuItem ( )`
Returns a reference to the menu item that currently has focus.

Returns: `YAHOO.widget.MenuItem`

#### getMenu

`YAHOO.widget.Menu getMenu ( p_sId )`
Returns a menu with the specified id.

Parameters:
  `p_sId <String>` String specifying the id of the menu to be retrieved.

Returns: `YAHOO.widget.Menu`

#### getMenuRootElement

`private void getMenuRootElement ( p_oElement )`
Finds the root DIV node of a menu or the root LI node of a menu item.

Parameters:
  `p_oElement <HTMLElement>` Object specifying an HTML element.

Returns: `void`

#### getMenus

`Array getMenus ( )`
Returns an array of all menus registered with the menu manger.

Returns: `Array`

#### hideVisible

`void hideVisible ( )`
Hides all visible, dynamically positioned menus.

Returns: `void`

#### onDOMEvent

`private void onDOMEvent ( p_oEvent )`
Generic, global event handler for all of a menu's DOM-based events. This listens for events against the document object. If the target of a given event is a member of a menu or menu item's DOM, the instance's corresponding Custom Event is fired.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

Returns: `void`

#### onItemAdded

`private void onItemAdded ( p_sType , p_aArgs )`
"itemadded" event handler for a Menu instance.

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.

Returns: `void`

#### onItemDestroy

`private void onItemDestroy ( p_sType , p_aArgs )`
"destroy" event handler for a MenuItem instance.

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.

Returns: `void`

#### onItemRemoved

`private void onItemRemoved ( p_sType , p_aArgs )`
"itemremoved" event handler for a Menu instance.

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.

Returns: `void`

#### onMenuBlur

`private void onMenuBlur ( p_sType , p_aArgs )`
"blur" event handler for a MenuItem instance.

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.

Returns: `void`

#### onMenuDestroy

`private void onMenuDestroy ( p_sType , p_aArgs )`
"destroy" event handler for a menu.

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.

Returns: `void`

#### onMenuFocus

`private void onMenuFocus ( p_sType , p_aArgs )`
"focus" event handler for a MenuItem instance.

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.

Returns: `void`

#### onMenuVisibleConfigChange

`private void onMenuVisibleConfigChange ( p_sType , p_aArgs )`
Event handler for when the "visible" configuration property of a Menu instance 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.

Returns: `void`

#### removeItem

`private void removeItem ( p_oItem )`
Removes an item from the collection of known menu items.

Parameters:
  `p_oItem <YAHOO.widget.MenuItem>` Object specifying the MenuItem instance to be removed.

Returns: `void`

#### removeMenu

`void removeMenu ( p_oMenu )`
Removes a menu from the collection of known menus.

Parameters:
  `p_oMenu <YAHOO.widget.Menu>` Object specifying the Menu instance to be removed.

Returns: `void`

#### toString

`String toString ( )`
Returns a string representing the menu manager.

Returns: `String`

Copyright © 2007 Yahoo! Inc. All rights reserved.