import netscape_beta.application.*;
import netscape_beta.util.*;

/**
 * A class that displays a class dictionary in hierarchical 
 * form within it's superview.
 *
 * @version        1.0 12 Dec 1996
 * @author         Andrew Miller
 */
public class DemClassView extends ContainerView //ScrollGroup
{
  protected Vector m_edges = new Vector();
  protected DemScrollClassView m_parent = null;

    /**
     * Constructs and displays a DemClassView in the specified 
     * rectangle within the provided parent view.
     * @param rcView     The DemClassView's bounds within it's parent.
     * @param parent     The DemScrollClassView containing this DemClassView
     */
  public DemClassView(Rect rcView, DemScrollClassView parent)
  {
	// initialize the super
	super(rcView);

	setBorder(null);
	setBackgroundColor(Color.white);

    // add it to the parent
	parent.addSubview(this);

	m_parent = parent;
  }

    /**
     * Overridden to prevent resizing.  Resizing is unnecessary 
     * since this class is contained within a scroll view.
     * @return Always false
     */
  public boolean isResizable()
  {
	return false;
  }

    /**
     * Add a TreeEdge to the view.
     * @param edge  Edge to add.
     */
  public void addEdge(TreeEdge edge)
  {
        m_edges.addElement(edge);
  }

    /**
     * Overridden to draw tree edges.
     * @param g     Graphics to use for drawing.
     */
  public void drawSubviews(Graphics g)
  {
     super.drawSubviews(g);

    for  (Enumeration e = m_edges.elements(); e.hasMoreElements()  ;)  
    {	
        ((TreeEdge)e.nextElement()).draw(g);
    }
  }

    /**
     * Overridden to handle selection of TreeEdges.  Currently
     * not implemented.
     * @param event     The mouse event.
     * @return          TRUE if handled by superclass
     */
  public boolean mouseDown(MouseEvent event)
  {
     // see if it's on one of the edges
      return (super.mouseDown(event));
  }
}
