# Yahoo! UI Library

### Container 2.5.1

Yahoo! UI Library > container > YAHOO.widget.OverlayManager

Show Private Show Protected

## Class YAHOO.widget.OverlayManager

OverlayManager is used for maintaining the focus status of multiple Overlays.

### Constructor

YAHOO.widget.OverlayManager `( overlays , userConfig )`

Parameters:
  `overlays <Array>` Optional. A collection of Overlays to register with the manager.
  `userConfig <Object>` The object literal representing the user configuration of the OverlayManager

### Properties

#### activeOverlay `- private YAHOO.widget.Overlay`

The currently activated Overlay

#### cfg `- Config`

The OverlayManager's Config object used for monitoring configuration properties.

#### contructor `- Function`

The class's constructor function

#### OverlayManager.CSS_FOCUSED `- static final String`

The CSS class representing a focused Overlay

#### overlays `- YAHOO.widget.Overlay[]`

The array of Overlays that are currently registered

### Methods

#### _onOverlayDestroy

`private void _onOverlayDestroy ( p_sType , p_aArgs , p_oOverlay )`
"destroy" event handler for the Overlay.

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_oOverlay <Overlay>` Object representing the menu that fired the event.

Returns: `void`

#### _onOverlayElementFocus

`private void _onOverlayElementFocus ( p_oEvent )`
Event handler for the DOM event that is used to focus the Overlay instance as specified by the "focusevent" configuration property.

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

Returns: `void`

#### blurAll

`void blurAll ( )`
Removes focus from all registered Overlays in the manager

Returns: `void`

#### bringToTop

`void bringToTop ( p_oOverlay )`
Places the specified Overlay instance on top of all other Overlay instances.

Parameters:
  `p_oOverlay <YAHOO.widget.Overlay>` Object representing an Overlay instance.
  `p_oOverlay <String>` String representing the id of an Overlay instance.

Returns: `void`

#### compareZIndexDesc

`private Number compareZIndexDesc ( )`
Used for sorting the manager's Overlays by z-index.

Returns: `Number`
  0, 1, or -1, depending on where the Overlay should fall in the stacking order.

#### find

`Overlay find ( overlay )`
Attempts to locate an Overlay by instance or ID.

Parameters:
  `overlay <Overlay>` An Overlay to locate within the manager
  `overlay <String>` An Overlay id to locate within the manager

Returns: `Overlay`
  The requested Overlay, if found, or null if it cannot be located.

#### focus

`void focus ( overlay )`
Focuses the specified Overlay

Parameters:
  `overlay <Overlay>` The Overlay to focus
  `overlay <String>` The id of the Overlay to focus

Returns: `void`

#### getActive

`Overlay getActive ( )`
Returns the currently focused Overlay

Returns: `Overlay`
  The currently focused Overlay

#### hideAll

`void hideAll ( )`
Hides all Overlays in the manager.

Returns: `void`

#### init

`void init ( overlays , userConfig )`
Initializes the OverlayManager

Parameters:
  `overlays <Overlay[]>` Optional. A collection of Overlays to register with the manager.
  `userConfig <Object>` The object literal representing the user configuration of the OverlayManager

Returns: `void`

#### initDefaultConfig

`void initDefaultConfig ( )`
Initializes the default configuration of the OverlayManager

Returns: `void`

#### register

`Boolean register ( overlay )`
Registers an Overlay or an array of Overlays with the manager. Upon registration, the Overlay receives functions for focus and blur, along with CustomEvents for each.

Parameters:
  `overlay <Overlay>` An Overlay to register with the manager.
  `overlay <Overlay[]>` An array of Overlays to register with the manager.

Returns: `Boolean`
  True if any Overlays are registered.

#### remove

`void remove ( overlay )`
Removes the specified Overlay from the manager

Parameters:
  `overlay <Overlay>` The Overlay to remove
  `overlay <String>` The id of the Overlay to remove

Returns: `void`

#### showAll

`void showAll ( )`
Shows all Overlays in the manager.

Returns: `void`

#### toString

`String toString ( )`
Returns a string representation of the object.

Returns: `String`
  The string representation of the OverlayManager

### Configuration Attributes

#### focusevent `- String`

The default DOM event that should be used to focus an Overlay
Default Value: "mousedown"

#### overlays `- YAHOO.widget.Overlay[]`

The collection of registered Overlays in use by the OverlayManager
Default Value: null

Copyright © 2007 Yahoo! Inc. All rights reserved.