TinyMCE:API/tinymce.ui.DropMenu
From Moxiecode Documentation Wiki
Contents |
[edit]
Class: tinymce.ui.DropMenu extends tinymce.ui.Menu
This class is used to create drop menus. A drop menu can be a context menu or a menu for a list box or a menu bar.
[edit]
Methods
- add
- Adds a new menu, menu item or sub classes of them to the drop menu.
- collapse
- Collapses the menu. This will hide the menu and all menu items.
- createMenu
- Creates a new sub menu for the drop menu control.
- destroy
- Destroys the menu.
- hideMenu
- Hides the displayed menu.
- remove
- Removes a specific sub menu or menu item from the drop menu.
- renderNode
- Renders the specified menu node to the DOM.
- showMenu
- Displays the menu at the specified coordinate.
- update
- Repaints the menu after new items have been added dynamically.
[edit]
Methods inherited from tinymce.ui.Menu
expand,collapse,isCollapsed,add,addSeparator,addMenu,hasMenus,remove,removeAll,createMenu
[edit]
Methods inherited from tinymce.ui.MenuItem
setSelected,isSelected,postRender,execCallback
[edit]
Methods inherited from tinymce.ui.Control
setDisabled,isDisabled,setActive,isActive,setState,isRendered,renderHTML,renderTo,postRender,destroy
[edit]
Examples
// Adds a menu to the currently active editor instance
var dm = tinyMCE.activeEditor.controlManager.createDropMenu('somemenu');
// Add some menu items
dm.add({title : 'Menu 1', onclick : function() {
alert('Item 1 was clicked.');
}});
dm.add({title : 'Menu 2', onclick : function() {
alert('Item 2 was clicked.');
}});
// Adds a submenu
var sub1 = dm.addMenu({title : 'Menu 3'});
sub1.add({title : 'Menu 1.1', onclick : function() {
alert('Item 1.1 was clicked.');
}});
// Adds a horizontal separator
sub1.addSeparator();
sub1.add({title : 'Menu 1.2', onclick : function() {
alert('Item 1.2 was clicked.');
}});
// Adds a submenu to the submenu
var sub2 = sub1.addMenu({title : 'Menu 1.3'});
// Adds items to the sub sub menu
sub2.add({title : 'Menu 1.3.1', onclick : function() {
alert('Item 1.3.1 was clicked.');
}});
sub2.add({title : 'Menu 1.3.2', onclick : function() {
alert('Item 1.3.2 was clicked.');
}});
dm.add({title : 'Menu 4', onclick : function() {
alert('Item 3 was clicked.');
}});
// Display the menu at position 100, 100
dm.showMenu(100, 100);
