#ifndef _EVENT_BUTTONRELEASE_H_
#define _EVENT_BUTTONRELEASE_H_

#include "ebase.h"

namespace event
{

/**
 * \brief Listener for ButtonRelease event.
 * ButtonRelease event means "A button is released (up)."
 * \date 01-12-2006
 *
 * \author Ondrej Svejdar
 *
 * \todo 
 *
 * \bug 
 *
 */
class ButtonReleaseListener:public TObject
{
public:
	virtual void onButtonRelease(EHeader& header,int button,const string& state,int x,int y,int x_root,int y_root)=0;
};


/**
 * \brief Handler for mouse button released event.
 * ButtonRelease event means "A button is released (up)."
 * \date 01-12-2006
 *
 * \author Ondrej Svejdar
 *
 * \todo 
 *
 * \bug 
 *
 */
class EButtonRelease:public EBase
{
	typedef vector<Ptr<ButtonReleaseListener> > t_listeners;
	t_listeners listeners;
	static const char* eventType;
	static const EField* eventFields[];
protected:
	int preprocessEvent(EHeader& header,Tcl_Interp* interp,int objc,Tcl_Obj* CONST objv[]);
public:
	inline EButtonRelease():EBase(eventType,eventFields) {}

	/**
	 * Add listener to collection of listeners
	 * \param listener 
	 */
	void addButtonReleaseListener(ButtonReleaseListener* listener)
	{
		listeners.push_back(listener);
		afterListenerRegistred();
	}
};

};

#endif/*_EVENT_BUTTONRELEASE_H_*/
