/*
 * This file is part of libtqtvd_astronav
 *
 * Copyright (C) 2008-2017 TQTVD Software
 * Copyright (C) 2017 Mirakulo Software (mirakulo@mirakulo.com)
 *
 * 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., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301  USA
 */

#include "BIEventLoop.h"

namespace BAL
{

class BCEventLoopGraphicManager : public BAL::BIEventLoop
{
public:
	BCEventLoopGraphicManager();
	virtual ~BCEventLoopGraphicManager();

	virtual bool isInitialized() const;
	virtual void quit();
	virtual bool WaitEvent(BAL::BIEvent*&);
	virtual bool PushEvent(BAL::BIEvent*);

protected:
#ifdef OWB_CONSOLE_INPUT
	// key not const because replacement may occur
	BAL::BIEvent* CreateEventFromStdin(int key);
	struct timeval  m_timeout;
	fd_set          m_fdSet;
#endif
	BAL::BIEvent* CreateEventFromGraphicManagerEvent(const GraphicManagerEvent&);

private:
	bool m_isInitialized;
	Vector<BAL::BIEvent *> m_event;
	IGraphicManagerEventBuffer *m_eventBuffer;
};

}

