/*  $Id: mouse.cpp,v 1.5 2004/05/08 09:47:41 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
*/

#include "Display/display_precomp.h"
#include "API/Display/mouse.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_Mouse construction:

/////////////////////////////////////////////////////////////////////////////
// CL_Mouse attributes:

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

int CL_Mouse::get_device_count()
{
	return get_ic()->get_mouse_count();
}

CL_InputDevice &CL_Mouse::get_device(int mouse)
{
	return get_ic()->get_mouse(mouse);
}

int CL_Mouse::get_x(int mouse)
{
	return get_ic()->get_mouse(mouse).get_x();
}
	
int CL_Mouse::get_y(int mouse)
{
	return get_ic()->get_mouse(mouse).get_y();
}
	
bool CL_Mouse::get_keycode(int keycode, int mouse)
{
	return get_ic()->get_mouse(mouse).get_keycode(keycode);
}

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

/////////////////////////////////////////////////////////////////////////////
// CL_Mouse operations:

void CL_Mouse::set_position(int x, int y, int mouse)
{
	get_ic()->get_mouse(mouse).set_position(x, y);
}

void CL_Mouse::show()
{
	CL_Display::get_current_window()->show_cursor();
}

void CL_Mouse::hide()
{
	CL_Display::get_current_window()->hide_cursor();
}

void CL_Mouse::set_cursor(const CL_Sprite &sprite)
{
	CL_Display::get_current_window()->set_cursor(sprite);
}

/////////////////////////////////////////////////////////////////////////////
// CL_Mouse signals:

CL_Signal_v1<const CL_InputEvent &> &CL_Mouse::sig_key_down(int mouse)
{
	return get_ic()->get_mouse(mouse).sig_key_down();
}

CL_Signal_v1<const CL_InputEvent &> &CL_Mouse::sig_key_up(int mouse)
{
	return get_ic()->get_mouse(mouse).sig_key_up();
}

CL_Signal_v1<const CL_InputEvent &> &CL_Mouse::sig_key_dblclk(int mouse)
{
	return get_ic()->get_mouse(mouse).sig_key_dblclk();
}

CL_Signal_v1<const CL_InputEvent &> &CL_Mouse::sig_move(int mouse)
{
	return get_ic()->get_mouse(mouse).sig_move();
}

/////////////////////////////////////////////////////////////////////////////
// CL_Mouse implementation:
