| Package | com.yworks.canvas.input |
| Class | public class ContextMenuInputMode |
| Inheritance | ContextMenuInputMode AbstractConcurrentInputMode AbstractInputMode flash.events.EventDispatcher |
IInputMode interface that allows
to customize the context menu that is shown when the user clicks the right mouse button.
This input mode is intented 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.
Note that in an Adobe AIR application, no mouse events will be dispatched while a context menu is still open. Therefore, the coordinates of the CanvasContextMenuEvents dispatched by this input mode will only be updated while no context menu is visible.
| Property | Defined by | ||
|---|---|---|---|
![]() | canvas : CanvasComponent
The canvas instance this mode is currently installed in or
null
| AbstractInputMode | |
![]() | controller : ConcurrencyController
Gets or injects the
ConcurrencyController for this instance. | AbstractConcurrentInputMode | |
![]() | enabled : Boolean
Gets or sets the enabled state of this input mode.
| AbstractConcurrentInputMode | |
![]() | inputModeContext : IInputModeContext
The context instance this mode is currently installed in or
null if this instance is not installed. | AbstractInputMode | |
![]() | installed : Boolean
Whether this mode is currently installed, i.e.
| AbstractInputMode | |
| menu : ContextMenu
Gets or sets the menu to show.
| ContextMenuInputMode | ||
![]() | preferredCursor : Cursor
Gets or sets the cursor this mode would like to have displayed in the
CanvasComponent. | AbstractConcurrentInputMode | |
| Method | Defined by | ||
|---|---|---|---|
|
ContextMenuInputMode(menu:ContextMenu = null)
Creates a new instance using the provided menu.
| ContextMenuInputMode | ||
![]() |
cancel():void
Releases the mutex if this input mode currently
owns the mutex.
| AbstractConcurrentInputMode | |
![]() |
dispose():void
Disposes this input mode.
| AbstractInputMode | |
|
install(context:IInputModeContext):void
Installs this mode in the canvas, registering the
menu
as the canvas' contextMenu. | ContextMenuInputMode | ||
![]() |
stop():Boolean
Returns true if this input mode doesn't own
the mutex.
| AbstractConcurrentInputMode | |
|
uninstall(context:IInputModeContext):void
| ContextMenuInputMode | ||
| Method | Defined by | ||
|---|---|---|---|
![]() |
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 | ||
![]() |
hasMutex():Boolean
Determines whether this instance owns the input mutex.
| AbstractConcurrentInputMode | |
![]() |
initialize():void
Performs one-time initialization of this instance.
| AbstractInputMode | |
![]() |
invalidate():void
Convenience method for subclass implementations that invalidates
the canvasComponent this mode is currently installed in.
| AbstractInputMode | |
![]() |
onDisabled():void
Called when the
enabled property changes to false. | AbstractConcurrentInputMode | |
![]() |
onEnabled():void
Called when the
enabled property changes to true. | AbstractConcurrentInputMode | |
![]() |
onMutexObtained():void
Called when this instance obtains the
InputMutex. | AbstractConcurrentInputMode | |
![]() |
onMutexReleased():void
Called when this instance released the
InputMutex. | AbstractConcurrentInputMode | |
![]() |
Called when the
preferredCursor property changes. | AbstractConcurrentInputMode | |
![]() |
releaseMutex():void
Releases the mutex that is currently owned by this instance.
| AbstractConcurrentInputMode | |
![]() |
requestMutex():void
Requests the
InputMutex from the current controller. | AbstractConcurrentInputMode | |
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when the contextMenu is about to be shown | ContextMenuInputMode | |||
![]() | Dispatched when the default cursor changed. | AbstractConcurrentInputMode | ||
| menu | property |
menu:ContextMenu [read-write]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.
public function get menu():ContextMenu
public function set menu(value:ContextMenu):void
| ContextMenuInputMode | () | constructor |
public function ContextMenuInputMode(menu:ContextMenu = null)Creates a new instance using the provided menu.
Parametersmenu:ContextMenu (default = null) |
| createContextMenuHandlerInputModeContext | () | method |
protected function createContextMenuHandlerInputModeContext():IInputModeContext
Creates an IInputModeContext for use
with the next menuSelect event.
IInputModeContext —
An instance of IInputModeContext.
|
See also
| createMenu | () | method |
protected function createMenu():ContextMenuFactory method that creates the initial menu.
Subclasses may override this with more sophisticated implementations.
ReturnsContextMenu — a default ContextMenu
|
| install | () | method |
public override function install(context:IInputModeContext):void
Installs this mode in the canvas, registering the menu
as the canvas' contextMenu.
Note: this also registers the menu for Application.application.root
since otherwise the custom menu won't work when a custom cursor is activated.
context:IInputModeContext — The canvas to install this mode into.
|
| uninstall | () | method |
public override function uninstall(context:IInputModeContext):voidParameters
context:IInputModeContext |
| menuSelect | event |
com.yworks.canvas.input.CanvasContextMenuEvent
Dispatched when the contextMenu is about to be shown