#include "eenter.h"

using namespace event;

const char* EEnter::eventType="Enter";
const EField* EEnter::eventFields[]=
{
	&EField::SERIAL,
	&EField::ID,
	&EField::TIME,
	&EField::ROOT_WINDOW,
	&EField::SUB_WINDOW,
	&EField::TYPE,
	&EField::WIDGET_PATHNAME,
	&EField::SENDEVENT,

	&EField::DETAIL,
	&EField::FOCUS,
	&EField::MODE,
	&EField::STATE,
	
	&EField::END
};

int EEnter::preprocessEvent(EHeader& header,Tcl_Interp* interp,int objc,Tcl_Obj* CONST objv[])
{
	string detail;
	int focus;
	string mode;
	string state;

	int index=10;

	detail=Tcl_GetString(objv[index++]);
	
	Tcl_GetBooleanFromObj(interp,objv[index++],&focus);

	mode=Tcl_GetString(objv[index++]);
	state=Tcl_GetString(objv[index++]);

	for(t_listeners::iterator it=listeners.begin();it!=listeners.end();it++)
	{
		(*it)->onEnter(header,detail,focus!=0,mode,state);
	}

	return TCL_OK;
}


