package jdraw.framework;

import java.awt.event.MouseEvent;

/**
 * A tool defines a mode of the drawing view, intended to be set over a
 * tool bar. An example of a tool is the construction of new figures.
 * Whenever a new tool is activated or deactivated, the corresponding
 * methods are called. This can be used to e.g. adjust the mouse cursor
 * depending on the current tool.
 * <P>
 * All input events targeted to the drawing view are forwarded to its 
 * current tool.
 *
 * @see Figure
 *
 * @author  Dominik Gruntz
 * @version 2.0, 26.04.01
 */
public interface DrawTool {

	/**
	 * 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.
	 */
	public void activate();

	/**
	 * 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.
	 */
	public void deactivate();
	 
	/**
	 * Handles mouse down events in the drawing view.
	 * @param x x coordinate of mouse position
	 * @param y y coordinate of mouse position
	 * @param e mouse event, contains state of modifiers
	 */
	public void mouseDown(int x, int y, MouseEvent e);

	/**
	 * Handles mouse drag events in the drawing view.
	 * @param x x coordinate of mouse position
	 * @param y y coordinate of mouse position
	 * @param e mouse event, contains state of modifiers
	 */
	public void mouseDrag(int x, int y, MouseEvent e);

	/**
	 * Handles mouse up in the drawing view.
	 * @param x x coordinate of mouse position
	 * @param y y coordinate of mouse position
	 * @param e mouse event, contains state of modifiers
	 */
	public void mouseUp  (int x, int y, MouseEvent e);
	
}
