/*  $Id: input_device_x11keyboard.h,v 1.1 2004/01/15 01:07:02 grumbel 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_x11keyboard
#define header_input_device_x11keyboard

#if _MSC_VER > 1000
#pragma once
#endif

#include "Display/input_device_generic.h"
#include "API/signals.h"

#include <X11/Xlib.h>
#include <X11/Xutil.h>

class CL_DisplayWindow_OpenGL;

class CL_InputDevice_X11Keyboard : public CL_InputDevice_Generic
{
//!Construction:
public:
	CL_InputDevice_X11Keyboard(CL_DisplayWindow_OpenGL *owner);

	virtual ~CL_InputDevice_X11Keyboard();

//!Attributes:
public:

//!Operations:
public:
	//: Key name for specified identifier (A, B, C, Space, Enter, Backspace).
	std::string get_key_name(int id) const;
  
	//: Returns true if the passed key code is down for this device.
	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;

//!Implementation:
private:
	void on_xevent(XEvent &event);
	
	CL_Slot slot_xevent;

	CL_DisplayWindow_OpenGL *owner;

};

#endif
