1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
// (jEdit options) :folding=explicit:collapseFolds=1:
//{{{ Package, imports
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.URL;
import java.text.DecimalFormat;
import java.util.*;
//import java.util.regex.*;
import javax.swing.*;
import driftwood.gui.*;
import king.*;
import king.core.*;
//}}}
/**
* <code>SimpleTool</code> hijacks the machinery of KiNG's dynamically loaded Tools
* to get easy-to-use mouse listener functions.
*
* <p>Copyright (C) 2006 by Ian W. Davis. All rights reserved.
* <br>Begun on Wed Jun 21 12:11:18 EDT 2006
*/
public class SimpleTool extends king.BasicTool
{
//{{{ Constants
//}}}
//{{{ Variable definitions
//##############################################################################
//}}}
//{{{ Constructor(s)
//##############################################################################
public SimpleTool(SimpleApp app, ToolBox tb)
{
super(tb);
}
//}}}
//{{{ click, drag, wheel
//##############################################################################
/** Override this function for (left-button) clicks */
public void click(int x, int y, KPoint p, MouseEvent ev)
{
// optional:
//super.click(x, y, p, ev);
if(p != null)
{
if(p.getColor() == KPalette.hotpink) p.setColor(null);
else p.setColor(KPalette.hotpink);
}
}
/** Override this function for right-button/shift clicks */
//public void s_click(int x, int y, KPoint p, MouseEvent ev) {}
/** Override this function for middle-button/control clicks */
//public void c_click(int x, int y, KPoint p, MouseEvent ev) {}
/** Override this function for shift-control clicks */
//public void sc_click(int x, int y, KPoint p, MouseEvent ev) {}
/** Override this function for (left-button) drags */
//public void drag(int dx, int dy, MouseEvent ev) {}
/** Override this function for right-button/shift drags */
//public void s_drag(int dx, int dy, MouseEvent ev) {}
/** Override this function for middle-button/control drags */
//public void c_drag(int dx, int dy, MouseEvent ev) {}
/** Override this function for shift-control drags */
//public void sc_drag(int dx, int dy, MouseEvent ev) {}
/** Override this function for mouse wheel motion */
//public void wheel(int rotation, MouseEvent ev) {}
/** Override this function for mouse wheel motion with shift down */
//public void s_wheel(int rotation, MouseEvent ev) {}
/** Override this function for mouse wheel motion with control down */
//public void c_wheel(int rotation, MouseEvent ev) {}
/** Override this function for mouse wheel motion with shift AND control down */
//public void sc_wheel(int rotation, MouseEvent ev) {}
//}}}
//{{{ toString
//##############################################################################
public String toString() { return "This *would* show up in KiNG's Tools menu"; }
//}}}
//{{{ empty_code_segment
//##############################################################################
//}}}
}//class
|