Print Friendly

# Class YAHOO.widget.Menubar

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

Horizontal collection of items, each of which can contain a submenu.

## 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_CLASS_NAME : String | Menubar
@description String representing the CSS class(es) to be applied to the menu bar's <div> element. @default "y...
| CSS_OVERLAY<static> : String | Overlay
<static> Constant representing the default CSS class used for an Overlay
| GROUP_TITLE_TAG_NAME : String | Menu
@description String representing the tagname of the HTML element used to title the menu's item groups. @default H6 @f...
| ITEM_TYPE : YAHOO.widget.MenuItem | Menu
@description Object representing the type of menu item to instantiate and add when parsing the child nodes (either &#...
| 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
@description Object reference to the item in the menu that has focus. @default null
| cfg : Boolean @default | Overlay
True if the Overlay should have an IFRAME shim (for correcting the select z-index bug in IE6 and below). @config iframe
| itemData : Array | Menu
@description Array of items to be added to the menu. The array can contain strings representing the text for each it...
| javascript : String | Overlay
<static> The URL that will be placed in the iframe
| lazyLoad : Boolean | Menu
@description Boolean indicating if the menu's "lazy load" feature is enabled. If set to "true," initialization and r...
| parent : YAHOO.widget.MenuItem | Menu
@description Object reference to the menu's parent menu or menu item. This property can be set via the constructor us...
| srcElement : | Menu
@description Object reference to the HTML element (either <select> or <div>) used to create the menu....
| value : Array | Menubar
@config submenualignment @description Array defining how submenus should be aligned to their parent menu bar item. Th...

## Public Methods

Method | Defined By
--- | ---
| Menubar() | Menubar
| _onClick(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuBar p_oMenuBar`) : void | Menubar
@description "click" event handler for the menu bar. @protected
| _onKeyDown(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`) : void | Menu
@description "keydown" event handler for the menu. @protected
| _onMouseOut(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`) : void | Menu
@description "mouseout" event handler for the menu. @protected
| _onMouseOver(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`) : void | Menu
@description "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
@description Appends an item to the menu.
| addItems(`Array p_aItems`, `Number p_nGroupIndex`) : Array | Menu
@description 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...
| center() : void | Overlay
Centers the container in the viewport.
| clearActiveItem(`Boolean p_bBlur`) : void | Menu
@description Sets the "selected" configuration property of the menu's active item to "false" and hides the item's sub...
| 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
@description 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
@description 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.
| configPosition(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`) : void | Menu
@description Event handler for when the "position" configuration property of the menu changes.
| configVisible(`String type`, `Object[] args`, `Object obj`) : void | Overlay
The default event handler fired when the "visible" property is changed. This method is responsible for firing showEve...
| 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 | Overlay
Removes the Overlay element from the DOM and sets all child elements to null.
| 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
@description Returns the item at the specified index.
| getItemGroups() : Array | Menu
@description Returns a multi-dimensional array of all of the items in the menu.
| getRoot() : void | Menu
@description Finds the menu's root menu.
| 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` | Menubar
@description The MenuBar class's initialization method. This method is automatically called by the constructor, and s...
| initDefaultConfig() : void | Menubar
@description Initializes the class's configurable properties which can be changed using the menu bar's Config object ...
| initEvents() : void | Overlay
Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.
| insertItem(`YAHOO.widget.MenuItem p_oItem`, `String p_oItem`, `Object p_oItem`, `Number p_nItemIndex`, `Number p_nGroupIndex`) : YAHOO.widget.MenuItem | Menu
@description 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 | Overlay
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
@description Removes the specified item from the menu.
| setInitialFocus() : void | Menu
@description Sets focus to the menu's first enabled item.
| setInitialSelection() : void | Menu
@description Sets the "selected" configuration property of the menu's first enabled item to "true."
| setItemGroupTitle(`String p_sGroupTitle`, `Number p_nGroupIndex`) : void | Menu
@description Sets the title of a group of menu items.
| 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 | Menubar
@description Returns a string representing the menu bar.
| 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
| beforeMoveEvent : (`Number x`, `Number y`) | Overlay
CustomEvent fired before the Overlay is moved.
| clickEvent : () | Menu
@description Fires when the user clicks the on the menu. Passes back the DOM Event object as an argument.
| itemAddedEvent : () | Menu
@description Fires when an item is added to the menu.
| itemRemovedEvent : () | Menu
@description Fires when an item is removed to the menu.
| keyDownEvent : () | Menu
@description Fires when the user presses a key when one of the menu's items has focus. Passes back the DOM Event obj...
| keyPressEvent : () | Menu
@description Fires when the user presses an alphanumeric key when one of the menu's items has focus. Passes back the...
| keyUpEvent : () | Menu
@description Fires when the user releases a key when one of the menu's items has focus. Passes back the DOM Event ob...
| mouseDownEvent : () | Menu
@description Fires when the user mouses down on the menu. Passes back the DOM Event object as an argument.
| mouseOutEvent : () | Menu
@description Fires when the mouse has left the menu. Passes back the DOM Event object as an argument.
| mouseOverEvent : () | Menu
@description Fires when the mouse has entered the menu. Passes back the DOM Event object as an argument.
| mouseUpEvent : () | Menu
@description Fires when the user releases a mouse button while the mouse is over the menu. Passes back the DOM Event...
| moveEvent : (`Number x`, `Number y`) | Overlay
CustomEvent fired after the Overlay is moved.

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

`public String CSS_CLASS_NAME`
@description String representing the CSS class(es) to be applied to the menu bar's `<div>` element. @default "yuimenubar" @final
This property is defined by Menubar.

### 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`
@description String representing the tagname of the HTML element used to title the menu's item groups. @default H6 @final
This property is defined by Menu.

### ITEM_TYPE

`public YAHOO.widget.MenuItem ITEM_TYPE`
@description 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. @default YAHOO.widget.MenuItem @final
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`
@description Object reference to the item in the menu that has focus. @default null
This property is defined by Menu.

### cfg

`public Boolean @default cfg`
True if the Overlay should have an IFRAME shim (for correcting the select z-index bug in IE6 and below). @config iframe
This property is defined by Overlay.

### itemData

`public Array itemData`
@description 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. @default null
This property is defined by Menu.

### javascript

`public String javascript`
<static> The URL that will be placed in the iframe
This property is defined by Overlay.

### lazyLoad

`public Boolean lazyLoad`
@description 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. @default false
This property is defined by Menu.

### parent

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

### srcElement

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

### value

`public Array value`
@config submenualignment @description Array defining how submenus should be aligned to their parent menu bar item. The format is: [itemCorner, submenuCorner]. @default ["tl","bl"]
This property is defined by Menubar.

## Constructor Details

### Menubar

`public function Menubar()`
Parameters:

- None.

## Method Details

### _onClick

`public function _onClick(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.MenuBar p_oMenuBar`)`
@description "click" event handler for the menu bar. @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_oMenuBar` : YAHOO.widget.MenuBar
  Object representing the menu bar that fired the event.

Returns:

- `void`

This method is defined by Menubar.

### _onKeyDown

`public function _onKeyDown(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`)`
@description "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`)`
@description "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`)`
@description "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`)`
@description 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`)`
@description 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.

### 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`)`
@description 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`)`
@description 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`)`
@description 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.

### configPosition

`public function configPosition(`String p_sType`, `Array p_aArgs`, `YAHOO.widget.Menu p_oMenu`)`
@description 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.

### configVisible

`public function configVisible(`String type`, `Object[] args`, `Object obj`)`
The default event handler fired when the "visible" property is changed. 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 Overlay.

### 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 Overlay element from the DOM and sets all child elements to null.
Parameters:

- None.

Returns:

- `void`

This method is defined by Overlay.

### 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`)`
@description 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()`
@description 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()`
@description Finds the menu's root menu.
Parameters:

- None.

Returns:

- `void`

This method is defined by Menu.

### 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`)`
@description The MenuBar 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 menu bar.
- `p_oElement` : String
  String specifying the id attribute of the `<select>` element to be used as the data source for the menu bar.
- `href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-` : one-html.html#ID-22445964">HTMLDivElement} p_oElement Object specifying the `<div>` element of the menu bar.

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

- `void`

`
This method is defined by Menubar.

### initDefaultConfig

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

- None.

Returns:

- `void`

This method is defined by Menubar.

### initEvents

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

- None.

Returns:

- `void`

This method is defined by Overlay.

### insertItem

`public function insertItem(`YAHOO.widget.MenuItem p_oItem`, `String p_oItem`, `Object p_oItem`, `Number p_nItemIndex`, `Number p_nGroupIndex`)`
@description 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 resize DOM event
- `obj` : Object
  The scope object

Returns:

- `void`

This method is defined by Overlay.

### removeItem

`public function removeItem(`YAHOO.widget.MenuItem p_oObject`, `Number p_oObject`, `Number p_nGroupIndex`)`
@description 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.

### setInitialFocus

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

- None.

Returns:

- `void`

This method is defined by Menu.

### setInitialSelection

`public function setInitialSelection()`
@description 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`)`
@description 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.

### 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()`
@description Returns a string representing the menu bar.
Parameters:

- None.

Returns:

- `String`

This method is defined by Menubar.

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

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

### clickEvent

`public event clickEvent`
@description 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.

### itemAddedEvent

`public event itemAddedEvent`
@description 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`
@description 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`
@description 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`
@description 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`
@description 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`
@description 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`
@description 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`
@description 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`
@description 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.

Copyright © 2006 Jack Slocum. All rights reserved.