import java.awt.*;
import java.math.*;
import java.awt.event.*;
import java.awt.geom.*;


public class PopupManager {
    Manager M;
    int X,Y;
    ListenSquare PUZZLE,DEFORM;

    public PopupManager(Manager m,int x,int y) {
	M=m;
	this.X=x;
	this.Y=y;
	PUZZLE=new ListenSquare(X,Y+25,80,25);
	DEFORM=new ListenSquare(X,Y+50,80,25);
    }


    public void render(Graphics2D g) {
	g.setColor(Color.black);
	g.fillRect(X,Y,80,75);
	g.setColor(Color.white);
	g.drawRect(X,Y,80,75);
	g.setFont(new Font("Helvetica",Font.PLAIN,16));
	g.drawString("popups",X+5,Y+18);
	PUZZLE.render(g,"puzzle",14,5,new Color(200,0,0));
	DEFORM.render(g,"deform",14,5,new Color(0,0,200));
    }

    public void process(Point X) {

	if(PUZZLE.inside(X)==1) {
	    PopupPuzzleCanvas PX=new PopupPuzzleCanvas();
	    PX.X.M=this.M;
	    M.X=PX.X;
	}
	
	if(DEFORM.inside(X)==1) {
	    PopupDeformCanvas PY=new PopupDeformCanvas();
	    PY.Y.M=this.M;
	    M.Y=PY.Y;
	}
    }


}

