#ifndef _EVENT_BUTTONPRESS_H_
#define _EVENT_BUTTONPRESS_H_

#include "ebase.h"

namespace event
{

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

/**
 * \brief Handler for ButtonPress event.
 * ButtonPress event means "A button is pressed (down)."
 * \date 01-12-2006
 *
 * \author Ondrej Svejdar
 *
 * \todo 
 *
 * \bug 
 *
 */
class EButtonPress:public EBase
{
	typedef vector<Ptr<ButtonPressListener> > 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 EButtonPress():EBase(eventType,eventFields) {}

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

};

#endif/*_EVENT_BUTTONPRESS_H_*/
