Back to index

moin  1.9.0~rc2
Public Member Functions
CH.ifa.draw.framework.Tool Interface Reference

A tool defines a mode of the drawing view. More...

List of all members.

Public Member Functions

void activate ()
 Activates the tool for the given view.
void deactivate ()
 Deactivates the tool.
void mouseDown (MouseEvent e, int x, int y)
 Handles mouse down events in the drawing view.
void mouseDrag (MouseEvent e, int x, int y)
 Handles mouse drag events in the drawing view.
void mouseUp (MouseEvent e, int x, int y)
 Handles mouse up in the drawing view.
void mouseMove (MouseEvent evt, int x, int y)
 Handles mouse moves (if the mouse button is up).
void keyDown (KeyEvent evt, int key)
 Handles key down events in the drawing view.

Detailed Description

A tool defines a mode of the drawing view.

All input events targeted to the drawing view are forwarded to its current tool.

Tools inform their editor when they are done with an interaction by calling the editor's toolDone() method. The Tools are created once and reused. They are initialized/deinitialized with activate()/deactivate().


Design Patterns

 o

State
Tool plays the role of the State. In encapsulates all state specific behavior. DrawingView plays the role of the StateContext.

See also:
DrawingView

Definition at line 28 of file Tool.java.


Member Function Documentation

Activates the tool for the given view.

This method is called whenever the user switches to this tool. Use this method to reinitialize a tool.

Deactivates the tool.

This method is called whenever the user switches to another tool. Use this method to do some clean-up when the tool is switched. Subclassers should always call super.deactivate.

void CH.ifa.draw.framework.Tool.keyDown ( KeyEvent  evt,
int  key 
)

Handles key down events in the drawing view.

void CH.ifa.draw.framework.Tool.mouseDown ( MouseEvent  e,
int  x,
int  y 
)

Handles mouse down events in the drawing view.

void CH.ifa.draw.framework.Tool.mouseDrag ( MouseEvent  e,
int  x,
int  y 
)

Handles mouse drag events in the drawing view.

void CH.ifa.draw.framework.Tool.mouseMove ( MouseEvent  evt,
int  x,
int  y 
)

Handles mouse moves (if the mouse button is up).

void CH.ifa.draw.framework.Tool.mouseUp ( MouseEvent  e,
int  x,
int  y 
)

Handles mouse up in the drawing view.


The documentation for this interface was generated from the following file: