// Copyright (c) 1995, 1996 Regents of the University of California.
// All rights reserved.
//
// This software was developed by the Arcadia project
// at the University of California, Irvine.
//
// Redistribution and use in source and binary forms are permitted
// provided that the above copyright notice and this paragraph are
// duplicated in all such forms and that any documentation,
// advertising materials, and other materials related to such
// distribution and use acknowledge that the software was developed
// by the University of California, Irvine.  The name of the
// University may not be used to endorse or promote products derived
// from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
// WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

// File: SelectionBox.java
// Classes: SelectionBox
// Original Author: Jason Robbins
// $Id: SelectionBox.java,v 1.2 2000/09/19 21:08:34 dougo Exp $

// Modified by : Kedar Patankar

package edu.neu.ccs.demeter.tools.apstudio.graphedit;

import java.awt.Graphics;
import java.awt.Rectangle;



/** 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;
  }
  public void setGraphicAttribute(String k, Object v){}
} /* end class SelectionBox */

