Class: tinymce.ui.Menu

# tinymce.ui.Menu

Namespace | tinymce.ui
Class | Menu
Inheritance | Menu MenuItem Control
Subclasses | DropMenu

This class is base class for all menu types like DropMenus etc. This class should not be instantiated directly other menu controls should inherit from this one.

## Public Methods

Method | Defined By
--- | ---
Menu(id:String, s:Object) Constructs a new button control instance. | Menu
add(o:Control):Control Adds a new menu, menu item or sub classes of them to the drop menu. | Menu
addMenu(o:Object):Menu Adds a sub menu to the menu. | Menu
addSeparator():MenuItem Adds a menu separator between the menu items. | Menu
collapse(d:Boolean):void Collapses the menu, this will hide the menu and all menu items. | Menu
createMenu(s:Object):Menu Created a new sub menu for the menu control. | Menu
destroy():void Destroys the control will free any memory by removing event listeners etc. | Control
expand(d:Boolean):void Expands the menu, this will show them menu and all menu items. | Menu
hasMenus():Boolean Returns true/false if the menu has sub menus or not. | Menu
isActive():Boolean Returns true/false if the control is disabled or not. | Control
isCollapsed():Boolean Returns true/false if the menu has been collapsed or not. | Menu
isDisabled():Boolean Returns true/false if the control is disabled or not. | Control
isRendered():Boolean Returns true/false if the control has been rendered or not. | Control
isSelected():Boolean Returns true/false if the control is selected or not. | MenuItem
postRender():void Post render handler. | MenuItem
remove(o:Control):Control Removes a specific sub menu or menu item from the menu. | Menu
removeAll():void Removes all menu items and sub menu items from the menu. | Menu
renderHTML():String Renders the control as a HTML string. | Control
renderTo(n:Element):void Renders the control to the specified container element. | Control
setActive(s:Boolean):void Sets the activated state for the control. | Control
setDisabled(s:Boolean):void Sets the disabled state for the control. | Control
setSelected(s:Boolean):void Sets the selected state for the control. | MenuItem
setState(c:String, s:Boolean):void Sets the specified class state for the control. | Control

## Method details

### addmethod

`public function add(o:Control):Control`
Adds a new menu, menu item or sub classes of them to the drop menu.

#### Parameters

o:Control | Menu or menu item to add to the drop menu.

#### Returns

Control - Same as the input control, the menu or menu item.

### addMenumethod

`public function addMenu(o:Object):Menu`
Adds a sub menu to the menu.

#### Parameters

o:Object | Menu control or a object with settings to be created into an control.

#### Returns

Menu - Menu control instance passed in or created.

### addSeparatormethod

`public function addSeparator():MenuItem`
Adds a menu separator between the menu items.

#### Returns

MenuItem - Menu item instance for the separator.

### collapsemethod

`public function collapse(d:Boolean):void`
Collapses the menu, this will hide the menu and all menu items.

#### Parameters

d:Boolean | Optional deep state. If this is set to true all children will be collapsed as well.

### createMenumethod

`public function createMenu(s:Object):Menu`
Created a new sub menu for the menu control.

#### Parameters

s:Object | Optional name/value settings object.

#### Returns

Menu - New drop menu instance.

### expandmethod

`public function expand(d:Boolean):void`
Expands the menu, this will show them menu and all menu items.

#### Parameters

d:Boolean | Optional deep state. If this is set to true all children will be expanded as well.

### hasMenusmethod

`public function hasMenus():Boolean`
Returns true/false if the menu has sub menus or not.

#### Returns

Boolean - True/false state if the menu has sub menues or not.

### isCollapsedmethod

`public function isCollapsed():Boolean`
Returns true/false if the menu has been collapsed or not.

#### Returns

Boolean - True/false state if the menu has been collapsed or not.

### removemethod

`public function remove(o:Control):Control`
Removes a specific sub menu or menu item from the menu.

#### Parameters

o:Control | Menu item or menu to remove from menu.

#### Returns

Control - Control instance or null if it wasn't found.

### removeAllmethod

`public function removeAll():void`
Removes all menu items and sub menu items from the menu.