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 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.
Property | Defined 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 | ||
canvas : CanvasComponent [read-only]
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 [read-only]
The context instance this mode is currently installed in or
null if this instance is not installed. | AbstractInputMode | ||
installed : 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 | ||
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 [override]
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 into the canvas of the given context. | AbstractInputMode | ||
stop():Boolean [override]
Returns true if this input mode doesn't own
the mutex. | AbstractConcurrentInputMode | ||
uninstall(context:IInputModeContext):void
Uninstalls this mode from the canvas. | AbstractInputMode |
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 | ||
fireInstalled():void | AbstractInputMode | ||
fireInstalling():void | AbstractInputMode | ||
fireUninstalled():void | AbstractInputMode | ||
fireUninstalling():void | AbstractInputMode | ||
hasMutex():Boolean
Determines whether this instance owns the input mutex. | AbstractConcurrentInputMode | ||
initialize():void
Performs one-time initialization of this instance. | AbstractInputMode | ||
installCore(context:IInputModeContext):void [override]
Installs this mode in the context's canvas, registering the menu
as the canvas' contextMenu. | ContextMenuInputMode | ||
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 | ||
uninstallCore(context:IInputModeContext):void [override] | ContextMenuInputMode |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched after the input mode was installed. | AbstractInputMode | |||
Dispatched before the input mode will be installed. | AbstractInputMode | |||
Dispatched when the contextMenu is about to be shown | ContextMenuInputMode | |||
Dispatched when the default cursor changed. | AbstractConcurrentInputMode | |||
Dispatched after the input mode was uninstalled. | AbstractInputMode | |||
Dispatched before the input mode will be uninstalled. | AbstractInputMode |
autoCleanCustomMenuItems | property |
autoCleanCustomMenuItems:Boolean
Whether to remove all custom menu items automatically before the
menuSelect
event is dispatched.
The default value is true
.
public function get autoCleanCustomMenuItems():Boolean
public function set autoCleanCustomMenuItems(value:Boolean):void
autoRegisterAtApplication | property |
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
.
public function get autoRegisterAtApplication():Boolean
public function set autoRegisterAtApplication(value:Boolean):void
menu | property |
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.
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():ContextMenu
Factory method that creates the initial menu.
Subclasses may override this with more sophisticated implementations.
ReturnsContextMenu — 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 |
menuSelect | Event |
com.yworks.canvas.input.CanvasContextMenuEvent
flash.events.ContextMenuEvent.MENU_SELECT
Dispatched when the contextMenu is about to be shown