Constructor
new Menu(optionsopt)
Construct a new Menu
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
MenuSystem.Menu~menuConfig |
<optional> |
The options to use for this menu |
Members
html :Element
The DOM Element of this Menu
Type:
- Element
Methods
addItem(itemConfig)
Add a MenuItem to this Menu
Parameters:
Name | Type | Description |
---|---|---|
itemConfig |
MenuSystem.MenuItem~menuItemConfig |
close()
Close this Menu
closeAllOtherSubmenus(menuItem)
Closes all submenus except on the given MenuItem
Parameters:
Name | Type | Description |
---|---|---|
menuItem |
MenuSystem.MenuItem |
deregisterOnCloseCallback(callback)
Deregister a callback to be called when this Menu closes
Parameters:
Name | Type | Description |
---|---|---|
callback |
function |
deregisterOnOpenCallback(callback)
Deregister a callback to be called when this Menu opens
Parameters:
Name | Type | Description |
---|---|---|
callback |
function |
destroy()
Destroy this menu
open(sourceopt)
Opens this Menu
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
source |
Element | MenuSystem~Point |
<optional> |
null
|
Some notion of the source that openend the Menu, could be a Element or a Point |
registerOnCloseCallback(callback)
Register a callback to be called when this Menu closes
Parameters:
Name | Type | Description |
---|---|---|
callback |
function |
registerOnOpenCallback(callback)
Register a callback to be called when this Menu opens
Parameters:
Name | Type | Description |
---|---|---|
callback |
function |
removeItem(menuItem)
Remove a MenuItem from this Menu
Parameters:
Name | Type | Description |
---|---|---|
menuItem |
MenuSystem.MenuItem | The menu item to remove |
update() → {number}
Updates the MenuItems in this menu.
Returns:
- The number of items in the menu
- Type
- number
Type Definitions
menuConfig
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
builder |
MenuSystem.MenuBuilder |
<optional> |
null
|
The MenuBuilder to use when instanciating the Menu, if null the DefaultBuilder will be used instead. |
context |
* |
<optional> |
null
|
The context of this Menu |
keepOpen |
Boolean |
<optional> |
false
|
Should the Menu stay open when clicked |
groupDividers |
Boolean |
<optional> |
false
|
Should group dividers be visible |
onOpen |
function |
<optional> |
Called when the Menu is opened | |
onClose |
function |
<optional> |
Called when the Menu is closed |
Type:
- Object