Jx.Menu

Extends: Object

Implements: Options, Events, Jx.AutoPosition, Jx.Chrome, Jx.Addable

A main menu as opposed to a sub menu that lives inside the menu.

Summary
Jx.MenuExtends: Object
TODO
Jx.Menurevisit this to see if Jx.Menu and Jx.SubMenu can be merged into a single implementation.
Properties
domObj{HTMLElement} The HTML element containing the menu.
button{Jx.Button} The button that represents this menu in a toolbar and opens the menu.
subDomObj{HTMLElement} the HTML element that contains the menu items within the menu.
items{Array} the items in this menu
Constructor
Jx.MenuCreate a new instance of Jx.Menu.
Functions
addAdd menu items to the sub menu.
removeRemove a single menu item from the menu.
deactivateDeactivate the menu by hiding it.
onMouseOverHandle the user moving the mouse over the button for this menu by showing this menu and hiding the other menu.
eventInMenudetermine if an event happened inside this menu or a sub menu of this menu.
hideHide the menu.
showShow the menu
setVisibleItemSet the sub menu that is currently open

TODO

Jx.Menu

revisit this to see if Jx.Menu and Jx.SubMenu can be merged into a single implementation.

Example

License

Copyright © 2008, DM Solutions Group Inc.

This file is licensed under an MIT style license

Properties

domObj

{HTMLElement} The HTML element containing the menu.

button

{Jx.Button} The button that represents this menu in a toolbar and opens the menu.

subDomObj

{HTMLElement} the HTML element that contains the menu items within the menu.

items

{Array} the items in this menu

Constructor

Jx.Menu

Create a new instance of Jx.Menu.

Parameters

optionssee Jx.Button.Options.  If no options are provided then no button is created.

Functions

add

add : function()

Add menu items to the sub menu.

Parameters

item{<Jx.MenuItem>} the menu item to add.  Multiple menu items can be added by passing multiple arguments to this function.

remove

remove: function(item)

Remove a single menu item from the menu.

Parameters

item{<Jx.MenuItem} the menu item to remove.

deactivate

deactivate: function()

Deactivate the menu by hiding it.

onMouseOver

onMouseOver: function(e)

Handle the user moving the mouse over the button for this menu by showing this menu and hiding the other menu.

Parameters

e{Event} the mouse event

eventInMenu

eventInMenu: function(e)

determine if an event happened inside this menu or a sub menu of this menu.

Parameters

e{Event} the mouse event

Returns

{Boolean} true if the event happened in the menu or a sub menu of this menu, false otherwise

hide

hide: function(e)

Hide the menu.

Parameters

e{Event} the mouse event

show

show : function(o)

Show the menu

Parameters

e{Event} the mouse event

setVisibleItem

setVisibleItem: function(obj)

Set the sub menu that is currently open

Parameters

obj- {<Jx.SubMenu>} the sub menu that just became visible

Extends: Object
add : function()
Add menu items to the sub menu.
remove: function(item)
Remove a single menu item from the menu.
deactivate: function()
Deactivate the menu by hiding it.
onMouseOver: function(e)
Handle the user moving the mouse over the button for this menu by showing this menu and hiding the other menu.
eventInMenu: function(e)
determine if an event happened inside this menu or a sub menu of this menu.
hide: function(e)
Hide the menu.
show : function(o)
Show the menu
setVisibleItem: function(obj)
Set the sub menu that is currently open
Mix-in class that provides a method for positioning elements relative to other elements.
A mix-in class that provides chrome helper functions.
A mix-in class that provides a helper function that allows an object to be added to an existing element on the page.