mxToolbar

Creates a toolbar inside a given DOM node.  The toolbar may contain icons, buttons and combo boxes.

Summary
mxToolbarCreates a toolbar inside a given DOM node.
Events
mxEvent.SELECTFires when an item was selected in the toolbar.
Functions
mxToolbarConstructs a toolbar in the specified container.
Variables
containerReference to the DOM nodes that contains the toolbar.
enabledSpecifies if events are handled.
noResetSpecifies if resetMode requires a forced flag of true for resetting the current mode in the toolbar.
updateDefaultModeBoolean indicating if the default mode should be the last selected switch mode or the first inserted switch mode.
Functions
addItemAdds the given function as an image with the specified title and icon and returns the new image node.
addComboAdds and returns a new SELECT element using the given style.
addComboAdds and returns a new SELECT element using the given title as the default element.
addOptionAdds and returns a new OPTION element inside the given SELECT element.
addSwitchModeAdds a new selectable item to the toolbar.
addModeAdds a new item to the toolbar.
selectModeResets the state of the previously selected mode and displays the given DOM node as selected.
resetModeSelects the default mode and resets the state of the previously selected mode.
addSeparatorAdds the specifies image as a separator.
addBreakAdds a break to the container.
addLineAdds a horizontal line to the container.
destroyRemoves the toolbar and all its associated resources.

Events

mxEvent.SELECT

Fires when an item was selected in the toolbar.  The <code>function</code> property contains the function that was selected in selectMode.

Functions

mxToolbar

function mxToolbar(container)

Constructs a toolbar in the specified container.

Parameters

containerDOM node that contains the toolbar.

Variables

container

mxToolbar.prototype.container

Reference to the DOM nodes that contains the toolbar.

enabled

mxToolbar.prototype.enabled

Specifies if events are handled.  Default is true.

noReset

mxToolbar.prototype.noReset

Specifies if resetMode requires a forced flag of true for resetting the current mode in the toolbar.  Default is false.  This is set to true if the toolbar item is double clicked to avoid a reset after a single use of the item.

updateDefaultMode

mxToolbar.prototype.updateDefaultMode

Boolean indicating if the default mode should be the last selected switch mode or the first inserted switch mode.  Default is true, that is the last selected switch mode is the default mode.  The default mode is the mode to be selected after a reset of the toolbar.  If this is false, then the default mode is the first inserted mode item regardless of what was last selected.  Otherwise, the selected item after a reset is the previously selected item.

Functions

addItem

mxToolbar.prototype.addItem = function(title,
icon,
funct,
pressedIcon,
style,
factoryMethod)

Adds the given function as an image with the specified title and icon and returns the new image node.

Parameters

titleOptional string that is used as the tooltip.
iconOptional URL of the image to be used.  If no URL is given, then a button is created.
functFunction to execute on a mouse click.
pressedIconOptional URL of the pressed image.  Default is a gray background.
styleOptional style classname.  Default is mxToolbarItem.
factoryMethodOptional factory method for popup menu, eg. function(menu, evt, cell) { menu.addItem(‘Hello, World!’); }

addCombo

mxToolbar.prototype.addCombo = function(style)

Adds and returns a new SELECT element using the given style.  The element is placed inside a DIV with the mxToolbarComboContainer style classname.

Parameters

styleOptional style classname.  Default is mxToolbarCombo.

addCombo

Adds and returns a new SELECT element using the given title as the default element.  The selection is reset to this element after each change.

Parameters

titleString that specifies the title of the default element.
styleOptional style classname.  Default is mxToolbarCombo.

addOption

mxToolbar.prototype.addOption = function(combo,
title,
value)

Adds and returns a new OPTION element inside the given SELECT element.  If the given value is a function then it is stored in the option’s funct field.

Parameters

comboSELECT element that will contain the new entry.
titleString that specifies the title of the option.
valueSpecifies the value associated with this option.

addSwitchMode

mxToolbar.prototype.addSwitchMode = function(title,
icon,
funct,
pressedIcon,
style)

Adds a new selectable item to the toolbar.  Only one switch mode item may be selected at a time.  The currently selected item is the default item after a reset of the toolbar.

addMode

mxToolbar.prototype.addMode = function(title,
icon,
funct,
pressedIcon,
style,
toggle)

Adds a new item to the toolbar.  The selection is typically reset after the item has been consumed, for example by adding a new vertex to the graph.  The reset is not carried out if the item is double clicked.

The function argument uses the following signature: funct(evt, cell) where evt is the native mouse event and cell is the cell under the mouse.

selectMode

mxToolbar.prototype.selectMode = function(domNode,
funct)

Resets the state of the previously selected mode and displays the given DOM node as selected.  This function fires a select event with the given function as a parameter.

resetMode

mxToolbar.prototype.resetMode = function(forced)

Selects the default mode and resets the state of the previously selected mode.

addSeparator

mxToolbar.prototype.addSeparator = function(icon)

Adds the specifies image as a separator.

Parameters

iconURL of the separator icon.

addBreak

mxToolbar.prototype.addBreak = function()

Adds a break to the container.

addLine

mxToolbar.prototype.addLine = function()

Adds a horizontal line to the container.

destroy

mxToolbar.prototype.destroy = function ()

Removes the toolbar and all its associated resources.

function mxToolbar(container)
Constructs a toolbar in the specified container.
mxToolbar.prototype.container
Reference to the DOM nodes that contains the toolbar.
mxToolbar.prototype.enabled
Specifies if events are handled.
mxToolbar.prototype.noReset
Specifies if resetMode requires a forced flag of true for resetting the current mode in the toolbar.
mxToolbar.prototype.resetMode = function(forced)
Selects the default mode and resets the state of the previously selected mode.
mxToolbar.prototype.updateDefaultMode
Boolean indicating if the default mode should be the last selected switch mode or the first inserted switch mode.
mxToolbar.prototype.addItem = function(title,
icon,
funct,
pressedIcon,
style,
factoryMethod)
Adds the given function as an image with the specified title and icon and returns the new image node.
mxToolbar.prototype.addCombo = function(style)
Adds and returns a new SELECT element using the given style.
mxToolbar.prototype.addOption = function(combo,
title,
value)
Adds and returns a new OPTION element inside the given SELECT element.
mxToolbar.prototype.addSwitchMode = function(title,
icon,
funct,
pressedIcon,
style)
Adds a new selectable item to the toolbar.
mxToolbar.prototype.addMode = function(title,
icon,
funct,
pressedIcon,
style,
toggle)
Adds a new item to the toolbar.
mxToolbar.prototype.selectMode = function(domNode,
funct)
Resets the state of the previously selected mode and displays the given DOM node as selected.
mxToolbar.prototype.addSeparator = function(icon)
Adds the specifies image as a separator.
mxToolbar.prototype.addBreak = function()
Adds a break to the container.
mxToolbar.prototype.addLine = function()
Adds a horizontal line to the container.
mxToolbar.prototype.destroy = function ()
Removes the toolbar and all its associated resources.
Close