Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Event: mxEvent.SELECT

Fires when an item was selected in the toolbar. The function property contains the function that was selected in .

Hierarchy

Index

Constructors

constructor

  • new mxToolbar(container: HTMLElement): mxToolbar

Properties

container

container: null | HTMLElement

Reference to the DOM nodes that contains the toolbar.

enabled

enabled: boolean

Specifies if events are handled. Default is true.

eventListeners

eventListeners: any[]

Variable: eventListeners

Holds the event names and associated listeners in an array. The array contains the event name followed by the respective listener for each registered listener.

eventSource

eventSource: any

Variable: eventSource

Optional source for events. Default is null.

eventsEnabled

eventsEnabled: boolean

Variable: eventsEnabled

Specifies if events can be fired. Default is true.

noReset

noReset: boolean

Specifies if 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

updateDefaultMode: boolean

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.

Methods

addActionCombo

  • addActionCombo(title: string, style?: string): HTMLSelectElement
  • 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

    • title: string

      String that specifies the title of the default element.

    • Optional style: string

      Optional style classname. Default is mxToolbarCombo.

    Returns HTMLSelectElement

addBreak

  • addBreak(): void

addCombo

  • addCombo(style?: string): HTMLSelectElement
  • Adds and returns a new SELECT element using the given style. The element is placed inside a DIV with the mxToolbarComboContainer style classname.

    Parameters

    • Optional style: string

      Optional style classname. Default is mxToolbarCombo.

    Returns HTMLSelectElement

addItem

  • addItem(title: null | string, icon?: string, funct?: null | ((event: MouseEvent) => void), pressedIcon?: string, style?: string, factoryMethod?: (menu: any, evt: Event, cell: mxCell) => void): HTMLImageElement | HTMLButtonElement
  • Adds the given function as an image with the specified title and icon and returns the new image node.

    Parameters

    • title: null | string

      Optional string that is used as the tooltip.

    • Optional icon: string

      Optional URL of the image to be used. If no URL is given, then a button is created.

    • Optional funct: null | ((event: MouseEvent) => void)

      Function to execute on a mouse click.

    • Optional pressedIcon: string

      Optional URL of the pressed image. Default is a gray background.

    • Optional style: string

      Optional style classname. Default is mxToolbarItem.

    • Optional factoryMethod: (menu: any, evt: Event, cell: mxCell) => void

      Optional factory method for popup menu, eg. function(menu, evt, cell) { menu.addItem('Hello, World!'); }

        • (menu: any, evt: Event, cell: mxCell): void
        • Parameters

          • menu: any
          • evt: Event
          • cell: mxCell

          Returns void

    Returns HTMLImageElement | HTMLButtonElement

addLine

  • addLine(): void

addListener

  • addListener(name: string, funct: (...args: any[]) => any): void
  • Function: addListener

    Binds the specified function to the given event name. If no event name is given, then the listener is registered for all events.

    The parameters of the listener are the sender and an .

    Parameters

    • name: string
    • funct: (...args: any[]) => any
        • (...args: any[]): any
        • Parameters

          • Rest ...args: any[]

          Returns any

    Returns void

addMode

  • addMode(title: null | string, icon: string, funct: Function, pressedIcon?: string, style?: string, toggle?: boolean): HTMLImageElement | HTMLButtonElement
  • 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.

    Parameters

    • title: null | string
    • icon: string
    • funct: Function
    • Optional pressedIcon: string
    • Optional style: string
    • Optional toggle: boolean

    Returns HTMLImageElement | HTMLButtonElement

addOption

  • addOption(combo: HTMLSelectElement, title: string, value: string): HTMLOptionElement
  • 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

    • combo: HTMLSelectElement

      SELECT element that will contain the new entry.

    • title: string

      String that specifies the title of the option.

    • value: string

      Specifies the value associated with this option.

    Returns HTMLOptionElement

addSeparator

  • addSeparator(icon: string): HTMLImageElement
  • Adds the specifies image as a separator.

    Parameters:

    Parameters

    • icon: string

      URL of the separator icon.

    Returns HTMLImageElement

addSwitchMode

  • addSwitchMode(title: null | string, icon: string, funct: Function, pressedIcon?: string, style?: string): HTMLImageElement
  • 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.

    Parameters

    • title: null | string
    • icon: string
    • funct: Function
    • Optional pressedIcon: string
    • Optional style: string

    Returns HTMLImageElement

destroy

  • destroy(): void

fireEvent

  • Function: fireEvent

    Dispatches the given event to the listeners which are registered for the event. The sender argument is optional. The current execution scope ("this") is used for the listener invocation (see <mxUtils.bind>).

    Example:

    (code) fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN)) (end)

    Parameters:

    evt - that represents the event. sender - Optional sender to be passed to the listener. Default value is the return value of .

    Parameters

    Returns void

getEventSource

  • getEventSource(): any

isEventsEnabled

  • isEventsEnabled(): boolean

removeListener

  • removeListener(funct: (...args: any[]) => any): void
  • Function: removeListener

    Removes all occurrences of the given listener from .

    Parameters

    • funct: (...args: any[]) => any
        • (...args: any[]): any
        • Parameters

          • Rest ...args: any[]

          Returns any

    Returns void

resetMode

  • resetMode(forced: boolean): void
  • Selects the default mode and resets the state of the previously selected mode.

    Parameters

    • forced: boolean

    Returns void

selectMode

  • selectMode(domNode: HTMLImageElement, funct: Function): void
  • 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.

    Parameters

    • domNode: HTMLImageElement
    • funct: Function

    Returns void

setEventSource

  • setEventSource(value: any): void

setEventsEnabled

  • setEventsEnabled(value: boolean): void

Generated using TypeDoc