(abstract) new module:ct-component /menu /Abstract Menu(sDescription, fHandler, pChildren)
This is in beta and therefore subject to API changes.
This abstract class should never be constructed explicitly.
AbstractMenu
contains all the functionality for the following classes:
module:ct-component/menu/MenuItem
module:ct-component/menu/SubMenu
module:ct-component/menu/MenuGroup
The concrete Menu
classes themselves merely provide helpful constructor methods to making using
AbstractMenu
easier.
Parameters:
Name | Type | Description |
---|---|---|
sDescription |
String | Description or name of this menu item. |
fHandler |
function | Action fired when this menu item is clicked. |
pChildren |
Array | Child menu items for this menu group or submenu. |
Methods
add Change Listener(oListener)
Register to receive menu change events.
Parameters:
Name | Type | Description |
---|---|---|
oListener |
module:ct-component |
The listener to be registered. |
- Implements:
add Menu Item(oMenu Item)
Add a new menu item to the list of child menu items.
Parameters:
Name | Type | Description |
---|---|---|
oMenuItem |
module:ct-component |
The menu item to be added. |
- Implements:
- See:
get Children()
A list of either the menu items within a sub-menu, or a grouped set of menu items.
- Implements:
get Description()
The description of either a single menu item or a sub-menu item.
- Implements:
get Handler()
The handler function that will be invoked when the menu item is clicked.
- Implements:
is Enabled()
Returns true if this menu is currently enabled, and false otherwise.
- Implements:
on Menu Changed()
This call-back is invoked whenever a change occurs; either directly on the menu you have registered the listener on, or also when a change occurs on one of the descendants of that menu.
remove Change Listener(oListener)
Remove a previously registered listener.
Parameters:
Name | Type | Description |
---|---|---|
oListener |
module:ct-component |
A previously registered listener. |
remove Menu Item(oMenu Item)
Remove an existing menu item from the list of child menu items.
Parameters:
Name | Type | Description |
---|---|---|
oMenuItem |
module:ct-component |
The menu item to be removed. |
- Implements:
- See:
set IsEnabled(bIsEnabled)
Set whether the menu is enabled or not.
Parameters:
Name | Type | Description |
---|---|---|
bIsEnabled |
boolean | Whether to enable or disable the menu item |
- Implements: