// (c) MIT 2003.  All rights reserved.

package rec.fun;

import java.awt.*;
import rec.util.*;
import rec.geo.*;
import rec.sys.*;
import rec.core.widgets.*;
import java.awt.geom.*;

public class Question extends VisibleWidget
{
  int x;
  int y;
  int h;
  int w;

  Surface surf = null;


  public Question( Surface surf, VisibleWidget targ )
  {
    this.surf = surf;

    Rectangle r = targ.getBounds();
    
    x = r.x;
    y = r.y;
    h = r.height;
    w = r.width;

  }

  public void draw( Graphics g )
  {
    Color oc = g.getColor();

    if ( getColor() != null )
      g.setColor( getColor().brighter().brighter() );
    else
      g.setColor( Colors.SELECTED.brighter().brighter() );

    g.setColor( Colors.STROKE );

    g.drawRect( x, y, w, h );

    Font of = g.getFont();
    AffineTransform af = AffineTransform.getScaleInstance( 3, 3 );
    Font nf = of.deriveFont( Font.BOLD, af );

    g.setFont( nf );
    g.setColor( Colors.TEXT );
    FontMetrics fm = g.getFontMetrics();
    int off = fm.getDescent();

    int wd = fm.stringWidth( "?" ) / 2;
    
    g.drawString( "?", x + w / 2 - wd, y + h / 2 + off );
    
    g.setFont( of );

    g.setColor( oc );
  }



  public Object clone()
  {
    Question e = new Question( surf, this );

    return e;
  }




  public boolean includes( GPoint p, double offset )
  {
    return false;
  }

  public boolean contains( GPoint p )
  {
    return false;
  }

  public void move( GPoint p )
  {
    Console.writeln( "Moving by " + p );
  }

  public void rotate( GPoint p, double angle )
  {
    Assert.note( "rotate in rec.fsm.Question Not implemented" );
  }

  public double size() 
  {
    Assert.error( "size not implemented." );
    
    return -1;
  }

  public void resize( double d )
  {
    Assert.note( "resize in rec.fsm.Question Not implemented" );
  }


  public Location getLocation()
  {
    return( new Location( new Rectangle( x, y, w, h ) ) );
  }

  public Rectangle getBounds()
  {
    return( new Rectangle( x,y,w,h) );
  }

}
