private
YAHOO.widget.MenuItem
_addItemToGroup
(
p_nGroupIndex
,
p_oItem
,
p_nItemIndex
)
Adds a menu item to a group.
- Parameters:
-
p_nGroupIndex <Number>
Number indicating the group to which the
item belongs.
-
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>
Optional. Number indicating the index at
which the menu item should be added.
- Returns:
YAHOO.widget.MenuItem
private
void
_cancelHideDelay
(
)
Cancels the call to "hideMenu."
private
void
_cancelShowDelay
(
)
Cancels the call to the "showMenu."
private
Boolean
_checkPosition
(
p_sPosition
)
Checks to make sure that the value of the "position" property
is one of the supported strings. Returns true if the position is supported.
- Parameters:
-
p_sPosition <Object>
String specifying the position of the menu.
- Returns:
Boolean
private
void
_configureSubmenu
(
p_oItem
)
Subscribes the menu item's submenu to its parent menu's events.
- Parameters:
-
p_oItem <YAHOO.widget.MenuItem>
Object reference for the MenuItem
instance with the submenu to be configured.
- Returns:
void
private
Array
_createItemGroup
(
p_nIndex
)
Creates a new menu item group (array) and its associated
<ul>
element. Returns an aray of menu item groups.
- Parameters:
-
p_nIndex <Number>
Number indicating the group to create.
- Returns:
Array
protected
void
_disableScrollFooter
(
)
Disables the footer used for scrolling the body of the menu.
protected
void
_disableScrollHeader
(
)
Disables the header used for scrolling the body of the menu.
protected
void
_enableScrollFooter
(
)
Enables the footer used for scrolling the body of the menu.
protected
void
_enableScrollHeader
(
)
Enables the header used for scrolling the body of the menu.
private
void
_execHideDelay
(
)
Hides the menu after the number of milliseconds specified by
the "hidedelay" configuration property.
private
void
_execShowDelay
(
p_oMenu
)
Shows the menu after the number of milliseconds specified by
the "showdelay" configuration property have ellapsed.
- Parameters:
-
p_oMenu <YAHOO.widget.Menu>
Object specifying the menu that should
be made visible.
- Returns:
void
private
void
_execSubmenuHideDelay
(
p_oSubmenu
,
p_nMouseX
,
p_nHideDelay
)
Hides a submenu after the number of milliseconds specified by
the "submenuhidedelay" configuration property have ellapsed.
- Parameters:
-
p_oSubmenu <YAHOO.widget.Menu>
Object specifying the submenu that
should be hidden.
-
p_nMouseX <Number>
The x coordinate of the mouse when it left
the specified submenu's parent menu item.
-
p_nHideDelay <Number>
The number of milliseconds that should ellapse
before the submenu is hidden.
- Returns:
void
private
YAHOO.widget.MenuItem
_getFirstEnabledItem
(
)
Returns the first enabled item in the menu.
- Returns:
YAHOO.widget.MenuItem
private
Array
_getItemGroup
(
p_nIndex
)
Returns the menu item group at the specified index.
- Parameters:
-
p_nIndex <Number>
Number indicating the index of the menu item group
to be retrieved.
- Returns:
Array
private
void
_getOffsetWidth
(
)
Returns the offset width of the menu's
<div>
element.
private
void
_initSubTree
(
)
Iterates the childNodes of the source element to find nodes
used to instantiate menu and menu items.
private
void
_onBeforeHide
(
p_sType
,
p_aArgs
,
p_oMenu
)
"beforehide" event handler for the 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>
Object representing the menu that fired
the event.
- Returns:
void
private
void
_onBeforeRender
(
p_sType
,
p_aArgs
,
p_oMenu
)
"beforerender" event handler for the menu. Appends all of the
<ul>
, <li>
and their accompanying
title elements to the body element of the 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>
Object representing the menu that
fired the event.
- Returns:
void
private
void
_onBeforeShow
(
p_sType
,
p_aArgs
,
p_oMenu
)
"beforeshow" event handler for the 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>
Object representing the menu that
fired the event.
- Returns:
void
protected
void
_onClick
(
p_sType
,
p_aArgs
,
p_oMenu
)
"click" event handler for the 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>
Object representing the menu that
fired the event.
- Returns:
void
private
void
_onHide
(
p_sType
,
p_aArgs
,
p_oMenu
)
"hide" event handler for the 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>
Object representing the menu that fired
the event.
- Returns:
void
private
void
_onInit
(
p_sType
,
p_aArgs
,
p_oMenu
)
"init" event handler for the 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>
Object representing the menu that
fired the event.
- Returns:
void
protected
void
_onKeyDown
(
p_sType
,
p_aArgs
,
p_oMenu
)
"keydown" event handler for the 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>
Object representing the menu that
fired the event.
- Returns:
void
protected
void
_onKeyPress
(
p_sType
,
p_aArgs
,
p_oMenu
)
"keypress" event handler for a Menu instance.
- Parameters:
-
p_sType <String>
The name of the event that was fired.
-
p_aArgs <Array>
Collection of arguments sent when the event
was fired.
-
p_oMenu <YAHOO.widget.Menu>
The Menu instance that fired the event.
- Returns:
void
private
void
_onMenuItemBlur
(
p_sType
,
p_aArgs
)
"blur" event handler for the menu's items.
- 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
private
void
_onMenuItemConfigChange
(
p_sType
,
p_aArgs
,
p_oItem
)
"configchange" event handler for the menu's items.
- 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_oItem <YAHOO.widget.MenuItem>
Object representing the menu item
that fired the event.
- Returns:
void
private
void
_onMenuItemFocus
(
p_sType
,
p_aArgs
)
"focus" event handler for the menu's items.
- 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
protected
void
_onMouseMove
(
p_oEvent
,
p_oMenu
)
"click" event handler for the menu.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
-
p_oMenu <YAHOO.widget.Menu>
Object representing the menu that
fired the event.
- Returns:
void
protected
void
_onMouseOut
(
p_sType
,
p_aArgs
,
p_oMenu
)
"mouseout" event handler for the 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>
Object representing the menu that
fired the event.
- Returns:
void
protected
void
_onMouseOver
(
p_sType
,
p_aArgs
,
p_oMenu
)
"mouseover" event handler for the 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>
Object representing the menu that
fired the event.
- Returns:
void
private
void
_onParentMenuConfigChange
(
p_sType
,
p_aArgs
,
p_oSubmenu
)
"configchange" event handler for a submenu.
- 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_oSubmenu <YAHOO.widget.Menu>
Object representing the submenu that
subscribed to the event.
- Returns:
void
private
void
_onParentMenuRender
(
p_sType
,
p_aArgs
,
p_oSubmenu
)
"render" event handler for a submenu. Renders a
submenu in response to the firing of its parent's "render" event.
- 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_oSubmenu <YAHOO.widget.Menu>
Object representing the submenu that
subscribed to the event.
- Returns:
void
private
void
_onRender
(
p_sType
,
p_aArgs
)
"render" event handler for the 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
protected
void
_onScrollTargetMouseOut
(
p_oEvent
,
p_oMenu
)
"mouseout" event handler for the menu's "header" and "footer"
elements. Used to stop scrolling the body of the menu up and down when the
menu's "maxheight" configuration property is set to a value greater than 0.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
-
p_oMenu <YAHOO.widget.Menu>
Object representing the menu that
fired the event.
- Returns:
void
protected
void
_onScrollTargetMouseOver
(
p_oEvent
,
p_oMenu
)
"mouseover" event handler for the menu's "header" and "footer"
elements. Used to scroll the body of the menu up and down when the
menu's "maxheight" configuration property is set to a value greater than 0.
- Parameters:
-
p_oEvent <Event>
Object representing the DOM event object passed
back by the event utility (YAHOO.util.Event).
-
p_oMenu <YAHOO.widget.Menu>
Object representing the menu that
fired the event.
- Returns:
void
private
void
_onShow
(
p_sType
,
p_aArgs
,
p_oMenu
)
"show" event handler for the 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>
Object representing the menu that fired
the event.
- Returns:
void
private
void
_onSubmenuBeforeShow
(
p_sType
,
p_aArgs
,
p_oSubmenu
)
"beforeshow" event handler for a submenu.
- 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_oSubmenu <YAHOO.widget.Menu>
Object representing the submenu that
subscribed to the event.
- Returns:
void
private
void
_onSubmenuHide
(
p_sType
,
p_aArgs
)
"hide" Custom Event handler for a submenu.
- 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
private
void
_onSubmenuShow
(
p_sType
,
p_aArgs
)
"show" event handler for a submenu.
- 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
protected
void
_onTextResize
(
p_sType
,
p_aArgs
,
p_oMenu
)
"textresize" event handler for the 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>
Object representing the menu that
fired the event.
- Returns:
void
private
void
_onVisibleChange
(
p_sType
,
p_aArgs
)
Change event handler for the the menu's "visible" configuration
property.
- 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
private
void
_onWidthChange
(
p_sType
,
p_aArgs
)
Change event handler for the the menu's "width" configuration
property.
- 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
private
YAHOO.widget.MenuItem
_removeItemFromGroupByIndex
(
p_nGroupIndex
,
p_nItemIndex
)
Removes a menu item from a group by index. Returns the menu
item that was removed.
- Parameters:
-
p_nGroupIndex <Number>
Number indicating the group to which the menu
item belongs.
-
p_nItemIndex <Number>
Number indicating the index of the menu item
to be removed.
- Returns:
YAHOO.widget.MenuItem
private
YAHOO.widget.MenuItem
_removeItemFromGroupByValue
(
p_nGroupIndex
,
p_oItem
)
Removes a menu item from a group by reference. Returns the
menu item that was removed.
- Parameters:
-
p_nGroupIndex <Number>
Number indicating the group to which the
menu item belongs.
-
p_oItem <YAHOO.widget.MenuItem>
Object reference for the MenuItem
instance to be removed.
- Returns:
YAHOO.widget.MenuItem
private
void
_setMaxHeight
(
p_sType
,
p_aArgs
,
p_nMaxHeight
)
"renderEvent" handler used to defer the setting of the
"maxheight" configuration property until the menu is rendered in lazy
load scenarios.
- Parameters:
-
p_sType <String>
The name of the event that was fired.
-
p_aArgs <Array>
Collection of arguments sent when the event
was fired.
-
p_nMaxHeight <Number>
Number representing the value to set for the
"maxheight" configuration property.
- Returns:
void
private
void
_setWidth
(
)
Sets the width of the menu's root <div>
element to its offsetWidth.
private
void
_subscribeToItemEvents
(
p_oItem
)
Subscribes a menu to a menu item's event.
- Parameters:
-
p_oItem <YAHOO.widget.MenuItem>
Object reference for the MenuItem
instance whose events should be subscribed to.
- Returns:
void
private
void
_updateItemProperties
(
p_nGroupIndex
)
Updates the "index," "groupindex," and "className" properties
of the menu items in the specified group.
- Parameters:
-
p_nGroupIndex <Number>
Number indicating the group of items to update.
- Returns:
void
YAHOO.widget.MenuItem
addItem
(
p_oItem
,
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
Array
addItems
(
p_aItems
,
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
void
blur
(
)
Causes the menu to lose focus and fires the "blur" event.
void
clearActiveItem
(
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
void
clearContent
(
)
Removes all of the content from the menu, including the menu
items, group titles, header and footer.
void
configClassName
(
p_sType
,
p_aArgs
,
p_oMenu
)
Event handler for when the "classname" configuration property of
a menu changes.
- Parameters:
-
p_sType <String>
The name of the event that was fired.
-
p_aArgs <Array>
Collection of arguments sent when the event was fired.
-
p_oMenu <YAHOO.widget.Menu>
The Menu instance fired the event.
- Returns:
void
void
configContainer
(
p_sType
,
p_aArgs
,
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
void
configHideDelay
(
p_sType
,
p_aArgs
,
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
void
configIframe
(
p_sType
,
p_aArgs
,
p_oMenu
)
Event handler for when the "iframe" 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
void
configMaxHeight
(
p_sType
,
p_aArgs
,
p_oMenu
)
Event handler for when the "maxheight" configuration property of
a Menu changes.
- Parameters:
-
p_sType <String>
The name of the event that was fired.
-
p_aArgs <Array>
Collection of arguments sent when the event
was fired.
-
p_oMenu <YAHOO.widget.Menu>
The Menu instance fired
the event.
- Returns:
void
void
configPosition
(
p_sType
,
p_aArgs
,
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
void
configVisible
(
p_sType
,
p_aArgs
,
p_oMenu
)
Event handler for when the "visible" configuration property
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
void
destroy
(
)
Removes the menu's <div>
element
(and accompanying child nodes) from the document.
void
enforceConstraints
(
type
,
args
,
obj
)
The default event handler executed when the moveEvent is fired,
if the "constraintoviewport" configuration property is set to true.
- Parameters:
-
type <String>
The name of the event that was fired.
-
args <Array>
Collection of arguments sent when the
event was fired.
-
obj <Array>
Array containing the current Menu instance
and the item that fired the event.
- Returns:
void
void
focus
(
)
Causes the menu to receive focus and fires the "focus" event.
YAHOO.widget.MenuItem
getItem
(
p_nItemIndex
,
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
Array
getItemGroups
(
)
Multi-dimensional Array representing the menu items as they
are grouped in the menu.
Array
getItems
(
)
Returns an array of all of the items in the menu.
void
getRoot
(
)
Finds the menu's root menu.
Boolean
hasFocus
(
)
Returns a boolean indicating whether or not the menu has focus.
void
init
(
p_oElement
,
p_oConfig
)
The Menu 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.
-
p_oElement <String>
String specifying the id attribute of the
<select>
element to be used as the data source
for the menu.
-
p_oElement <HTMLDivElement>
Object
specifying the <div>
element of the menu.
-
p_oElement <HTMLSelectElement>
Object specifying the <select>
element to be used as
the data source for the menu.
-
p_oConfig <Object>
Optional. Object literal specifying the
configuration for the menu. See configuration class documentation for
more details.
- Returns:
void
void
initDefaultConfig
(
)
Initializes the class's configurable properties which can be
changed using the menu's Config object ("cfg").
void
initEvents
(
)
Initializes the custom events for the menu.
YAHOO.widget.MenuItem
insertItem
(
p_oItem
,
p_nItemIndex
,
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
YAHOO.widget.MenuItem
removeItem
(
p_oObject
,
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
void
setInitialFocus
(
)
Sets focus to the menu's first enabled item.
void
setInitialSelection
(
)
Sets the "selected" configuration property of the menu's first
enabled item to "true."
void
setItemGroupTitle
(
p_sGroupTitle
,
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
String
toString
(
)
Returns a string representing the menu.