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

////////////////////////////////////////////////////////////////////////////////
//
// FILE:	WClick.java
//
// AUTHOR:	Manoj D. Muzumdar
//		archon@ai.mit.edu
//
//              Adapted from code written by Luke Weisman
//              luke@ai.mit.edu
//
// DATE:	06-XX-98
//
// COPYRIGHT:	Massachusetts Institute of Technology
//		All rights reserved.
//
// PURPOSE:	Drawing recognition
//
// HISTORY:     11-15-98 archon
//              Now aware of new rec.geo package
//
////////////////////////////////////////////////////////////////////////////////

package rec.core.widgets;

import java.awt.*;
import rec.util.*;
import rec.geo.*;
import rec.sys.*;

public class WButtonClick extends WClick
{
  
  public WButtonClick( GPoint gp, WButton b )
  {
    super( gp );
    setEnglishName( "Button Click" );
    m_Button = b;
  }


  //////////////////////////////////////////////////////////////////////////////

  public Object clone()
  {
    return( new WButtonClick( m_Point, m_Button ) );
  }


  // a button click should call the hit function of the button, and 
  // make sure it knows how ti undo the hit function of the button
  public void makeDefaultSuitcase( Surface s )
  {
    super.makeDefaultSuitcase( s );
    
    m_Suitcase.addTransition( new DoTransition( s ) {
      public void doDo()
	{ 
	  m_Button.hit( m_Surface );
	}
      public void doUndo()
	{
	  m_Button.undoHit();
	}
      public String getAction()
	{
	  return m_Button.describeHit();
	}
    } );    
    
  }

  private WButton m_Button;
}

////////////////////////////////////////////////////////////////////////////////
