Packagecom.yworks.canvas.input
Classpublic class ContextMenuInputMode
InheritanceContextMenuInputMode Inheritance AbstractConcurrentInputMode Inheritance AbstractInputMode Inheritance flash.events.EventDispatcher

An implementation of the IInputMode interface that allows to customize the context menu that is shown when the user clicks the right mouse button.

This input mode is intended for adding context menu items to the context menu just before the context menu is displayed. Therefore, all custom items are removed before the menuSelect event is dispatched. Custom context menu items can then be added in event handler functions for the menuSelect event.



Public Properties
 PropertyDefined By
  autoCleanCustomMenuItems : Boolean
Whether to remove all custom menu items automatically before the menuSelect event is dispatched.
ContextMenuInputMode
  autoRegisterAtApplication : Boolean
Whether to automatically set the application' contextMenu property to the ContextMenu used by this input mode.
ContextMenuInputMode
 Inheritedcanvas : CanvasComponent
[read-only] The canvas instance this mode is currently installed in or null
AbstractInputMode
 Inheritedcontroller : ConcurrencyController
Gets or injects the ConcurrencyController for this instance.
AbstractConcurrentInputMode
 Inheritedenabled : Boolean
Gets or sets the enabled state of this input mode.
AbstractConcurrentInputMode
 InheritedinputModeContext : IInputModeContext
[read-only] The context instance this mode is currently installed in or null if this instance is not installed.
AbstractInputMode
 Inheritedinstalled : Boolean
[read-only] Whether this mode is currently installed, i.e if a call to the canvas property will yield a non-null result.
AbstractInputMode
  menu : ContextMenu
Gets or sets the menu to show.
ContextMenuInputMode
 InheritedpreferredCursor : Cursor
Gets or sets the cursor this mode would like to have displayed in the CanvasComponent.
AbstractConcurrentInputMode
Public Methods
 MethodDefined By
  
ContextMenuInputMode(menu:ContextMenu = null)
Creates a new instance using the provided menu.
ContextMenuInputMode
 Inherited
cancel():void
[override] Releases the mutex if this input mode currently owns the mutex.
AbstractConcurrentInputMode
 Inherited
dispose():void
Disposes this input mode.
AbstractInputMode
 Inherited
Installs this mode into the canvas of the given context.
AbstractInputMode
 Inherited
stop():Boolean
[override] Returns true if this input mode doesn't own the mutex.
AbstractConcurrentInputMode
 Inherited
Uninstalls this mode from the canvas.
AbstractInputMode
Protected Methods
 MethodDefined By
 Inherited
canRequestMutex():Boolean
Determines whether this instance can request the InputMutex.
AbstractConcurrentInputMode
  
Creates an IInputModeContext for use with the next menuSelect event.
ContextMenuInputMode
  
createMenu():ContextMenu
Factory method that creates the initial menu.
ContextMenuInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
hasMutex():Boolean
Determines whether this instance owns the input mutex.
AbstractConcurrentInputMode
 Inherited
initialize():void
Performs one-time initialization of this instance.
AbstractInputMode
  
[override] Installs this mode in the context's canvas, registering the menu as the canvas' contextMenu.
ContextMenuInputMode
 Inherited
invalidate():void
Convenience method for subclass implementations that invalidates the canvasComponent this mode is currently installed in.
AbstractInputMode
 Inherited
onDisabled():void
Called when the enabled property changes to false.
AbstractConcurrentInputMode
 Inherited
onEnabled():void
Called when the enabled property changes to true.
AbstractConcurrentInputMode
 Inherited
Called when this instance obtains the InputMutex.
AbstractConcurrentInputMode
 Inherited
Called when this instance released the InputMutex.
AbstractConcurrentInputMode
 Inherited
onPreferredCursorChanged(oldValue:Cursor, newValue:Cursor):void
Called when the preferredCursor property changes.
AbstractConcurrentInputMode
 Inherited
Releases the mutex that is currently owned by this instance.
AbstractConcurrentInputMode
 Inherited
Requests the InputMutex from the current controller.
AbstractConcurrentInputMode
  
[override]
ContextMenuInputMode
Events
 Event Summary Defined By
 InheritedDispatched after the input mode was installed.AbstractInputMode
 InheritedDispatched before the input mode will be installed.AbstractInputMode
  Dispatched when the contextMenu is about to be shownContextMenuInputMode
 InheritedDispatched when the default cursor changed.AbstractConcurrentInputMode
 InheritedDispatched after the input mode was uninstalled.AbstractInputMode
 InheritedDispatched before the input mode will be uninstalled.AbstractInputMode
Public Constants
 ConstantDefined By
 InheritedINSTALLED : String = installed
[static]
AbstractInputMode
 InheritedINSTALLING : String = installing
[static]
AbstractInputMode
 InheritedPREFERRED_CURSOR_CHANGED : String = preferredCursorChanged
[static]
AbstractConcurrentInputMode
 InheritedUNINSTALLED : String = uninstalled
[static]
AbstractInputMode
 InheritedUNINSTALLING : String = uninstalling
[static]
AbstractInputMode
Property Detail
autoCleanCustomMenuItemsproperty
autoCleanCustomMenuItems:Boolean

Whether to remove all custom menu items automatically before the menuSelect event is dispatched.

The default value is true.


Implementation
    public function get autoCleanCustomMenuItems():Boolean
    public function set autoCleanCustomMenuItems(value:Boolean):void
autoRegisterAtApplicationproperty 
autoRegisterAtApplication:Boolean

Whether to automatically set the application' contextMenu property to the ContextMenu used by this input mode.

If set to false, only the contextMenu property of the CanvasComponent using this input mode is set.

The default value is true.


Implementation
    public function get autoRegisterAtApplication():Boolean
    public function set autoRegisterAtApplication(value:Boolean):void
menuproperty 
menu:ContextMenu

Gets or sets the menu to show.

If no menu has been configured with this instance this will create the menu using the createMenu callback.


Implementation
    public function get menu():ContextMenu
    public function set menu(value:ContextMenu):void
Constructor Detail
ContextMenuInputMode()Constructor
public function ContextMenuInputMode(menu:ContextMenu = null)

Creates a new instance using the provided menu.

Parameters
menu:ContextMenu (default = null)
Method Detail
createContextMenuHandlerInputModeContext()method
protected function createContextMenuHandlerInputModeContext():IInputModeContext

Creates an IInputModeContext for use with the next menuSelect event.

Returns
IInputModeContext — An instance of IInputModeContext.

See also

createMenu()method 
protected function createMenu():ContextMenu

Factory method that creates the initial menu.

Subclasses may override this with more sophisticated implementations.

Returns
ContextMenu — a default ContextMenu
installCore()method 
override protected function installCore(context:IInputModeContext):void

Installs this mode in the context's canvas, registering the menu as the canvas' contextMenu.

Parameters

context:IInputModeContext — The input mode context containing the canvas to install this mode into.

uninstallCore()method 
override protected function uninstallCore(context:IInputModeContext):void

Parameters

context:IInputModeContext

Event Detail
menuSelect Event
Event Object Type: com.yworks.canvas.input.CanvasContextMenuEvent
CanvasContextMenuEvent.type property = flash.events.ContextMenuEvent.MENU_SELECT

Dispatched when the contextMenu is about to be shown