package jdraw.framework;

import java.awt.*;

/**
 * The class DrawView displays a graphic model. It is responsible for the
 * presentation of the model and the interaction with the user (selecting,
 * moving and dragging new figures).
 *
 * The type of new figures which are generated if a rectangle is drawn
 * is defined by the currently installed factory.
 *
 * @see DrawModel
 * @see DrawTool
 *
 * @author  Dominik Gruntz
 * @version 2.0, 26.04.01
 */
public interface DrawView  {

	/**
	 * Returns the graphic model of this view.
	 * @return the graphic model presented by this view
	 */
	public DrawModel getModel();

	/**
	 * Returns the draw editor which contains this view.
	 * This object gains access to the editor's menu bar 
	 * and status field. 
	 * @return the draw editor
	 */
	public DrawEditor getEditor();
	
	/**
	 * Returns the currently active tool.
	 * @return active tool
	 */
	public DrawTool getTool();
	
	/**
	 * Sets the tool to be used.
	 * @param tool tool to be used by the draw view
	 */
	public void setTool(DrawTool tool);
	
	/**
	 * Sets the default tool (selection and moving of figures).
	 */
	public void setDefaultTool();
	
	
	/**
	 * Sets the current point constrainer.
	 */
	public void setConstrainer(PointConstrainer p);

	/**
	 * Gets the current grid setting.
	 */
	public PointConstrainer getConstrainer();
	
	
	/**
	 * Returns the selected figures.
	 */
	public java.util.Set getSelection();
	
		
	/**
	 * Clears the selection.
	 */
	public void clearSelection();
	
	
	
	/**
	 * Adds a figure to the selected figures.
	 */	
	public void addToSelection(Figure f);
		
	/**
	 * Removes a figure from the selected figures.
	 */	
	public void removeFromSelection(Figure f);
		
	/**
	 * Draws the graphic model. The paint method iterates over all
	 * figures in the graphic model and calls their paint method.
	 */	
	public void paint(Graphics g);

	/**
	 * Repaints this view.
	 */
	public void repaint();
	
	/**
	 * Returns the size of the drawing.
	 * @return size of the drawing
	 */
	public Dimension getSize();
	
	/**
	 * Sets the cursor of the DrawingView.
	 */
	public void setCursor(Cursor c);
	
}
