C

InputModeBase
abstract

Abstract base class implementation of an IInputMode that can be used concurrently with other IInputMode implementations if its exclusive property is true.
ImplementsInheritance Hierarchy

Remarks

This class provides methods which facilitate implementing a custom IInputMode.

Members

Show:

Constructors

Initializes a new instance of the InputModeBase class.
protected

Parameters

exclusive?: boolean
Whether this mode should be exclusive. The default value is true

Properties

Gets if this mode is active.
This mode is active if a controller is installed and is active.
readonlyfinal
Gets the installed controller.
protectedreadonlyfinal

See Also

API
requestMutex, releaseMutex, hasMutex, canRequestMutex
Gets or sets the enabled state of this input mode.
Clients can use this property to disable or reenable this instance. This will set the enabled property of the installed controller so a disabled instance should never try to acquire the input mutex.
Gets or sets a value indicating whether this mode will be the only one running when it has the mutex.

The value of this property will be delegated to the exclusive property of the controller.

If this mode is marked as exclusive and has the mutex, all other modes added to the same MultiplexingInputMode will be deactivated. Otherwise, it will always run concurrently with all other modes.

final
Gets whether this mode is currently installed so a call to parentInputModeContext will yield a non- null result.
readonlyfinal

See Also

API
install
Gets the context instance this mode is currently installed in or null if this instance is not installed.
Note that this instance should not be passed down to subordinate modes or instances. Instead, a corresponding context that has this instance set as the inputMode should be used. One such instance can be obtained through helper method createInputModeContext.
protectedreadonlyfinal
Gets the priority of this input mode.
The priority will influence the order in which the modes will be installed into the CanvasComponent. The lower the priority value, the earlier it will be installed. If two modes are using the same priority value, the first one to be registered will be installed earlier.
final

Methods

Cancels the editing of this mode by first disabling and afterward re-enabling the installed controller.
This implementation disables and re-enables the controller and fires the onCanceled event afterward. Classes that need to perform cleanup should override the onConcurrencyControllerDeactivated method and invoke base.OnConcurrencyControllerDeactivated as the last statement.

See Also

API
onCanceled, canceled
Determines whether this instance can request the mutex.
This will return true, iff a controller has been injected and the helper allows requesting the mutex.
protectedfinal

Return Value

boolean
Whether a call to requestMutex would currently succeed.
Creates an implementation of IInputModeContext that is specific to this mode.

This is needed for events that are triggered by this InputMode to signal where the event is coming from. A common usage for this is, for example, in isHit calls.

The result can be given to isHit or enumerateHits to let implementations of IHitTestable get access to the current IInputModeContext. This can be done by looking up IInputModeContext from the ICanvasContext's lookup method or simply downcasting.

protected

Return Value

IInputModeContext
A readily configured IInputModeContext.

See Also

API
enumerateHits, isHit, IInputModeContext
Helper method that yields a suitably configured InputModeEventArgs for this input mode.
protected

Parameters

context: IInputModeContext

An input mode context that should be made available in the context property.

May be omitted, in which case a child context for this instance is created automatically.

Return Value

InputModeEventArgs
An input mode event argument that is configured for this instance.
Determines whether this instance owns the input mutex.
If no controller had been associated with this instance upon the call to requestMutex this method will return false.
protectedfinal

Return Value

boolean
Whether this instance has the input mutex.
Performs one-time initialization of this instance.

This method should not be invoked by subclasses. This will be done automatically upon first installation of this mode.

This code will be executed only once per instance. The parentInputModeContext property will be null when this code is executed. This method should not be used to install this mode into a specific canvas. Subclasses should always call base.Initialize() first.

protected

See Also

API
install
Installs this mode into a CanvasComponent using the provided IInputModeContext.
Subclasses should override this method and call base.Install(context), first. One-time initialization should be performed in the initialize method. This implementation will call the initialize method the first time this mode gets installed. The initialization will be surrounded by calls to onInitializing and onInitialized to trigger the corresponding events.

Parameters

context: IInputModeContext
the context to install this mode into
controller: ConcurrencyController
The controller for this mode.

See Also

API
parentInputModeContext, inputMode
Event dispatch method that will dispatch the canceled event.
This method is called by subclasses when the editing process has been canceled.
protected

Parameters

evt: InputModeEventArgs
The event arguments.

See Also

API
initialize
Called after the active property of the installed ConcurrencyController has been set to true.

Can be overridden in subclasses to perform additional actions after the mode has been activated.

Overriding implementations should call the base implementation.

protected
Called after the active property of the installed ConcurrencyController has been set to false.

Can be overridden in subclasses to perform additional actions after the mode has been deactivated.

Overriding implementations should call the base implementation.

protected
Event dispatch method that will dispatch the initialized event.
This method will be called by install for the first installation directly after initialize has returned.
protected

Parameters

evt: InputModeEventArgs
The event arguments.

See Also

API
initialize
Event dispatch method that will dispatch the initializing event.
This method will be called by install for the first installation directly before initialize is invoked.
protected

Parameters

evt: InputModeEventArgs
The event arguments.

See Also

API
initialize
Called when this instance obtains the mutex.
If no controller had been associated with this instance upon the call to requestMutex, this method will not be called.
protected
Called when this instance released the mutex.
If no controller had been associated with this instance upon the call to requestMutex this method will not be called.
protected
Event dispatch method that will dispatch the stopped event.
This method will be called by tryStop or can be called by subclasses during a tryStop operation.
protected

Parameters

evt: InputModeEventArgs
The event arguments.

See Also

API
tryStop, stopped
Releases previously captured keyboard input.
protected

See Also

API
requestKeyboard
Releases the mutex that is currently owned by this instance.
This will trigger the onMutexReleased method if this instance previously owned the mutex.
protectedfinal
Releases previously captured MOUSE, TOUCH and PEN input.
protected

See Also

API
requestPointer
Requests capturing of all keyboard input that happens in the CanvasComponent.
This sets the captureAllKeyboardInput property to true, which will prevent visuals inside the canvas from stealing keystrokes.
protected

See Also

API
releaseKeyboard
Requests the mutex from the current controller.
This implementation will call the onMutexObtained method if the mutex has been successfully obtained. If the mutex cannot be obtained, this method will trigger an exception.
protectedfinal

Throws

Exception ({ name: 'Error' })
If the mutex could not be obtained.
Requests capturing of all MOUSE, TOUCH and PEN input that happens in the CanvasComponent.
This sets the captureAllPointerInput property to true, which will prevent visuals inside the canvas from stealing mouse input.
protected

See Also

API
releasePointer
Tries to stop the editing.

This implementation returns if this instance does not currently have the input mutex.

This implementation calls onStopped. Subclasses that want to prevent a stop or need to do special clean up should do this here if the base class implementation of tryStop returns true. A typical implementation should follow this idiom if it wants to stop:

if (mode.tryStop()) {
  // do cleanup
  return true
}
return false

If it doesn't want to stop, simply return false immediately.

Calling this method raises the stopped event.

Return Value

boolean
true iff this instance does not own the mutex.

See Also

API
onStopped
Uninstalls this mode from the canvas.
Subclasses should always call base.Uninstall(context) as the last statement.

Parameters

context: IInputModeContext
The context to remove this mode from. This is the same instance that has been passed to install.

Events

Occurs after the call to cancel
Clients can use this event to perform post cleanup steps of the instance shortly after the mode has been canceled.

Properties of

InputModeEventArgs
context: IInputModeContext
Gets the context for the current event.

See Also

API
onCanceled, cancel, tryStop, stopped
Occurs after the call to initialize
Clients can use this event to perform post-configuration steps of the instance shortly after the initialization has been performed.

Properties of

InputModeEventArgs
context: IInputModeContext
Gets the context for the current event.

See Also

API
install
Occurs before the call to initialize
Clients can use this event to perform configuration of the instance shortly before the initialization begins.

Properties of

InputModeEventArgs
context: IInputModeContext
Gets the context for the current event.

See Also

API
install
Occurs after the call to tryStop
Clients can use this event to perform post cleanup steps of the instance shortly after the mode has been stopped.

Properties of

InputModeEventArgs
context: IInputModeContext
Gets the context for the current event.

See Also

API
onStopped, cancel, tryStop, canceled