//------------------------------------------------------------------------------------
// irr::SEvent wrappers
//------------------------------------------------------------------------------------
extern "C" {

	SEvent* Irr_SEvent_new()
	{
		return new SEvent();
	}
	
	void Irr_SEvent_del(SEvent* se)
	{
		if (se)
			delete se;
			
		se=0;
	}
	
	void Irr_SEvent_setEventType(SEvent* se,EEVENT_TYPE type)
	{
		if (se)
			se->EventType=type;
	}
	
	s32 Irr_SEvent_getEventType(SEvent* se)
	{
		if (se)
			return se->EventType;
		else
			return -1;
	}
	
	// -----------------------------------------------------
	// SGUIEvent get/sets
	// -----------------------------------------------------

	void Irr_SEvent_setGUIEventCaller(SEvent* se,IGUIElement* element)
	{
		if (se)
			se->GUIEvent.Caller=element;
	}
	
	IGUIElement* Irr_SEvent_getGUIEventCaller(SEvent* se)
	{
		if (se)
			return se->GUIEvent.Caller;
		else
			return 0;
	}
	
	void Irr_SEvent_setGUIEventElement(SEvent* se,IGUIElement* element)
	{
		if (se)
			se->GUIEvent.Element=element;
	}
	
	IGUIElement* Irr_SEvent_getGUIEventElement(SEvent* se)
	{
		if (se)
			return se->GUIEvent.Element;
		else
			return 0;
	}
	
	void Irr_SEvent_setGUIEventType(SEvent* se,EGUI_EVENT_TYPE type)
	{
		if (se)
			se->GUIEvent.EventType=type;
	}
	
	s32 Irr_SEvent_getGUIEventType(SEvent* se)
	{
		if (se)
			return se->GUIEvent.EventType;
		else
			return -1;
	}
	
	// -----------------------------------------------------
	// SMouseInput get/sets
	// -----------------------------------------------------
	
	s32 Irr_SEvent_getMouseEventType(SEvent* se)
	{
		if (se)
			return se->MouseInput.Event;
		else
			return -1;
	}
	
	void Irr_SEvent_setMouseEventType(SEvent* se,EMOUSE_INPUT_EVENT type)
	{
		if (se)
			se->MouseInput.Event=type;
	}
	
	s32 Irr_SEvent_getMouseX(SEvent* se)
	{
		if (se)
			return se->MouseInput.X;
		else
			return -1;
	}
	
	s32 Irr_SEvent_getMouseY(SEvent* se)
	{
		if (se)
			return se->MouseInput.Y;
		else
			return -1;
	}
	
	void Irr_SEvent_setMouse(SEvent* se,s32 x,s32 y)
	{
		if (se) {
			se->MouseInput.X=x;
			se->MouseInput.Y=y;
		}
	}
	
	f32 Irr_SEvent_getMouseWheel(SEvent* se)
	{
		if (se)
			return se->MouseInput.Wheel;
		else
			return 0.0f;
	}
	
	void Irr_SEvent_setMouseWheel(SEvent* se,f32 wheel)
	{
		if (se)
			se->MouseInput.Wheel=wheel;
	}
	
	void Irr_SEvent_setMouseShift(SEvent* se, bool shift) 
	{
		if (se)
			se->MouseInput.Shift = shift;
	}
	
	bool Irr_SEvent_getMouseShift(SEvent* se) 
	{
		if (se)
			return se->MouseInput.Shift;
		else return false;
	}

	void Irr_SEvent_setMouseControl(SEvent* se, bool control) 
	{
		if (se)
			se->MouseInput.Control = control;
	}
	
	bool Irr_SEvent_getMouseControl(SEvent* se) 
	{
		if (se)
			return se->MouseInput.Control;
		else return false;
	}
	
	void Irr_SEvent_setMouseButtonStates(SEvent* se, u32 ButtonStates)
	{
		if (se)
			se->MouseInput.ButtonStates = ButtonStates;
	}
	
	u32 Irr_SEvent_getMouseButtonStates(SEvent* se)
	{
		if (se)
			return se->MouseInput.ButtonStates;
		else return 0;
	}
	
	bool Irr_SEvent_getMouseIsLeftPressed(SEvent* se) 
	{
		if (se)
			return se->MouseInput.isLeftPressed();
		else return false;
	}

	bool Irr_SEvent_getMouseIsRightPressed(SEvent* se) 
	{
		if (se)
			return se->MouseInput.isRightPressed();
		else return false;
	}

	bool Irr_SEvent_getMouseIsMiddlePressed(SEvent* se)
	{
		if (se)
			return se->MouseInput.isMiddlePressed();
		else return false;
	}
	
	// -----------------------------------------------------
	// SKeyInput get/sets
	// -----------------------------------------------------
	
	const c8* Irr_SEvent_getKeyInputChar(SEvent* se)
	{
		stringw inputchar(&se->KeyInput.Char);
	
		if (se) {
			stringc* pChar=new stringc(inputchar.c_str());
			return pChar->c_str();
		} else return 0;
	}
	
	void Irr_SEvent_setKeyInputChar(SEvent* se,const c8* chr)
	{
		stringw w_text = chr;
		if (se)
			se->KeyInput.Char=w_text.c_str()[0];
	}
	
	s32 Irr_SEvent_getKeyInputKey(SEvent* se)
	{
		if (se)
			return se->KeyInput.Key;
		else
			return -1;
	}
	
	void Irr_SEvent_setKeyInputKey(SEvent* se,EKEY_CODE key)
	{
		if (se)
			se->KeyInput.Key=key;
	}
	
	bool Irr_SEvent_getKeyPressedDown(SEvent* se)
	{
		if (se)
			return se->KeyInput.PressedDown;
		else
			return false;
	}
	
	void Irr_SEvent_setKeyPressedDown(SEvent* se,bool pressed)
	{
		if (se)
			se->KeyInput.PressedDown=pressed;
	}
	
	bool Irr_SEvent_getKeyShift(SEvent* se)
	{
		if (se)
			return se->KeyInput.Shift;
		else
			return false;
	}
	
	void Irr_SEvent_setKeyShift(SEvent* se,bool pressed)
	{
		if (se)
			se->KeyInput.Shift=pressed;
	}
	
	bool Irr_SEvent_getKeyControl(SEvent* se)
	{
		if (se)
			return se->KeyInput.Control;
		else
			return false;
	}
	
	void Irr_SEvent_setKeyControl(SEvent* se,bool pressed)
	{
		if (se)
			se->KeyInput.Control=pressed;
	}
	
	const c8* Irr_SEvent_getLogText(SEvent* se)
	{
		if (se)
			return se->LogEvent.Text;
		else
			return false;
	}
	
	void Irr_SEvent_setLogText(SEvent* se,const c8* text)
	{
		if (se)
			se->LogEvent.Text=text;
	}
	
	s32 Irr_SEvent_getLogLevel(SEvent* se)
	{
		if (se)
			return se->LogEvent.Level;
		else
			return false;
	}
	
	void Irr_SEvent_setLogLevel(SEvent* se,ELOG_LEVEL level)
	{
		if (se)
			se->LogEvent.Level=level;
	}
	
	s32 Irr_SEvent_getUserData1(SEvent* se)
	{
		if (se)
			return se->UserEvent.UserData1;
		else
			return false;
	}
	
	void Irr_SEvent_setUserData1(SEvent* se,s32 data)
	{
		if (se)
			se->UserEvent.UserData1=data;
	}
	
	s32 Irr_SEvent_getUserData2(SEvent* se)
	{
		if (se)
			return se->UserEvent.UserData2;
		else
			return false;
	}
	
	void Irr_SEvent_setUserData2(SEvent* se,s32 data)
	{
		if (se)
			se->UserEvent.UserData2=data;
	}

	// -----------------------------------------------------
	// SJoystickEvent get/sets
	// -----------------------------------------------------
	
	u32 Irr_SEvent_getJoystickButtonStates(SEvent* se)
	{
		if (se)
			return se->JoystickEvent.ButtonStates;
		else return 0;
	}

	void Irr_SEvent_setJoystickButtonStates(SEvent* se, u32 states)
	{
		if (se)
			se->JoystickEvent.ButtonStates = states;
	}

	s16 Irr_SEvent_getJoystickGetAxis(SEvent* se, u16 axis)
	{
		if (se)
			return se->JoystickEvent.Axis[axis];
		else return 0;
	}

	void Irr_SEvent_setJoystickSetAxis(SEvent* se, u16 axis, s16 axis_value)
	{
		if (se)
			se->JoystickEvent.Axis[axis] = axis_value;
	}

	u16 Irr_SEvent_getJoystickGetPOV(SEvent* se)
	{
		if (se)
			return se->JoystickEvent.POV;
		else return 0;
	}

	void Irr_SEvent_setJoystickSetPOV(SEvent* se, u16 POV)
	{
		if (se)
			se->JoystickEvent.POV = POV;
	}

	u8 Irr_SEvent_getJoystickJoystick(SEvent* se)
	{
		if (se)
			return se->JoystickEvent.Joystick;
		else return 0;
	}

	void Irr_SEvent_setJoystickSetJoystick(SEvent* se, u8 joystick)
	{
		if (se)
			se->JoystickEvent.Joystick = joystick;
	}
	
	bool Irr_SEvent_getJoystickIsButtonPressed(SEvent* se, u32 button) 
	{
		if (se)
			return se->JoystickEvent.IsButtonPressed(button);
		else return false;
	}

} // extern "C"


