// File: SelectionBox.java // Classes: SelectionBox // Original Author: Jason Robbins // $Id: SelectionBox.java,v 1.1.1.1 1997/02/27 20:52:48 chandra Exp $ package uci.graphedit; /*import java.lang.*;*/ import java.util.*; import java.awt.*; /** Selection object for DiagramElement's that do not have handles. A * colorded rectangular frame is drawn just outside the bounding box * of the DiagramElement. * * @see FigText * @see Perspective */ public class SelectionBox extends SelectionSingle { /** The margin between the contents bbox and the frame */ public static final int BORDER_WIDTH = 4; private Editor _editor; /** Construct a new SelectionBox around the given DiagramElement */ public SelectionBox(DiagramElement de) { super(de); } /** Draw the selection. */ public void draw(Graphics g) { Rectangle bb = _content.getBoundingBox(); g.setColor(Globals.prefs().handleColor()); g.drawRect(bb.x - BORDER_WIDTH, bb.y - BORDER_WIDTH, bb.width + BORDER_WIDTH * 2, bb.height + BORDER_WIDTH * 2); g.drawRect(bb.x - BORDER_WIDTH - 1, bb.y - BORDER_WIDTH - 1, bb.width + BORDER_WIDTH * 2 + 2, bb.height + BORDER_WIDTH * 2 + 2); } /** SelectionBox is used when there are no handles, so dragHandle * does nothing. Actually, pickHandle always returns -1 , so this * method should never even get called. */ public void dragHandle(int mx, int my, int an_x,int an_y, int h) { /* do nothing */ } /** The bounding box of the SelectionBox is the contents bbox plus a * border on all sides */ public Rectangle getBoundingBox() { Rectangle r = _content.getBoundingBox(); return r; } } /* end class SelectionBox */