Basic popup menu. To add a vertical scrollbar to a given submenu, the following code can be used.
var mxPopupMenuShowMenu = mxPopupMenu.prototype.showMenu; mxPopupMenu.prototype.showMenu = function() { mxPopupMenuShowMenu.apply(this, arguments); this.div.style.overflowY = 'auto'; this.div.style.overflowX = 'hidden'; this.div.style.maxHeight = '160px'; };
mxPopupMenu | Basic popup menu. |
Functions | |
mxPopupMenu | Constructs a popupmenu. |
Events | |
mxEvent.SHOW | Fires after the menu has been shown in popup. |
Variables | |
submenuImage | URL of the image to be used for the submenu icon. |
zIndex | Specifies the zIndex for the popupmenu and its shadow. |
factoryMethod | Function that is used to create the popup menu. |
useLeftButtonForPopup | Specifies if popupmenus should be activated by clicking the left mouse button. |
enabled | Specifies if events are handled. |
itemCount | Contains the number of times addItem has been called for a new menu. |
autoExpand | Specifies if submenus should be expanded on mouseover. |
smartSeparators | Specifies if separators should only be added if a menu item follows them. |
labels | Specifies if any labels should be visible. |
Functions | |
init | Initializes the shapes required for this vertex handler. |
isEnabled | Returns true if events are handled. |
setEnabled | Enables or disables event handling. |
isPopupTrigger | Returns true if the given event is a popupmenu trigger for the optional given cell. |
addItem | Adds the given item to the given parent item. |
createSubmenu | Creates the nodes required to add submenu items inside the given parent item. |
showSubmenu | Shows the submenu inside the given parent row. |
addSeparator | Adds a horizontal separator in the given parent item or the top-level menu if no parent is specified. |
popup | Shows the popup menu for the given event and cell. |
isMenuShowing | Returns true if the menu is showing. |
showMenu | Shows the menu. |
hideMenu | Removes the menu and all submenus. |
hideSubmenu | Removes all submenus inside the given parent. |
destroy | Destroys the handler and all its resources and DOM nodes. |
Fires after the menu has been shown in popup.
mxPopupMenu.prototype.factoryMethod
Function that is used to create the popup menu. The function takes the current panning handler, the mxCell under the mouse and the mouse event that triggered the call as arguments.
mxPopupMenu.prototype.itemCount
Contains the number of times addItem has been called for a new menu.
mxPopupMenu.prototype.isEnabled = function()
Returns true if events are handled. This implementation returns enabled.
mxPopupMenu.prototype.setEnabled = function( enabled )
Enables or disables event handling. This implementation updates enabled.
mxPopupMenu.prototype.isPopupTrigger = function( me )
Returns true if the given event is a popupmenu trigger for the optional given cell.
me | mxMouseEvent that represents the mouse event. |
mxPopupMenu.prototype.addItem = function( title, image, funct, parent, iconCls, enabled )
Adds the given item to the given parent item. If no parent item is specified then the item is added to the top-level menu. The return value may be used as the parent argument, ie. as a submenu item. The return value is the table row that represents the item.
title | String that represents the title of the menu item. |
image | Optional URL for the image icon. |
funct | Function associated that takes a mouseup or touchend event. |
parent | Optional item returned by addItem. |
iconCls | Optional string that represents the CSS class for the image icon. IconsCls is ignored if image is given. |
enabled | Optional boolean indicating if the item is enabled. Default is true. |
mxPopupMenu.prototype.createSubmenu = function( parent )
Creates the nodes required to add submenu items inside the given parent item. This is called in addItem if a parent item is used for the first time. This adds various DOM nodes and a submenuImage to the parent.
parent | An item returned by addItem. |
mxPopupMenu.prototype.addSeparator = function( parent, force )
Adds a horizontal separator in the given parent item or the top-level menu if no parent is specified.
parent | Optional item returned by addItem. |
force | Optional boolean to ignore smartSeparators. Default is false. |
mxPopupMenu.prototype.hideSubmenu = function( parent )
Removes all submenus inside the given parent.
parent | An item returned by addItem. |
Shows the popup menu for the given event and cell.
mxPopupMenu.prototype.popup = function( x, y, cell, evt )
URL of the image to be used for the submenu icon.
mxPopupMenu.prototype.submenuImage
Specifies the zIndex for the popupmenu and its shadow.
mxPopupMenu.prototype.zIndex
Function that is used to create the popup menu.
mxPopupMenu.prototype.factoryMethod
Specifies if popupmenus should be activated by clicking the left mouse button.
mxPopupMenu.prototype.useLeftButtonForPopup
Specifies if events are handled.
mxPopupMenu.prototype.enabled
Contains the number of times addItem has been called for a new menu.
mxPopupMenu.prototype.itemCount
Adds the given item to the given parent item.
mxPopupMenu.prototype.addItem = function( title, image, funct, parent, iconCls, enabled )
Specifies if submenus should be expanded on mouseover.
mxPopupMenu.prototype.autoExpand
Specifies if separators should only be added if a menu item follows them.
mxPopupMenu.prototype.smartSeparators
Specifies if any labels should be visible.
mxPopupMenu.prototype.labels
Initializes the shapes required for this vertex handler.
mxPopupMenu.prototype.init = function()
Returns true if events are handled.
mxPopupMenu.prototype.isEnabled = function()
Enables or disables event handling.
mxPopupMenu.prototype.setEnabled = function( enabled )
Returns true if the given event is a popupmenu trigger for the optional given cell.
mxPopupMenu.prototype.isPopupTrigger = function( me )
Creates the nodes required to add submenu items inside the given parent item.
mxPopupMenu.prototype.createSubmenu = function( parent )
Shows the submenu inside the given parent row.
mxPopupMenu.prototype.showSubmenu = function( parent, row )
Adds a horizontal separator in the given parent item or the top-level menu if no parent is specified.
mxPopupMenu.prototype.addSeparator = function( parent, force )
Returns true if the menu is showing.
mxPopupMenu.prototype.isMenuShowing = function()
Shows the menu.
mxPopupMenu.prototype.showMenu = function()
Removes the menu and all submenus.
mxPopupMenu.prototype.hideMenu = function()
Removes all submenus inside the given parent.
mxPopupMenu.prototype.hideSubmenu = function( parent )
Destroys the handler and all its resources and DOM nodes.
mxPopupMenu.prototype.destroy = function()