public interface Tool extends RichPlugin, SingletonPlugin
For example, a PanTool
might pan a display when the mouse is dragged
or arrow key is pressed, while a PencilTool
could draw hard lines on
the data within a display.
Tools discoverable at runtime must implement this interface and be annotated
with @Plugin
with Plugin.type()
= Tool
.class. While
it possible to create a tool merely by implementing this interface, it is
encouraged to instead extend AbstractTool
, for convenience.
Plugin
,
ToolService
Modifier and Type | Method and Description |
---|---|
default void |
activate()
Informs the tool that it is now active.
|
default void |
configure()
Occurs when the user right clicks this tool's icon.
|
default void |
deactivate()
Informs the tool that it is no longer active.
|
default MouseCursor |
getCursor()
The tool's mouse pointer.
|
default String |
getDescription()
Returns the text the tool provides when mouse hovers over tool
|
default boolean |
isActiveInAppFrame()
When true, tool receives events when the main application frame is active.
|
default boolean |
isAlwaysActive()
When true, tool has no button but rather is active all the time.
|
default void |
onKeyDown(KyPressedEvent evt)
Occurs when a key on the keyboard is pressed while the tool is active.
|
default void |
onKeyUp(KyReleasedEvent evt)
Occurs when a key on the keyboard is released while the tool is active.
|
default void |
onMouseClick(MsClickedEvent evt)
Occurs when a mouse button is double clicked while the tool is active.
|
default void |
onMouseDown(MsPressedEvent evt)
Occurs when a mouse button is pressed while the tool is active.
|
default void |
onMouseDrag(MsDraggedEvent evt)
Occurs when the mouse is dragged while the tool is active.
|
default void |
onMouseMove(MsMovedEvent evt)
Occurs when the mouse is moved while the tool is active.
|
default void |
onMouseUp(MsReleasedEvent evt)
Occurs when a mouse button is released while the tool is active.
|
default void |
onMouseWheel(MsWheelEvent evt)
Occurs when the mouse wheel is moved while the tool is active.
|
getIdentifier, log
context, getContext, setContext
compareTo, getPriority, setPriority
getInfo, setInfo
getLocation
getVersion
default boolean isAlwaysActive()
default boolean isActiveInAppFrame()
default MouseCursor getCursor()
default void activate()
default void deactivate()
default void onKeyDown(KyPressedEvent evt)
default void onKeyUp(KyReleasedEvent evt)
default void onMouseDown(MsPressedEvent evt)
default void onMouseUp(MsReleasedEvent evt)
default void onMouseClick(MsClickedEvent evt)
default void onMouseMove(MsMovedEvent evt)
default void onMouseDrag(MsDraggedEvent evt)
default void onMouseWheel(MsWheelEvent evt)
default void configure()
default String getDescription()
Copyright © 2015–2022 SciJava. All rights reserved.