public abstract class Tool extends java.lang.Object implements Drawable2D
Modifier and Type | Field and Description |
---|---|
protected CutCADApplet |
application
A reference to the application itself.
|
private ShapeButton |
button |
protected ObjectContainer |
objectContainer
A reference to the object container.
|
protected DrawingView2D |
view
The 2D drawing view of the application.
|
Constructor and Description |
---|
Tool(CutCADApplet application,
ObjectContainer container)
Default constructor for a tool.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canStaySelected()
Return whether this tool can be selected for a longer time (such as the drawing tools or select tool)
or whether it is a click-and-forget-tool (such as the save, load or new tool).
|
void |
draw2D(processing.core.PGraphics p,
Transformation transform)
Will be called by the drawing runloop of the application whenever the screen is redrawn.
|
ShapeButton |
getButton()
Returns the button to select this tool.
|
private SVGIcon |
getIcon()
Loads the SVGIcon for the tool.
|
abstract java.lang.String |
getIconName()
Return the name of the SVG for the icon for the tool.
|
void |
mouseButtonPressed(Vector2D position,
int button)
Will be called by the application when a mouse button was pressed.
|
void |
mouseButtonReleased(Vector2D position,
int button)
Will be called by the application when a mouse button was released.
|
void |
mouseMoved(Vector2D position)
Will be called by the application when the mouse was moved.
|
void |
toolWasSelected()
Will be called by the application when this tool was selected.
|
void |
toolWasUnselected()
Will be called by the application when another tool was selected.
|
protected DrawingView2D view
protected CutCADApplet application
protected ObjectContainer objectContainer
private ShapeButton button
public Tool(CutCADApplet application, ObjectContainer container)
application
- Reference to the application.container
- Reference to the object container.public abstract java.lang.String getIconName()
public void mouseButtonPressed(Vector2D position, int button)
position
- The absolute position of the mouse cursor.button
- The button that was pressed.public void mouseButtonReleased(Vector2D position, int button)
position
- The absolute position of the mouse cursor.button
- The button that was released.public void mouseMoved(Vector2D position)
position
- The absolute position of the mouse cursor.public void toolWasSelected()
public void toolWasUnselected()
public void draw2D(processing.core.PGraphics p, Transformation transform)
draw2D
in interface Drawable2D
p
- The graphics context to draw into.transform
- The transformation currently applied to the context.public boolean canStaySelected()
public ShapeButton getButton()
private SVGIcon getIcon()