package uk.co.patrickhaston.mars;
import java.awt.Dimension;
import java.awt.Graphics;

public class MarsPopupPanel extends MPanel 
{
  protected MarsFrame theFrame = null;
  // pointer to the Frame so it can reference the rest of the application
  protected int mode;
  // the mode which this window is currently showing
  public static int POPUP_HIDDEN = 0;
  public static int POPUP_CONVERSATION = 1;
  public static int POPUP_SETTLEMENT_INFO = 2;
  public static int POPUP_READ_EMAIL = 3;
  public static int POPUP_CONSTRUCTION_INFO = 4;
  
  public MarsPopupPanel(MarsFrame frame)
  {
    theFrame = frame;
  }
  
  public void setMode(int m)
  {
    mode = m;
    if(mode == POPUP_HIDDEN)
    {
      theFrame.map.setPreferredSize(
        new Dimension(theFrame.mapPanel.getWidth(), theFrame.mapPanel.getHeight()));
    }
    else
    {
      theFrame.map.setPreferredSize(
        new Dimension(theFrame.mapPanel.getWidth(), theFrame.mapPanel.getHeight()/2));
    }
  }
  
  public int getMode()
  {
    return mode;
  }
  
  public void paintComponent(Graphics g)
  {
    if(mode == POPUP_HIDDEN) return;
    if(mode == POPUP_CONVERSATION) paintConversation(g);
    if(mode == POPUP_SETTLEMENT_INFO) paintSettlementInfo(g);
    if(mode == POPUP_READ_EMAIL) paintReadEmail(g);
    if(mode == POPUP_CONSTRUCTION_INFO) paintConstructionInfo(g);
  }

  public void paintConversation(Graphics g)
  {
  }

  public void paintSettlementInfo(Graphics g)
  {
  }

  public void paintReadEmail(Graphics g)
  {
  }

  public void paintConstructionInfo(Graphics g)
  {
  }
}
