public interface IInputMode
CanvasControl
instance.
Input modes capture user gestures (or any other kind of "input") and manipulate the contents of the scene graph or the model behind the scene graph.
Implementations may request an input mutex from the ConcurrencyController
that will be given to them in their install(IInputModeContext, ConcurrencyController)
method. This allows them to exclusively modify the contents of the view. If another IInputMode
successfully
acquires the mutex, the ConcurrencyController
will be deactivated
.
AbstractInputMode
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Called by the client to unconditionally cancel all editing.
|
IInputModeContext |
getInputModeContext()
Returns the context instance this mode is currently installed in or
null if this instance is not installed. |
int |
getPriority()
The priority of this input mode.
|
void |
install(IInputModeContext context,
ConcurrencyController controller)
Installs this mode into the given context that is provided by the canvas.
|
boolean |
stop()
Called by the client in order to stop a current editing progress.
|
void |
uninstall(IInputModeContext context)
Uninstalls this mode from the given context.
|
void cancel()
This will be called prior to the uninstalling of this instance.
In order to stop an active input mode manually, client code should use the following idiom:
IInputModeContext getInputModeContext()
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 ParentInputMode
should be used.
int getPriority()
The priority will influence the order in which the modes will be installed
into the canvas control. The lower the priority value, the earlier it will be installed. If two modes are installed
using the same priority value, the first one will be installed earlier.
void install(IInputModeContext context, ConcurrencyController controller)
In general a mode can only be installed into a single canvas at all times.
This method is called to initialize this instance. Subclasses should override this method to register the corresponding
event handler delegates for the various input events they need to register with.
When this instance gets uninstalled
from the context the same context instance
will be passed to it.
Implementations may hold a reference to the context
instance and use it while they are being installed.
context
- The context that this instance shall be installed into. The same instance will be passed to this instance during
uninstall(IInputModeContext)
. A reference to the context may be kept and queried during the time the mode
is installed.controller
- The ConcurrencyController
for this mode.uninstall(IInputModeContext)
boolean stop()
This should stop the current edit, if one is in progress and possibly commit all of the changes. If stopping is not
possible, this method can return false
true
if and only if the editing has been stopped or there was no edit in progresscancel()
void uninstall(IInputModeContext context)
This code should clean up all changes made to the canvas in the install(IInputModeContext, ConcurrencyController)
method. After a mode has been uninstalled it can be installed again into the same or another canvas.
context
- The context to deregister from. This is the same instance that had been passed to install(IInputModeContext, ConcurrencyController)
during installation.