/*  $Id: joystick.cpp,v 1.3 2003/11/04 20:41:27 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
*/

#include "Display/display_precomp.h"
#include "API/Display/joystick.h"
#include "API/Display/display.h"
#include "API/Display/display_window.h"
#include "API/Display/input_context.h"
#include "API/Display/input_device.h"

/////////////////////////////////////////////////////////////////////////////
// CL_Joystick construction:

/////////////////////////////////////////////////////////////////////////////
// CL_Joystick attributes:

#define get_ic() CL_Display::get_current_window()->get_ic()

int CL_Joystick::get_device_count()
{
	return get_ic()->get_joystick_count();
}

CL_InputDevice &CL_Joystick::get_device(int joystick)
{
	return get_ic()->get_joystick(joystick);
}

bool CL_Joystick::get_keycode(int keycode, int joystick)
{
	return get_ic()->get_joystick(joystick).get_keycode(keycode);
}

std::string CL_Joystick::get_key_name(int id)
{
	return get_ic()->get_joystick().get_key_name(id);
}

/////////////////////////////////////////////////////////////////////////////
// CL_Joystick operations:

/////////////////////////////////////////////////////////////////////////////
// CL_Joystick signals:

CL_Signal_v1<const CL_InputEvent &> &CL_Joystick::sig_key_down(int joystick)
{
	return get_ic()->get_joystick(joystick).sig_key_down();
}

CL_Signal_v1<const CL_InputEvent &> &CL_Joystick::sig_key_up(int joystick)
{
	return get_ic()->get_joystick(joystick).sig_key_up();
}

CL_Signal_v1<const CL_InputEvent &> &CL_Joystick::sig_key_dblclk(int joystick)
{
	return get_ic()->get_joystick(joystick).sig_key_dblclk();
}

CL_Signal_v1<const CL_InputEvent &> &CL_Joystick::sig_move(int joystick)
{
	return get_ic()->get_joystick(joystick).sig_move();
}

/////////////////////////////////////////////////////////////////////////////
// CL_Joystick implementation:
