/// Copyright (c) 2010 Ruben Penalva. All rights reserved.
/// Redistribution and use in source and binary forms, with or without modification, 
/// are permitted provided that the following conditions are met:
///    1. Redistributions of source code must retain the above copyright notice, this 
///    list of conditions and the following disclaimer.
///    2. Redistributions in binary form must reproduce the above copyright notice,
///    this list of conditions and the following disclaimer in the documentation and/or
///    other materials provided with the distribution.
///    3. The name of the author may not be used to endorse or promote products derived
///    from this software without specific prior written permission.
///
/// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
/// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
/// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 
/// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
/// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
/// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
/// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef _WINDOW_H_
#define _WINDOW_H_

/// TODO
/// - Mouse listener (think how its going to interact with the scene!!!)

#include <boost\utility.hpp>

#include <QtCore\QVariant>
#include <QtGui\QAction>
#include <QtGui\QApplication>
#include <QtGui\QButtonGroup>
#include <QtGui\QFrame>
#include <QtGui\QGroupBox>
#include <QtGui\QHBoxLayout>
#include <QtGui\QHeaderView>
#include <QtGui\QLabel>
#include <QtGui\QTabWidget>
#include <QtGui\QWidget>
#include <QtGui\QtEvents>

#include "ITab.h"
#include "IWindowListener.h"
#include "UserEventQueue.h"
#include "MouseState.h"

namespace TestFrameWork
{

class Window :
	public QWidget, boost::noncopyable
{
public:
	Window(const std::wstring windowTitle, ITabVector tabs, IWindowListener* listener,
		   UserEventQueue& eventQueue);

	~Window(void);

	HDC GetRenderCanvasContext(void) const;

	size_t GetWidth(void) const;

	size_t GetHeight(void) const;

protected:
	void closeEvent(QCloseEvent* event);

	void mouseMoveEvent(QMouseEvent* event);

	void wheelEvent(QWheelEvent* event);

private:
	ITabVector m_tabs;

	IWindowListener* m_listener;

	UserEventQueue& m_eventQueue;

	HDC m_renderCanvasContext;

	MouseState m_mouseState;

	void CreateUI(const std::wstring& windowTitle);
	
	void AddSettingsTabs(QTabWidget* tabWidget);

	void UpdateMouseState(QMouseEvent* event);

	void UpdateMouseState(QWheelEvent* event);
};

typedef boost::shared_ptr<Window> WindowPtr;
}

#endif