/*  $Id: event_listener.cpp,v 1.9 2003/07/20 22:30:53 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 "Core/precomp.h"
#include "API/Core/System/event_listener.h"
#include "event_listener_generic.h"

#ifdef WIN32
#include "Core/System/Win32/event_listener_win32.h"
#else
#include "Core/System/Unix/event_listener_unix.h"
#endif

/////////////////////////////////////////////////////////////////////////////
// CL_EventListener construction:

CL_EventListener::CL_EventListener()
: impl(NULL)
{
#ifdef WIN32
	impl = new CL_EventListener_Win32(this);
#else
	impl = new CL_EventListener_Unix(this);
#endif
}

CL_EventListener::CL_EventListener(CL_EventTrigger *trigger)
: impl(NULL)
{
#ifdef WIN32
	impl = new CL_EventListener_Win32(this);
#else
	impl = new CL_EventListener_Unix(this);
#endif

	add_trigger(trigger);
}

CL_EventListener::~CL_EventListener()
{
	if (impl) delete impl;
}

/////////////////////////////////////////////////////////////////////////////
// CL_EventListener attributes:

/////////////////////////////////////////////////////////////////////////////
// CL_EventListener operations:

void CL_EventListener::add_trigger(CL_EventTrigger *trigger)
{
	if (impl) impl->add_trigger(trigger);
}

void CL_EventListener::remove_trigger(CL_EventTrigger *trigger)
{
	if (impl) impl->remove_trigger(trigger);
}

void CL_EventListener::clear()
{
	if (impl) impl->clear();
}

void CL_EventListener::reset_all()
{
	if (impl) impl->reset_all();
}

bool CL_EventListener::wait(int timeout)
{
	if (impl) return impl->wait(timeout);
	else return false;
}

/////////////////////////////////////////////////////////////////////////////
// CL_EventListener implementation:
