package j3deditor.bin.components;


/**
 * Object that describes the event sent by a <code>SimpleButton</code>.
 *
 * @author Risto Seene
 * 
 * @see SimpleButton
 * @see SimpleButtonListener
 */
public class SimpleButtonEvent{


	/** the sender of this event */
	private SimpleButton source;

	/** drag distance on X-axis */
	private float x;

	/** drag distance on Y-axis */
	private float y;


	/**
	 * Creates an instance of <code>SimpleButtonEvent</code>
	 * which is sent by the given object.
	 *
	 * @param source
	 *	the sender of this event
	 */
	public SimpleButtonEvent(SimpleButton source){
		this.source = source;
		x = 0;
		y = 0;
	}


	/**
	 * Creates an instance of <code>SimpleButtonEvent</code>
	 * which is sent by the given object and drag distances.
	 *
	 * @param source
	 *	the sender of this event
	 * @param x
	 *	drag distance on X-axis
	 * @param y
	 *	drag distance on Y-axis
	 */
	public SimpleButtonEvent(SimpleButton source, float x, float y){
		this.source = source;

		this.x = x;
		this.y = y;
	}


	/**
	 * Returns the sender of this event.
	 *
	 * @return Returns the sender of this event
	 */
	public SimpleButton getSource(){
		return source;
	}


	/**
	 * Returns the drag distance on X-axis.
	 *
	 * @return drag distance on X-axis
	 */
	public float getX(){
		return x;
	}


	/**
	 * Returns the drag distance on Y-axis.
	 *
	 * @return drag distance on Y-axis
	 */
	public float getY(){
		return y;
	}

}
