Back to index

moin  1.9.0~rc2
AbstractTool.java
Go to the documentation of this file.
00001 /*
00002  * @(#)AbstractTool.java 5.1
00003  *
00004  */
00005 
00006 package CH.ifa.draw.standard;
00007 
00008 import java.awt.*;
00009 import java.awt.event.MouseEvent;
00010 import java.awt.event.KeyEvent;
00011 import CH.ifa.draw.framework.*;
00012 
00020 public class AbstractTool implements Tool {
00021 
00022     protected DrawingView  fView;
00023 
00027     protected int     fAnchorX, fAnchorY;
00028 
00032     public AbstractTool(DrawingView itsView) {
00033         fView = itsView;
00034     }
00035 
00041     public void activate() {
00042         fView.clearSelection();
00043     }
00044 
00051     public void deactivate() {
00052         fView.setCursor(Cursor.getDefaultCursor());
00053     }
00054 
00058     public void mouseDown(MouseEvent e, int x, int y) {
00059         fAnchorX = x;
00060         fAnchorY = y;
00061     }
00062 
00066     public void mouseDrag(MouseEvent e, int x, int y) {
00067     }
00068 
00072     public void mouseUp(MouseEvent e, int x, int y) {
00073     }
00074 
00078     public void mouseMove(MouseEvent evt, int x, int y) {
00079     }
00080 
00084     public void keyDown(KeyEvent evt, int key) {
00085     }
00086 
00090     public Drawing drawing() {
00091         return fView.drawing();
00092     }
00093 
00097     public DrawingEditor editor() {
00098         return fView.editor();
00099     }
00100 
00104     public DrawingView view() {
00105         return fView;
00106     }
00107 }