Constructor
new Menu(optionsopt)
- Description:
- Construct a new Menu
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
MenuSystem.Menu~menuConfig |
<optional> |
The options to use for this menu |
Members
html :Element
- Description:
- The DOM Element of this Menu
- Source:
The DOM Element of this Menu
Type:
- Element
Methods
addItem(itemConfig) → {MenuSystem.MenuItem}
- Description:
- Add a MenuItem to this Menu
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
itemConfig |
MenuSystem.MenuItem~menuItemConfig |
Returns:
- The added item
- Type
- MenuSystem.MenuItem
close()
- Description:
- Close this Menu
- Source:
closeAllOtherSubmenus(menuItem)
- Description:
- Closes all submenus except on the given MenuItem
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
menuItem |
MenuSystem.MenuItem |
deregisterOnCloseCallback(callback)
- Description:
- Deregister a callback to be called when this Menu closes
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function |
deregisterOnOpenCallback(callback)
- Description:
- Deregister a callback to be called when this Menu opens
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function |
destroy()
- Description:
- Destroy this menu
- Source:
open(sourceopt)
- Description:
- Opens this Menu
- Source:
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)
- Description:
- Register a callback to be called when this Menu closes
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function |
registerOnOpenCallback(callback)
- Description:
- Register a callback to be called when this Menu opens
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function |
removeItem(menuItem)
- Description:
- Remove a MenuItem from this Menu
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
menuItem |
MenuSystem.MenuItem | The menu item to remove |
update() → {number}
- Description:
- Updates the MenuItems in this menu.
- Source:
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