# Yahoo! UI Library

### Menu 2.8.2r1

Yahoo! UI Library > menu > YAHOO.widget.MenuManager
Search:
Filters Show Private Show Protected Show Deprecated

## `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

#### 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.

#### getFocusedMenu

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

#### getFocusedMenuItem

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

#### getMenu

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

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

#### getMenuItem

`YAHOO.widget.MenuItem getMenuItem ( p_sId )`
Returns a menu item with the specified id.

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

#### getMenuItemGroup

`Array getMenuItemGroup ( p_sId )`
Returns an array of menu item instances whose corresponding `<li>` elements are child nodes of the `<ul>` element with the specified id.

Parameters:
  `p_sId <String>` String specifying the id of the `<ul>` element representing the group of menu items to be retrieved.

#### 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.

#### getMenus

`Object getMenus ( )`
Returns a collection of all menus registered with the menu manger.

#### getVisible

`Object getVisible ( )`
Returns a collection of all visible menus registered with the menu manger.

#### hideVisible

`void hideVisible ( )`
Hides all visible, dynamically positioned menus (excluding instances of YAHOO.widget.MenuBar).

#### 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).

#### 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.

#### 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.

#### 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.

#### onMenuDestroy

`private void onMenuDestroy ( p_sType , p_aArgs , p_oMenu )`
"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.
  `p_oMenu <YAHOO.widget.Menu>` The menu that fired the event.

#### 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.

#### 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.

#### removeItem

`private void removeItem ( p_oMenuItem )`
Removes a MenuItem instance from the MenuManager's collection of MenuItems.

Parameters:
  `p_oMenuItem <MenuItem>` The MenuItem instance to be removed.

#### 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.

#### toString

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

Copyright © 2010 Yahoo! Inc. All rights reserved.