/*  $Id: input_device_sdlmouse.h,v 1.5 2003/10/29 13:12:43 mbn Exp $
**
**  ClanLib Game SDK
**  Copyright (C) 2003  The ClanLib Team
**  For a total list of contributers see the file CREDITS.
**
**  This library is free software; you can redistribute it and/or
**  modify it under the terms of the GNU Lesser General Public
**  License as published by the Free Software Foundation; either
**  version 2.1 of the License, or (at your option) any later version.
**
**  This library is distributed in the hope that it will be useful,
**  but WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
**  Lesser General Public License for more details.
**
**  You should have received a copy of the GNU Lesser General Public
**  License along with this library; if not, write to the Free Software
**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
*/

#ifndef header_input_device_sldmouse
#define header_input_device_sdlmouse

#if _MSC_VER > 1000
#pragma once
#endif

#include "Display/input_device_generic.h"
#include "API/signals.h"
#include "API/Core/Math/point.h"

#include <SDL/SDL.h>

class CL_DisplayWindow_SDL;

class CL_InputDevice_SDLMouse : public CL_InputDevice_Generic
{
//!Construction:
public:
	CL_InputDevice_SDLMouse(CL_DisplayWindow_SDL *owner);

	virtual ~CL_InputDevice_SDLMouse();

//!Attributes:
public:
	//: Returns the x position of the device.
	virtual int get_x() const;

	//: Returns the y position of the device.
	virtual int get_y() const;

	//: Returns true if the passed key code is down for this device.
	virtual bool get_keycode(int keycode) const;

	//: Returns the the current position of a joystick axis.
	virtual float get_axis(int index) const;

	//: Returns the name of the device (i.e. 'Microsoft Sidewinder 3D').
	virtual std::string get_name() const;

	//: Returns the number of axes available on this device.
	virtual int get_axis_count() const;

	//: Returns the number of buttons available on this device.
	//- <p>If used on a keyboard, this function returns -1.</p>
	virtual int get_button_count() const;

//!Operations:
public:
	//: Key name for specified identifier (A, B, C, Space, Enter, Backspace).
	virtual std::string get_key_name(int id) const;
	virtual void handle_mouse_event(SDL_Event&);

//!Implementation:
private:
	CL_DisplayWindow_SDL *owner;

	CL_Slot slot_sdlevent;

	CL_Point mouse_pos;
	bool key_states[5];
};

#endif
